diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 35d8cef..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Bug report -about: Report a crash, or behavior that seems incorrect. -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -What went wrong? - -**To Reproduce** -What were you doing when the bug happened? - -**Environment** -What version of the mod were you using? Are you on singleplayer or multiplayer? - -**Crash Report** -If the problem crashed the game, please attach a log using a [GitHub Gist](https://gist.github.com/). diff --git a/.gitignore b/.gitignore index 5c2530c..b477375 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,8 @@ out # gradle build .gradle +gradle/ +gradlew* # other eclipse @@ -25,3 +27,5 @@ logs # Files from Forge MDK forge*changelog.txt changelog.txt +LICENSE.txt +CREDITS.txt diff --git a/CREDITS.txt b/CREDITS.txt deleted file mode 100644 index a70c53d..0000000 --- a/CREDITS.txt +++ /dev/null @@ -1,65 +0,0 @@ -Minecraft Forge: Credits/Thank You - -Forge is a set of tools and modifications to the Minecraft base game code to assist -mod developers in creating new and exciting content. It has been in development for -several years now, but I would like to take this time thank a few people who have -helped it along it's way. - -First, the people who originally created the Forge projects way back in Minecraft -alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance -of me taking over the project, who knows what Minecraft modding would be today. - -Secondly, someone who has worked with me, and developed some of the core features -that allow modding to be as functional, and as simple as it is, cpw. For developing -FML, which stabelized the client and server modding ecosystem. As well as the base -loading system that allows us to modify Minecraft's code as elegently as possible. - -Mezz, who has stepped up as the issue and pull request manager. Helping to keep me -sane as well as guiding the community into creating better additions to Forge. - -Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which -I am a part}. For creating some of the core tools needed to make Minecraft modding -both possible, and as stable as can be. - On that note, here is some specific information of the MCP data we use: - * Minecraft Coder Pack (MCP) * - Forge Mod Loader and Minecraft Forge have permission to distribute and automatically - download components of MCP and distribute MCP data files. This permission is not - transitive and others wishing to redistribute the Minecraft Forge source independently - should seek permission of MCP or remove the MCP data files and request their users - to download MCP separately. - -And lastly, the countless community members who have spent time submitting bug reports, -pull requests, and just helping out the community in general. Thank you. - ---LexManos - -========================================================================= - -This is Forge Mod Loader. - -You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml - -This minecraft mod is a clean open source implementation of a mod loader for minecraft servers -and minecraft clients. - -The code is authored by cpw. - -It began by partially implementing an API defined by the client side ModLoader, authored by Risugami. -http://www.minecraftforum.net/topic/75440- -This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader. - -It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge. -http://www.minecraftforge.net/ - -Additionally, it contains an implementation of topological sort based on that -published at http://keithschwarz.com/interesting/code/?dir=topological-sort - -It also contains code from the Maven project for performing versioned dependency -resolution. http://maven.apache.org/ - -It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/ -with credit to it's authors. - -Forge Mod Loader downloads components from the Minecraft Coder Pack -(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team. - diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index b0cbe2b..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,520 +0,0 @@ -Unless noted below, Minecraft Forge, Forge Mod Loader, and all -parts herein are licensed under the terms of the LGPL 2.1 found -here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and -copied below. - -Homepage: http://minecraftforge.net/ - https://github.com/MinecraftForge/MinecraftForge - - -A note on authorship: -All source artifacts are property of their original author, with -the exclusion of the contents of the patches directory and others -copied from it from time to time. Authorship of the contents of -the patches directory is retained by the Minecraft Forge project. -This is because the patches are partially machine generated -artifacts, and are changed heavily due to the way forge works. -Individual attribution within them is impossible. - -Consent: -All contributions to Forge must consent to the release of any -patch content to the Forge project. - -A note on infectivity: -The LGPL is chosen specifically so that projects may depend on Forge -features without being infected with its license. That is the -purpose of the LGPL. Mods and others using this code via ordinary -Java mechanics for referencing libraries are specifically not bound -by Forge's license for the Mod code. - - -=== MCP Data === -This software includes data from the Minecraft Coder Pack (MCP), with kind permission -from them. The license to MCP data is not transitive - distribution of this data by -third parties requires independent licensing from the MCP team. This data is not -redistributable without permission from the MCP team. - -=== Sharing === -I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of -the minecraft modding community. All contributions to these parts should be licensed under the same additional grant. - --- Runtime patcher -- -License is granted to redistribute the runtime patcher code (src/main/java/net/minecraftforge/fml/common/patcher -and subdirectories) under any alternative open source license as classified by the OSI (http://opensource.org/licenses) - --- ASM transformers -- -License is granted to redistribute the ASM transformer code (src/main/java/net/minecraftforge/common/asm/ and subdirectories) -under any alternative open source license as classified by the OSI (http://opensource.org/licenses) - -========================================================================= -This software includes portions from the Apache Maven project at -http://maven.apache.org/ specifically the ComparableVersion.java code. It is -included based on guidelines at -http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html -with notices intact. The only change is a non-functional change of package name. - -This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating -binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/ -authored by genman, heikok, pivot. -The only changes are to replace some Trove collection types with standard Java collections, and repackaged. -========================================================================= - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/build.gradle b/build.gradle index aa52924..a4659f0 100644 --- a/build.gradle +++ b/build.gradle @@ -4,9 +4,10 @@ buildscript { jcenter() mavenCentral() maven {url='https://dist.creeper.host/Sponge/maven'} + maven {url='https://repo.spongepowered.org/repository/maven-public'} } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } @@ -14,23 +15,17 @@ apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' apply plugin: 'maven-publish' +// apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle' -version = '0.2.7' +version = '0.3b' group = 'elucent.eidolon' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'eidolon' -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { - // The mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD Snapshot are built nightly. - // stable_# Stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'snapshot', version: '20201028-1.16.3' - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - + mappings channel: 'official', version: '1.18.1' // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. @@ -110,13 +105,15 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.16.4-35.1.28' + minecraft 'net.minecraftforge:forge:1.18.1-39.0.55' - compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.2-4.0.0.1:api") - runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.2-4.0.0.1") + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' - compileOnly fg.deobf('mezz.jei:jei-1.16.4:7.6.0.58') - runtimeOnly fg.deobf('mezz.jei:jei-1.16.4:7.6.0.58') + compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18-5.0.2.4:api") + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18-5.0.2.4") + + compileOnly fg.deobf('mezz.jei:jei-1.18.1:9.1.0.46') + runtimeOnly fg.deobf('mezz.jei:jei-1.18.1:9.1.0.46') } // Example for how to get properties into the manifest for reading by the runtime.. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265e..0000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1d5b29f..0000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip diff --git a/gradlew b/gradlew deleted file mode 100644 index cccdd3d..0000000 --- a/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index e95643d..0000000 --- a/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/src/main/java/elucent/eidolon/ClientConfig.java b/src/main/java/elucent/eidolon/ClientConfig.java index e6d3218..9be53a1 100644 --- a/src/main/java/elucent/eidolon/ClientConfig.java +++ b/src/main/java/elucent/eidolon/ClientConfig.java @@ -1,19 +1,51 @@ package elucent.eidolon; -import net.minecraftforge.common.ForgeConfigSpec; +import java.util.List; + import org.apache.commons.lang3.tuple.Pair; +import com.google.common.collect.ImmutableList; + +import net.minecraftforge.common.ForgeConfigSpec; + public class ClientConfig { // graphics public static ForgeConfigSpec.ConfigValue BETTER_LAYERING; + // ui + public static ForgeConfigSpec.ConfigValue MANA_BAR_POSITION, MANA_BAR_ORIENTATION; + + public static class Positions { + public static final String BOTTOM_LEFT = "bottomLeft", + LEFT = "left", + TOP_LEFT = "topLeft", + TOP = "top", + TOP_RIGHT = "topRight", + RIGHT = "right", + BOTTOM_RIGHT = "bottomRight"; + public static List VALUES = ImmutableList.of(BOTTOM_LEFT, LEFT, TOP_LEFT, TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT); + } + + public static class Orientations { + public static final String HORIZONTAL = "horizontal", + VERTICAL = "vertical", + DEFAULT = "default"; + + public static final List VALUES = ImmutableList.of(HORIZONTAL, VERTICAL, DEFAULT); + } public ClientConfig(ForgeConfigSpec.Builder builder) { builder.comment("Graphics settings").push("graphics"); - BETTER_LAYERING = builder.comment("Enable better particle/effect layering.") - .comment("Fixes particles and effects rendering behind clouds and weather.") - .comment("NOTE: Does NOT work with fabulous graphics mode.") + BETTER_LAYERING = builder.comment("Enable better particle/effect layering.", + "Fixes particles and effects rendering behind clouds and weather.", + "NOTE: Does NOT work with fabulous graphics mode.") .define("betterLayering", true); builder.pop(); + builder.comment("UI settings").push("ui"); + MANA_BAR_POSITION = builder.comment("Onscreen positioning of the magic power meter.") + .defineInList("manaBarPosition", "top", Positions.VALUES); + MANA_BAR_ORIENTATION = builder.comment("Orientation of the magic power meter.") + .defineInList("manaBarOrientation", "default", Orientations.VALUES); + builder.pop(); } public static final ClientConfig INSTANCE; diff --git a/src/main/java/elucent/eidolon/ClientEvents.java b/src/main/java/elucent/eidolon/ClientEvents.java index c61d129..b6bc933 100644 --- a/src/main/java/elucent/eidolon/ClientEvents.java +++ b/src/main/java/elucent/eidolon/ClientEvents.java @@ -1,61 +1,152 @@ package elucent.eidolon; +import java.util.HashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Random; + +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.systems.RenderSystem; + +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.capability.ISoul; +import elucent.eidolon.item.IWingsItem; +import elucent.eidolon.item.WarlockRobesItem; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.IRenderTypeBuffer; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; + +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.ReportedException; +import net.minecraft.client.Camera; +import net.minecraft.client.KeyMapping; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.client.event.InputEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import net.minecraftforge.client.event.RenderLevelLastEvent; +import net.minecraftforge.client.gui.ForgeIngameGui; +import net.minecraftforge.event.TickEvent.PlayerTickEvent; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; - -import java.util.HashMap; -import java.util.Map; +import net.minecraftforge.fml.LogicalSide; public class ClientEvents { @OnlyIn(Dist.CLIENT) - static IRenderTypeBuffer.Impl DELAYED_RENDER = null; + static MultiBufferSource.BufferSource DELAYED_RENDER = null; @OnlyIn(Dist.CLIENT) - public static IRenderTypeBuffer.Impl getDelayedRender() { + public static MultiBufferSource.BufferSource getDelayedRender() { if (DELAYED_RENDER == null) { Map buffers = new HashMap<>(); for (RenderType type : new RenderType[]{ + RenderUtil.VAPOR_TRANSLUCENT, RenderUtil.DELAYED_PARTICLE, RenderUtil.GLOWING_PARTICLE, RenderUtil.GLOWING_BLOCK_PARTICLE, RenderUtil.GLOWING, RenderUtil.GLOWING_SPRITE}) { - buffers.put(type, new BufferBuilder(type.getBufferSize())); + buffers.put(type, new BufferBuilder(type.bufferSize())); } - DELAYED_RENDER = IRenderTypeBuffer.getImpl(buffers, new BufferBuilder(256)); + DELAYED_RENDER = MultiBufferSource.immediateWithBuffers(buffers, new BufferBuilder(256)); } return DELAYED_RENDER; } @OnlyIn(Dist.CLIENT) static float clientTicks = 0; + + @OnlyIn(Dist.CLIENT) + public static Matrix4f particleMVMatrix = null; @OnlyIn(Dist.CLIENT) @SubscribeEvent - public void onRenderLast(RenderWorldLastEvent event) { + public void onRenderLast(RenderLevelLastEvent event) { if (ClientConfig.BETTER_LAYERING.get()) { - RenderSystem.pushMatrix(); // this feels...cheaty - RenderSystem.multMatrix(event.getMatrixStack().getLast().getMatrix()); - getDelayedRender().finish(RenderUtil.DELAYED_PARTICLE); - getDelayedRender().finish(RenderUtil.GLOWING_PARTICLE); - getDelayedRender().finish(RenderUtil.GLOWING_BLOCK_PARTICLE); - RenderSystem.popMatrix(); - - getDelayedRender().finish(RenderUtil.GLOWING_SPRITE); - getDelayedRender().finish(RenderUtil.GLOWING); + PoseStack mStack = RenderSystem.getModelViewStack(); + + RenderSystem.getModelViewStack().pushPose(); // this feels...cheaty + RenderSystem.getModelViewStack().setIdentity(); + if (particleMVMatrix != null) RenderSystem.getModelViewStack().mulPoseMatrix(particleMVMatrix); + RenderSystem.applyModelViewMatrix(); + RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + getDelayedRender().endBatch(RenderUtil.DELAYED_PARTICLE); + RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + getDelayedRender().endBatch(RenderUtil.GLOWING_PARTICLE); + getDelayedRender().endBatch(RenderUtil.GLOWING_BLOCK_PARTICLE); + RenderSystem.getModelViewStack().popPose(); + RenderSystem.applyModelViewMatrix(); + + getDelayedRender().endBatch(RenderUtil.GLOWING_SPRITE); + getDelayedRender().endBatch(RenderUtil.GLOWING); } - clientTicks += event.getPartialTicks(); + clientTicks += event.getPartialTick(); } @OnlyIn(Dist.CLIENT) public static float getClientTicks() { return clientTicks; } + + public static boolean isInGui = false; + + @SubscribeEvent + public void onRenderGuiStart(RenderGameOverlayEvent.Pre event) { + if (event.getType() == ElementType.ALL) isInGui = true; + } + + @SubscribeEvent + public void onRenderGuiStart(RenderGameOverlayEvent.Post event) { + if (event.getType() == ElementType.ALL) isInGui = false; + } + + public static int jumpTicks = 0; + public static boolean wasJumping = false; + + @SubscribeEvent + public void onPlayerTick(PlayerTickEvent event) { + if (event.side != LogicalSide.CLIENT) return; + Player p = event.player; + if (p instanceof LocalPlayer lp) { + p.getCapability(IPlayerData.INSTANCE).ifPresent((d) -> { + ItemStack wings = d.getWingsItem(p); + if (!d.canFlap(p)) return; + if (!(wings.getItem() instanceof IWingsItem)) return; + if (lp.input.jumping && (!wasJumping || jumpTicks > 0)) { + jumpTicks ++; + if (jumpTicks > 20) jumpTicks = 20; + } + else if (wasJumping && jumpTicks > 0) { + if (jumpTicks >= 20 && !d.isDashing(p)) { + d.tryDash(p); + } + else d.tryFlapWings(p); + jumpTicks = 0; + } + }); + if (p.isOnGround()) jumpTicks = 0; + wasJumping = p.isOnGround() || lp.input.jumping; + } + } } diff --git a/src/main/java/elucent/eidolon/ClientRegistry.java b/src/main/java/elucent/eidolon/ClientRegistry.java new file mode 100644 index 0000000..8d94b9e --- /dev/null +++ b/src/main/java/elucent/eidolon/ClientRegistry.java @@ -0,0 +1,484 @@ +package elucent.eidolon; + +import java.io.IOException; +import java.util.NoSuchElementException; +import java.util.Random; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.capability.ISoul; +import elucent.eidolon.entity.AngelArrowRenderer; +import elucent.eidolon.entity.ChantCasterRenderer; +import elucent.eidolon.entity.NecromancerModel; +import elucent.eidolon.entity.NecromancerRenderer; +import elucent.eidolon.entity.RavenModel; +import elucent.eidolon.entity.RavenRenderer; +import elucent.eidolon.entity.SlimySlugModel; +import elucent.eidolon.entity.SlimySlugRenderer; +import elucent.eidolon.entity.WraithModel; +import elucent.eidolon.entity.WraithRenderer; +import elucent.eidolon.entity.ZombieBruteModel; +import elucent.eidolon.entity.ZombieBruteRenderer; +import elucent.eidolon.item.IManaRelatedItem; +import elucent.eidolon.item.curio.RavenCloakRenderer; +import elucent.eidolon.item.model.BonelordArmorModel; +import elucent.eidolon.item.model.RavenCloakModel; +import elucent.eidolon.item.model.SilverArmorModel; +import elucent.eidolon.item.model.TopHatModel; +import elucent.eidolon.item.model.WarlockArmorModel; +import elucent.eidolon.reagent.Reagent; +import elucent.eidolon.reagent.ReagentRegistry; +import elucent.eidolon.ritual.AbsorptionRitual; +import elucent.eidolon.ritual.AllureRitual; +import elucent.eidolon.ritual.CrystalRitual; +import elucent.eidolon.ritual.DaylightRitual; +import elucent.eidolon.ritual.DeceitRitual; +import elucent.eidolon.ritual.MoonlightRitual; +import elucent.eidolon.ritual.PurifyRitual; +import elucent.eidolon.ritual.RechargingRitual; +import elucent.eidolon.ritual.RepellingRitual; +import elucent.eidolon.ritual.SanguineRitual; +import elucent.eidolon.ritual.SummonRitual; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import elucent.eidolon.tile.CrucibleTileRenderer; +import elucent.eidolon.tile.SoulEnchanterTileRenderer; +import net.minecraft.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.ShaderInstance; +import net.minecraft.client.renderer.entity.EntityRenderers; +import net.minecraft.client.renderer.entity.NoopRenderer; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.event.EntityRenderersEvent; +import net.minecraftforge.client.event.RegisterShadersEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import net.minecraftforge.client.gui.ForgeIngameGui; +import net.minecraftforge.client.gui.IIngameOverlay; +import net.minecraftforge.eventbus.api.EventPriority; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import top.theillusivec4.curios.api.client.CuriosRendererRegistry; + +public class ClientRegistry { + @OnlyIn(Dist.CLIENT) + @SubscribeEvent + public void onTextureStitch(TextureStitchEvent.Pre event) { + event.addSprite(AbsorptionRitual.SYMBOL); + event.addSprite(CrystalRitual.SYMBOL); + event.addSprite(SummonRitual.SYMBOL); + event.addSprite(DeceitRitual.SYMBOL); + event.addSprite(AllureRitual.SYMBOL); + event.addSprite(DaylightRitual.SYMBOL); + event.addSprite(MoonlightRitual.SYMBOL); + event.addSprite(PurifyRitual.SYMBOL); + event.addSprite(RepellingRitual.SYMBOL); + event.addSprite(SanguineRitual.SYMBOL); + event.addSprite(RechargingRitual.SYMBOL); + event.addSprite(SoulEnchanterTileRenderer.BOOK_TEXTURE); + + event.addSprite(new ResourceLocation(Eidolon.MODID, "particle/aura")); + event.addSprite(new ResourceLocation(Eidolon.MODID, "particle/beam")); + event.addSprite(new ResourceLocation(Eidolon.MODID, "particle/ring")); + for (Reagent r : ReagentRegistry.getReagents()) event.addSprite(r.getTexture()); + for (Sign s : Signs.getSigns()) event.addSprite(s.getSprite()); + for (Rune r : Runes.getRunes()) event.addSprite(r.getSprite()); + } + + public static ModelLayerLocation + SILVER_ARMOR_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "silver_armor"), "main"), + WARLOCK_ARMOR_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "warlock_armor"), "main"), + BONELORD_ARMOR_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "bonelord_armor"), "main"), + TOP_HAT_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "top_hat"), "main"), + RAVEN_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "raven"), "main"), + NECROMANCER_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "necromancer"), "main"), + WRAITH_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "wraith"), "main"), + ZOMBIE_BRUTE_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "zombie_brute"), "main"), + SLUG_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "slimy_slug"), "main"), + CRUCIBLE_STIRRER_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "crucible_stirrer"), "main"), + RAVEN_CLOAK_LAYER = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "raven_cloak"), "main"); + + public static WarlockArmorModel WARLOCK_ARMOR_MODEL = null; + public static BonelordArmorModel BONELORD_ARMOR_MODEL = null; + public static TopHatModel TOP_HAT_MODEL = null; + public static SilverArmorModel SILVER_ARMOR_MODEL = null; + public static ZombieBruteModel ZOMBIE_BRUTE_MODEL = null; + public static WraithModel WRAITH_MODEL = null; + public static RavenModel RAVEN_MODEL = null; + public static NecromancerModel NECROMANCER_MODEL = null; + public static SlimySlugModel SLUG_MODEL = null; + + @SubscribeEvent + public void onRegisterLayers(EntityRenderersEvent.RegisterLayerDefinitions event) { + event.registerLayerDefinition(WARLOCK_ARMOR_LAYER, WarlockArmorModel::createBodyLayer); + event.registerLayerDefinition(BONELORD_ARMOR_LAYER, BonelordArmorModel::createBodyLayer); + event.registerLayerDefinition(TOP_HAT_LAYER, TopHatModel::createBodyLayer); + event.registerLayerDefinition(SILVER_ARMOR_LAYER, SilverArmorModel::createBodyLayer); + event.registerLayerDefinition(RAVEN_CLOAK_LAYER, RavenCloakModel::createBodyLayer); + + event.registerLayerDefinition(RAVEN_LAYER, RavenModel::createBodyLayer); + event.registerLayerDefinition(ZOMBIE_BRUTE_LAYER, ZombieBruteModel::createBodyLayer); + event.registerLayerDefinition(WRAITH_LAYER, WraithModel::createBodyLayer); + event.registerLayerDefinition(NECROMANCER_LAYER, NecromancerModel::createBodyLayer); + event.registerLayerDefinition(SLUG_LAYER, SlimySlugModel::createBodyLayer); + + event.registerLayerDefinition(CRUCIBLE_STIRRER_LAYER, CrucibleTileRenderer::createModelLayer); + } + + @SubscribeEvent + public void onRegisterLayers(EntityRenderersEvent.AddLayers event) { + WARLOCK_ARMOR_MODEL = new WarlockArmorModel(event.getEntityModels().bakeLayer(WARLOCK_ARMOR_LAYER)); + BONELORD_ARMOR_MODEL = new BonelordArmorModel(event.getEntityModels().bakeLayer(BONELORD_ARMOR_LAYER)); + TOP_HAT_MODEL = new TopHatModel(event.getEntityModels().bakeLayer(TOP_HAT_LAYER)); + SILVER_ARMOR_MODEL = new SilverArmorModel(event.getEntityModels().bakeLayer(SILVER_ARMOR_LAYER)); + + RAVEN_MODEL = new RavenModel(event.getEntityModels().bakeLayer(RAVEN_LAYER)); + ZOMBIE_BRUTE_MODEL = new ZombieBruteModel(event.getEntityModels().bakeLayer(ZOMBIE_BRUTE_LAYER)); + WRAITH_MODEL = new WraithModel(event.getEntityModels().bakeLayer(WRAITH_LAYER)); + NECROMANCER_MODEL = new NecromancerModel(event.getEntityModels().bakeLayer(NECROMANCER_LAYER)); + SLUG_MODEL = new SlimySlugModel(event.getEntityModels().bakeLayer(SLUG_LAYER)); + } + + @SubscribeEvent + public void onRegisterEntityRenders(EntityRenderersEvent.RegisterRenderers event) { + EntityRenderers.register(Registry.ZOMBIE_BRUTE.get(), ZombieBruteRenderer::new); + EntityRenderers.register(Registry.WRAITH.get(), WraithRenderer::new); + EntityRenderers.register(Registry.NECROMANCER.get(), NecromancerRenderer::new); + EntityRenderers.register(Registry.SOULFIRE_PROJECTILE.get(), NoopRenderer::new); + EntityRenderers.register(Registry.BONECHILL_PROJECTILE.get(), NoopRenderer::new); + EntityRenderers.register(Registry.NECROMANCER_SPELL.get(), NoopRenderer::new); + EntityRenderers.register(Registry.CHANT_CASTER.get(), ChantCasterRenderer::new); + EntityRenderers.register(Registry.RAVEN.get(), RavenRenderer::new); + EntityRenderers.register(Registry.ANGEL_ARROW.get(), AngelArrowRenderer::new); + EntityRenderers.register(Registry.SLIMY_SLUG.get(), SlimySlugRenderer::new); + } + + public static ShaderInstance GLOWING_SHADER, GLOWING_SPRITE_SHADER, GLOWING_PARTICLE_SHADER, VAPOR_SHADER, GLOWING_ENTITY_SHADER, SPRITE_PARTICLE_SHADER; + + public static ShaderInstance getGlowingShader() { return GLOWING_SHADER; } + public static ShaderInstance getGlowingSpriteShader() { return GLOWING_SPRITE_SHADER; } + public static ShaderInstance getGlowingParticleShader() { return GLOWING_PARTICLE_SHADER; } + public static ShaderInstance getGlowingEntityShader() { return GLOWING_ENTITY_SHADER; } + public static ShaderInstance getVaporShader() { return VAPOR_SHADER; } + public static ShaderInstance getSpriteParticleShader() { return SPRITE_PARTICLE_SHADER; } + + @SubscribeEvent + public void shaderRegistry(RegisterShadersEvent event) throws IOException { + event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("eidolon:glowing"), DefaultVertexFormat.POSITION_COLOR), + shader -> { GLOWING_SHADER = shader; }); + event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("eidolon:glowing_sprite"), DefaultVertexFormat.POSITION_TEX_COLOR), + shader -> { GLOWING_SPRITE_SHADER = shader; }); + event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("eidolon:glowing_particle"), DefaultVertexFormat.PARTICLE), + shader -> { GLOWING_PARTICLE_SHADER = shader; }); + event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("eidolon:glowing_entity"), DefaultVertexFormat.NEW_ENTITY), + shader -> { GLOWING_ENTITY_SHADER = shader; }); + event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("eidolon:vapor"), DefaultVertexFormat.BLOCK), + shader -> { VAPOR_SHADER = shader; }); + event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("eidolon:sprite_particle"), DefaultVertexFormat.PARTICLE), + shader -> { SPRITE_PARTICLE_SHADER = shader; }); + } + + public static void initCurios() { + CuriosRendererRegistry.register(Registry.RAVEN_CLOAK.get(), RavenCloakRenderer::new); + } + + protected static final ResourceLocation ICONS_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/gui/icons.png"); + protected static final ResourceLocation MANA_BAR_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/gui/mana_bar.png"); + + public static class EidolonManaBar implements IIngameOverlay { + int xPos() { + String origin = ClientConfig.MANA_BAR_POSITION.get(); + if (origin.equals(ClientConfig.Positions.BOTTOM_LEFT) + || origin.equals(ClientConfig.Positions.LEFT) + || origin.equals(ClientConfig.Positions.TOP_LEFT)) + return -1; + if (origin.equals(ClientConfig.Positions.BOTTOM_RIGHT) + || origin.equals(ClientConfig.Positions.RIGHT) + || origin.equals(ClientConfig.Positions.TOP_RIGHT)) + return 1; + return 0; + } + + int yPos() { + String origin = ClientConfig.MANA_BAR_POSITION.get(); + if (origin.equals(ClientConfig.Positions.TOP_LEFT) + || origin.equals(ClientConfig.Positions.TOP) + || origin.equals(ClientConfig.Positions.TOP_LEFT)) + return -1; + if (origin.equals(ClientConfig.Positions.BOTTOM_LEFT) + || origin.equals(ClientConfig.Positions.BOTTOM_RIGHT)) + return 1; + return 0; + } + + boolean horiz() { + String orient = ClientConfig.MANA_BAR_ORIENTATION.get(); + String origin = ClientConfig.MANA_BAR_POSITION.get(); + if (orient.equals(ClientConfig.Orientations.HORIZONTAL)) return true; + else if (orient.equals(ClientConfig.Orientations.VERTICAL)) return false; + else if (origin.equals(ClientConfig.Positions.LEFT) + || origin.equals(ClientConfig.Positions.RIGHT)) return false; + else return true; + } + + @Override + public void render(ForgeIngameGui gui, PoseStack mStack, float partialTicks, int width, int height) { + Minecraft mc = Minecraft.getInstance(); + LocalPlayer player = mc.player; + + int xp = xPos(), yp = yPos(); + boolean isHoriz = horiz(); + + int w = isHoriz ? 120 : 28, h = isHoriz ? 28 : 120; + + int ox = width / 2 - w / 2; + int oy = height / 2 - h / 2; + if (isHoriz) { + if (yp == -1) oy = 4; + else if (yp == 1) oy = height + 4 - h; + if (xp == -1) ox = 8; + else if (xp == 1) ox = width - 4 - w; + } + else { + if (yp == -1) oy = -8; + else if (yp == 1) oy = height - 20 - h; + if (xp == -1) ox = 4; + else if (xp == 1) ox = width + 4 - w; + } + + final int barlength = 114; + float magic = 0, maxMagic = 0; + try { + ISoul soul = player.getCapability(ISoul.INSTANCE).resolve().get(); + magic = soul.getMagic(); + maxMagic = soul.getMaxMagic(); + } catch (NoSuchElementException e) { + // + } + if (maxMagic == 0) return; + if (!(player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof IManaRelatedItem) + && !(player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof IManaRelatedItem)) + return; + + int length = Mth.ceil(barlength * magic / maxMagic); + + int iconU = 48, iconV = 48; + + mStack.pushPose(); + mStack.translate(0, 0, 0.01); + RenderSystem.setShaderTexture(0, MANA_BAR_TEXTURE); + if (isHoriz) { + ox -= 4; + gui.blit(mStack, ox, oy, 2, length == 0 ? 6 : 38, 6, 20); + if (xp > 0) { + gui.blit(mStack, ox - 23, oy - 2, 0, 64, 24, 24); + gui.blit(mStack, ox - 18, oy + 4, iconU, iconV, 12, 12); + } + ox += 6; + + int firstSegment = Math.min(8, length); + length -= firstSegment; + gui.blit(mStack, ox, oy, 8, 38, firstSegment, 20); + ox += firstSegment; + if (firstSegment < 8) { + gui.blit(mStack, ox, oy, 8 + firstSegment, 6, 8 - firstSegment, 20); + ox += 8 - firstSegment; + } + + for (int i = 0; i < 6; i ++) { + int segment = Math.min(16, length); + length -= segment; + gui.blit(mStack, ox, oy, 16, 38, segment, 20); + ox += segment; + if (segment < 16) { + gui.blit(mStack, ox, oy, 16 + segment, 6, 16 - segment, 20); + ox += 16 - segment; + } + } + + int lastSegment = Math.min(8, length); + length -= lastSegment; + gui.blit(mStack, ox, oy, 32, 38, lastSegment, 20); + ox += lastSegment; + if (lastSegment < 8) { + gui.blit(mStack, ox, oy, 32 + lastSegment, 6, 8 - lastSegment, 20); + ox += 8 - lastSegment; + } + + gui.blit(mStack, ox, oy, 40, Mth.ceil(barlength * magic / maxMagic) == barlength ? 6 : 38, 7, 20); + if (xp <= 0) { + gui.blit(mStack, ox + 5, oy - 2, 32, 64, 24, 24); + gui.blit(mStack, ox + 12, oy + 4, iconU, iconV, 12, 12); + } + } + else { + oy += 16; + oy += barlength; + gui.blit(mStack, ox, oy, length == 0 ? 54 : 86, 40, 20, 6); + if (yp < 0) { + gui.blit(mStack, ox - 2, oy + 5, 32, 96, 24, 24); + gui.blit(mStack, ox + 4, oy + 12, iconU, iconV, 12, 12); + } + + int firstSegment = Math.min(8, length); + length -= firstSegment; + oy -= firstSegment; + gui.blit(mStack, ox, oy, 86, 32, 20, firstSegment); + if (firstSegment < 8) { + oy -= 8 - firstSegment; + gui.blit(mStack, ox, oy, 54, 32 + firstSegment, 20, 8 - firstSegment); + } + + for (int i = 0; i < 6; i ++) { + int segment = Math.min(16, length); + length -= segment; + oy -= segment; + gui.blit(mStack, ox, oy, 86, 16, 20, segment); + if (segment < 16) { + oy -= 16 - segment; + gui.blit(mStack, ox, oy, 54, 16 + segment, 20, 16 - segment); + } + } + + int lastSegment = Math.min(8, length); + length -= lastSegment; + oy -= lastSegment; + gui.blit(mStack, ox, oy, 86, 8, 20, lastSegment); + if (lastSegment < 8) { + oy -= 8 - lastSegment; + gui.blit(mStack, ox, oy, 54, 8 + lastSegment, 20, 8 - lastSegment); + } + + oy -= 6; + gui.blit(mStack, ox, oy, Mth.ceil(barlength * magic / maxMagic) == barlength ? 54 : 86, 2, 20, 6); + if (yp >= 0) { + gui.blit(mStack, ox - 2, oy - 23, 0, 96, 24, 24); + gui.blit(mStack, ox + 4, oy - 18, iconU, iconV, 12, 12); + } + } + + mStack.popPose(); + } + } + + public static class EidolonHearts implements IIngameOverlay { + float lastEtherealHealth = 0; + long healthBlinkTime = 0; + long lastHealthTime = 0; + + @Override + public void render(ForgeIngameGui gui, PoseStack mStack, float partialTicks, int width, int height) { + if (!gui.shouldDrawSurvivalElements()) return; + Minecraft mc = Minecraft.getInstance(); + LocalPlayer player = mc.player; + mStack.pushPose(); + mStack.translate(0, 0, 0.01); + + int health = Mth.ceil(player.getHealth()); + float absorb = Mth.ceil(player.getAbsorptionAmount()); + AttributeInstance attrMaxHealth = player.getAttribute(Attributes.MAX_HEALTH); + float healthMax = (float)attrMaxHealth.getValue(); + + float etherealHealth = 0, etherealMax = 0; + try { + ISoul cap = player.getCapability(ISoul.INSTANCE).resolve().get(); + etherealHealth = cap.getEtherealHealth(); + etherealMax = cap.getMaxEtherealHealth(); + } catch (NoSuchElementException e) { + // ignore empty optional + } + + int ticks = gui.getGuiTicks(); + boolean highlight = healthBlinkTime > (long)ticks && (healthBlinkTime - (long)ticks) / 3L % 2L == 1L; + + if (etherealHealth < this.lastEtherealHealth && player.invulnerableTime > 0) { + this.lastHealthTime = Util.getMillis(); + this.healthBlinkTime = (long)(ticks + 20); + } + else if (etherealHealth > this.lastEtherealHealth) { + this.lastHealthTime = Util.getMillis(); + this.healthBlinkTime = (long)(ticks + 10); + } + if (Util.getMillis() - this.lastHealthTime > 1000L) { + lastEtherealHealth = health; + lastHealthTime = Util.getMillis(); + } + + lastEtherealHealth = etherealHealth; + + float f = Math.max((float)player.getAttributeValue(Attributes.MAX_HEALTH), (float)Math.max(health, health)); + int regen = -1; + if (player.hasEffect(MobEffects.REGENERATION)) regen = ticks % Mth.ceil(f + 5.0F); + + Random rand = new Random(); + rand.setSeed((long)(ticks * 312871)); + + int absorptionHearts = Mth.ceil(absorb / 2.0f) - 1; + int hearts = Mth.ceil(healthMax / 2.0f) - 1; + int ethHearts = (int)Mth.ceil(etherealMax / 2.0f); + int healthRows = Mth.ceil((healthMax + absorb) / 2.0F / 10.0F); + int totalHealthRows = Mth.ceil((healthMax + absorb + etherealMax) / 2.0F / 10.0F); + int rowHeight = Math.max(10 - (healthRows - 2), 3); + int extraHealthRows = totalHealthRows - healthRows; + int extraRowHeight = Mth.clamp(10 - (healthRows - 2), 3, 10); + + int left = width / 2 - 91; + int top = height - ((ForgeIngameGui)Minecraft.getInstance().gui).left_height + healthRows * rowHeight; + if (rowHeight != 10) top += 10 - rowHeight; + + gui.left_height += extraHealthRows * extraRowHeight; + + RenderSystem.setShaderTexture(0, ICONS_TEXTURE); + for (int i = absorptionHearts + hearts + ethHearts; i > absorptionHearts + hearts; -- i) { + int row = (i + 1) / 10; + int heart = (i + 1) % 10; + int x = left + heart * 8; + int y = top - extraRowHeight * Math.max(0, row - healthRows + 1) - rowHeight * Math.min(row, healthRows - 1); + mc.gui.blit(mStack, x, y, highlight ? 9 : 0, 18, 9, 9); + } + for (int i = absorptionHearts + hearts + ethHearts; i > absorptionHearts + hearts; -- i) { + int row = (i + 1) / 10; + int heart = (i + 1) % 10; + int x = left + heart * 8; + int y = top - extraRowHeight * Math.max(0, row - healthRows + 1) - rowHeight * Math.min(row, healthRows - 1); + int i2 = i - (Mth.ceil((healthMax + absorb) / 2.0f) - 1); + if (i2 * 2 + 1 < etherealHealth) + mc.gui.blit(mStack, x, y, 0, 9, 9, 9); + else if (i2 * 2 + 1 == etherealHealth) + mc.gui.blit(mStack, x, y, 9, 9, 9, 9); + } + for (int i = Mth.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; -- i) { + int row = i / 10; + int heart = i % 10; + int x = left + heart * 8; + int y = top - row * rowHeight; + + if (health <= 4) y += rand.nextInt(2); + if (i == regen) y -= 2; + + RenderSystem.enableBlend(); + if (player.hasEffect(Registry.CHILLED_EFFECT.get()) && i <= Mth.ceil(healthMax / 2.0f) - 1) { + if (i * 2 + 1 < health) + mc.gui.blit(mStack, x, y, 0, 0, 9, 9); + else if (i * 2 + 1 == health) + mc.gui.blit(mStack, x, y, 9, 0, 9, 9); + } + RenderSystem.disableBlend(); + } + mStack.popPose(); + } + } +} diff --git a/src/main/java/elucent/eidolon/Config.java b/src/main/java/elucent/eidolon/Config.java index 27ff749..20abb7e 100644 --- a/src/main/java/elucent/eidolon/Config.java +++ b/src/main/java/elucent/eidolon/Config.java @@ -1,37 +1,67 @@ package elucent.eidolon; +import org.apache.commons.lang3.tuple.Pair; + import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import org.apache.commons.lang3.tuple.Pair; public class Config { + // generic + public static ConfigValue CRUCIBLE_STEP_DURATION, MAX_ETHEREAL_HEALTH; + // mobs - public static ConfigValue WRAITH_SPAWN_WEIGHT, ZOMBIE_BRUTE_SPAWN_WEIGHT; + public static ConfigValue WRAITH_SPAWN_WEIGHT, ZOMBIE_BRUTE_SPAWN_WEIGHT, RAVEN_SPAWN_WEIGHT, + ABOVEGROUND_SLUG_WEIGHT, UNDERGROUND_SLUG_WEIGHT; // world public static ConfigValue LEAD_MIN_Y, LEAD_MAX_Y, LEAD_VEIN_SIZE, LEAD_VEIN_COUNT; + public static ConfigValue SILVER_MIN_Y, SILVER_MAX_Y, SILVER_VEIN_SIZE, SILVER_VEIN_COUNT; public static ConfigValue LAB_RARITY, STRAY_TOWER_RARITY, CATACOMB_RARITY; - public static ConfigValue LEAD_ENABLED, LAB_ENABLED, STRAY_TOWER_ENABLED, CATACOMB_ENABLED; + public static ConfigValue LEAD_ENABLED, SILVER_ENABLED, + LAB_ENABLED, STRAY_TOWER_ENABLED, CATACOMB_ENABLED; public Config(ForgeConfigSpec.Builder builder) { + builder.comment("Generic settings").push("generic"); + CRUCIBLE_STEP_DURATION = builder.comment("Duration in ticks of each step of a crucible recipe.") + .defineInRange("crucibleStepDuration", 100, 20, 1200); + MAX_ETHEREAL_HEALTH = builder.comment("Maximum amount of ethereal health (soul half-hearts) an entity can have at once.") + .defineInRange("maxEtherealHealth", 80, 0, 1000); + builder.pop(); + builder.comment("Mob settings").push("mobs"); WRAITH_SPAWN_WEIGHT = builder.comment("Spawn weight for wraith entity. Set to zero to disable spawning.") - .defineInRange("wraithSpawnWeight", 40, 0, 1000); + .defineInRange("wraithSpawnWeight", 60, 0, 1000); ZOMBIE_BRUTE_SPAWN_WEIGHT = builder.comment("Spawn weight for zombie brute entity. Set to zero to disable spawning.") - .defineInRange("zombieBruteSpawnWeight", 40, 0, 1000); + .defineInRange("zombieBruteSpawnWeight", 60, 0, 1000); + RAVEN_SPAWN_WEIGHT = builder.comment("Spawn weight for raven entity. Set to zero to disable spawning.") + .defineInRange("ravenSpawnWeight", 6, 0, 1000); + ABOVEGROUND_SLUG_WEIGHT = builder.comment("Spawn weight for slug entity in aboveground biomes. Set to zero to disable spawning.") + .defineInRange("slugWeightAboveground", 8, 0, 1000); + UNDERGROUND_SLUG_WEIGHT = builder.comment("Spawn weight for slug entity in underground biomes. Set to zero to disable spawning.") + .defineInRange("slugWeightUnderground", 6, 0, 1000); builder.pop(); builder.comment("World generation settings").push("world"); LEAD_ENABLED = builder.comment("Whether lead ore is enabled. Set to false to disable spawning.") .define("leadEnabled", true); LEAD_MIN_Y = builder.comment("Minimum Y value for lead ore veins") - .defineInRange("leadOreMinY", 0, 0, 254); + .defineInRange("leadOreMinY", -27, -63, 318); LEAD_MAX_Y = builder.comment("Maximum Y value for lead ore veins") - .defineInRange("leadOreMaxY", 41, 1, 255); + .defineInRange("leadOreMaxY", 41, -62, 319); LEAD_VEIN_SIZE = builder.comment("Maximum number of blocks per lead ore vein") .defineInRange("leadOreVeinSize", 6, 1, 255); LEAD_VEIN_COUNT = builder.comment("Number of lead ore veins per chunk") .defineInRange("leadOreVeinCount", 6, 0, 255); + SILVER_ENABLED = builder.comment("Whether silver ore is enabled. Set to false to disable spawning.") + .define("silverEnabled", true); + SILVER_MIN_Y = builder.comment("Minimum Y value for silver ore veins") + .defineInRange("silverOreMinY", -60, -63, 318); + SILVER_MAX_Y = builder.comment("Maximum Y value for silver ore veins") + .defineInRange("silverOreMaxY", 33, -62, 319); + SILVER_VEIN_SIZE = builder.comment("Maximum number of blocks per silver ore vein") + .defineInRange("silverOreVeinSize", 6, 1, 255); + SILVER_VEIN_COUNT = builder.comment("Number of silver ore veins per chunk") + .defineInRange("silverOreVeinCount", 5, 0, 255); LAB_ENABLED = builder.comment("Whether the lab structure is enabled. Set to false to disable spawning.") .define("labEnabled", true); LAB_RARITY = builder.comment("Rarity of the lab structure. Higher numbers mean rarer structures.") diff --git a/src/main/java/elucent/eidolon/Eidolon.java b/src/main/java/elucent/eidolon/Eidolon.java index 09886f2..c9871bd 100644 --- a/src/main/java/elucent/eidolon/Eidolon.java +++ b/src/main/java/elucent/eidolon/Eidolon.java @@ -1,51 +1,55 @@ package elucent.eidolon; -import com.google.common.collect.Lists; -import elucent.eidolon.capability.*; import elucent.eidolon.codex.CodexChapters; -import elucent.eidolon.entity.*; +import elucent.eidolon.deity.RegisterDeitiesEvent; +import elucent.eidolon.gui.ResearchTableScreen; import elucent.eidolon.gui.SoulEnchanterScreen; import elucent.eidolon.gui.WoodenBrewingStandScreen; import elucent.eidolon.gui.WorktableScreen; +import elucent.eidolon.item.AthameItem; import elucent.eidolon.network.Networking; import elucent.eidolon.proxy.ClientProxy; import elucent.eidolon.proxy.ISidedProxy; import elucent.eidolon.proxy.ServerProxy; +import elucent.eidolon.reagent.RegisterReagentsEvent; import elucent.eidolon.recipe.CrucibleRegistry; -import elucent.eidolon.recipe.WorktableRegistry; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; import elucent.eidolon.ritual.RitualRegistry; import elucent.eidolon.spell.AltarEntries; -import elucent.eidolon.spell.AltarInfo; -import elucent.eidolon.tile.*; -import mezz.jei.api.JeiPlugin; -import mezz.jei.plugins.vanilla.brewing.BrewingRecipeUtil; -import mezz.jei.runtime.JeiHelpers; -import mezz.jei.startup.JeiStarter; -import net.minecraft.client.gui.ScreenManager; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.tile.BrazierTileRenderer; +import elucent.eidolon.tile.CrucibleTileRenderer; +import elucent.eidolon.tile.GobletTileRenderer; +import elucent.eidolon.tile.HandTileRenderer; +import elucent.eidolon.tile.NecroticFocusTileRenderer; +import elucent.eidolon.tile.SoulEnchanterTileRenderer; +import elucent.eidolon.tile.reagent.CisternTileRenderer; +import elucent.eidolon.tile.reagent.PipeTileRenderer; +import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.RenderTypeLookup; -import net.minecraft.entity.EntitySpawnPlacementRegistry; -import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes; -import net.minecraft.entity.monster.MonsterEntity; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.potion.EffectInstance; -import net.minecraft.potion.PotionUtils; -import net.minecraft.potion.Potions; -import net.minecraft.world.gen.Heightmap; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.renderer.ItemBlockRenderTypes; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.SpawnPlacements; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.gui.ForgeIngameGui; +import net.minecraftforge.client.gui.OverlayRegistry; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.brewing.BrewingRecipeRegistry; -import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -57,16 +61,25 @@ @Mod(Eidolon.MODID) public class Eidolon { - public static ISidedProxy proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> ServerProxy::new); + public static ISidedProxy proxy = DistExecutor.unsafeRunForDist(() -> ClientProxy::new, () -> ServerProxy::new); public static final String MODID = "eidolon"; - public static final ItemGroup TAB = new ItemGroup(MODID) { + public static final CreativeModeTab TAB = new CreativeModeTab(MODID) { @Override - public ItemStack createIcon() { + public ItemStack makeIcon() { return new ItemStack(Registry.SHADOW_GEM.get(), 1); } }; + + public static boolean trueMobType = false; + + public static MobType getTrueMobType(LivingEntity e) { + trueMobType = true; + MobType type = e.getMobType(); + trueMobType = false; + return type; + } public Eidolon() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); @@ -76,11 +89,13 @@ public Eidolon() { FMLJavaModLoadingContext.get().getModEventBus().register(new Registry()); Registry.init(); proxy.init(); + MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new WorldGen()); WorldGen.preInit(); MinecraftForge.EVENT_BUS.register(new Events()); DistExecutor.unsafeCallWhenOn(Dist.CLIENT, () -> () -> { MinecraftForge.EVENT_BUS.register(new ClientEvents()); + FMLJavaModLoadingContext.get().getModEventBus().register(new ClientRegistry()); return new Object(); }); } @@ -90,58 +105,64 @@ public void setup(final FMLCommonSetupEvent event) { WorldGen.init(); event.enqueueWork(() -> { CrucibleRegistry.init(); - WorktableRegistry.init(); RitualRegistry.init(); - CodexChapters.init(); Registry.addBrewingRecipes(); AltarEntries.init(); + Researches.init(); + Runes.init(); + AthameItem.initHarvestables(); + CodexChapters.init(); }); - event.enqueueWork(this::defineAttributes); - CapabilityManager.INSTANCE.register(IReputation.class, new ReputationStorage(), ReputationImpl::new); - CapabilityManager.INSTANCE.register(IKnowledge.class, new KnowledgeStorage(), KnowledgeImpl::new); - - EntitySpawnPlacementRegistry.register(Registry.ZOMBIE_BRUTE.get(), EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, - MonsterEntity::canMonsterSpawnInLight); - EntitySpawnPlacementRegistry.register(Registry.WRAITH.get(), EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, - MonsterEntity::canMonsterSpawnInLight); + SpawnPlacements.register(Registry.ZOMBIE_BRUTE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + Monster::checkMonsterSpawnRules); + SpawnPlacements.register(Registry.WRAITH.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + Monster::checkMonsterSpawnRules); + SpawnPlacements.register(Registry.RAVEN.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + Animal::checkAnimalSpawnRules); + SpawnPlacements.register(Registry.SLIMY_SLUG.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + (e, w, t, pos, rand) -> true); } @OnlyIn(Dist.CLIENT) public static void clientSetup(final FMLClientSetupEvent event){ - RenderingRegistry.registerEntityRenderingHandler(Registry.ZOMBIE_BRUTE.get(), (erm) -> new ZombieBruteRenderer(erm, new ZombieBruteModel(), 0.6f)); - RenderingRegistry.registerEntityRenderingHandler(Registry.WRAITH.get(), (erm) -> new WraithRenderer(erm, new WraithModel(), 0.6f)); - RenderingRegistry.registerEntityRenderingHandler(Registry.NECROMANCER.get(), (erm) -> new NecromancerRenderer(erm, new NecromancerModel(0), 0.6f)); - RenderingRegistry.registerEntityRenderingHandler(Registry.SOULFIRE_PROJECTILE.get(), (erm) -> new EmptyRenderer(erm)); - RenderingRegistry.registerEntityRenderingHandler(Registry.BONECHILL_PROJECTILE.get(), (erm) -> new EmptyRenderer(erm)); - RenderingRegistry.registerEntityRenderingHandler(Registry.NECROMANCER_SPELL.get(), (erm) -> new EmptyRenderer(erm)); - RenderingRegistry.registerEntityRenderingHandler(Registry.CHANT_CASTER.get(), (erm) -> new EmptyRenderer(erm)); - ClientRegistry.bindTileEntityRenderer(Registry.HAND_TILE_ENTITY, (trd) -> new HandTileRenderer(trd)); - ClientRegistry.bindTileEntityRenderer(Registry.BRAZIER_TILE_ENTITY, (trd) -> new BrazierTileRenderer(trd)); - ClientRegistry.bindTileEntityRenderer(Registry.NECROTIC_FOCUS_TILE_ENTITY, (trd) -> new NecroticFocusTileRenderer(trd)); - ClientRegistry.bindTileEntityRenderer(Registry.CRUCIBLE_TILE_ENTITY, (trd) -> new CrucibleTileRenderer(trd)); - ClientRegistry.bindTileEntityRenderer(Registry.SOUL_ENCHANTER_TILE_ENTITY, (trd) -> new SoulEnchanterTileRenderer(trd)); - ClientRegistry.bindTileEntityRenderer(Registry.GOBLET_TILE_ENTITY, (trd) -> new GobletTileRenderer(trd)); + BlockEntityRenderers.register(Registry.HAND_TILE_ENTITY, (trd) -> new HandTileRenderer()); + BlockEntityRenderers.register(Registry.BRAZIER_TILE_ENTITY, (trd) -> new BrazierTileRenderer()); + BlockEntityRenderers.register(Registry.NECROTIC_FOCUS_TILE_ENTITY, (trd) -> new NecroticFocusTileRenderer()); + BlockEntityRenderers.register(Registry.CRUCIBLE_TILE_ENTITY, (trd) -> new CrucibleTileRenderer()); + BlockEntityRenderers.register(Registry.SOUL_ENCHANTER_TILE_ENTITY, (trd) -> new SoulEnchanterTileRenderer()); + BlockEntityRenderers.register(Registry.GOBLET_TILE_ENTITY, (trd) -> new GobletTileRenderer()); + BlockEntityRenderers.register(Registry.CISTERN_TILE_ENTITY, (trd) -> new CisternTileRenderer()); + BlockEntityRenderers.register(Registry.PIPE_TILE_ENTITY, (trd) -> new PipeTileRenderer()); - RenderTypeLookup.setRenderLayer(Registry.ENCHANTED_ASH.get(), RenderType.getCutoutMipped()); - RenderTypeLookup.setRenderLayer(Registry.WOODEN_STAND.get(), RenderType.getCutoutMipped()); - RenderTypeLookup.setRenderLayer(Registry.GOBLET.get(), RenderType.getCutoutMipped()); - RenderTypeLookup.setRenderLayer(Registry.UNHOLY_EFFIGY.get(), RenderType.getCutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.ENCHANTED_ASH.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.WOODEN_STAND.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.GOBLET.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.UNHOLY_EFFIGY.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.INCUBATOR.get(), (t) -> t == RenderType.solid() || t == RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(Registry.GLASS_TUBE.get(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(Registry.CISTERN.get(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(Registry.MERAMMER_ROOT.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.SILDRIAN_SEED.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.OANNA_BLOOM.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.AVENNIAN_SPRIG.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.ILLWOOD_LEAVES.get(), RenderType.cutoutMipped()); + ItemBlockRenderTypes.setRenderLayer(Registry.ILLWOOD_SAPLING.get(), RenderType.cutoutMipped()); event.enqueueWork(() -> { - ScreenManager.registerFactory(Registry.WORKTABLE_CONTAINER.get(), WorktableScreen::new); - ScreenManager.registerFactory(Registry.SOUL_ENCHANTER_CONTAINER.get(), SoulEnchanterScreen::new); - ScreenManager.registerFactory(Registry.WOODEN_STAND_CONTAINER.get(), WoodenBrewingStandScreen::new); + MenuScreens.register(Registry.WORKTABLE_CONTAINER.get(), WorktableScreen::new); + MenuScreens.register(Registry.SOUL_ENCHANTER_CONTAINER.get(), SoulEnchanterScreen::new); + MenuScreens.register(Registry.WOODEN_STAND_CONTAINER.get(), WoodenBrewingStandScreen::new); + MenuScreens.register(Registry.RESEARCH_TABLE_CONTAINER.get(), ResearchTableScreen::new); + + OverlayRegistry.registerOverlayAbove(ForgeIngameGui.PLAYER_HEALTH_ELEMENT, Eidolon.MODID + ":hearts", new ClientRegistry.EidolonHearts()); + OverlayRegistry.registerOverlayBelow(ForgeIngameGui.CHAT_PANEL_ELEMENT, Eidolon.MODID + ":mana_bar", new ClientRegistry.EidolonManaBar()); + ClientRegistry.initCurios(); }); } - public void defineAttributes() { - GlobalEntityTypeAttributes.put(Registry.ZOMBIE_BRUTE.get(), ZombieBruteEntity.createAttributes()); - GlobalEntityTypeAttributes.put(Registry.WRAITH.get(), WraithEntity.createAttributes()); - GlobalEntityTypeAttributes.put(Registry.NECROMANCER.get(), NecromancerEntity.createAttributes()); - } - public void sendImc(InterModEnqueueEvent evt) { + InterModComms.sendTo("consecration", "holy_material", () -> "silver"); InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.CHARM.getMessageBuilder().build()); InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.RING.getMessageBuilder().size(2).build()); InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.BELT.getMessageBuilder().build()); diff --git a/src/main/java/elucent/eidolon/Events.java b/src/main/java/elucent/eidolon/Events.java index 85ba7f7..b1f1195 100644 --- a/src/main/java/elucent/eidolon/Events.java +++ b/src/main/java/elucent/eidolon/Events.java @@ -1,13 +1,21 @@ package elucent.eidolon; +import java.util.Comparator; +import java.util.List; +import java.util.UUID; + import com.mojang.authlib.GameProfile; + import elucent.eidolon.capability.IKnowledge; -import elucent.eidolon.capability.KnowledgeProvider; -import elucent.eidolon.capability.ReputationProvider; -import elucent.eidolon.entity.ai.GenericBarterGoal; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.capability.ISoul; +import elucent.eidolon.capability.KnowledgeCommand; +import elucent.eidolon.entity.ZombieBruteEntity; import elucent.eidolon.entity.ai.PriestBarterGoal; import elucent.eidolon.entity.ai.WitchBarterGoal; -import elucent.eidolon.event.SpeedFactorEvent; +import elucent.eidolon.event.StuckInBlockEvent; +import elucent.eidolon.item.BonelordArmorItem; import elucent.eidolon.item.CleavingAxeItem; import elucent.eidolon.item.CodexItem; import elucent.eidolon.item.ReaperScytheItem; @@ -15,138 +23,219 @@ import elucent.eidolon.network.CrystallizeEffectPacket; import elucent.eidolon.network.KnowledgeUpdatePacket; import elucent.eidolon.network.Networking; +import elucent.eidolon.network.SoulUpdatePacket; +import elucent.eidolon.network.WingsDataUpdatePacket; +import elucent.eidolon.research.Research; import elucent.eidolon.ritual.Ritual; import elucent.eidolon.spell.Signs; import elucent.eidolon.tile.GobletTileEntity; import elucent.eidolon.util.EntityUtil; -import net.minecraft.entity.*; -import net.minecraft.entity.boss.dragon.EnderDragonEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.merchant.villager.VillagerEntity; -import net.minecraft.entity.monster.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.potion.Effects; -import net.minecraft.util.DamageSource; -import net.minecraft.util.RegistryKey; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.MobSpawnInfo; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.monster.Creeper; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.monster.Skeleton; +import net.minecraft.world.entity.monster.Witch; +import net.minecraft.world.entity.monster.WitherSkeleton; +import net.minecraft.world.entity.monster.Zombie; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biomes; +import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.event.AttachCapabilitiesEvent; +import net.minecraftforge.event.RegisterCommandsEvent; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.event.TickEvent.PlayerTickEvent; +import net.minecraftforge.event.entity.EntityAttributeModificationEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.entity.living.PotionEvent; +import net.minecraftforge.event.entity.living.PotionEvent.PotionAddedEvent; +import net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.eventbus.api.Event.Result; import net.minecraftforge.registries.ForgeRegistries; -import java.util.Comparator; -import java.util.List; - public class Events { @SubscribeEvent - public void attachWorldCaps(AttachCapabilitiesEvent event) { - if (event.getObject() instanceof World) event.addCapability(new ResourceLocation(Eidolon.MODID, "reputation"), new ReputationProvider()); + public void attachWorldCaps(AttachCapabilitiesEvent event) { + if (event.getObject() instanceof Level) event.addCapability(new ResourceLocation(Eidolon.MODID, "reputation"), new IReputation.Provider()); } @SubscribeEvent public void attachEntityCaps(AttachCapabilitiesEvent event) { - if (event.getObject() instanceof Entity) event.addCapability(new ResourceLocation(Eidolon.MODID, "knowledge"), new KnowledgeProvider()); + if (event.getObject() instanceof Player) { + event.addCapability(new ResourceLocation(Eidolon.MODID, "knowledge"), new IKnowledge.Provider()); + event.addCapability(new ResourceLocation(Eidolon.MODID, "player_data"), new IPlayerData.Provider()); + } + if (event.getObject() instanceof LivingEntity) event.addCapability(new ResourceLocation(Eidolon.MODID, "soul"), new ISoul.Provider()); } @SubscribeEvent public void onClone(PlayerEvent.Clone event) { - Capability KNOWLEDGE = KnowledgeProvider.CAPABILITY; - KNOWLEDGE.getStorage().readNBT( - KNOWLEDGE, - event.getPlayer().getCapability(KNOWLEDGE, null).resolve().get(), - null, - KNOWLEDGE.getStorage().writeNBT(KNOWLEDGE, event.getOriginal().getCapability(KNOWLEDGE, null).resolve().get(), null) - ); - if (!event.getPlayer().world.isRemote) { + Capability KNOWLEDGE = IKnowledge.INSTANCE; + Capability SOUL = ISoul.INSTANCE; + Capability PDATA = IPlayerData.INSTANCE; + event.getOriginal().reviveCaps(); + event.getPlayer().getCapability(KNOWLEDGE).ifPresent((k) -> { + event.getOriginal().getCapability(KNOWLEDGE).ifPresent((o) -> { + ((INBTSerializable)k).deserializeNBT(((INBTSerializable)o).serializeNBT()); + }); + }); + event.getPlayer().getCapability(SOUL).ifPresent((k) -> { + event.getOriginal().getCapability(SOUL).ifPresent((o) -> { + ((INBTSerializable)k).deserializeNBT(((INBTSerializable)o).serializeNBT()); + }); + }); + event.getPlayer().getCapability(PDATA).ifPresent((k) -> { + event.getOriginal().getCapability(PDATA).ifPresent((o) -> { + ((INBTSerializable)k).deserializeNBT(((INBTSerializable)o).serializeNBT()); + }); + }); + event.getOriginal().invalidateCaps(); + if (!event.getPlayer().level.isClientSide) { Networking.sendTo(event.getPlayer(), new KnowledgeUpdatePacket(event.getPlayer(), false)); + Networking.sendTo(event.getPlayer(), new SoulUpdatePacket(event.getPlayer())); } } + + @SubscribeEvent + public void registerCommands(RegisterCommandsEvent event) { + KnowledgeCommand.register(event.getDispatcher()); + } @SubscribeEvent public void onTarget(LivingSetAttackTargetEvent event) { if (EntityUtil.isEnthralledBy(event.getEntityLiving(), event.getTarget())) - ((MobEntity)event.getEntityLiving()).setAttackTarget(null); + ((Mob)event.getEntityLiving()).setTarget(null); + } + + @SubscribeEvent + public void onTarget(LivingUpdateEvent event) { + Level level = event.getEntity().getLevel(); + LivingEntity e = event.getEntityLiving(); + if (e.hasEffect(Registry.UNDEATH_EFFECT.get()) && level.isDay() && !level.isClientSide) { + float f = e.getBrightness(); + BlockPos blockpos = e.getVehicle() instanceof Boat ? (new BlockPos(e.getX(), (double) Math.round(e.getY()), e.getZ())).above() : new BlockPos(e.getX(), (double) Math.round(e.getY()), e.getZ()); + if (f > 0.5F && e.getRandom().nextFloat() * 30.0F < (f - 0.4F) * 2.0F && level.canSeeSky(blockpos)) { + e.setSecondsOnFire(8); + } + } + boolean hasBoneArmor = false; + for (ItemStack s : e.getArmorSlots()) { + if (s.getItem() instanceof BonelordArmorItem) hasBoneArmor = true; + } + if (hasBoneArmor && event.getEntityLiving().getHealth() >= event.getEntityLiving().getMaxHealth() * 0.999 && event.getEntity().tickCount % 80 == 0) + event.getEntityLiving().getCapability(ISoul.INSTANCE).ifPresent(s -> s.healEtherealHealth(1, ISoul.getPersistentHealth(event.getEntityLiving()))); } @SubscribeEvent public void onDeath(LivingDropsEvent event) { LivingEntity entity = event.getEntityLiving(); - if (!(entity instanceof MonsterEntity)) { - World world = entity.world; - BlockPos pos = entity.getPosition(); - List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AxisAlignedBB(pos.add(-2, -2, -2), pos.add(3, 3, 3))); + if (!(entity instanceof Monster)) { + Level world = entity.level; + BlockPos pos = entity.blockPosition(); + List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AABB(pos.offset(-2, -2, -2), pos.offset(3, 3, 3))); if (goblets.size() > 0) { - GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((g) -> g.getPos().distanceSq(pos))).get(); + GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((g) -> g.getBlockPos().distSqr(pos))).get(); goblet.setEntityType(entity.getType()); } } - if (entity instanceof WitchEntity || entity instanceof VillagerEntity) { - if (entity.getHeldItemMainhand().getItem() instanceof CodexItem) - event.getDrops().add(new ItemEntity(entity.world, entity.getPosX(), entity.getPosY(), entity.getPosZ(), entity.getHeldItemMainhand().copy())); + if (entity instanceof Witch || entity instanceof Villager) { + if (entity.getMainHandItem().getItem() instanceof CodexItem) + event.getDrops().add(new ItemEntity(entity.level, entity.getX(), entity.getY(), entity.getZ(), entity.getMainHandItem().copy())); } if (EntityUtil.isEnthralled(entity)) { event.getDrops().clear(); return; } + + if (entity instanceof ZombieBruteEntity z && entity.hasEffect(MobEffects.WITHER) && !entity.level.isClientSide) { + for (ItemEntity item : event.getDrops()) if (item.getItem().is(Registry.ZOMBIE_HEART.get())) { + item.setItem(new ItemStack(Registry.WITHERED_HEART.get(), item.getItem().getCount())); + } + } - if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof LivingEntity) { - LivingEntity source = (LivingEntity) event.getSource().getTrueSource(); - ItemStack held = source.getHeldItemMainhand(); - if (!entity.world.isRemote && held.getItem() instanceof ReaperScytheItem && entity.isEntityUndead()) { + if (event.getSource().getEntity() != null && event.getSource().getEntity() instanceof LivingEntity) { + LivingEntity source = (LivingEntity) event.getSource().getEntity(); + ItemStack held = source.getMainHandItem(); + if (!entity.level.isClientSide && (held.getItem() instanceof ReaperScytheItem || event.getSource() == Registry.RITUAL_DAMAGE) + && entity.isInvertedHealAndHarm()) { + if (!(entity instanceof Player)) event.getDrops().clear(); int looting = ForgeHooks.getLootingLevel(entity, source, event.getSource()); - ItemEntity drop = new ItemEntity(source.world, entity.getPosX(), entity.getPosY(), entity.getPosZ(), - new ItemStack(Registry.SOUL_SHARD.get(), source.world.rand.nextInt(2 + looting))); - drop.setDefaultPickupDelay(); + ItemEntity drop = new ItemEntity(source.level, entity.getX(), entity.getY(), entity.getZ(), + new ItemStack(Registry.SOUL_SHARD.get(), source.level.random.nextInt(2 + looting))); + drop.setDefaultPickUpDelay(); event.getDrops().add(drop); - Networking.sendToTracking(entity.world, entity.getPosition(), new CrystallizeEffectPacket(entity.getPosition())); + Networking.sendToTracking(entity.level, entity.blockPosition(), new CrystallizeEffectPacket(entity.blockPosition())); } - if (!entity.world.isRemote && held.getItem() instanceof CleavingAxeItem) { + if (!entity.level.isClientSide && held.getItem() instanceof CleavingAxeItem) { int looting = ForgeHooks.getLootingLevel(entity, source, event.getSource()); ItemStack head = ItemStack.EMPTY; - if (entity instanceof WitherSkeletonEntity) head = new ItemStack(Items.WITHER_SKELETON_SKULL); - else if (entity instanceof SkeletonEntity) head = new ItemStack(Items.SKELETON_SKULL); - else if (entity instanceof ZombieEntity) head = new ItemStack(Items.ZOMBIE_HEAD); - else if (entity instanceof CreeperEntity) head = new ItemStack(Items.CREEPER_HEAD); - else if (entity instanceof EnderDragonEntity) head = new ItemStack(Items.DRAGON_HEAD); - else if (entity instanceof PlayerEntity) { + if (entity instanceof WitherSkeleton) head = new ItemStack(Items.WITHER_SKELETON_SKULL); + else if (entity instanceof Skeleton) head = new ItemStack(Items.SKELETON_SKULL); + else if (entity instanceof Zombie) head = new ItemStack(Items.ZOMBIE_HEAD); + else if (entity instanceof Creeper) head = new ItemStack(Items.CREEPER_HEAD); + else if (entity instanceof EnderDragon) head = new ItemStack(Items.DRAGON_HEAD); + else if (entity instanceof Player) { head = new ItemStack(Items.PLAYER_HEAD); - GameProfile gameprofile = ((PlayerEntity)entity).getGameProfile(); - head.getOrCreateTag().put("SkullOwner", NBTUtil.writeGameProfile(new CompoundNBT(), gameprofile)); + GameProfile gameprofile = ((Player)entity).getGameProfile(); + head.getOrCreateTag().put("SkullOwner", NbtUtils.writeGameProfile(new CompoundTag(), gameprofile)); } if (!head.isEmpty()) { boolean doDrop = false; - if (entity.world.rand.nextInt(20) == 0) doDrop = true; + if (entity.level.random.nextInt(20) == 0) doDrop = true; else for (int i = 0; i < looting; i++) { - if (entity.world.rand.nextInt(40) == 0) { + if (entity.level.random.nextInt(40) == 0) { doDrop = true; break; } } + for (ItemEntity e : event.getDrops()) { + if (e.getItem().is(head.getItem())) doDrop = false; // No duplicate heads. + } if (doDrop) { - ItemEntity drop = new ItemEntity(source.world, entity.getPosX(), entity.getPosY(), entity.getPosZ(), head); - drop.setDefaultPickupDelay(); + ItemEntity drop = new ItemEntity(source.level, entity.getX(), entity.getY(), entity.getZ(), head); + drop.setDefaultPickUpDelay(); event.getDrops().add(drop); } } @@ -156,64 +245,128 @@ else if (entity instanceof PlayerEntity) { @SubscribeEvent public void registerSpawns(BiomeLoadingEvent ev) { - RegistryKey key = RegistryKey.getOrCreateKey(ForgeRegistries.Keys.BIOMES, ev.getName()); - if (BiomeDictionary.hasType(key, BiomeDictionary.Type.OVERWORLD) && ev.getCategory() != Biome.Category.MUSHROOM) { - ev.getSpawns().withSpawner(EntityClassification.MONSTER, - new MobSpawnInfo.Spawners(Registry.WRAITH.get(), Config.WRAITH_SPAWN_WEIGHT.get(), 1, 2)); - ev.getSpawns().withSpawner(EntityClassification.MONSTER, - new MobSpawnInfo.Spawners(Registry.ZOMBIE_BRUTE.get(), Config.ZOMBIE_BRUTE_SPAWN_WEIGHT.get(), 1, 2)); + ResourceKey key = ResourceKey.create(ForgeRegistries.Keys.BIOMES, ev.getName()); + if (BiomeDictionary.hasType(key, BiomeDictionary.Type.OVERWORLD) && ev.getCategory() != Biome.BiomeCategory.MUSHROOM) { + ev.getSpawns().addSpawn(MobCategory.MONSTER, + new MobSpawnSettings.SpawnerData(Registry.WRAITH.get(), Config.WRAITH_SPAWN_WEIGHT.get(), 1, 2)); + ev.getSpawns().addSpawn(MobCategory.MONSTER, + new MobSpawnSettings.SpawnerData(Registry.ZOMBIE_BRUTE.get(), Config.ZOMBIE_BRUTE_SPAWN_WEIGHT.get(), 1, 2)); } + if (BiomeDictionary.hasType(key, BiomeDictionary.Type.OVERWORLD) && BiomeDictionary.hasType(key, BiomeDictionary.Type.FOREST)) { + ev.getSpawns().addSpawn(MobCategory.CREATURE, + new MobSpawnSettings.SpawnerData(Registry.RAVEN.get(), Config.RAVEN_SPAWN_WEIGHT.get(), 2, 5)); + } + if (key.equals(Biomes.OLD_GROWTH_PINE_TAIGA) || key.equals(Biomes.OLD_GROWTH_SPRUCE_TAIGA) || key.equals(Biomes.FLOWER_FOREST)) + ev.getSpawns().addSpawn(MobCategory.AMBIENT, + new MobSpawnSettings.SpawnerData(Registry.SLIMY_SLUG.get(), Config.ABOVEGROUND_SLUG_WEIGHT.get(), 2, 5)); + if (key.equals(Biomes.LUSH_CAVES)) + ev.getSpawns().addSpawn(MobCategory.AMBIENT, + new MobSpawnSettings.SpawnerData(Registry.SLIMY_SLUG.get(), Config.UNDERGROUND_SLUG_WEIGHT.get(), 2, 5)); } @SubscribeEvent public void registerCustomAI(EntityJoinWorldEvent event) { - if (event.getEntity() instanceof LivingEntity && !event.getWorld().isRemote) { - if (event.getEntity() instanceof PlayerEntity) { - Networking.sendTo((PlayerEntity)event.getEntity(), new KnowledgeUpdatePacket((PlayerEntity)event.getEntity(), false)); + if (event.getEntity() instanceof LivingEntity && !event.getWorld().isClientSide) { + if (event.getEntity() instanceof Player) { + Networking.sendTo((Player)event.getEntity(), new KnowledgeUpdatePacket((Player)event.getEntity(), false)); + Networking.sendTo((Player)event.getEntity(), new SoulUpdatePacket((Player)event.getEntity())); } - if (event.getEntity() instanceof WitchEntity) { - ((WitchEntity)event.getEntity()).goalSelector.addGoal(1, new WitchBarterGoal( - (WitchEntity)event.getEntity(), + if (event.getEntity() instanceof Witch) { + ((Witch)event.getEntity()).goalSelector.addGoal(1, new WitchBarterGoal( + (Witch)event.getEntity(), (stack) -> stack.getItem() == Registry.CODEX.get(), (stack) -> CodexItem.withSign(stack, Signs.WICKED_SIGN) )); } - if (event.getEntity() instanceof VillagerEntity) { - ((VillagerEntity)event.getEntity()).goalSelector.addGoal(1, new PriestBarterGoal( - (VillagerEntity)event.getEntity(), + if (event.getEntity() instanceof Villager) { + ((Villager)event.getEntity()).goalSelector.addGoal(1, new PriestBarterGoal( + (Villager)event.getEntity(), (stack) -> stack.getItem() == Registry.CODEX.get(), (stack) -> CodexItem.withSign(stack, Signs.SACRED_SIGN) )); } } } + + @SubscribeEvent + public void onPlayerTick(PlayerTickEvent event) { + if (event.phase == TickEvent.Phase.END) event.player.getCapability(IPlayerData.INSTANCE).ifPresent((d) -> { + if (!d.getWingsItem(event.player).isEmpty()) { + if (event.player.isCrouching() && event.player.getDeltaMovement().y < -0.1) { + d.startFlying(event.player); + event.player.setDeltaMovement(event.player.getDeltaMovement().x, -0.1, event.player.getDeltaMovement().z); + } + if (d.isFlying(event.player)) event.player.resetFallDistance(); + + if (d.isDashing(event.player)) d.doDashTick(event.player); + + if (event.player.isOnGround()) { + d.rechargeWings(event.player); + d.stopFlying(event.player); + } + if (!event.player.level.isClientSide) { + Networking.sendToTracking(event.player.level, event.player.blockPosition(), new WingsDataUpdatePacket(event.player)); + } + } + }); + } @SubscribeEvent public void onApplyPotion(PotionEvent.PotionApplicableEvent event) { - if (event.getPotionEffect().getPotion() == Effects.SLOWNESS && event.getEntityLiving().getItemStackFromSlot(EquipmentSlotType.FEET).getItem() instanceof WarlockRobesItem) { + if (event.getPotionEffect().getEffect() == MobEffects.MOVEMENT_SLOWDOWN && event.getEntityLiving().getItemBySlot(EquipmentSlot.FEET).getItem() instanceof WarlockRobesItem) { event.setResult(Event.Result.DENY); } } + + @SubscribeEvent + public void onLivingUse(LivingEntityUseItemEvent event) { + if (event.getEntityLiving().hasEffect(Registry.UNDEATH_EFFECT.get())) { + if (!Registry.ZOMBIE_FOOD_TAG.contains(event.getItem().getItem())) + event.setCanceled(true); + } + } + + @SubscribeEvent + public void onPotionApplicable(PotionAddedEvent event) { + if (event.getEntityLiving().hasEffect(MobEffects.HUNGER) && event.getPotionEffect().getEffect() == Registry.UNDEATH_EFFECT.get()) { + event.getEntityLiving().removeEffect(MobEffects.HUNGER); + } + } + + @SubscribeEvent + public void onPotionApplicable(PotionApplicableEvent event) { + if (event.getEntityLiving().hasEffect(Registry.UNDEATH_EFFECT.get()) && event.getPotionEffect().getEffect() == MobEffects.HUNGER) { + event.setResult(Result.DENY); + } + } @SubscribeEvent public void onLivingHurt(LivingHurtEvent event) { - if ((event.getSource().getDamageType() == DamageSource.WITHER.getDamageType() || event.getSource().isMagicDamage())) { - if (event.getSource().getTrueSource() instanceof LivingEntity - && ((LivingEntity)event.getSource().getTrueSource()).getItemStackFromSlot(EquipmentSlotType.HEAD).getItem() instanceof WarlockRobesItem) { + if ((event.getSource().getMsgId() == DamageSource.WITHER.getMsgId() || event.getSource().isMagic())) { + if (event.getSource().getEntity() instanceof LivingEntity + && ((LivingEntity)event.getSource().getEntity()).getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof WarlockRobesItem) { event.setAmount(event.getAmount() * 1.5f); - if (event.getSource().getDamageType() == DamageSource.WITHER.getDamageType()) - ((LivingEntity) event.getSource().getTrueSource()).heal(event.getAmount() / 2); + if (event.getSource().getMsgId() == DamageSource.WITHER.getMsgId()) + ((LivingEntity) event.getSource().getEntity()).heal(event.getAmount() / 2); } - if (event.getEntityLiving().getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() instanceof WarlockRobesItem) + if (event.getEntityLiving().getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof WarlockRobesItem) event.setAmount(event.getAmount() / 2); } + + event.getEntityLiving().getCapability(ISoul.INSTANCE).ifPresent(s -> { + if (s.hasEtherealHealth()) { + s.hurtEtherealHealth(event.getAmount(), ISoul.getPersistentHealth(event.getEntityLiving())); + event.setAmount(0); + Networking.sendToTracking(event.getEntity().level, event.getEntity().getOnPos(), new SoulUpdatePacket((Player)event.getEntityLiving())); + } + }); } @SubscribeEvent - public void onGetSpeedFactor(SpeedFactorEvent event) { - if (event.getSpeedFactor() < 1.0f && event.getEntity() instanceof LivingEntity && ((LivingEntity)event.getEntity()).getItemStackFromSlot(EquipmentSlotType.FEET).getItem() instanceof WarlockRobesItem) { - float diff = 1.0f - event.getSpeedFactor(); - event.setSpeedFactor(1.0f - diff / 2); + public void onGetSpeedFactor(StuckInBlockEvent event) { + if (event.getStuckMultiplier().length() < 1.0f && event.getEntity() instanceof LivingEntity && ((LivingEntity)event.getEntity()).getItemBySlot(EquipmentSlot.FEET).getItem() instanceof WarlockRobesItem) { + Vec3 diff = new Vec3(1, 1, 1).subtract(event.getStuckMultiplier()).scale(0.5); + event.setStuckMultiplier(new Vec3(1, 1, 1).subtract(diff)); } } } diff --git a/src/main/java/elucent/eidolon/Registry.java b/src/main/java/elucent/eidolon/Registry.java index be9faa5..3f74d2f 100644 --- a/src/main/java/elucent/eidolon/Registry.java +++ b/src/main/java/elucent/eidolon/Registry.java @@ -1,80 +1,256 @@ package elucent.eidolon; -import com.google.common.collect.Lists; -import elucent.eidolon.block.*; -import elucent.eidolon.entity.*; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +import com.mojang.blaze3d.vertex.DefaultVertexFormat; + +import elucent.eidolon.block.BlockBase; +import elucent.eidolon.block.BrazierBlock; +import elucent.eidolon.block.CandleBlock; +import elucent.eidolon.block.CandlestickBlock; +import elucent.eidolon.block.CisternBlock; +import elucent.eidolon.block.CrucibleBlock; +import elucent.eidolon.block.EffigyBlock; +import elucent.eidolon.block.EnchantedAshBlock; +import elucent.eidolon.block.GobletBlock; +import elucent.eidolon.block.HandBlock; +import elucent.eidolon.block.HerbBlockBase; +import elucent.eidolon.block.NecroticFocusBlock; +import elucent.eidolon.block.PillarBlockBase; +import elucent.eidolon.block.PipeBlock; +import elucent.eidolon.block.ResearchTableBlock; +import elucent.eidolon.block.SoulEnchanterBlock; +import elucent.eidolon.block.TableBlockBase; +import elucent.eidolon.block.TwoHighBlockBase; +import elucent.eidolon.block.WoodenStandBlock; +import elucent.eidolon.block.WorktableBlock; +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.capability.ISoul; +import elucent.eidolon.capability.KnowledgeCommand; +import elucent.eidolon.entity.AngelArrowEntity; +import elucent.eidolon.entity.AngelArrowRenderer; +import elucent.eidolon.entity.BonechillProjectileEntity; +import elucent.eidolon.entity.ChantCasterEntity; +import elucent.eidolon.entity.NecromancerEntity; +import elucent.eidolon.entity.NecromancerModel; +import elucent.eidolon.entity.NecromancerRenderer; +import elucent.eidolon.entity.NecromancerSpellEntity; +import elucent.eidolon.entity.RavenEntity; +import elucent.eidolon.entity.RavenModel; +import elucent.eidolon.entity.RavenRenderer; +import elucent.eidolon.entity.SlimySlugEntity; +import elucent.eidolon.entity.SlimySlugModel; +import elucent.eidolon.entity.SlimySlugRenderer; +import elucent.eidolon.entity.SoulfireProjectileEntity; +import elucent.eidolon.entity.WraithEntity; +import elucent.eidolon.entity.WraithModel; +import elucent.eidolon.entity.WraithRenderer; +import elucent.eidolon.entity.ZombieBruteEntity; +import elucent.eidolon.entity.ZombieBruteModel; +import elucent.eidolon.entity.ZombieBruteRenderer; +import elucent.eidolon.gui.ResearchTableContainer; import elucent.eidolon.gui.SoulEnchanterContainer; import elucent.eidolon.gui.WoodenBrewingStandContainer; import elucent.eidolon.gui.WorktableContainer; -import elucent.eidolon.item.*; -import elucent.eidolon.item.curio.*; +import elucent.eidolon.item.AthameItem; +import elucent.eidolon.item.BonechillWandItem; +import elucent.eidolon.item.BonelordArmorItem; +import elucent.eidolon.item.CleavingAxeItem; +import elucent.eidolon.item.CodexItem; +import elucent.eidolon.item.CompletedResearchItem; +import elucent.eidolon.item.DeathbringerScytheItem; +import elucent.eidolon.item.ItemBase; +import elucent.eidolon.item.NotetakingToolsItem; +import elucent.eidolon.item.ReaperScytheItem; +import elucent.eidolon.item.ResearchNotesItem; +import elucent.eidolon.item.ReversalPickItem; +import elucent.eidolon.item.SappingSwordItem; +import elucent.eidolon.item.SilverArmorItem; +import elucent.eidolon.item.SoulfireWandItem; +import elucent.eidolon.item.SummoningStaffItem; +import elucent.eidolon.item.Tiers; +import elucent.eidolon.item.TongsItem; +import elucent.eidolon.item.TopHatItem; +import elucent.eidolon.item.UnholySymbolItem; +import elucent.eidolon.item.WarlockRobesItem; +import elucent.eidolon.item.curio.AngelSightItem; +import elucent.eidolon.item.curio.BasicAmuletItem; +import elucent.eidolon.item.curio.BasicBeltItem; +import elucent.eidolon.item.curio.BasicRingItem; +import elucent.eidolon.item.curio.EnervatingRingItem; +import elucent.eidolon.item.curio.GlassHandItem; +import elucent.eidolon.item.curio.GravityBeltItem; +import elucent.eidolon.item.curio.MindShieldingPlateItem; +import elucent.eidolon.item.curio.PrestigiousPalmItem; +import elucent.eidolon.item.curio.RavenCloakItem; +import elucent.eidolon.item.curio.ResoluteBeltItem; +import elucent.eidolon.item.curio.SanguineAmuletItem; +import elucent.eidolon.item.curio.SoulboneAmuletItem; +import elucent.eidolon.item.curio.TerminusMirrorItem; +import elucent.eidolon.item.curio.VoidAmuletItem; +import elucent.eidolon.item.curio.WardedMailItem; +import elucent.eidolon.item.model.SilverArmorModel; +import elucent.eidolon.item.model.TopHatModel; +import elucent.eidolon.item.model.WarlockArmorModel; import elucent.eidolon.mixin.PotionBrewingMixin; -import elucent.eidolon.particle.*; +import elucent.eidolon.particle.BubbleParticleType; +import elucent.eidolon.particle.FlameParticleType; +import elucent.eidolon.particle.GlowingSlashParticleType; +import elucent.eidolon.particle.LineWispParticleType; +import elucent.eidolon.particle.RuneParticleType; +import elucent.eidolon.particle.SignParticleType; +import elucent.eidolon.particle.SlashParticleType; +import elucent.eidolon.particle.SmokeParticleType; +import elucent.eidolon.particle.SparkleParticleType; +import elucent.eidolon.particle.SteamParticleType; +import elucent.eidolon.particle.WispParticleType; import elucent.eidolon.potion.AnchoredEffect; import elucent.eidolon.potion.ChilledEffect; -import elucent.eidolon.potion.StrictBrewingRecipe; -import elucent.eidolon.ritual.*; +import elucent.eidolon.potion.ReinforcedEffect; +import elucent.eidolon.potion.UndeathEffect; +import elucent.eidolon.potion.VulnerableEffect; +import elucent.eidolon.reagent.Reagent; +import elucent.eidolon.reagent.ReagentRegistry; +import elucent.eidolon.recipe.CrucibleRecipe; +import elucent.eidolon.recipe.WorktableRecipe; +import elucent.eidolon.research.Research; +import elucent.eidolon.ritual.AllureRitual; +import elucent.eidolon.ritual.CrystalRitual; +import elucent.eidolon.ritual.DaylightRitual; +import elucent.eidolon.ritual.DeceitRitual; +import elucent.eidolon.ritual.MoonlightRitual; +import elucent.eidolon.ritual.PurifyRitual; +import elucent.eidolon.ritual.RepellingRitual; +import elucent.eidolon.ritual.SanguineRitual; +import elucent.eidolon.ritual.SummonRitual; import elucent.eidolon.spell.Sign; import elucent.eidolon.spell.Signs; -import elucent.eidolon.tile.*; -import net.minecraft.block.*; -import net.minecraft.block.material.Material; -import net.minecraft.block.material.MaterialColor; +import elucent.eidolon.tile.BrazierTileEntity; +import elucent.eidolon.tile.CrucibleTileEntity; +import elucent.eidolon.tile.CrucibleTileRenderer; +import elucent.eidolon.tile.EffigyTileEntity; +import elucent.eidolon.tile.GobletTileEntity; +import elucent.eidolon.tile.HandTileEntity; +import elucent.eidolon.tile.NecroticFocusTileEntity; +import elucent.eidolon.tile.ResearchTableTileEntity; +import elucent.eidolon.tile.SoulEnchanterTileEntity; +import elucent.eidolon.tile.SoulEnchanterTileRenderer; +import elucent.eidolon.tile.WoodenStandTileEntity; +import elucent.eidolon.tile.reagent.CisternTileEntity; +import elucent.eidolon.tile.reagent.PipeTileEntity; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.FenceBlock; +import net.minecraft.world.level.block.FenceGateBlock; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityClassification; -import net.minecraft.entity.EntityType; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.item.*; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.particles.ParticleType; -import net.minecraft.potion.*; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.DamageSource; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.ShaderInstance; +import net.minecraft.client.renderer.entity.EntityRenderers; +import net.minecraft.client.renderer.entity.NoopRenderer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.RangedAttribute; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.AxeItem; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.HoeItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.RecordItem; +import net.minecraft.world.item.PickaxeItem; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.ShovelItem; +import net.minecraft.world.item.SpawnEggItem; +import net.minecraft.world.item.SwordItem; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.item.alchemy.Potions; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.Tag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType.BlockEntitySupplier; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.phys.shapes.Shapes; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; +import net.minecraftforge.client.event.RegisterShadersEvent; import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.Tags; -import net.minecraftforge.common.ToolType; -import net.minecraftforge.common.brewing.BrewingRecipeRegistry; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; +import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.event.entity.EntityAttributeCreationEvent; +import net.minecraftforge.event.entity.EntityAttributeModificationEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.IForgeRegistry; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; +import net.minecraftforge.registries.RegistryObject; public class Registry { + public static Tags.IOptionalNamedTag + INGOTS_LEAD = ItemTags.createOptional(new ResourceLocation("forge", "ingots/lead")), + INGOTS_PEWTER = ItemTags.createOptional(new ResourceLocation("forge", "ingots/pewter")), + INGOTS_ARCANE_GOLD = ItemTags.createOptional(new ResourceLocation("forge", "ingots/arcane_gold")), + INGOTS_SILVER = ItemTags.createOptional(new ResourceLocation("forge", "ingots/silver")), + GEMS_SHADOW = ItemTags.createOptional(new ResourceLocation("forge", "gems/shadow_gem")); + static Map BLOCK_MAP = new HashMap<>(); static Map ITEM_MAP = new HashMap<>(); static DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Eidolon.MODID); static DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Eidolon.MODID); static DeferredRegister> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, Eidolon.MODID); - static DeferredRegister> TILE_ENTITIES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, Eidolon.MODID); - static DeferredRegister POTIONS = DeferredRegister.create(ForgeRegistries.POTIONS, Eidolon.MODID); - static DeferredRegister POTION_TYPES = DeferredRegister.create(ForgeRegistries.POTION_TYPES, Eidolon.MODID); + static DeferredRegister> TILE_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, Eidolon.MODID); + static DeferredRegister POTIONS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, Eidolon.MODID); + static DeferredRegister POTION_TYPES = DeferredRegister.create(ForgeRegistries.POTIONS, Eidolon.MODID); static DeferredRegister SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Eidolon.MODID); - static DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, Eidolon.MODID); + static DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, Eidolon.MODID); + static DeferredRegister> RECIPE_TYPES = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, Eidolon.MODID); + static DeferredRegister ATTRIBUTES = DeferredRegister.create(ForgeRegistries.ATTRIBUTES, Eidolon.MODID); + + public static Tag ZOMBIE_FOOD_TAG = ItemTags.createOptional(new ResourceLocation(Eidolon.MODID, "zombie_food")); static Item.Properties itemProps() { - return new Item.Properties().group(Eidolon.TAB); + return new Item.Properties().tab(Eidolon.TAB); } - static AbstractBlock.Properties blockProps(Material mat, MaterialColor color) { - return AbstractBlock.Properties.create(mat, color); + static BlockBehaviour.Properties blockProps(Material mat, MaterialColor color) { + return BlockBehaviour.Properties.of(mat, color); } static RegistryObject addItem(String name) { @@ -94,6 +270,10 @@ static RegistryObject addItem(String name, Item item) { return ITEMS.register(name, () -> item); } + static RegistryObject addItem(String name, Supplier item) { + return ITEMS.register(name, item); + } + static RegistryObject addBlock(String name, Block.Properties props) { Block b = new Block(props); BLOCK_MAP.put(name, b); @@ -110,16 +290,16 @@ static RegistryObject addBlock(String name, Block block) { public static class DecoBlockPack { DeferredRegister registry; String basename; - AbstractBlock.Properties props; + BlockBehaviour.Properties props; RegistryObject full = null, slab = null, stair = null, wall = null, fence = null, fence_gate = null; - public DecoBlockPack(DeferredRegister blocks, String basename, AbstractBlock.Properties props) { + public DecoBlockPack(DeferredRegister blocks, String basename, BlockBehaviour.Properties props) { this.registry = blocks; this.basename = basename; this.props = props; full = addBlock(basename, new Block(props)); slab = addBlock(basename + "_slab", new SlabBlock(props)); - stair = addBlock(basename + "_stairs", new StairsBlock(() -> full.get().getDefaultState(), props)); + stair = addBlock(basename + "_stairs", new StairBlock(() -> full.get().defaultBlockState(), props)); } public DecoBlockPack addWall() { @@ -140,22 +320,22 @@ public DecoBlockPack addFence() { public Block getFence() { return fence.get(); } } - static RegistryObject> addEntity(String name, float width, float height, EntityType.IFactory factory, EntityClassification kind) { - EntityType type = EntityType.Builder.create(factory, kind) + static RegistryObject> addEntity(String name, float width, float height, EntityType.EntityFactory factory, MobCategory kind) { + EntityType type = EntityType.Builder.of(factory, kind) .setTrackingRange(64) .setUpdateInterval(1) - .size(width, height) + .sized(width, height) .build(Eidolon.MODID + ":" + name); return ENTITIES.register(name, () -> type); } - static RegistryObject> addEntity(String name, int color1, int color2, float width, float height, EntityType.IFactory factory, EntityClassification kind) { - EntityType type = EntityType.Builder.create(factory, kind) + static RegistryObject> addEntity(String name, int color1, int color2, float width, float height, EntityType.EntityFactory factory, MobCategory kind) { + EntityType type = EntityType.Builder.of(factory, kind) .setTrackingRange(64) .setUpdateInterval(1) - .size(width, height) + .sized(width, height) .build(Eidolon.MODID + ":" + name); - ITEMS.register("spawn_" + name, () -> new SpawnEggItem(type, color1, color2, itemProps().group(ItemGroup.MISC))); + ITEMS.register("spawn_" + name, () -> new SpawnEggItem((EntityType) type, color1, color2, itemProps().tab(CreativeModeTab.TAB_MISC))); return ENTITIES.register(name, () -> type); } @@ -164,15 +344,14 @@ static RegistryObject addSound(String name) { return SOUND_EVENTS.register(name, () -> event); } - static RegistryObject> addContainer(String name, ContainerType.IFactory factory) { - return CONTAINERS.register(name, () -> new ContainerType(factory)); + static RegistryObject> addContainer(String name, MenuType.MenuSupplier factory) { + return CONTAINERS.register(name, () -> new MenuType(factory)); } - static TileEntityType addTileEntity(IForgeRegistry> registry, String name, Supplier factory, Block... blocks) { - TileEntityType type = TileEntityType.Builder.create(factory, blocks).build(null); + static BlockEntityType addTileEntity(IForgeRegistry> registry, String name, BlockEntitySupplier factory, Block... blocks) { + BlockEntityType type = BlockEntityType.Builder.of(factory, blocks).build(null); type.setRegistryName(Eidolon.MODID, name); registry.register(type); - for (Block block : blocks) if (block instanceof BlockBase) ((BlockBase)block).setTile(type); return type; } @@ -181,212 +360,395 @@ static TileEntityType addTileEntity(IForgeRegistry + public static RegistryObject CHILLED_EFFECT = POTIONS.register("chilled", () -> new ChilledEffect()), - ANCHORED_EFFECT = POTIONS.register("anchored", () -> new AnchoredEffect()); + ANCHORED_EFFECT = POTIONS.register("anchored", () -> new AnchoredEffect()), + REINFORCED_EFFECT = POTIONS.register("reinforced", () -> new ReinforcedEffect() + .addAttributeModifier(Attributes.ARMOR, "483b6415-421e-45d1-ab28-d85d11a19c70", 0.25, Operation.MULTIPLY_TOTAL)), + VULNERABLE_EFFECT = POTIONS.register("vulnerable", () -> new VulnerableEffect() + .addAttributeModifier(Attributes.ARMOR, "e5bae4de-2019-4316-b8cc-b4d879d676f9", -0.25, Operation.MULTIPLY_TOTAL)), + UNDEATH_EFFECT = POTIONS.register("undeath", () -> new UndeathEffect()); public static RegistryObject - CHILLED_POTION = POTION_TYPES.register("chilled", () -> new Potion(new EffectInstance(CHILLED_EFFECT.get(), 3600))), - LONG_CHILLED_POTION = POTION_TYPES.register("long_chilled", () -> new Potion(new EffectInstance(CHILLED_EFFECT.get(), 9600))), - ANCHORED_POTION = POTION_TYPES.register("anchored", () -> new Potion(new EffectInstance(ANCHORED_EFFECT.get(), 3600))), - LONG_ANCHORED_POTION = POTION_TYPES.register("long_anchored", () -> new Potion(new EffectInstance(ANCHORED_EFFECT.get(), 9600))); + CHILLED_POTION = POTION_TYPES.register("chilled", () -> new Potion(new MobEffectInstance(CHILLED_EFFECT.get(), 3600))), + LONG_CHILLED_POTION = POTION_TYPES.register("long_chilled", () -> new Potion(new MobEffectInstance(CHILLED_EFFECT.get(), 9600))), + ANCHORED_POTION = POTION_TYPES.register("anchored", () -> new Potion(new MobEffectInstance(ANCHORED_EFFECT.get(), 3600))), + LONG_ANCHORED_POTION = POTION_TYPES.register("long_anchored", () -> new Potion(new MobEffectInstance(ANCHORED_EFFECT.get(), 9600))), + REINFORCED_POTION = POTION_TYPES.register("reinforced", () -> new Potion(new MobEffectInstance(REINFORCED_EFFECT.get(), 3600))), + LONG_REINFORCED_POTION = POTION_TYPES.register("long_reinforced", () -> new Potion(new MobEffectInstance(REINFORCED_EFFECT.get(), 9600))), + STRONG_REINFORCED_POTION = POTION_TYPES.register("strong_reinforced", () -> new Potion(new MobEffectInstance(REINFORCED_EFFECT.get(), 1800, 1))), + VULNERABLE_POTION = POTION_TYPES.register("vulnerable", () -> new Potion(new MobEffectInstance(VULNERABLE_EFFECT.get(), 3600))), + LONG_VULNERABLE_POTION = POTION_TYPES.register("long_vulnerable", () -> new Potion(new MobEffectInstance(VULNERABLE_EFFECT.get(), 9600))), + STRONG_VULNERABLE_POTION = POTION_TYPES.register("strong_vulnerable", () -> new Potion(new MobEffectInstance(VULNERABLE_EFFECT.get(), 1800, 1))), + UNDEATH_POTION = POTION_TYPES.register("undeath", () -> new Potion(new MobEffectInstance(UNDEATH_EFFECT.get(), 3600))), + LONG_UNDEATH_POTION = POTION_TYPES.register("long_undeath", () -> new Potion(new MobEffectInstance(UNDEATH_EFFECT.get(), 9600))), + DECAY_POTION = POTION_TYPES.register("decay", () -> new Potion(new MobEffectInstance(MobEffects.WITHER, 900))), + LONG_DECAY_POTION = POTION_TYPES.register("long_decay", () -> new Potion(new MobEffectInstance(MobEffects.WITHER, 1800))), + STRONG_DECAY_POTION = POTION_TYPES.register("strong_decay", () -> new Potion(new MobEffectInstance(MobEffects.WITHER, 450, 1))); public static RegistryObject LEAD_INGOT = addItem("lead_ingot"), + RAW_LEAD = addItem("raw_lead"), LEAD_NUGGET = addItem("lead_nugget"), + SILVER_INGOT = addItem("silver_ingot"), + RAW_SILVER = addItem("raw_silver"), + SILVER_NUGGET = addItem("silver_nugget"), PEWTER_BLEND = addItem("pewter_blend"), PEWTER_INGOT = addItem("pewter_ingot"), PEWTER_NUGGET = addItem("pewter_nugget"), PEWTER_INLAY = addItem("pewter_inlay"), ARCANE_GOLD_INGOT = addItem("arcane_gold_ingot"), ARCANE_GOLD_NUGGET = addItem("arcane_gold_nugget"), + ELDER_BRICK = addItem("elder_brick"), SULFUR = addItem("sulfur"), GOLD_INLAY = addItem("gold_inlay"), - ZOMBIE_HEART = addItem("zombie_heart", new ItemBase(itemProps().rarity(Rarity.UNCOMMON)) - .setLore("lore.eidolon.zombie_heart")), + ZOMBIE_HEART = addItem("zombie_heart", new ItemBase(itemProps().rarity(Rarity.UNCOMMON).food( + new FoodProperties.Builder() + .nutrition(2).saturationMod(1.5f) + .effect(() -> new MobEffectInstance(MobEffects.HUNGER, 1800), 0.875f) + .effect(() -> new MobEffectInstance(MobEffects.POISON, 900, 1), 1.0f) + .build())).setLore("lore.eidolon.zombie_heart")), TATTERED_CLOTH = addItem("tattered_cloth"), WRAITH_HEART = addItem("wraith_heart", new ItemBase(itemProps() .rarity(Rarity.UNCOMMON)).setLore("lore.eidolon.wraith_heart")), - TOP_HAT = addItem("top_hat", new TopHatItem(itemProps().maxStackSize(1).rarity(Rarity.EPIC)).setLore("lore.eidolon.top_hat")), - BASIC_RING = addItem("basic_ring", new BasicRingItem(itemProps().maxStackSize(1))), - BASIC_AMULET = addItem("basic_amulet", new BasicAmuletItem(itemProps().maxStackSize(1))), - BASIC_BELT = addItem("basic_belt", new BasicBeltItem(itemProps().maxStackSize(1))), - CODEX = addItem("codex", new CodexItem(itemProps().maxStackSize(1).rarity(Rarity.UNCOMMON)).setLore("lore.eidolon.codex")), + TOP_HAT = addItem("top_hat", new TopHatItem(itemProps().stacksTo(1).rarity(Rarity.EPIC)).setLore("lore.eidolon.top_hat")), + BASIC_RING = addItem("basic_ring", new BasicRingItem(itemProps().stacksTo(1))), + BASIC_AMULET = addItem("basic_amulet", new BasicAmuletItem(itemProps().stacksTo(1))), + BASIC_BELT = addItem("basic_belt", new BasicBeltItem(itemProps().stacksTo(1))), + CODEX = addItem("codex", new CodexItem(itemProps().stacksTo(1).rarity(Rarity.UNCOMMON)).setLore("lore.eidolon.codex")), SOUL_SHARD = addItem("soul_shard"), DEATH_ESSENCE = addItem("death_essence"), CRIMSON_ESSENCE = addItem("crimson_essence"), - FUNGUS_SPROUTS = addItem("fungus_sprouts", itemProps().food(new Food.Builder().hunger(2).saturation(0.1f).build())), - WARPED_SPROUTS = addItem("warped_sprouts", itemProps().food(new Food.Builder().hunger(4).saturation(0.6f).effect(() -> new EffectInstance(ANCHORED_EFFECT.get(), 900), 1).build())), + FUNGUS_SPROUTS = addItem("fungus_sprouts", itemProps().food(new FoodProperties.Builder().nutrition(2).saturationMod(0.1f).build())), + WARPED_SPROUTS = addItem("warped_sprouts", itemProps().food(new FoodProperties.Builder().nutrition(4).saturationMod(0.6f).effect(() -> new MobEffectInstance(ANCHORED_EFFECT.get(), 900), 1).build())), ENDER_CALX = addItem("ender_calx"), TALLOW = addItem("tallow"), LESSER_SOUL_GEM = addItem("lesser_soul_gem"), - UNHOLY_SYMBOL = addItem("unholy_symbol", new UnholySymbolItem(itemProps().rarity(Rarity.UNCOMMON).maxStackSize(1))), + UNHOLY_SYMBOL = addItem("unholy_symbol", new UnholySymbolItem(itemProps().rarity(Rarity.UNCOMMON).stacksTo(1))), REAPER_SCYTHE = addItem("reaper_scythe", new ReaperScytheItem(itemProps().rarity(Rarity.UNCOMMON)) .setLore("lore.eidolon.reaper_scythe")), CLEAVING_AXE = addItem("cleaving_axe", new CleavingAxeItem(itemProps().rarity(Rarity.UNCOMMON)) .setLore("lore.eidolon.cleaving_axe")), SHADOW_GEM = addItem("shadow_gem"), WICKED_WEAVE = addItem("wicked_weave"), - WARLOCK_HAT = addItem("warlock_hat", new WarlockRobesItem(EquipmentSlotType.HEAD, itemProps())), - WARLOCK_CLOAK = addItem("warlock_cloak", new WarlockRobesItem(EquipmentSlotType.CHEST, itemProps())), - WARLOCK_BOOTS = addItem("warlock_boots", new WarlockRobesItem(EquipmentSlotType.FEET, itemProps())), + WARLOCK_HAT = addItem("warlock_hat", new WarlockRobesItem(EquipmentSlot.HEAD, itemProps())), + WARLOCK_CLOAK = addItem("warlock_cloak", new WarlockRobesItem(EquipmentSlot.CHEST, itemProps())), + WARLOCK_BOOTS = addItem("warlock_boots", new WarlockRobesItem(EquipmentSlot.FEET, itemProps())), + SILVER_HELMET = addItem("silver_helmet", new SilverArmorItem(EquipmentSlot.HEAD, itemProps())), + SILVER_CHESTPLATE = addItem("silver_chestplate", new SilverArmorItem(EquipmentSlot.CHEST, itemProps())), + SILVER_LEGGINGS = addItem("silver_leggings", new SilverArmorItem(EquipmentSlot.LEGS, itemProps())), + SILVER_BOOTS = addItem("silver_boots", new SilverArmorItem(EquipmentSlot.FEET, itemProps())), + SILVER_SWORD = addItem("silver_sword", new SwordItem(Tiers.SilverTier.INSTANCE, 3, -2.4f, itemProps())), + SILVER_PICKAXE = addItem("silver_pickaxe", new PickaxeItem(Tiers.SilverTier.INSTANCE, 1, -2.4f, itemProps())), + SILVER_AXE = addItem("silver_axe", new AxeItem(Tiers.SilverTier.INSTANCE, 6, -2.4f, itemProps())), + SILVER_SHOVEL = addItem("silver_shovel", new ShovelItem(Tiers.SilverTier.INSTANCE, 1.5f, -2.4f, itemProps())), + SILVER_HOE = addItem("silver_hoe", new HoeItem(Tiers.SilverTier.INSTANCE, 0, -2.4f, itemProps())), + ATHAME = addItem("athame", new AthameItem(itemProps().stacksTo(1))), REVERSAL_PICK = addItem("reversal_pick", new ReversalPickItem(itemProps() .rarity(Rarity.UNCOMMON))), VOID_AMULET = addItem("void_amulet", new VoidAmuletItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.void_amulet")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.void_amulet")), WARDED_MAIL = addItem("warded_mail", new WardedMailItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.warded_mail")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.warded_mail")), SAPPING_SWORD = addItem("sapping_sword", new SappingSwordItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.sapping_sword")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.sapping_sword")), SANGUINE_AMULET = addItem("sanguine_amulet", new SanguineAmuletItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.sanguine_amulet")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.sanguine_amulet")), + ENERVATING_RING = addItem("enervating_ring", new EnervatingRingItem(itemProps() + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.enervating_ring")), SOULFIRE_WAND = addItem("soulfire_wand", new SoulfireWandItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1).maxDamage(253).setNoRepair()) + .rarity(Rarity.UNCOMMON).stacksTo(1).durability(253).setNoRepair()) .setLore("lore.eidolon.soulfire_wand")), BONECHILL_WAND = addItem("bonechill_wand", new BonechillWandItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1).maxDamage(253).setNoRepair()) + .rarity(Rarity.UNCOMMON).stacksTo(1).durability(253).setNoRepair()) .setLore("lore.eidolon.bonechill_wand")), GRAVITY_BELT = addItem("gravity_belt", new GravityBeltItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.gravity_belt")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.gravity_belt")), RESOLUTE_BELT = addItem("resolute_belt", new ResoluteBeltItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.resolute_belt")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.resolute_belt")), PRESTIGIOUS_PALM = addItem("prestigious_palm", new PrestigiousPalmItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.prestigious_palm")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.prestigious_palm")), MIND_SHIELDING_PLATE = addItem("mind_shielding_plate", new MindShieldingPlateItem(itemProps() - .rarity(Rarity.UNCOMMON).maxStackSize(1)).setLore("lore.eidolon.mind_shielding_plate")), + .rarity(Rarity.UNCOMMON).stacksTo(1)).setLore("lore.eidolon.mind_shielding_plate")), GLASS_HAND = addItem("glass_hand", new GlassHandItem(itemProps() - .rarity(Rarity.RARE).maxStackSize(1)).setLore("lore.eidolon.glass_hand")), - PAROUSIA_DISC = addItem("music_disc_parousia", new MusicDiscItem(9, () -> PAROUSIA.get(), - itemProps().maxStackSize(1).group(ItemGroup.MISC).rarity(Rarity.RARE))); + .rarity(Rarity.RARE).stacksTo(1)).setLore("lore.eidolon.glass_hand")), + TERMINUS_MIRROR = addItem("terminus_mirror", new TerminusMirrorItem(itemProps() + .rarity(Rarity.RARE).stacksTo(1)).setLore("lore.eidolon.terminus_mirror")), + ANGELS_SIGHT = addItem("angels_sight", new AngelSightItem(itemProps() + .rarity(Rarity.RARE).stacksTo(1)).setLore("lore.eidolon.angels_sight")), + WITHERED_HEART = addItem("withered_heart", new ItemBase(itemProps().rarity(Rarity.RARE).food( + new FoodProperties.Builder() + .nutrition(2).saturationMod(1.5f) + .effect(() -> new MobEffectInstance(MobEffects.HUNGER, 1800), 0.875f) + .effect(() -> new MobEffectInstance(MobEffects.WITHER, 900, 1), 1.0f) + .build())).setLore("lore.eidolon.withered_heart")), + IMBUED_BONES = addItem("imbued_bones", itemProps().rarity(Rarity.UNCOMMON)), + SUMMONING_STAFF = addItem("summoning_staff", new SummoningStaffItem(itemProps().rarity(Rarity.RARE))), + DEATHBRINGER_SCYTHE = addItem("deathbringer_scythe", new DeathbringerScytheItem(itemProps().rarity(Rarity.RARE)) + .setLore("lore.eidolon.deathbringer_scythe")), + SOULBONE_AMULET = addItem("soulbone_amulet", new SoulboneAmuletItem(itemProps() + .rarity(Rarity.RARE).stacksTo(1)).setLore("lore.eidolon.soulbone_amulet")), + BONELORD_HELM = addItem("bonelord_helm", new BonelordArmorItem(EquipmentSlot.HEAD, itemProps().rarity(Rarity.RARE))), + BONELORD_CHESTPLATE = addItem("bonelord_chestplate", new BonelordArmorItem(EquipmentSlot.CHEST, itemProps().rarity(Rarity.RARE))), + BONELORD_GREAVES = addItem("bonelord_greaves", new BonelordArmorItem(EquipmentSlot.LEGS, itemProps().rarity(Rarity.RARE))), + PAROUSIA_DISC = addItem("music_disc_parousia", new RecordItem(9, () -> PAROUSIA.get(), + itemProps().stacksTo(1).tab(CreativeModeTab.TAB_MISC).rarity(Rarity.RARE))), + RAVEN_FEATHER = addItem("raven_feather"), + RAVEN_CLOAK = addItem("raven_cloak", new RavenCloakItem(itemProps().rarity(Rarity.RARE))), + ALCHEMISTS_TONGS = addItem("alchemists_tongs", new TongsItem(itemProps().stacksTo(1))), + MERAMMER_RESIN = addItem("merammer_resin"), + MAGIC_INK = addItem("magic_ink"), + MAGICIANS_WAX = addItem("magicians_wax"), + ARCANE_SEAL = addItem("arcane_seal"), + PARCHMENT = addItem("parchment"), + NOTETAKING_TOOLS = addItem("notetaking_tools", new NotetakingToolsItem(itemProps().stacksTo(16))), + RESEARCH_NOTES = addItem("research_notes", new ResearchNotesItem(itemProps().rarity(Rarity.UNCOMMON).stacksTo(1))), + COMPLETED_RESEARCH = addItem("completed_research", new CompletedResearchItem(itemProps().rarity(Rarity.UNCOMMON).stacksTo(1))), + RED_CANDY = addItem("red_candy", new ItemBase(itemProps().rarity(Rarity.COMMON).food( + new FoodProperties.Builder() + .nutrition(2).saturationMod(2) + .build())).setLore(ChatFormatting.RED, "lore.eidolon.red_candy")), + GRAPE_CANDY = addItem("grape_candy", new ItemBase(itemProps().rarity(Rarity.COMMON).food( + new FoodProperties.Builder() + .nutrition(2).saturationMod(2) + .build())).setLore(ChatFormatting.LIGHT_PURPLE, "lore.eidolon.grape_candy")); public static RegistryObject - LEAD_ORE = addBlock("lead_ore", blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).hardnessAndResistance(2.8f, 3.0f) - .harvestLevel(2).harvestTool(ToolType.PICKAXE)), - LEAD_BLOCK = addBlock("lead_block", blockProps(Material.ROCK, MaterialColor.PURPLE_TERRACOTTA) - .sound(SoundType.METAL).hardnessAndResistance(3.0f, 3.0f) - .harvestLevel(2).harvestTool(ToolType.PICKAXE)), - PEWTER_BLOCK = addBlock("pewter_block", blockProps(Material.ROCK, MaterialColor.LIGHT_GRAY) - .sound(SoundType.METAL).hardnessAndResistance(4.0f, 4.0f) - .harvestLevel(2).harvestTool(ToolType.PICKAXE)), - ARCANE_GOLD_BLOCK = addBlock("arcane_gold_block", blockProps(Material.ROCK, MaterialColor.GOLD) - .sound(SoundType.METAL).hardnessAndResistance(3.0f, 4.0f) - .harvestLevel(2).harvestTool(ToolType.PICKAXE)), + LEAD_ORE = addBlock("lead_ore", blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.8f, 3.0f).requiresCorrectToolForDrops()), + DEEP_LEAD_ORE = addBlock("deep_lead_ore", blockProps(Material.STONE, MaterialColor.DEEPSLATE) + .sound(SoundType.DEEPSLATE).strength(3.2f, 3.0f).requiresCorrectToolForDrops()), + LEAD_BLOCK = addBlock("lead_block", blockProps(Material.STONE, MaterialColor.TERRACOTTA_PURPLE) + .sound(SoundType.METAL).strength(3.0f, 3.0f).requiresCorrectToolForDrops()), + RAW_LEAD_BLOCK = addBlock("raw_lead_block", blockProps(Material.STONE, MaterialColor.TERRACOTTA_PURPLE) + .sound(SoundType.DEEPSLATE).strength(2.4f, 3.0f).requiresCorrectToolForDrops()), + SILVER_ORE = addBlock("silver_ore", blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(3.2f, 3.0f).requiresCorrectToolForDrops()), + DEEP_SILVER_ORE = addBlock("deep_silver_ore", blockProps(Material.STONE, MaterialColor.DEEPSLATE) + .sound(SoundType.DEEPSLATE).strength(3.6f, 3.0f).requiresCorrectToolForDrops()), + SILVER_BLOCK = addBlock("silver_block", blockProps(Material.STONE, MaterialColor.COLOR_LIGHT_BLUE) + .sound(SoundType.METAL).strength(3.0f, 3.0f).requiresCorrectToolForDrops()), + RAW_SILVER_BLOCK = addBlock("raw_silver_block", blockProps(Material.STONE, MaterialColor.COLOR_LIGHT_BLUE) + .sound(SoundType.STONE).strength(2.4f, 3.0f).requiresCorrectToolForDrops()), + PEWTER_BLOCK = addBlock("pewter_block", blockProps(Material.STONE, MaterialColor.COLOR_LIGHT_GRAY) + .sound(SoundType.METAL).strength(4.0f, 4.0f).requiresCorrectToolForDrops()), + ARCANE_GOLD_BLOCK = addBlock("arcane_gold_block", blockProps(Material.STONE, MaterialColor.GOLD) + .sound(SoundType.METAL).strength(3.0f, 4.0f).requiresCorrectToolForDrops()), + SHADOW_GEM_BLOCK = addBlock("shadow_gem_block", blockProps(Material.STONE, MaterialColor.COLOR_PURPLE) + .sound(SoundType.METAL).strength(3.0f, 4.0f).requiresCorrectToolForDrops()), WOODEN_ALTAR = addBlock("wooden_altar", new TableBlockBase(blockProps(Material.WOOD, MaterialColor.WOOD) - .sound(SoundType.WOOD).hardnessAndResistance(1.6f, 3.0f) - .harvestTool(ToolType.AXE))), - STONE_ALTAR = addBlock("stone_altar", new TableBlockBase(blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).hardnessAndResistance(2.8f, 3.0f) - .setRequiresTool().harvestTool(ToolType.PICKAXE).notSolid()) - .setMainShape(VoxelShapes.or( - VoxelShapes.create(0, 0.375, 0, 1, 1, 1), - VoxelShapes.create(0.0625, 0.125, 0.0625, 0.9375, 0.375, 0.9375) + .sound(SoundType.WOOD).strength(1.6f, 3.0f))), + STONE_ALTAR = addBlock("stone_altar", new TableBlockBase(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.8f, 3.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setMainShape(Shapes.or( + Shapes.box(0, 0.375, 0, 1, 1, 1), + Shapes.box(0.0625, 0.125, 0.0625, 0.9375, 0.375, 0.9375) ))), - CANDLE = addBlock("candle", new CandleBlock(blockProps(Material.MISCELLANEOUS, MaterialColor.WHITE_TERRACOTTA) - .sound(SoundType.STONE).setLightLevel((state) -> 15).hardnessAndResistance(0.6f, 0.8f).notSolid())), - CANDLESTICK = addBlock("candlestick", new CandlestickBlock(blockProps(Material.IRON, MaterialColor.GOLD) - .sound(SoundType.STONE).setLightLevel((state) -> 15).hardnessAndResistance(1.2f, 2.0f).notSolid())), - STRAW_EFFIGY = addBlock("straw_effigy", new HorizontalWaterloggableBlock(blockProps(Material.PLANTS, MaterialColor.YELLOW) - .sound(SoundType.WOOD).hardnessAndResistance(1.4f, 2.0f) - .notSolid()).setShape( - VoxelShapes.create(0.28125, 0, 0.28125, 0.71875, 1, 0.71875) + CANDLE = addBlock("candle", new CandleBlock(blockProps(Material.DECORATION, MaterialColor.TERRACOTTA_WHITE) + .sound(SoundType.STONE).lightLevel((state) -> 15).strength(0.6f, 0.8f).noOcclusion())), + CANDLESTICK = addBlock("candlestick", new CandlestickBlock(blockProps(Material.METAL, MaterialColor.GOLD) + .sound(SoundType.STONE).lightLevel((state) -> 15).strength(1.2f, 2.0f).noOcclusion())), + MAGIC_CANDLE = addBlock("magic_candle", new CandleBlock(blockProps(Material.DECORATION, MaterialColor.TERRACOTTA_RED) + .sound(SoundType.STONE).lightLevel((state) -> 15).strength(0.6f, 0.8f).noOcclusion())), + MAGIC_CANDLESTICK = addBlock("magic_candlestick", new CandlestickBlock(blockProps(Material.DECORATION, MaterialColor.GOLD) + .sound(SoundType.STONE).lightLevel((state) -> 15).strength(1.2f, 2.0f).noOcclusion())), + STRAW_EFFIGY = addBlock("straw_effigy", new EffigyBlock(blockProps(Material.PLANT, MaterialColor.COLOR_YELLOW) + .sound(SoundType.WOOD).strength(1.4f, 2.0f) + .noOcclusion()).setShape( + Shapes.box(0.28125, 0, 0.28125, 0.71875, 1, 0.71875) )), - GOBLET = addBlock("goblet", new BlockBase(blockProps(Material.IRON, MaterialColor.GOLD) - .sound(SoundType.METAL).hardnessAndResistance(1.4f, 2.0f).setRequiresTool().harvestTool(ToolType.PICKAXE) - .notSolid()).setShape(VoxelShapes.create(0.3125, 0, 0.3125, 0.6875, 0.5, 0.6875))), - UNHOLY_EFFIGY = addBlock("unholy_effigy", new HorizontalWaterloggableBlock(blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).hardnessAndResistance(2.8f, 3.0f) - .setRequiresTool().harvestTool(ToolType.PICKAXE) - .notSolid()).setShape( - VoxelShapes.create(0.25, 0, 0.25, 0.75, 1, 0.75) + GOBLET = addBlock("goblet", new GobletBlock(blockProps(Material.METAL, MaterialColor.GOLD) + .sound(SoundType.METAL).strength(1.4f, 2.0f).requiresCorrectToolForDrops() + .noOcclusion()).setShape(Shapes.box(0.3125, 0, 0.3125, 0.6875, 0.5, 0.6875))), + UNHOLY_EFFIGY = addBlock("unholy_effigy", new EffigyBlock(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.8f, 3.0f) + .requiresCorrectToolForDrops() + .noOcclusion()).setShape( + Shapes.box(0.25, 0, 0.25, 0.75, 1, 0.75) )), WORKTABLE = addBlock("worktable", new WorktableBlock(blockProps(Material.WOOD, MaterialColor.WOOD) - .sound(SoundType.WOOD).hardnessAndResistance(1.6f, 3.0f) - .harvestTool(ToolType.AXE).notSolid()).setShape(VoxelShapes.or( - VoxelShapes.create(0, 0, 0, 1, 0.25, 1), - VoxelShapes.create(0.125, 0.25, 0.125, 0.875, 0.625, 0.875), - VoxelShapes.create(0, 0.625, 0, 1, 1, 1) + .sound(SoundType.WOOD).strength(1.6f, 3.0f) + .noOcclusion()).setShape(Shapes.or( + Shapes.box(0, 0, 0, 1, 0.25, 1), + Shapes.box(0.125, 0.25, 0.125, 0.875, 0.625, 0.875), + Shapes.box(0, 0.625, 0, 1, 1, 1) + ))), + RESEARCH_TABLE = addBlock("research_table", new ResearchTableBlock(blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(1.6f, 3.0f) + .noOcclusion()).setShape(Shapes.or( + Shapes.box(0, 0, 0, 1, 0.25, 1), + Shapes.box(0.125, 0.25, 0.125, 0.875, 0.625, 0.875), + Shapes.box(0, 0.625, 0, 1, 1, 1) ))), - PLINTH = addBlock("plinth", new PlinthBlockBase(blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).hardnessAndResistance(2.0f, 3.0f) - .setRequiresTool().harvestTool(ToolType.PICKAXE).notSolid()) - .setShape(VoxelShapes.create(0.25, 0, 0.25, 0.75, 1, 0.75))), - BRAZIER = addBlock("brazier", new BlockBase(blockProps(Material.WOOD, MaterialColor.IRON) - .sound(SoundType.METAL).hardnessAndResistance(2.5f, 3.0f) - .notSolid()) - .setShape(VoxelShapes.create(0.1875, 0, 0.1875, 0.8125, 0.75, 0.8125))), - CRUCIBLE = addBlock("crucible", new BlockBase(blockProps(Material.IRON, MaterialColor.IRON) - .sound(SoundType.METAL).hardnessAndResistance(4.0f, 3.0f) - .setRequiresTool().harvestTool(ToolType.PICKAXE).notSolid()) - .setShape(VoxelShapes.or( - VoxelShapes.create(0.0625, 0.875, 0.0625, 0.1875, 1, 0.9375), - VoxelShapes.create(0.8125, 0.875, 0.0625, 0.9375, 1, 0.9375), - VoxelShapes.create(0.0625, 0.875, 0.0625, 0.9375, 1, 0.1875), - VoxelShapes.create(0.0625, 0.875, 0.8125, 0.9375, 1, 0.9375), - VoxelShapes.create(0, 0.125, 0, 0.125, 0.875, 1), - VoxelShapes.create(0.875, 0.125, 0, 1, 0.875, 1), - VoxelShapes.create(0, 0.125, 0, 1, 0.875, 0.125), - VoxelShapes.create(0, 0.125, 0.875, 1, 0.875, 1), - VoxelShapes.create(0.0625, 0, 0.0625, 0.9375, 0.125, 0.9375) + PLINTH = addBlock("plinth", new PillarBlockBase(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.0f, 3.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setShape(Shapes.box(0.25, 0, 0.25, 0.75, 1, 0.75))), + OBELISK = addBlock("obelisk", new PillarBlockBase(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.0f, 3.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setShape(Shapes.box(0.125, 0, 0.125, 0.875, 1, 0.875))), + BRAZIER = addBlock("brazier", new BrazierBlock(blockProps(Material.WOOD, MaterialColor.METAL) + .sound(SoundType.METAL).strength(2.5f, 3.0f) + .noOcclusion()) + .setShape(Shapes.box(0.1875, 0, 0.1875, 0.8125, 0.75, 0.8125))), + CRUCIBLE = addBlock("crucible", new CrucibleBlock(blockProps(Material.METAL, MaterialColor.METAL) + .sound(SoundType.METAL).strength(4.0f, 3.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setShape(Shapes.or( + Shapes.box(0.0625, 0.875, 0.0625, 0.1875, 1, 0.9375), + Shapes.box(0.8125, 0.875, 0.0625, 0.9375, 1, 0.9375), + Shapes.box(0.0625, 0.875, 0.0625, 0.9375, 1, 0.1875), + Shapes.box(0.0625, 0.875, 0.8125, 0.9375, 1, 0.9375), + Shapes.box(0, 0.125, 0, 0.125, 0.875, 1), + Shapes.box(0.875, 0.125, 0, 1, 0.875, 1), + Shapes.box(0, 0.125, 0, 1, 0.875, 0.125), + Shapes.box(0, 0.125, 0.875, 1, 0.875, 1), + Shapes.box(0.0625, 0, 0.0625, 0.9375, 0.125, 0.9375) ))), - STONE_HAND = addBlock("stone_hand", new HorizontalWaterloggableBlock(blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).hardnessAndResistance(2.0f, 3.0f) - .setRequiresTool().harvestTool(ToolType.PICKAXE).notSolid()) - .setShape(VoxelShapes.create(0.25, 0, 0.25, 0.75, 0.75, 0.75))), - ENCHANTED_ASH = addBlock("enchanted_ash", new EnchantedAshBlock(blockProps(Material.MISCELLANEOUS, MaterialColor.WHITE_TERRACOTTA) - .sound(SoundType.STONE).hardnessAndResistance(0.0f, 0.75f).notSolid()) - .setShape(VoxelShapes.empty())), - NECROTIC_FOCUS = addBlock("necrotic_focus", new NecroticFocusBlock(blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).hardnessAndResistance(2.8f, 3.0f) - .setRequiresTool().harvestTool(ToolType.PICKAXE).notSolid()) - .setShape(VoxelShapes.create(0.25, 0, 0.25, 0.75, 0.75, 0.75))), - SOUL_ENCHANTER = addBlock("soul_enchanter", new SoulEnchanterBlock(blockProps(Material.ROCK, MaterialColor.OBSIDIAN) - .sound(SoundType.STONE).hardnessAndResistance(5.0f, 1200.0f) - .harvestTool(ToolType.PICKAXE).setRequiresTool().notSolid()) - .setShape(VoxelShapes.create(0, 0, 0, 1, 0.75, 1))), - WOODEN_STAND = addBlock("wooden_brewing_stand", new WoodenStandBlock(blockProps(Material.IRON, MaterialColor.WOOD) - .sound(SoundType.STONE).hardnessAndResistance(2.0f, 3.0f) - .harvestTool(ToolType.PICKAXE).notSolid())); + STONE_HAND = addBlock("stone_hand", new HandBlock(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.0f, 3.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setShape(Shapes.box(0.25, 0, 0.25, 0.75, 0.75, 0.75))), + ENCHANTED_ASH = addBlock("enchanted_ash", new EnchantedAshBlock(blockProps(Material.DECORATION, MaterialColor.TERRACOTTA_WHITE) + .sound(SoundType.STONE).strength(0.0f, 0.75f).noOcclusion()) + .setShape(Shapes.empty())), + NECROTIC_FOCUS = addBlock("necrotic_focus", new NecroticFocusBlock(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.8f, 3.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setShape(Shapes.box(0.25, 0, 0.25, 0.75, 0.75, 0.75))), + PLANTER = addBlock("planter", new BlockBase(blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(2.0f, 3.0f) + .noOcclusion()) + .setShape(Shapes.or( + Shapes.box(0, 0.25, 0, 1, 1, 1), + Shapes.box(0.25, 0, 0.25, 0.75, 0.25, 0.75)))), + MERAMMER_ROOT = addBlock("merammer_root", new HerbBlockBase(blockProps(Material.PLANT, MaterialColor.GRASS) + .sound(SoundType.GRASS).noOcclusion())), + AVENNIAN_SPRIG = addBlock("avennian_sprig", new HerbBlockBase(blockProps(Material.PLANT, MaterialColor.GRASS) + .sound(SoundType.GRASS).noOcclusion())), + OANNA_BLOOM = addBlock("oanna_bloom", new HerbBlockBase(blockProps(Material.PLANT, MaterialColor.GRASS) + .sound(SoundType.GRASS).noOcclusion())), + SILDRIAN_SEED = addBlock("sildrian_seed", new HerbBlockBase(blockProps(Material.PLANT, MaterialColor.GRASS) + .sound(SoundType.GRASS).noOcclusion())), + ILLWOOD_SAPLING = addBlock("illwood_sapling", new BushBlock(blockProps(Material.PLANT, MaterialColor.GRASS) + .sound(SoundType.GRASS).noOcclusion().noCollission())), + ILLWOOD_LEAVES = addBlock("illwood_leaves", new BlockBase(blockProps(Material.PLANT, MaterialColor.GRASS) + .sound(SoundType.GRASS).noOcclusion())), + ILLWOOD_LOG = addBlock("illwood_log", new RotatedPillarBlock(blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(1.6f, 3.0f))), + ILLWOOD_BARK = addBlock("illwood_bark", new RotatedPillarBlock(blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(1.6f, 3.0f))), + STRIPPED_ILLWOOD_LOG = addBlock("stripped_illwood_log", new RotatedPillarBlock(blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(1.4f, 3.0f))), + STRIPPED_ILLWOOD_BARK = addBlock("stripped_illwood_bark", new RotatedPillarBlock(blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(1.4f, 3.0f))), + SOUL_ENCHANTER = addBlock("soul_enchanter", new SoulEnchanterBlock(blockProps(Material.STONE, MaterialColor.PODZOL) + .sound(SoundType.STONE).strength(5.0f, 1200.0f) + .requiresCorrectToolForDrops().noOcclusion()) + .setShape(Shapes.box(0, 0, 0, 1, 0.75, 1))), + WOODEN_STAND = addBlock("wooden_brewing_stand", new WoodenStandBlock(blockProps(Material.METAL, MaterialColor.WOOD) + .sound(SoundType.STONE).strength(2.0f, 3.0f) + .noOcclusion())), + INCUBATOR = addBlock("incubator", new TwoHighBlockBase(blockProps(Material.METAL, MaterialColor.METAL) + .sound(SoundType.GLASS).strength(2.0f, 3.0f) + .noOcclusion()).setShape(Shapes.box(0.0625, 0, 0.0625, 0.9375, 1, 0.9375))), + GLASS_TUBE = addBlock("glass_tube", new PipeBlock(blockProps(Material.GLASS, MaterialColor.COLOR_LIGHT_BLUE) + .sound(SoundType.GLASS).strength(1.0f, 1.5f).noOcclusion())), + CISTERN = addBlock("cistern", new CisternBlock(blockProps(Material.GLASS, MaterialColor.COLOR_LIGHT_BLUE) + .sound(SoundType.GLASS).strength(1.5f, 1.5f).noOcclusion()) + .setShape(Shapes.box(0.0625, 0, 0.0625, 0.9375, 1, 0.9375))); public static DecoBlockPack - SMOOTH_STONE_BRICK = new DecoBlockPack(BLOCKS, "smooth_stone_bricks", blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).setRequiresTool().harvestTool(ToolType.PICKAXE).hardnessAndResistance(2.0f, 3.0f)) + SMOOTH_STONE_BRICK = new DecoBlockPack(BLOCKS, "smooth_stone_bricks", blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).requiresCorrectToolForDrops().strength(2.0f, 3.0f)) .addWall(), - SMOOTH_STONE_TILES = new DecoBlockPack(BLOCKS, "smooth_stone_tiles", blockProps(Material.ROCK, MaterialColor.STONE) - .sound(SoundType.STONE).setRequiresTool().harvestTool(ToolType.PICKAXE).hardnessAndResistance(2.0f, 3.0f)), + SMOOTH_STONE_TILES = new DecoBlockPack(BLOCKS, "smooth_stone_tiles", blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).requiresCorrectToolForDrops().strength(2.0f, 3.0f)), + SMOOTH_STONE_MASONRY = new DecoBlockPack(BLOCKS, "smooth_stone_masonry", blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).requiresCorrectToolForDrops().strength(1.6f, 3.0f)), POLISHED_PLANKS = new DecoBlockPack(BLOCKS, "polished_planks", blockProps(Material.WOOD, MaterialColor.WOOD) - .sound(SoundType.WOOD).harvestTool(ToolType.AXE).hardnessAndResistance(1.6f, 3.0f)) - .addFence(); + .sound(SoundType.WOOD).strength(1.6f, 3.0f)) + .addFence(), + ILLWOOD_PLANKS = new DecoBlockPack(BLOCKS, "illwood_planks", blockProps(Material.WOOD, MaterialColor.WOOD) + .sound(SoundType.WOOD).strength(1.6f, 3.0f)) + .addFence(), + ELDER_BRICKS = new DecoBlockPack(BLOCKS, "elder_bricks", blockProps(Material.STONE, MaterialColor.TERRACOTTA_ORANGE) + .sound(SoundType.STONE).requiresCorrectToolForDrops().strength(3.0f, 3.0f)) + .addWall(), + ELDER_MASONRY = new DecoBlockPack(BLOCKS, "elder_masonry", blockProps(Material.STONE, MaterialColor.TERRACOTTA_ORANGE) + .sound(SoundType.STONE).requiresCorrectToolForDrops().strength(2.4f, 3.0f)), + BONE_PILE = new DecoBlockPack(BLOCKS, "bone_pile", blockProps(Material.STONE, MaterialColor.QUARTZ) + .sound(SoundType.DEEPSLATE).requiresCorrectToolForDrops().strength(1.6f, 3.0f)); public static RegistryObject POLISHED_WOOD_PILLAR = addBlock("polished_wood_pillar", new RotatedPillarBlock(blockProps(Material.WOOD, MaterialColor.WOOD) - .harvestTool(ToolType.AXE).hardnessAndResistance(1.6f, 3.0f))); + .strength(1.6f, 3.0f))), + SMOOTH_STONE_ARCH = addBlock("smooth_stone_arch", new PillarBlockBase(blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.0f, 3.0f).requiresCorrectToolForDrops())), + MOSSY_SMOOTH_STONE_BRICKS = addBlock("mossy_smooth_stone_bricks", blockProps(Material.STONE, MaterialColor.STONE) + .sound(SoundType.STONE).strength(2.0f, 3.0f).requiresCorrectToolForDrops()), + ELDER_BRICKS_EYE = addBlock("elder_bricks_eye", blockProps(Material.STONE, MaterialColor.TERRACOTTA_ORANGE) + .sound(SoundType.STONE).strength(3.0f, 3.0f).requiresCorrectToolForDrops()), + ELDER_PILLAR = addBlock("elder_pillar", new PillarBlockBase(blockProps(Material.STONE, MaterialColor.TERRACOTTA_ORANGE) + .sound(SoundType.STONE).strength(3.0f, 3.0f) + .requiresCorrectToolForDrops())); public static RegistryObject> - ZOMBIE_BRUTE = addEntity("zombie_brute", 7969893, 44975, 1.2f, 2.5f, ZombieBruteEntity::new, EntityClassification.MONSTER); + ZOMBIE_BRUTE = addEntity("zombie_brute", 7969893, 44975, 1.2f, 2.5f, ZombieBruteEntity::new, MobCategory.MONSTER); public static RegistryObject> - WRAITH = addEntity("wraith", 0x706e6b, 0xadacbd, 0.6f, 1.9f, WraithEntity::new, EntityClassification.MONSTER); + WRAITH = addEntity("wraith", 0x706e6b, 0xadacbd, 0.6f, 1.9f, WraithEntity::new, MobCategory.MONSTER); public static RegistryObject> - SOULFIRE_PROJECTILE = addEntity("soulfire_projectile", 0.4f, 0.4f, SoulfireProjectileEntity::new, EntityClassification.MISC); + SOULFIRE_PROJECTILE = addEntity("soulfire_projectile", 0.4f, 0.4f, SoulfireProjectileEntity::new, MobCategory.MISC); public static RegistryObject> - BONECHILL_PROJECTILE = addEntity("bonechill_projectile", 0.4f, 0.4f, BonechillProjectileEntity::new, EntityClassification.MISC); + BONECHILL_PROJECTILE = addEntity("bonechill_projectile", 0.4f, 0.4f, BonechillProjectileEntity::new, MobCategory.MISC); public static RegistryObject> - NECROMANCER_SPELL = addEntity("necromancer_spell", 0.4f, 0.4f, NecromancerSpellEntity::new, EntityClassification.MISC); + NECROMANCER_SPELL = addEntity("necromancer_spell", 0.4f, 0.4f, NecromancerSpellEntity::new, MobCategory.MISC); public static RegistryObject> - CHANT_CASTER = addEntity("chant_caster", 0.1f, 0.1f, ChantCasterEntity::new, EntityClassification.MISC); + CHANT_CASTER = addEntity("chant_caster", 0.1f, 0.1f, ChantCasterEntity::new, MobCategory.MISC); + public static RegistryObject> + ANGEL_ARROW = addEntity("angel_arrow", 0.5f, 0.5f, AngelArrowEntity::new, MobCategory.MISC); public static RegistryObject> - NECROMANCER = addEntity("necromancer", 0x69255e, 0x9ce8ff, 0.6f, 1.9f, NecromancerEntity::new, EntityClassification.MONSTER); + NECROMANCER = addEntity("necromancer", 0x69255e, 0x9ce8ff, 0.6f, 1.9f, NecromancerEntity::new, MobCategory.MONSTER); + public static RegistryObject> + RAVEN = addEntity("raven", 0x1e1f24, 0x404f66, 0.375f, 0.5f, RavenEntity::new, MobCategory.CREATURE); + public static RegistryObject> + SLIMY_SLUG = addEntity("slimy_slug", 0xdbe388, 0x5f9e42, 0.5f, 0.25f, SlimySlugEntity::new, MobCategory.CREATURE); - public static RegistryObject> + public static RegistryObject> WORKTABLE_CONTAINER = addContainer("worktable", WorktableContainer::new); - public static RegistryObject> + public static RegistryObject> SOUL_ENCHANTER_CONTAINER = addContainer("soul_enchanter", SoulEnchanterContainer::new); - public static RegistryObject> + public static RegistryObject> WOODEN_STAND_CONTAINER = addContainer("wooden_brewing_stand", WoodenBrewingStandContainer::new); - + public static RegistryObject> + RESEARCH_TABLE_CONTAINER = addContainer("research_table", ResearchTableContainer::new); + + public static RegistryObject> + WORKTABLE_RECIPE = RECIPE_TYPES.register("worktable", () -> new WorktableRecipe.Serializer()); + public static RegistryObject> + CRUCIBLE_RECIPE = RECIPE_TYPES.register("crucible", () -> new CrucibleRecipe.Serializer()); + + public static RegistryObject + MAX_SOUL_HEARTS = ATTRIBUTES.register("max_soul_hearts", () -> new RangedAttribute(Eidolon.MODID + ".max_soul_hearts", Config.MAX_ETHEREAL_HEALTH.get(), 0, 2000).setSyncable(true)), + PERSISTENT_SOUL_HEARTS = ATTRIBUTES.register("persistent_soul_hearts", () -> new RangedAttribute(Eidolon.MODID + ".persistent_soul_hearts", 0, 0, 2000).setSyncable(true)); + + + @SubscribeEvent + public void addCustomAttributes(EntityAttributeModificationEvent event) { + for (EntityType t : event.getTypes()) { + if (event.has(t, Attributes.MAX_HEALTH)) { + event.add(t, Registry.PERSISTENT_SOUL_HEARTS.get()); + event.add(t, Registry.MAX_SOUL_HEARTS.get()); + } + } + } + public static void init() { + ATTRIBUTES.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); @@ -396,32 +758,46 @@ public static void init() { PARTICLES.register(FMLJavaModLoadingContext.get().getModEventBus()); SOUND_EVENTS.register(FMLJavaModLoadingContext.get().getModEventBus()); CONTAINERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + RECIPE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static void addBrewingRecipes() { - System.out.println("calling addBrewingRecipes"); PotionBrewingMixin.callAddMix(Potions.WATER, Registry.FUNGUS_SPROUTS.get(), Potions.AWKWARD); PotionBrewingMixin.callAddMix(Potions.AWKWARD, Registry.WRAITH_HEART.get(), Registry.CHILLED_POTION.get()); PotionBrewingMixin.callAddMix(Registry.CHILLED_POTION.get(), Items.REDSTONE, Registry.LONG_CHILLED_POTION.get()); PotionBrewingMixin.callAddMix(Potions.AWKWARD, Registry.WARPED_SPROUTS.get(), Registry.ANCHORED_POTION.get()); PotionBrewingMixin.callAddMix(Registry.ANCHORED_POTION.get(), Items.REDSTONE, Registry.LONG_ANCHORED_POTION.get()); + PotionBrewingMixin.callAddMix(Potions.AWKWARD, Items.NAUTILUS_SHELL, Registry.REINFORCED_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.REINFORCED_POTION.get(), Items.REDSTONE, Registry.LONG_REINFORCED_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.REINFORCED_POTION.get(), Items.GLOWSTONE, Registry.STRONG_REINFORCED_POTION.get()); + PotionBrewingMixin.callAddMix(Potions.AWKWARD, Registry.TATTERED_CLOTH.get(), Registry.VULNERABLE_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.VULNERABLE_POTION.get(), Items.REDSTONE, Registry.LONG_VULNERABLE_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.VULNERABLE_POTION.get(), Items.GLOWSTONE, Registry.STRONG_VULNERABLE_POTION.get()); + PotionBrewingMixin.callAddMix(Potions.AWKWARD, Registry.DEATH_ESSENCE.get(), Registry.UNDEATH_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.UNDEATH_POTION.get(), Items.REDSTONE, Registry.LONG_UNDEATH_POTION.get()); + PotionBrewingMixin.callAddMix(Potions.AWKWARD, Registry.WITHERED_HEART.get(), Registry.DECAY_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.DECAY_POTION.get(), Items.REDSTONE, Registry.LONG_DECAY_POTION.get()); + PotionBrewingMixin.callAddMix(Registry.DECAY_POTION.get(), Items.GLOWSTONE, Registry.STRONG_DECAY_POTION.get()); } @OnlyIn(Dist.CLIENT) public static void clientInit() { } - public static TileEntityType HAND_TILE_ENTITY; - public static TileEntityType BRAZIER_TILE_ENTITY; - public static TileEntityType NECROTIC_FOCUS_TILE_ENTITY; - public static TileEntityType CRUCIBLE_TILE_ENTITY; - public static TileEntityType EFFIGY_TILE_ENTITY; - public static TileEntityType SOUL_ENCHANTER_TILE_ENTITY; - public static TileEntityType WOODEN_STAND_TILE_ENTITY; - public static TileEntityType GOBLET_TILE_ENTITY; + public static BlockEntityType HAND_TILE_ENTITY; + public static BlockEntityType BRAZIER_TILE_ENTITY; + public static BlockEntityType NECROTIC_FOCUS_TILE_ENTITY; + public static BlockEntityType CRUCIBLE_TILE_ENTITY; + public static BlockEntityType EFFIGY_TILE_ENTITY; + public static BlockEntityType SOUL_ENCHANTER_TILE_ENTITY; + public static BlockEntityType WOODEN_STAND_TILE_ENTITY; + public static BlockEntityType GOBLET_TILE_ENTITY; + public static BlockEntityType CISTERN_TILE_ENTITY; + public static BlockEntityType PIPE_TILE_ENTITY; + public static BlockEntityType RESEARCH_TABLE_TILE_ENTITY; @SubscribeEvent - public void registerTiles(RegistryEvent.Register> evt) { + public void registerTiles(RegistryEvent.Register> evt) { HAND_TILE_ENTITY = addTileEntity(evt.getRegistry(), "hand_tile", HandTileEntity::new, STONE_HAND.get()); BRAZIER_TILE_ENTITY = addTileEntity(evt.getRegistry(), "brazier_tile", BrazierTileEntity::new, BRAZIER.get()); NECROTIC_FOCUS_TILE_ENTITY = addTileEntity(evt.getRegistry(), "necrotic_focus", NecroticFocusTileEntity::new, NECROTIC_FOCUS.get()); @@ -430,10 +806,29 @@ public void registerTiles(RegistryEvent.Register> evt) { SOUL_ENCHANTER_TILE_ENTITY = addTileEntity(evt.getRegistry(), "soul_enchanter", SoulEnchanterTileEntity::new, SOUL_ENCHANTER.get()); WOODEN_STAND_TILE_ENTITY = addTileEntity(evt.getRegistry(), "wooden_brewing_stand", WoodenStandTileEntity::new, WOODEN_STAND.get()); GOBLET_TILE_ENTITY = addTileEntity(evt.getRegistry(), "goblet", GobletTileEntity::new, GOBLET.get()); + CISTERN_TILE_ENTITY = addTileEntity(evt.getRegistry(), "cistern", CisternTileEntity::new, CISTERN.get()); + PIPE_TILE_ENTITY = addTileEntity(evt.getRegistry(), "pipe", PipeTileEntity::new, GLASS_TUBE.get()); + RESEARCH_TABLE_TILE_ENTITY = addTileEntity(evt.getRegistry(), "research_table", ResearchTableTileEntity::new, RESEARCH_TABLE.get()); } - public static DamageSource RITUAL_DAMAGE = new DamageSource("ritual").setDamageBypassesArmor().setDamageIsAbsolute(); + public static DamageSource RITUAL_DAMAGE = new DamageSource("ritual").bypassArmor().bypassMagic(); public static DamageSource FROST_DAMAGE = new DamageSource("frost"); + + public void registerCaps(RegisterCapabilitiesEvent event) { + event.register(IReputation.class); + event.register(IKnowledge.class); + event.register(ISoul.class); + event.register(IPlayerData.class); + } + + @SubscribeEvent + public void defineAttributes(EntityAttributeCreationEvent event) { + event.put(Registry.ZOMBIE_BRUTE.get(), ZombieBruteEntity.createAttributes()); + event.put(Registry.WRAITH.get(), WraithEntity.createAttributes()); + event.put(Registry.NECROMANCER.get(), NecromancerEntity.createAttributes()); + event.put(Registry.RAVEN.get(), RavenEntity.createAttributes()); + event.put(Registry.SLIMY_SLUG.get(), SlimySlugEntity.createAttributes()); + } static DeferredRegister> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, Eidolon.MODID); @@ -453,34 +848,26 @@ public void registerTiles(RegistryEvent.Register> evt) { STEAM_PARTICLE = PARTICLES.register("steam_particle", SteamParticleType::new); public static RegistryObject SIGN_PARTICLE = PARTICLES.register("sign_particle", SignParticleType::new); + public static RegistryObject + SLASH_PARTICLE = PARTICLES.register("slash_particle", SlashParticleType::new); + public static RegistryObject + GLOWING_SLASH_PARTICLE = PARTICLES.register("glowing_slash_particle", GlowingSlashParticleType::new); + public static RegistryObject + RUNE_PARTICLE = PARTICLES.register("rune_particle", RuneParticleType::new); @OnlyIn(Dist.CLIENT) @SubscribeEvent public void registerFactories(ParticleFactoryRegisterEvent evt) { - Minecraft.getInstance().particles.registerFactory(FLAME_PARTICLE.get(), FlameParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(SMOKE_PARTICLE.get(), SmokeParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(SPARKLE_PARTICLE.get(), SparkleParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(WISP_PARTICLE.get(), WispParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(BUBBLE_PARTICLE.get(), BubbleParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(STEAM_PARTICLE.get(), SteamParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(LINE_WISP_PARTICLE.get(), LineWispParticleType.Factory::new); - Minecraft.getInstance().particles.registerFactory(SIGN_PARTICLE.get(), (sprite) -> new SignParticleType.Factory()); - } - - @OnlyIn(Dist.CLIENT) - @SubscribeEvent - public void onTextureStitch(TextureStitchEvent.Pre event) { - event.addSprite(CrystalRitual.SYMBOL); - event.addSprite(SummonRitual.SYMBOL); - event.addSprite(DeceitRitual.SYMBOL); - event.addSprite(AllureRitual.SYMBOL); - event.addSprite(DaylightRitual.SYMBOL); - event.addSprite(MoonlightRitual.SYMBOL); - event.addSprite(PurifyRitual.SYMBOL); - event.addSprite(RepellingRitual.SYMBOL); - event.addSprite(SanguineRitual.SYMBOL); - event.addSprite(SoulEnchanterTileRenderer.BOOK_TEXTURE); - - for (Sign s : Signs.getSigns()) event.addSprite(s.getSprite()); + Minecraft.getInstance().particleEngine.register(FLAME_PARTICLE.get(), FlameParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(SMOKE_PARTICLE.get(), SmokeParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(SPARKLE_PARTICLE.get(), SparkleParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(WISP_PARTICLE.get(), WispParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(BUBBLE_PARTICLE.get(), BubbleParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(STEAM_PARTICLE.get(), SteamParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(LINE_WISP_PARTICLE.get(), LineWispParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(SIGN_PARTICLE.get(), (sprite) -> new SignParticleType.Factory()); + Minecraft.getInstance().particleEngine.register(SLASH_PARTICLE.get(), SlashParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(GLOWING_SLASH_PARTICLE.get(), GlowingSlashParticleType.Factory::new); + Minecraft.getInstance().particleEngine.register(RUNE_PARTICLE.get(), (sprite) -> new RuneParticleType.Factory()); } } diff --git a/src/main/java/elucent/eidolon/WorldGen.java b/src/main/java/elucent/eidolon/WorldGen.java index b8b240e..07f4ace 100644 --- a/src/main/java/elucent/eidolon/WorldGen.java +++ b/src/main/java/elucent/eidolon/WorldGen.java @@ -1,144 +1,234 @@ package elucent.eidolon; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import elucent.eidolon.world.*; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.WorldGenRegistries; -import net.minecraft.world.Dimension; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.gen.DimensionSettings; -import net.minecraft.world.gen.GenerationStage; -import net.minecraft.world.gen.feature.*; -import net.minecraft.world.gen.feature.structure.IStructurePieceType; -import net.minecraft.world.gen.feature.structure.IglooStructure; -import net.minecraft.world.gen.feature.structure.Structure; -import net.minecraft.world.gen.feature.template.RuleTest; -import net.minecraft.world.gen.feature.template.TagMatchRuleTest; -import net.minecraft.world.gen.settings.DimensionStructuresSettings; -import net.minecraft.world.gen.settings.StructureSeparationSettings; +import com.google.common.collect.ImmutableMultimap; + +import elucent.eidolon.world.CatacombPieces; +import elucent.eidolon.world.CatacombStructure; +import elucent.eidolon.world.LabStructure; +import elucent.eidolon.world.RandomlyRotatedPiece; +import elucent.eidolon.world.StrayTowerStructure; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.data.BuiltinRegistries; +import net.minecraft.data.worldgen.placement.PlacementUtils; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.BiomeCategory; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; +import net.minecraft.world.level.levelgen.FlatLevelSource; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; +import net.minecraft.world.level.levelgen.feature.StructurePieceType; +import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest; +import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; +import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; +import net.minecraft.world.level.levelgen.StructureSettings; +import net.minecraft.world.level.levelgen.VerticalAnchor; +import net.minecraft.world.level.levelgen.feature.configurations.StructureFeatureConfiguration; +import net.minecraft.world.level.levelgen.placement.BiomeFilter; +import net.minecraft.world.level.levelgen.placement.CountPlacement; +import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; +import net.minecraft.world.level.levelgen.placement.InSquarePlacement; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraftforge.common.Tags; import net.minecraftforge.event.world.BiomeLoadingEvent; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class WorldGen { - static List> ORES = new ArrayList<>(); - static ConfiguredFeature LEAD_ORE_GEN; - static DeferredRegister> STRUCTURES = DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Eidolon.MODID); - static List> STRUCTURE_LIST = new ArrayList<>(); - static Map STRUCTURE_SETTINGS = new HashMap<>(); - static RuleTest IN_STONE = new TagMatchRuleTest(Tags.Blocks.STONE); + static List ORES = new ArrayList<>(); + static PlacedFeature LEAD_ORE_GEN, SILVER_ORE_GEN, DEEP_LEAD_ORE_GEN, DEEP_SILVER_ORE_GEN; + static DeferredRegister> STRUCTURES = DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Eidolon.MODID); + static List> STRUCTURE_LIST = new ArrayList<>(); + static Map STRUCTURE_SETTINGS = new HashMap<>(); + static RuleTest IN_STONE = new TagMatchTest(Tags.Blocks.STONE); + static RuleTest IN_DEEPSLATE = new BlockMatchTest(Blocks.DEEPSLATE); - static IStructurePieceType register(IStructurePieceType type, String name) { - net.minecraft.util.registry.Registry.register(net.minecraft.util.registry.Registry.STRUCTURE_PIECE, new ResourceLocation(Eidolon.MODID, name), type); + static StructurePieceType register(StructurePieceType type, String name) { + net.minecraft.core.Registry.register(net.minecraft.core.Registry.STRUCTURE_PIECE, new ResourceLocation(Eidolon.MODID, name), type); return type; } - static > ConfiguredFeature register(ConfiguredFeature feature, String name) { - WorldGenRegistries.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation(Eidolon.MODID, name), feature); + static > ConfiguredFeature register(ConfiguredFeature feature, String name) { + BuiltinRegistries.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(Eidolon.MODID, name), feature); return feature; } - static > StructureFeature register(StructureFeature feature, String name) { - WorldGenRegistries.register(WorldGenRegistries.CONFIGURED_STRUCTURE_FEATURE, new ResourceLocation(Eidolon.MODID, name), feature); + static > ConfiguredStructureFeature register(ConfiguredStructureFeature feature, String name) { + BuiltinRegistries.register(BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE, new ResourceLocation(Eidolon.MODID, name), feature); return feature; } - static RegistryObject> addStructure(String name, Structure structure, GenerationStage.Decoration stage, StructureSeparationSettings settings) { - Structure.NAME_STRUCTURE_BIMAP.put(Eidolon.MODID + ":" + name, structure); - Structure.STRUCTURE_DECORATION_STAGE_MAP.put(structure, stage); + static RegistryObject> addStructure(String name, StructureFeature structure, GenerationStep.Decoration stage, StructureFeatureConfiguration settings) { + StructureFeature.STRUCTURES_REGISTRY.put(Eidolon.MODID + ":" + name, structure); + StructureFeature.STEP.put(structure, stage); STRUCTURE_LIST.add(structure); STRUCTURE_SETTINGS.put(new ResourceLocation(Eidolon.MODID, name), settings); - if (stage != GenerationStage.Decoration.UNDERGROUND_STRUCTURES) { - Structure.field_236384_t_ = ImmutableList.>builder().addAll(Structure.field_236384_t_).add(structure).build(); + if (stage != GenerationStep.Decoration.UNDERGROUND_STRUCTURES) { + StructureFeature.NOISE_AFFECTING_FEATURES = ImmutableList.>builder().addAll(StructureFeature.NOISE_AFFECTING_FEATURES).add(structure).build(); } return STRUCTURES.register(name, () -> structure); } - public static IStructurePieceType LAB_PIECE, STRAY_TOWER_PIECE; + public static StructurePieceType LAB_PIECE, STRAY_TOWER_PIECE; - public static RegistryObject> LAB_STRUCTURE = addStructure("lab", - new LabStructure(NoFeatureConfig.field_236558_a_), - GenerationStage.Decoration.UNDERGROUND_STRUCTURES, - new StructureSeparationSettings(7, 5, 1337)); + public static RegistryObject> LAB_STRUCTURE = addStructure("lab", + new LabStructure(NoneFeatureConfiguration.CODEC), + GenerationStep.Decoration.UNDERGROUND_STRUCTURES, + new StructureFeatureConfiguration(7, 5, 1337)); - public static RegistryObject> STRAY_TOWER_STRUCTURE = addStructure("stray_tower", - new StrayTowerStructure(NoFeatureConfig.field_236558_a_), - GenerationStage.Decoration.UNDERGROUND_STRUCTURES, - new StructureSeparationSettings(16, 8, 1341)); + public static RegistryObject> STRAY_TOWER_STRUCTURE = addStructure("stray_tower", + new StrayTowerStructure(NoneFeatureConfiguration.CODEC), + GenerationStep.Decoration.UNDERGROUND_STRUCTURES, + new StructureFeatureConfiguration(16, 8, 1341)); - public static RegistryObject> CATACOMB_STRUCTURE = addStructure("catacomb", - new CatacombStructure(NoFeatureConfig.field_236558_a_), - GenerationStage.Decoration.UNDERGROUND_STRUCTURES, - new StructureSeparationSettings(11, 7, 1347)); + public static RegistryObject> CATACOMB_STRUCTURE = addStructure("catacomb", + new CatacombStructure(NoneFeatureConfiguration.CODEC), + GenerationStep.Decoration.UNDERGROUND_STRUCTURES, + new StructureFeatureConfiguration(11, 7, 1347)); - public static StructureFeature> LAB_FEATURE, STRAY_TOWER_FEATURE, CATACOMB_FEATURE; + public static ConfiguredStructureFeature> LAB_FEATURE, STRAY_TOWER_FEATURE, CATACOMB_FEATURE; public static void preInit() { STRUCTURES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static void init() { - LEAD_ORE_GEN = register(Feature.ORE.withConfiguration(new OreFeatureConfig(IN_STONE, - Registry.LEAD_ORE.get().getDefaultState(), Config.LEAD_VEIN_SIZE.get())) - .square() - .func_242731_b(Config.LEAD_VEIN_COUNT.get()) // per chunk - .range(Config.LEAD_MAX_Y.get() // maximum Y - ), "lead_ore"); - if (Config.LEAD_ENABLED.get()) ORES.add(LEAD_ORE_GEN); - - LAB_PIECE = register(LabStructure.Piece::new, "lab"); - LAB_FEATURE = register(LAB_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "lab"); - - STRAY_TOWER_PIECE = register(StrayTowerStructure.Piece::new, "stray_tower"); - STRAY_TOWER_FEATURE = register(STRAY_TOWER_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "stray_tower"); - - CatacombPieces.CORRIDOR_CENTER = register(CatacombPieces.CorridorCenter::new, CatacombPieces.CORRIDOR_CENTER_ID.getPath()); - CatacombPieces.CORRIDOR_DOOR = register(CatacombPieces.CorridorDoor::new, CatacombPieces.CORRIDOR_DOOR_ID.getPath()); - CatacombPieces.SMALL_ROOM = register(CatacombPieces.SmallRoom::new, CatacombPieces.SMALL_ROOM_ID.getPath()); - CatacombPieces.SHRINE = register(CatacombPieces.Shrine::new, CatacombPieces.SHRINE_ID.getPath()); - CatacombPieces.TRAP = register(CatacombPieces.Trap::new, CatacombPieces.TRAP_ID.getPath()); - CatacombPieces.SKULL = register(CatacombPieces.Skull::new, CatacombPieces.SKULL_ID.getPath()); - CatacombPieces.SPAWNER = register(CatacombPieces.Spawner::new, CatacombPieces.SPAWNER_ID.getPath()); - CatacombPieces.COFFIN = register(CatacombPieces.Coffin::new, CatacombPieces.COFFIN_ID.getPath()); - CatacombPieces.MEDIUM_ROOM = register(CatacombPieces.MediumRoom::new, CatacombPieces.MEDIUM_ROOM_ID.getPath()); - CatacombPieces.GRAVEYARD = register(CatacombPieces.Graveyard::new, CatacombPieces.GRAVEYARD_ID.getPath()); - CatacombPieces.TURNAROUND = register(CatacombPieces.Turnaround::new, CatacombPieces.TURNAROUND_ID.getPath()); - CatacombPieces.LAB = register(CatacombPieces.Lab::new, CatacombPieces.LAB_ID.getPath()); - CATACOMB_FEATURE = register(CATACOMB_STRUCTURE.get().withConfiguration(NoFeatureConfig.field_236559_b_), "catacomb"); - - for (Structure s : STRUCTURE_LIST) { - DimensionStructuresSettings.field_236191_b_ = // Default structures - ImmutableMap., StructureSeparationSettings>builder() - .putAll(DimensionStructuresSettings.field_236191_b_) + ConfiguredFeature LEAD_ORE = register(Feature.ORE.configured(new OreConfiguration(IN_STONE, + Registry.LEAD_ORE.get().defaultBlockState(), Config.LEAD_VEIN_SIZE.get())), "lead_ore"); + LEAD_ORE_GEN = PlacementUtils.register("lead_ore", LEAD_ORE.placed( + InSquarePlacement.spread(), BiomeFilter.biome(), CountPlacement.of(Config.LEAD_VEIN_COUNT.get()), + HeightRangePlacement.uniform(VerticalAnchor.absolute(Math.max(0, Config.LEAD_MIN_Y.get())), VerticalAnchor.absolute(Config.LEAD_MAX_Y.get())) + )); + ConfiguredFeature DEEP_LEAD_ORE = register(Feature.ORE.configured(new OreConfiguration(IN_DEEPSLATE, + Registry.DEEP_LEAD_ORE.get().defaultBlockState(), Config.LEAD_VEIN_SIZE.get())), "deep_lead_ore"); + DEEP_LEAD_ORE_GEN = PlacementUtils.register("deep_lead_ore", DEEP_LEAD_ORE.placed( + InSquarePlacement.spread(), BiomeFilter.biome(), CountPlacement.of(Config.LEAD_VEIN_COUNT.get()), + HeightRangePlacement.uniform(VerticalAnchor.absolute(Config.LEAD_MIN_Y.get()), VerticalAnchor.absolute(Math.min(0, Config.LEAD_MAX_Y.get()))) + )); + if (Config.LEAD_ENABLED.get()) { + ORES.add(LEAD_ORE_GEN); + ORES.add(DEEP_LEAD_ORE_GEN); + } + + ConfiguredFeature SILVER_ORE = register(Feature.ORE.configured(new OreConfiguration(IN_STONE, + Registry.SILVER_ORE.get().defaultBlockState(), Config.SILVER_VEIN_SIZE.get())), "silver_ore"); + SILVER_ORE_GEN = PlacementUtils.register("silver_ore", SILVER_ORE.placed( + InSquarePlacement.spread(), BiomeFilter.biome(), CountPlacement.of(Config.SILVER_VEIN_COUNT.get()), + HeightRangePlacement.uniform(VerticalAnchor.absolute(Math.max(0, Config.SILVER_MIN_Y.get())), VerticalAnchor.absolute(Config.SILVER_MAX_Y.get())) + )); + ConfiguredFeature DEEP_SILVER_ORE = register(Feature.ORE.configured(new OreConfiguration(IN_DEEPSLATE, + Registry.DEEP_SILVER_ORE.get().defaultBlockState(), Config.SILVER_VEIN_SIZE.get())), "deep_silver_ore"); + DEEP_SILVER_ORE_GEN = PlacementUtils.register("deep_silver_ore", DEEP_SILVER_ORE.placed( + InSquarePlacement.spread(), BiomeFilter.biome(), CountPlacement.of(Config.SILVER_VEIN_COUNT.get()), + HeightRangePlacement.uniform(VerticalAnchor.absolute(Config.SILVER_MIN_Y.get()), VerticalAnchor.absolute(Math.min(0, Config.SILVER_MAX_Y.get()))) + )); + if (Config.SILVER_ENABLED.get()) { + ORES.add(SILVER_ORE_GEN); + ORES.add(DEEP_SILVER_ORE_GEN); + } + + LAB_PIECE = register((ctx, tag) -> new RandomlyRotatedPiece(LAB_PIECE, tag, ctx.structureManager()), "lab"); + LAB_FEATURE = register(LAB_STRUCTURE.get().configured(NoneFeatureConfiguration.INSTANCE), "lab"); + + STRAY_TOWER_PIECE = register((ctx, tag) -> new RandomlyRotatedPiece(STRAY_TOWER_PIECE, tag, ctx.structureManager()), "stray_tower"); + STRAY_TOWER_FEATURE = register(STRAY_TOWER_STRUCTURE.get().configured(NoneFeatureConfiguration.INSTANCE), "stray_tower"); + + CatacombPieces.CORRIDOR_CENTER = register((ctx, tag) -> new CatacombPieces.CorridorCenter(ctx.structureManager(), tag), CatacombPieces.CORRIDOR_CENTER_ID.getPath()); + CatacombPieces.CORRIDOR_DOOR = register((ctx, tag) -> new CatacombPieces.CorridorDoor(ctx.structureManager(), tag), CatacombPieces.CORRIDOR_DOOR_ID.getPath()); + CatacombPieces.SMALL_ROOM = register((ctx, tag) -> new CatacombPieces.SmallRoom(ctx.structureManager(), tag), CatacombPieces.SMALL_ROOM_ID.getPath()); + CatacombPieces.SHRINE = register((ctx, tag) -> new CatacombPieces.Shrine(ctx.structureManager(), tag), CatacombPieces.SHRINE_ID.getPath()); + CatacombPieces.TRAP = register((ctx, tag) -> new CatacombPieces.Trap(ctx.structureManager(), tag), CatacombPieces.TRAP_ID.getPath()); + CatacombPieces.SKULL = register((ctx, tag) -> new CatacombPieces.Skull(ctx.structureManager(), tag), CatacombPieces.SKULL_ID.getPath()); + CatacombPieces.SPAWNER = register((ctx, tag) -> new CatacombPieces.Spawner(ctx.structureManager(), tag), CatacombPieces.SPAWNER_ID.getPath()); + CatacombPieces.COFFIN = register((ctx, tag) -> new CatacombPieces.Coffin(ctx.structureManager(), tag), CatacombPieces.COFFIN_ID.getPath()); + CatacombPieces.MEDIUM_ROOM = register((ctx, tag) -> new CatacombPieces.MediumRoom(ctx.structureManager(), tag), CatacombPieces.MEDIUM_ROOM_ID.getPath()); + CatacombPieces.GRAVEYARD = register((ctx, tag) -> new CatacombPieces.Graveyard(ctx.structureManager(), tag), CatacombPieces.GRAVEYARD_ID.getPath()); + CatacombPieces.TURNAROUND = register((ctx, tag) -> new CatacombPieces.Turnaround(ctx.structureManager(), tag), CatacombPieces.TURNAROUND_ID.getPath()); + CatacombPieces.LAB = register((ctx, tag) -> new CatacombPieces.Lab(ctx.structureManager(), tag), CatacombPieces.LAB_ID.getPath()); + CATACOMB_FEATURE = register(CATACOMB_STRUCTURE.get().configured(NoneFeatureConfiguration.INSTANCE), "catacomb"); + + for (StructureFeature s : STRUCTURE_LIST) { + StructureSettings.DEFAULTS = // Default structures + ImmutableMap., StructureFeatureConfiguration>builder() + .putAll(StructureSettings.DEFAULTS) .put(s, STRUCTURE_SETTINGS.get(s.getRegistryName())) .build(); - DimensionSettings.field_242740_q.getStructures().field_236193_d_.put(s, STRUCTURE_SETTINGS.get(s.getRegistryName())); + NoiseGeneratorSettings overworld = BuiltinRegistries.NOISE_GENERATOR_SETTINGS.get(NoiseGeneratorSettings.OVERWORLD); + overworld.structureSettings().structureConfig.put(s, STRUCTURE_SETTINGS.get(s.getRegistryName())); } } + + @SubscribeEvent + public void onWorldLoad(WorldEvent.Load event) { + if (event.getWorld() instanceof ServerLevel sl) { + ChunkGenerator chunkGenerator = sl.getChunkSource().getGenerator(); + + if (chunkGenerator instanceof FlatLevelSource && sl.dimensionType().equals(DimensionType.OVERWORLD_LOCATION)) { + return; + } + + StructureSettings worldStructureConfig = chunkGenerator.getSettings(); + HashMap, HashMultimap, ResourceKey>> structureMap = new HashMap<>(); + + for(Map.Entry, Biome> biomeEntry : sl.registryAccess().ownedRegistryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY).entrySet()) { + Biome.BiomeCategory biomeCategory = biomeEntry.getValue().getBiomeCategory(); + if (Config.LAB_ENABLED.get()) + associateBiomeToConfiguredStructure(structureMap, LAB_FEATURE, biomeEntry.getKey()); + if ((biomeCategory == BiomeCategory.ICY || biomeCategory == BiomeCategory.TAIGA) && Config.STRAY_TOWER_ENABLED.get()) + associateBiomeToConfiguredStructure(structureMap, STRAY_TOWER_FEATURE, biomeEntry.getKey()); + if (Config.CATACOMB_ENABLED.get()) + associateBiomeToConfiguredStructure(structureMap, CATACOMB_FEATURE, biomeEntry.getKey()); + } + + ImmutableMap.Builder, ImmutableMultimap, ResourceKey>> tempStructureToMultiMap = ImmutableMap.builder(); + worldStructureConfig.configuredStructures.entrySet().stream().filter(entry -> !structureMap.containsKey(entry.getKey())).forEach(tempStructureToMultiMap::put); + structureMap.forEach((key, value) -> tempStructureToMultiMap.put(key, ImmutableMultimap.copyOf(value))); + worldStructureConfig.configuredStructures = tempStructureToMultiMap.build(); + + Map, StructureFeatureConfiguration> tempMap = new HashMap<>(worldStructureConfig.structureConfig()); + tempMap.putIfAbsent(STRAY_TOWER_STRUCTURE.get(), STRUCTURE_SETTINGS.get(STRAY_TOWER_STRUCTURE.getId())); + tempMap.putIfAbsent(LAB_STRUCTURE.get(), STRUCTURE_SETTINGS.get(LAB_STRUCTURE.getId())); + tempMap.putIfAbsent(CATACOMB_STRUCTURE.get(), STRUCTURE_SETTINGS.get(CATACOMB_STRUCTURE.getId())); + worldStructureConfig.structureConfig = tempMap; + } + } + + private static void associateBiomeToConfiguredStructure(Map, HashMultimap, ResourceKey>> STStructureToMultiMap, ConfiguredStructureFeature configuredStructureFeature, ResourceKey biomeRegistryKey) { + STStructureToMultiMap.putIfAbsent(configuredStructureFeature.feature, HashMultimap.create()); + HashMultimap, ResourceKey> configuredStructureToBiomeMultiMap = STStructureToMultiMap.get(configuredStructureFeature.feature); + configuredStructureToBiomeMultiMap.put(configuredStructureFeature, biomeRegistryKey); + } @SubscribeEvent public void onBiomeLoad(BiomeLoadingEvent event) { - for (ConfiguredFeature feature : ORES) { - event.getGeneration().withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, feature); + for (PlacedFeature feature : ORES) { + event.getGeneration().addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, feature); } - if (Config.LAB_ENABLED.get()) - event.getGeneration().withStructure(LAB_FEATURE); - if (Config.CATACOMB_ENABLED.get()) - event.getGeneration().withStructure(CATACOMB_FEATURE); - if (event.getCategory() == Biome.Category.ICY && Config.STRAY_TOWER_ENABLED.get()) - event.getGeneration().withStructure(STRAY_TOWER_FEATURE); } } diff --git a/src/main/java/elucent/eidolon/block/BlockBase.java b/src/main/java/elucent/eidolon/block/BlockBase.java index f1d312a..9f892b1 100644 --- a/src/main/java/elucent/eidolon/block/BlockBase.java +++ b/src/main/java/elucent/eidolon/block/BlockBase.java @@ -1,27 +1,24 @@ package elucent.eidolon.block; import elucent.eidolon.tile.TileEntityBase; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.fml.RegistryObject; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; public class BlockBase extends Block { VoxelShape shape = null; - TileEntityType tileEntityType = null; public BlockBase(Properties properties) { super(properties); @@ -32,65 +29,50 @@ public BlockBase setShape(VoxelShape shape) { return this; } - public BlockBase setTile(TileEntityType type) { - this.tileEntityType = type; - return this; - } - - @Override - public boolean hasTileEntity(BlockState state) { - return this.tileEntityType != null; - } - - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return tileEntityType.create(); - } - @Override - public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { - return getRaytraceShape(state, world, pos); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { + return getInteractionShape(state, world, pos); } @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { - return getRaytraceShape(state, world, pos); + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { + return getInteractionShape(state, world, pos); } @Override - public VoxelShape getRaytraceShape(BlockState state, IBlockReader world, BlockPos pos) { - return shape != null ? shape : VoxelShapes.fullCube(); + public VoxelShape getInteractionShape(BlockState state, BlockGetter world, BlockPos pos) { + return shape != null ? shape : Shapes.block(); } @Override - public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public void playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { breakBlock(state, world, pos); - super.onBlockHarvested(world, pos, state, player); + super.playerWillDestroy(world, pos, state, player); } @Override - public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosion explosion) { + public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { breakBlock(state, world, pos); super.onBlockExploded(state, world, pos, explosion); } - public void breakBlock(BlockState state, IBlockReader world, BlockPos pos) { - if (hasTileEntity(state)) { - TileEntity te = world.getTileEntity(pos); + public void breakBlock(BlockState state, Level world, BlockPos pos) { + if (this instanceof EntityBlock) { + BlockEntity te = world.getBlockEntity(pos); if (te instanceof TileEntityBase) { - ((TileEntityBase) world.getTileEntity(pos)).onDestroyed(state, pos); + ((TileEntityBase) world.getBlockEntity(pos)).onDestroyed(state, pos); } } } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) { - if (hasTileEntity(state)) { - TileEntity te = world.getTileEntity(pos); + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + if (this instanceof EntityBlock) { + BlockEntity te = world.getBlockEntity(pos); if (te instanceof TileEntityBase) { - return ((TileEntityBase) world.getTileEntity(pos)).onActivated(state, pos, player, hand); + return ((TileEntityBase) world.getBlockEntity(pos)).onActivated(state, pos, player, hand); } } - return super.onBlockActivated(state, world, pos, player, hand, ray); + return super.use(state, world, pos, player, hand, ray); } } diff --git a/src/main/java/elucent/eidolon/block/BrazierBlock.java b/src/main/java/elucent/eidolon/block/BrazierBlock.java new file mode 100644 index 0000000..419e96e --- /dev/null +++ b/src/main/java/elucent/eidolon/block/BrazierBlock.java @@ -0,0 +1,34 @@ +package elucent.eidolon.block; + +import javax.annotation.Nullable; + +import elucent.eidolon.tile.BrazierTileEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; + +public class BrazierBlock extends BlockBase implements EntityBlock { + public BrazierBlock(Properties properties) { + super(properties); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new BrazierTileEntity(pos, state); + } + + @Override + @Nullable + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return new BlockEntityTicker() { + @Override + public void tick(Level level, BlockPos pos, BlockState state, T tile) { + ((BrazierTileEntity)tile).tick(); + } + }; + } +} diff --git a/src/main/java/elucent/eidolon/block/CandleBlock.java b/src/main/java/elucent/eidolon/block/CandleBlock.java index 29cef03..b02fd6a 100644 --- a/src/main/java/elucent/eidolon/block/CandleBlock.java +++ b/src/main/java/elucent/eidolon/block/CandleBlock.java @@ -1,60 +1,54 @@ package elucent.eidolon.block; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; +import java.util.Random; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.Random; - public class CandleBlock extends BlockBase { - protected static final VoxelShape SHAPE = Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 9.0, 10.0D); + protected static final VoxelShape SHAPE = Block.box(6.0D, 0.0D, 6.0D, 10.0D, 9.0, 10.0D); public CandleBlock(Properties properties) { super(properties); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return VoxelShapes.empty(); + public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return Shapes.empty(); } @Override - public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { - BlockPos blockpos = pos.offset(Direction.DOWN); + public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + BlockPos blockpos = pos.relative(Direction.DOWN); BlockState blockstate = worldIn.getBlockState(blockpos); - return blockstate.isSolidSide(worldIn, blockpos, Direction.UP); + return blockstate.isFaceSturdy(worldIn, blockpos, Direction.UP); } @Override - public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { - return facing == Direction.DOWN && !this.isValidPosition(state, worldIn, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(state, facing, facingState, worldIn, currentPos, facingPos); + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + return facing == Direction.DOWN && !this.canSurvive(state, worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, facing, facingState, worldIn, currentPos, facingPos); } @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState state, World worldIn, BlockPos pos, Random rand) { + public void animateTick(BlockState state, Level worldIn, BlockPos pos, Random rand) { double d0 = (double) pos.getX() + 0.5D; double d1 = (double) pos.getY() + 0.6D; double d2 = (double) pos.getZ() + 0.5D; diff --git a/src/main/java/elucent/eidolon/block/CandlestickBlock.java b/src/main/java/elucent/eidolon/block/CandlestickBlock.java index 022cd24..aae53c9 100644 --- a/src/main/java/elucent/eidolon/block/CandlestickBlock.java +++ b/src/main/java/elucent/eidolon/block/CandlestickBlock.java @@ -1,39 +1,36 @@ package elucent.eidolon.block; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import net.minecraft.block.*; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; +import java.util.Random; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; -import java.util.Map; -import java.util.Random; - public class CandlestickBlock extends BlockBase { public static final DirectionProperty FACING = DirectionProperty.create("facing", (d) -> d != Direction.DOWN); - protected static final VoxelShape UP_SHAPE = Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 14.0D, 10.0D); + protected static final VoxelShape UP_SHAPE = Block.box(6.0D, 0.0D, 6.0D, 10.0D, 14.0D, 10.0D); private static final VoxelShape[] SHAPES = new VoxelShape[]{ - Block.makeCuboidShape(5.5D, 3.0D, 11.0D, 10.5D, 16.0D, 16.0D), - Block.makeCuboidShape(5.5D, 3.0D, 0.0D, 10.5D, 16.0D, 5.0D), - Block.makeCuboidShape(11.0D, 3.0D, 5.5D, 16.0D, 16.0D, 10.5D), - Block.makeCuboidShape(0.0D, 3.0D, 5.5D, 5.0D, 16.0D, 10.5D) + Block.box(5.5D, 3.0D, 11.0D, 10.5D, 16.0D, 16.0D), + Block.box(5.5D, 3.0D, 0.0D, 10.5D, 16.0D, 5.0D), + Block.box(11.0D, 3.0D, 5.5D, 16.0D, 16.0D, 10.5D), + Block.box(0.0D, 3.0D, 5.5D, 5.0D, 16.0D, 10.5D) }; public CandlestickBlock(Properties properties) { @@ -41,48 +38,48 @@ public CandlestickBlock(Properties properties) { } public static VoxelShape getShapeForState(BlockState state) { - Direction dir = state.get(FACING); + Direction dir = state.getValue(FACING); if (dir == Direction.UP) return UP_SHAPE; else return SHAPES[dir.ordinal() - 2]; } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return getShapeForState(state); } @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return VoxelShapes.empty(); + public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return Shapes.empty(); } @Override - public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { - Direction direction = state.get(FACING); - BlockPos blockpos = pos.offset(direction.getOpposite()); + public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + Direction direction = state.getValue(FACING); + BlockPos blockpos = pos.relative(direction.getOpposite()); BlockState blockstate = worldIn.getBlockState(blockpos); - return blockstate.isSolidSide(worldIn, blockpos, direction); + return blockstate.isFaceSturdy(worldIn, blockpos, direction); } @Override - public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { - Direction direction = state.get(FACING); - if (direction == Direction.UP) return facing == Direction.DOWN && !this.isValidPosition(state, worldIn, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(state, facing, facingState, worldIn, currentPos, facingPos); - else return facing.getOpposite() == state.get(FACING) && !state.isValidPosition(worldIn, currentPos) ? Blocks.AIR.getDefaultState() : state; + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { + Direction direction = state.getValue(FACING); + if (direction == Direction.UP) return facing == Direction.DOWN && !this.canSurvive(state, worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, facing, facingState, worldIn, currentPos, facingPos); + else return facing.getOpposite() == state.getValue(FACING) && !state.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : state; } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - BlockState blockstate = this.getDefaultState(); - IWorldReader iworldreader = context.getWorld(); - BlockPos blockpos = context.getPos(); + public BlockState getStateForPlacement(BlockPlaceContext context) { + BlockState blockstate = this.defaultBlockState(); + LevelReader iworldreader = context.getLevel(); + BlockPos blockpos = context.getClickedPos(); Direction[] adirection = context.getNearestLookingDirections(); for(Direction direction : adirection) { if (direction != Direction.UP) { Direction direction1 = direction.getOpposite(); - blockstate = blockstate.with(FACING, direction1); - if (blockstate.isValidPosition(iworldreader, blockpos)) { + blockstate = blockstate.setValue(FACING, direction1); + if (blockstate.canSurvive(iworldreader, blockpos)) { return blockstate; } } @@ -92,15 +89,15 @@ public BlockState getStateForPlacement(BlockItemUseContext context) { } @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState state, World worldIn, BlockPos pos, Random rand) { - Direction direction = state.get(FACING); + public void animateTick(BlockState state, Level worldIn, BlockPos pos, Random rand) { + Direction direction = state.getValue(FACING); double d0 = (double) pos.getX() + 0.5D; double d1 = (double) pos.getY() + 0.925D; double d2 = (double) pos.getZ() + 0.5D; if (direction != Direction.UP) { - d0 -= 0.3 * direction.getXOffset(); + d0 -= 0.3 * direction.getStepX(); d1 += 0.125; - d2 -= 0.3 * direction.getZOffset(); + d2 -= 0.3 * direction.getStepZ(); } worldIn.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); worldIn.addParticle(ParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D); @@ -108,16 +105,16 @@ public void animateTick(BlockState state, World worldIn, BlockPos pos, Random ra @Override public BlockState rotate(BlockState state, Rotation rot) { - return state.get(FACING) != Direction.UP ? state.with(FACING, rot.rotate(state.get(FACING))) : state; + return state.getValue(FACING) != Direction.UP ? state.setValue(FACING, rot.rotate(state.getValue(FACING))) : state; } @Override public BlockState mirror(BlockState state, Mirror mirrorIn) { - return state.get(FACING) != Direction.UP ? state.rotate(mirrorIn.toRotation(state.get(FACING))) : state; + return state.getValue(FACING) != Direction.UP ? state.rotate(mirrorIn.getRotation(state.getValue(FACING))) : state; } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } } diff --git a/src/main/java/elucent/eidolon/block/CisternBlock.java b/src/main/java/elucent/eidolon/block/CisternBlock.java new file mode 100644 index 0000000..800692e --- /dev/null +++ b/src/main/java/elucent/eidolon/block/CisternBlock.java @@ -0,0 +1,58 @@ +package elucent.eidolon.block; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.core.Direction; +import elucent.eidolon.tile.reagent.CisternTileEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.Level; + +public class CisternBlock extends BlockBase implements EntityBlock { + public static final BooleanProperty TOP = BooleanProperty.create("top"); + public static final BooleanProperty BOTTOM = BooleanProperty.create("bottom"); + + public CisternBlock(Properties properties) { + super(properties); + } + + protected boolean canConnectTo(LevelAccessor world, BlockPos pos, Direction dir) { + BlockState state = world.getBlockState(pos); + if (state.getBlock() instanceof CisternBlock && dir.getAxis() == Direction.Axis.Y) return true; + return false; + } + + protected BlockState getState(Level world, BlockPos pos) { + return this.defaultBlockState() + .setValue(TOP, canConnectTo(world, pos.above(), Direction.UP)) + .setValue(BOTTOM, canConnectTo(world, pos.below(), Direction.DOWN)); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return getState(context.getLevel(), context.getClickedPos()); + } + + @Override + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos pos, BlockPos facingPos) { + if (facing == Direction.UP) state = state.setValue(TOP, canConnectTo(world, pos.above(), Direction.UP)); + if (facing == Direction.DOWN) state = state.setValue(BOTTOM, canConnectTo(world, pos.below(), Direction.DOWN)); + + return state; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(TOP, BOTTOM); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new CisternTileEntity(pos, state); + } +} diff --git a/src/main/java/elucent/eidolon/block/CrucibleBlock.java b/src/main/java/elucent/eidolon/block/CrucibleBlock.java new file mode 100644 index 0000000..710964d --- /dev/null +++ b/src/main/java/elucent/eidolon/block/CrucibleBlock.java @@ -0,0 +1,34 @@ +package elucent.eidolon.block; + +import javax.annotation.Nullable; + +import elucent.eidolon.tile.CrucibleTileEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; + +public class CrucibleBlock extends BlockBase implements EntityBlock { + public CrucibleBlock(Properties properties) { + super(properties); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new CrucibleTileEntity(pos, state); + } + + @Override + @Nullable + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return new BlockEntityTicker() { + @Override + public void tick(Level level, BlockPos pos, BlockState state, T tile) { + ((CrucibleTileEntity)tile).tick(); + } + }; + } +} diff --git a/src/main/java/elucent/eidolon/block/EffigyBlock.java b/src/main/java/elucent/eidolon/block/EffigyBlock.java new file mode 100644 index 0000000..7459551 --- /dev/null +++ b/src/main/java/elucent/eidolon/block/EffigyBlock.java @@ -0,0 +1,18 @@ +package elucent.eidolon.block; + +import elucent.eidolon.tile.EffigyTileEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; + +public class EffigyBlock extends HorizontalWaterloggableBlock implements EntityBlock { + public EffigyBlock(Properties properties) { + super(properties); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new EffigyTileEntity(pos, state); + } +} diff --git a/src/main/java/elucent/eidolon/block/EnchantedAshBlock.java b/src/main/java/elucent/eidolon/block/EnchantedAshBlock.java index ae746e9..9eb208a 100644 --- a/src/main/java/elucent/eidolon/block/EnchantedAshBlock.java +++ b/src/main/java/elucent/eidolon/block/EnchantedAshBlock.java @@ -1,61 +1,60 @@ package elucent.eidolon.block; +import java.util.Map; +import java.util.Random; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; + import elucent.eidolon.Registry; -import net.minecraft.block.*; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ArrowEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.ProjectileHelper; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.EnumProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.state.properties.RedstoneSide; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.RedStoneWireBlock; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.RedstoneSide; +import net.minecraft.world.InteractionResult; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.EntityCollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; -import java.util.Map; -import java.util.Random; -import java.util.Set; - public class EnchantedAshBlock extends BlockBase { - public static final EnumProperty NORTH = BlockStateProperties.REDSTONE_NORTH; - public static final EnumProperty EAST = BlockStateProperties.REDSTONE_EAST; - public static final EnumProperty SOUTH = BlockStateProperties.REDSTONE_SOUTH; - public static final EnumProperty WEST = BlockStateProperties.REDSTONE_WEST; + public static final EnumProperty NORTH = BlockStateProperties.NORTH_REDSTONE; + public static final EnumProperty EAST = BlockStateProperties.EAST_REDSTONE; + public static final EnumProperty SOUTH = BlockStateProperties.SOUTH_REDSTONE; + public static final EnumProperty WEST = BlockStateProperties.WEST_REDSTONE; public static final Map> FACING_PROPERTY_MAP = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, NORTH, Direction.EAST, EAST, Direction.SOUTH, SOUTH, Direction.WEST, WEST)); - private static final VoxelShape BARRIER_SHAPE = VoxelShapes.create(0, -4, 0, 1, 5, 1); - private static final VoxelShape BASE_SHAPE = Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D); - private static final Map SIDE_TO_SHAPE = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, Block.makeCuboidShape(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Direction.SOUTH, Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Direction.EAST, Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Direction.WEST, Block.makeCuboidShape(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D))); - private static final Map SIDE_TO_ASCENDING_SHAPE = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, VoxelShapes.or(SIDE_TO_SHAPE.get(Direction.NORTH), Block.makeCuboidShape(3.0D, 0.0D, 0.0D, 13.0D, 16.0D, 1.0D)), Direction.SOUTH, VoxelShapes.or(SIDE_TO_SHAPE.get(Direction.SOUTH), Block.makeCuboidShape(3.0D, 0.0D, 15.0D, 13.0D, 16.0D, 16.0D)), Direction.EAST, VoxelShapes.or(SIDE_TO_SHAPE.get(Direction.EAST), Block.makeCuboidShape(15.0D, 0.0D, 3.0D, 16.0D, 16.0D, 13.0D)), Direction.WEST, VoxelShapes.or(SIDE_TO_SHAPE.get(Direction.WEST), Block.makeCuboidShape(0.0D, 0.0D, 3.0D, 1.0D, 16.0D, 13.0D)))); + private static final VoxelShape BARRIER_SHAPE = Shapes.box(0, -4, 0, 1, 5, 1); + private static final VoxelShape BASE_SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D); + private static final Map SIDE_TO_SHAPE = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Direction.SOUTH, Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Direction.EAST, Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Direction.WEST, Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D))); + private static final Map SIDE_TO_ASCENDING_SHAPE = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, Shapes.or(SIDE_TO_SHAPE.get(Direction.NORTH), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 16.0D, 1.0D)), Direction.SOUTH, Shapes.or(SIDE_TO_SHAPE.get(Direction.SOUTH), Block.box(3.0D, 0.0D, 15.0D, 13.0D, 16.0D, 16.0D)), Direction.EAST, Shapes.or(SIDE_TO_SHAPE.get(Direction.EAST), Block.box(15.0D, 0.0D, 3.0D, 16.0D, 16.0D, 13.0D)), Direction.WEST, Shapes.or(SIDE_TO_SHAPE.get(Direction.WEST), Block.box(0.0D, 0.0D, 3.0D, 1.0D, 16.0D, 13.0D)))); private final Map stateToShapeMap = Maps.newHashMap(); private final BlockState sideBaseState; public EnchantedAshBlock(Properties properties) { super(properties); - this.setDefaultState(this.stateContainer.getBaseState().with(NORTH, RedstoneSide.NONE).with(EAST, RedstoneSide.NONE).with(SOUTH, RedstoneSide.NONE).with(WEST, RedstoneSide.NONE)); - this.sideBaseState = this.getDefaultState().with(NORTH, RedstoneSide.SIDE).with(EAST, RedstoneSide.SIDE).with(SOUTH, RedstoneSide.SIDE).with(WEST, RedstoneSide.SIDE); + this.registerDefaultState(this.stateDefinition.any().setValue(NORTH, RedstoneSide.NONE).setValue(EAST, RedstoneSide.NONE).setValue(SOUTH, RedstoneSide.NONE).setValue(WEST, RedstoneSide.NONE)); + this.sideBaseState = this.defaultBlockState().setValue(NORTH, RedstoneSide.SIDE).setValue(EAST, RedstoneSide.SIDE).setValue(SOUTH, RedstoneSide.SIDE).setValue(WEST, RedstoneSide.SIDE); - for(BlockState blockstate : this.getStateContainer().getValidStates()) { + for(BlockState blockstate : this.getStateDefinition().getPossibleStates()) { this.stateToShapeMap.put(blockstate, this.getShapeForState(blockstate)); } } @@ -64,11 +63,11 @@ private VoxelShape getShapeForState(BlockState state) { VoxelShape voxelshape = BASE_SHAPE; for(Direction direction : Direction.Plane.HORIZONTAL) { - RedstoneSide redstoneside = state.get(FACING_PROPERTY_MAP.get(direction)); + RedstoneSide redstoneside = state.getValue(FACING_PROPERTY_MAP.get(direction)); if (redstoneside == RedstoneSide.SIDE) { - voxelshape = VoxelShapes.or(voxelshape, SIDE_TO_SHAPE.get(direction)); + voxelshape = Shapes.or(voxelshape, SIDE_TO_SHAPE.get(direction)); } else if (redstoneside == RedstoneSide.UP) { - voxelshape = VoxelShapes.or(voxelshape, SIDE_TO_ASCENDING_SHAPE.get(direction)); + voxelshape = Shapes.or(voxelshape, SIDE_TO_ASCENDING_SHAPE.get(direction)); } } @@ -76,51 +75,51 @@ private VoxelShape getShapeForState(BlockState state) { } private static boolean areAllSidesInvalid(BlockState state) { - return !state.get(NORTH).func_235921_b_() && !state.get(SOUTH).func_235921_b_() && !state.get(EAST).func_235921_b_() && !state.get(WEST).func_235921_b_(); + return !state.getValue(NORTH).isConnected() && !state.getValue(SOUTH).isConnected() && !state.getValue(EAST).isConnected() && !state.getValue(WEST).isConnected(); } private static boolean areAllSidesValid(BlockState state) { - return state.get(NORTH).func_235921_b_() && state.get(SOUTH).func_235921_b_() && state.get(EAST).func_235921_b_() && state.get(WEST).func_235921_b_(); + return state.getValue(NORTH).isConnected() && state.getValue(SOUTH).isConnected() && state.getValue(EAST).isConnected() && state.getValue(WEST).isConnected(); } - private BlockState recalculateFacingState(IBlockReader reader, BlockState state, BlockPos pos) { - boolean flag = !reader.getBlockState(pos.up()).isNormalCube(reader, pos); + private BlockState recalculateFacingState(BlockGetter reader, BlockState state, BlockPos pos) { + boolean flag = !reader.getBlockState(pos.above()).isRedstoneConductor(reader, pos); for(Direction direction : Direction.Plane.HORIZONTAL) { - if (!state.get(FACING_PROPERTY_MAP.get(direction)).func_235921_b_()) { + if (!state.getValue(FACING_PROPERTY_MAP.get(direction)).isConnected()) { RedstoneSide redstoneside = this.recalculateSide(reader, pos, direction, flag); - state = state.with(FACING_PROPERTY_MAP.get(direction), redstoneside); + state = state.setValue(FACING_PROPERTY_MAP.get(direction), redstoneside); } } return state; } - private RedstoneSide getSide(IBlockReader worldIn, BlockPos pos, Direction face) { - RedstoneWireBlock r; - return this.recalculateSide(worldIn, pos, face, !worldIn.getBlockState(pos.up()).isNormalCube(worldIn, pos)); + private RedstoneSide getSide(BlockGetter worldIn, BlockPos pos, Direction face) { + RedStoneWireBlock r; + return this.recalculateSide(worldIn, pos, face, !worldIn.getBlockState(pos.above()).isRedstoneConductor(worldIn, pos)); } - public void updateDiagonalNeighbors(BlockState state, IWorld worldIn, BlockPos pos, int flags, int recursionLeft) { - BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(); + public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor worldIn, BlockPos pos, int flags, int recursionLeft) { + BlockPos.MutableBlockPos blockpos$mutable = new BlockPos.MutableBlockPos(); for(Direction direction : Direction.Plane.HORIZONTAL) { - RedstoneSide redstoneside = state.get(FACING_PROPERTY_MAP.get(direction)); - if (redstoneside != RedstoneSide.NONE && !worldIn.getBlockState(blockpos$mutable.setAndMove(pos, direction)).isIn(this)) { + RedstoneSide redstoneside = state.getValue(FACING_PROPERTY_MAP.get(direction)); + if (redstoneside != RedstoneSide.NONE && !worldIn.getBlockState(blockpos$mutable.setWithOffset(pos, direction)).is(this)) { blockpos$mutable.move(Direction.DOWN); BlockState blockstate = worldIn.getBlockState(blockpos$mutable); - if (!blockstate.isIn(Blocks.OBSERVER)) { - BlockPos blockpos = blockpos$mutable.offset(direction.getOpposite()); - BlockState blockstate1 = blockstate.updatePostPlacement(direction.getOpposite(), worldIn.getBlockState(blockpos), worldIn, blockpos$mutable, blockpos); - replaceBlockState(blockstate, blockstate1, worldIn, blockpos$mutable, flags, recursionLeft); + if (!blockstate.is(Blocks.OBSERVER)) { + BlockPos blockpos = blockpos$mutable.relative(direction.getOpposite()); + BlockState blockstate1 = blockstate.updateShape(direction.getOpposite(), worldIn.getBlockState(blockpos), worldIn, blockpos$mutable, blockpos); + updateOrDestroy(blockstate, blockstate1, worldIn, blockpos$mutable, flags, recursionLeft); } - blockpos$mutable.setAndMove(pos, direction).move(Direction.UP); + blockpos$mutable.setWithOffset(pos, direction).move(Direction.UP); BlockState blockstate3 = worldIn.getBlockState(blockpos$mutable); - if (!blockstate3.isIn(Blocks.OBSERVER)) { - BlockPos blockpos1 = blockpos$mutable.offset(direction.getOpposite()); - BlockState blockstate2 = blockstate3.updatePostPlacement(direction.getOpposite(), worldIn.getBlockState(blockpos1), worldIn, blockpos$mutable, blockpos1); - replaceBlockState(blockstate3, blockstate2, worldIn, blockpos$mutable, flags, recursionLeft); + if (!blockstate3.is(Blocks.OBSERVER)) { + BlockPos blockpos1 = blockpos$mutable.relative(direction.getOpposite()); + BlockState blockstate2 = blockstate3.updateShape(direction.getOpposite(), worldIn.getBlockState(blockpos1), worldIn, blockpos$mutable, blockpos1); + updateOrDestroy(blockstate3, blockstate2, worldIn, blockpos$mutable, flags, recursionLeft); } } } @@ -128,24 +127,24 @@ public void updateDiagonalNeighbors(BlockState state, IWorld worldIn, BlockPos p } @Override - public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { + public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { if (facing == Direction.DOWN) { return stateIn; } else if (facing == Direction.UP) { return this.getUpdatedState(worldIn, stateIn, currentPos); } else { RedstoneSide redstoneside = this.getSide(worldIn, currentPos, facing); - return redstoneside.func_235921_b_() == stateIn.get(FACING_PROPERTY_MAP.get(facing)).func_235921_b_() && !areAllSidesValid(stateIn) ? stateIn.with(FACING_PROPERTY_MAP.get(facing), redstoneside) : this.getUpdatedState(worldIn, this.sideBaseState.with(FACING_PROPERTY_MAP.get(facing), redstoneside), currentPos); + return redstoneside.isConnected() == stateIn.getValue(FACING_PROPERTY_MAP.get(facing)).isConnected() && !areAllSidesValid(stateIn) ? stateIn.setValue(FACING_PROPERTY_MAP.get(facing), redstoneside) : this.getUpdatedState(worldIn, this.sideBaseState.setValue(FACING_PROPERTY_MAP.get(facing), redstoneside), currentPos); } } - private RedstoneSide recalculateSide(IBlockReader reader, BlockPos pos, Direction direction, boolean nonNormalCubeAbove) { - BlockPos blockpos = pos.offset(direction); + private RedstoneSide recalculateSide(BlockGetter reader, BlockPos pos, Direction direction, boolean nonNormalCubeAbove) { + BlockPos blockpos = pos.relative(direction); BlockState blockstate = reader.getBlockState(blockpos); if (nonNormalCubeAbove) { boolean flag = this.canPlaceOnTopOf(reader, blockpos, blockstate); - if (flag && canConnectTo(reader.getBlockState(blockpos.up()), reader, blockpos.up(), null) ) { - if (blockstate.isSolidSide(reader, blockpos, direction.getOpposite())) { + if (flag && canConnectTo(reader.getBlockState(blockpos.above()), reader, blockpos.above(), null) ) { + if (blockstate.isFaceSturdy(reader, blockpos, direction.getOpposite())) { return RedstoneSide.UP; } @@ -153,39 +152,39 @@ private RedstoneSide recalculateSide(IBlockReader reader, BlockPos pos, Directio } } - return !canConnectTo(blockstate, reader, blockpos, direction) && (blockstate.isNormalCube(reader, blockpos) || !canConnectTo(reader.getBlockState(blockpos.down()), reader, blockpos.down(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE; + return !canConnectTo(blockstate, reader, blockpos, direction) && (blockstate.isRedstoneConductor(reader, blockpos) || !canConnectTo(reader.getBlockState(blockpos.below()), reader, blockpos.below(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE; } - private boolean canPlaceOnTopOf(IBlockReader reader, BlockPos pos, BlockState state) { - return state.isSolidSide(reader, pos, Direction.UP); + private boolean canPlaceOnTopOf(BlockGetter reader, BlockPos pos, BlockState state) { + return state.isFaceSturdy(reader, pos, Direction.UP); } - private BlockState getUpdatedState(IBlockReader reader, BlockState state, BlockPos pos) { + private BlockState getUpdatedState(BlockGetter reader, BlockState state, BlockPos pos) { boolean flag = areAllSidesInvalid(state); - state = this.recalculateFacingState(reader, this.getDefaultState(), pos); + state = this.recalculateFacingState(reader, this.defaultBlockState(), pos); if (flag && areAllSidesInvalid(state)) { return state; } else { - boolean flag1 = state.get(NORTH).func_235921_b_(); - boolean flag2 = state.get(SOUTH).func_235921_b_(); - boolean flag3 = state.get(EAST).func_235921_b_(); - boolean flag4 = state.get(WEST).func_235921_b_(); + boolean flag1 = state.getValue(NORTH).isConnected(); + boolean flag2 = state.getValue(SOUTH).isConnected(); + boolean flag3 = state.getValue(EAST).isConnected(); + boolean flag4 = state.getValue(WEST).isConnected(); boolean flag5 = !flag1 && !flag2; boolean flag6 = !flag3 && !flag4; if (!flag4 && flag5) { - state = state.with(WEST, RedstoneSide.SIDE); + state = state.setValue(WEST, RedstoneSide.SIDE); } if (!flag3 && flag5) { - state = state.with(EAST, RedstoneSide.SIDE); + state = state.setValue(EAST, RedstoneSide.SIDE); } if (!flag1 && flag6) { - state = state.with(NORTH, RedstoneSide.SIDE); + state = state.setValue(NORTH, RedstoneSide.SIDE); } if (!flag2 && flag6) { - state = state.with(SOUTH, RedstoneSide.SIDE); + state = state.setValue(SOUTH, RedstoneSide.SIDE); } return state; @@ -193,20 +192,20 @@ private BlockState getUpdatedState(IBlockReader reader, BlockState state, BlockP } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return this.stateToShapeMap.get(state); } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getUpdatedState(context.getWorld(), this.sideBaseState, context.getPos()); + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.getUpdatedState(context.getLevel(), this.sideBaseState, context.getClickedPos()); } @Override - public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { - if (!oldState.isIn(state.getBlock()) && !worldIn.isRemote) { + public void onPlace(BlockState state, Level worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + if (!oldState.is(state.getBlock()) && !worldIn.isClientSide) { for(Direction direction : Direction.Plane.VERTICAL) { - worldIn.notifyNeighborsOfStateChange(pos.offset(direction), this); + worldIn.updateNeighborsAt(pos.relative(direction), this); } this.updateNeighboursStateChange(worldIn, pos); @@ -214,41 +213,43 @@ public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockSta } @Override - public boolean collisionExtendsVertically(BlockState state, IBlockReader world, BlockPos pos, Entity entity) { - return entity instanceof LivingEntity && ((LivingEntity)entity).isEntityUndead(); + public boolean collisionExtendsVertically(BlockState state, BlockGetter world, BlockPos pos, Entity entity) { + return entity instanceof LivingEntity && ((LivingEntity)entity).isInvertedHealAndHarm(); } boolean isBlocked(Entity entity) { if (entity == null) return false; if (entity instanceof LivingEntity) { LivingEntity living = (LivingEntity)entity; - if (living.isEntityUndead()) return true; + if (living.isInvertedHealAndHarm()) return true; } - if (entity.getPassengers().stream().anyMatch((e) -> e instanceof LivingEntity && ((LivingEntity)e).isEntityUndead())) + if (entity.getPassengers().stream().anyMatch((e) -> e instanceof LivingEntity && ((LivingEntity)e).isInvertedHealAndHarm())) return true; return false; } @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { - return isBlocked(ctx.getEntity()) ? BARRIER_SHAPE : super.getCollisionShape(state, world, pos, ctx); + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { + return ctx instanceof EntityCollisionContext + && ((EntityCollisionContext)ctx).getEntity() != null + && isBlocked(((EntityCollisionContext)ctx).getEntity()) ? BARRIER_SHAPE : super.getCollisionShape(state, world, pos, ctx); } @Override - public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { - BlockPos blockpos = pos.down(); + public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) { + BlockPos blockpos = pos.below(); BlockState blockstate = worldIn.getBlockState(blockpos); return this.canPlaceOnTopOf(worldIn, blockpos, blockstate); } @Override - public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - if (!isMoving && !state.isIn(newState.getBlock())) { - super.onReplaced(state, worldIn, pos, newState, isMoving); - if (!worldIn.isRemote) { + public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + if (!isMoving && !state.is(newState.getBlock())) { + super.onRemove(state, worldIn, pos, newState, isMoving); + if (!worldIn.isClientSide) { for(Direction direction : Direction.values()) { - worldIn.notifyNeighborsOfStateChange(pos.offset(direction), this); + worldIn.updateNeighborsAt(pos.relative(direction), this); } this.updateNeighboursStateChange(worldIn, pos); @@ -256,76 +257,76 @@ public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState } } - private void updateChangedConnections(World world, BlockPos pos, BlockState prevState, BlockState newState) { + private void updateChangedConnections(Level world, BlockPos pos, BlockState prevState, BlockState newState) { for(Direction direction : Direction.Plane.HORIZONTAL) { - BlockPos blockpos = pos.offset(direction); - if (prevState.get(FACING_PROPERTY_MAP.get(direction)).func_235921_b_() != newState.get(FACING_PROPERTY_MAP.get(direction)).func_235921_b_() && world.getBlockState(blockpos).isNormalCube(world, blockpos)) { - world.notifyNeighborsOfStateExcept(blockpos, newState.getBlock(), direction.getOpposite()); + BlockPos blockpos = pos.relative(direction); + if (prevState.getValue(FACING_PROPERTY_MAP.get(direction)).isConnected() != newState.getValue(FACING_PROPERTY_MAP.get(direction)).isConnected() && world.getBlockState(blockpos).isRedstoneConductor(world, blockpos)) { + world.updateNeighborsAtExceptFromFacing(blockpos, newState.getBlock(), direction.getOpposite()); } } } - private void notifyWireNeighborsOfStateChange(World worldIn, BlockPos pos) { - if (worldIn.getBlockState(pos).isIn(this)) { - worldIn.notifyNeighborsOfStateChange(pos, this); + private void notifyWireNeighborsOfStateChange(Level worldIn, BlockPos pos) { + if (worldIn.getBlockState(pos).is(this)) { + worldIn.updateNeighborsAt(pos, this); for(Direction direction : Direction.values()) { - worldIn.notifyNeighborsOfStateChange(pos.offset(direction), this); + worldIn.updateNeighborsAt(pos.relative(direction), this); } } } - private void updateNeighboursStateChange(World world, BlockPos pos) { + private void updateNeighboursStateChange(Level world, BlockPos pos) { for(Direction direction : Direction.Plane.HORIZONTAL) { - this.notifyWireNeighborsOfStateChange(world, pos.offset(direction)); + this.notifyWireNeighborsOfStateChange(world, pos.relative(direction)); } for(Direction direction1 : Direction.Plane.HORIZONTAL) { - BlockPos blockpos = pos.offset(direction1); - if (world.getBlockState(blockpos).isNormalCube(world, blockpos)) { - this.notifyWireNeighborsOfStateChange(world, blockpos.up()); + BlockPos blockpos = pos.relative(direction1); + if (world.getBlockState(blockpos).isRedstoneConductor(world, blockpos)) { + this.notifyWireNeighborsOfStateChange(world, blockpos.above()); } else { - this.notifyWireNeighborsOfStateChange(world, blockpos.down()); + this.notifyWireNeighborsOfStateChange(world, blockpos.below()); } } } @Override - public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { - if (!worldIn.isRemote) { - if (!state.isValidPosition(worldIn, pos)) { - spawnDrops(state, worldIn, pos); + public void neighborChanged(BlockState state, Level worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { + if (!worldIn.isClientSide) { + if (!state.canSurvive(worldIn, pos)) { + dropResources(state, worldIn, pos); worldIn.removeBlock(pos, false); } } } - protected static boolean canConnectTo(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { - if (blockState.isIn(Registry.ENCHANTED_ASH.get())) { + protected static boolean canConnectTo(BlockState blockState, BlockGetter world, BlockPos pos, Direction side) { + if (blockState.is(Registry.ENCHANTED_ASH.get())) { return true; } return false; } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { - return ActionResultType.PASS; + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + return InteractionResult.PASS; } @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { + public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, Random rand) { // } @Override - public boolean canProvidePower(BlockState state) { + public boolean isSignalSource(BlockState state) { return false; } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(NORTH, EAST, SOUTH, WEST); } } diff --git a/src/main/java/elucent/eidolon/block/GobletBlock.java b/src/main/java/elucent/eidolon/block/GobletBlock.java new file mode 100644 index 0000000..59ef3ea --- /dev/null +++ b/src/main/java/elucent/eidolon/block/GobletBlock.java @@ -0,0 +1,24 @@ +package elucent.eidolon.block; + +import javax.annotation.Nullable; + +import elucent.eidolon.tile.CrucibleTileEntity; +import elucent.eidolon.tile.GobletTileEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; + +public class GobletBlock extends BlockBase implements EntityBlock { + public GobletBlock(Properties properties) { + super(properties); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new GobletTileEntity(pos, state); + } +} diff --git a/src/main/java/elucent/eidolon/block/HandBlock.java b/src/main/java/elucent/eidolon/block/HandBlock.java new file mode 100644 index 0000000..8eb2efa --- /dev/null +++ b/src/main/java/elucent/eidolon/block/HandBlock.java @@ -0,0 +1,18 @@ +package elucent.eidolon.block; + +import elucent.eidolon.tile.HandTileEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; + +public class HandBlock extends HorizontalWaterloggableBlock implements EntityBlock { + public HandBlock(Properties properties) { + super(properties); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new HandTileEntity(pos, state); + } +} diff --git a/src/main/java/elucent/eidolon/block/HerbBlockBase.java b/src/main/java/elucent/eidolon/block/HerbBlockBase.java new file mode 100644 index 0000000..b71f98e --- /dev/null +++ b/src/main/java/elucent/eidolon/block/HerbBlockBase.java @@ -0,0 +1,70 @@ +package elucent.eidolon.block; + +import java.util.Random; + +import elucent.eidolon.Registry; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.core.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.server.level.ServerLevel; +import net.minecraftforge.common.IPlantable; + +public class HerbBlockBase extends BushBlock { + public static final IntegerProperty AGE = BlockStateProperties.AGE_1; + private static final VoxelShape[] SHAPES = new VoxelShape[]{Block.box(5, 0, 5, 11, 4, 11), Block.box(4, 0, 4, 12, 8, 12) }; + public HerbBlockBase(BlockBehaviour.Properties builder) { + super(builder); + this.registerDefaultState(this.stateDefinition.any().setValue(AGE, Integer.valueOf(0))); + } + + @Override + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return SHAPES[state.getValue(AGE)]; + } + + @Override + public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + return Shapes.empty(); + } + + @Override + public boolean canSustainPlant(BlockState state, BlockGetter worldIn, BlockPos pos, Direction facing, IPlantable plantable) { + return state.is(Registry.PLANTER.get()); + } + + @Override + protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { + return state.is(Registry.PLANTER.get()); + } + + @Override + public boolean isRandomlyTicking(BlockState state) { + return state.getValue(AGE) < 1; + } + + @Override + public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Random random) { + int i = state.getValue(AGE); + if (i < 1 && mayPlaceOn(worldIn.getBlockState(pos.below()), worldIn, pos.below()) + && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, random.nextInt(20) == 0)) { + state = state.setValue(AGE, i + 1); + worldIn.setBlock(pos, state, 2); + net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state); + } + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(AGE); + } +} diff --git a/src/main/java/elucent/eidolon/block/HorizontalBlockBase.java b/src/main/java/elucent/eidolon/block/HorizontalBlockBase.java index 0650285..2d27611 100644 --- a/src/main/java/elucent/eidolon/block/HorizontalBlockBase.java +++ b/src/main/java/elucent/eidolon/block/HorizontalBlockBase.java @@ -1,26 +1,11 @@ package elucent.eidolon.block; -import elucent.eidolon.tile.TileEntityBase; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; public class HorizontalBlockBase extends BlockBase { public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; @@ -30,12 +15,12 @@ public HorizontalBlockBase(Properties properties) { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.defaultBlockState().setValue(HORIZONTAL_FACING, context.getHorizontalDirection().getOpposite()); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING); } } diff --git a/src/main/java/elucent/eidolon/block/HorizontalWaterloggableBlock.java b/src/main/java/elucent/eidolon/block/HorizontalWaterloggableBlock.java index 103f634..ea6c298 100644 --- a/src/main/java/elucent/eidolon/block/HorizontalWaterloggableBlock.java +++ b/src/main/java/elucent/eidolon/block/HorizontalWaterloggableBlock.java @@ -1,20 +1,20 @@ package elucent.eidolon.block; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.IWaterLoggable; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; - -public class HorizontalWaterloggableBlock extends HorizontalBlockBase implements IWaterLoggable { +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.core.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; + +public class HorizontalWaterloggableBlock extends HorizontalBlockBase implements SimpleWaterloggedBlock { public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public HorizontalWaterloggableBlock(Properties properties) { @@ -23,30 +23,30 @@ public HorizontalWaterloggableBlock(Properties properties) { @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) { - return !state.get(WATERLOGGED); + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return !state.getValue(WATERLOGGED); } @Override - public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) { - if (state.get(WATERLOGGED)) { - world.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos pos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } return state; } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - return super.getStateForPlacement(context).with(WATERLOGGED, false); + public BlockState getStateForPlacement(BlockPlaceContext context) { + return super.getStateForPlacement(context).setValue(WATERLOGGED, false); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { - super.fillStateContainer(builder); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); builder.add(WATERLOGGED); } } diff --git a/src/main/java/elucent/eidolon/block/NecroticFocusBlock.java b/src/main/java/elucent/eidolon/block/NecroticFocusBlock.java index bac63ce..f35e5fd 100644 --- a/src/main/java/elucent/eidolon/block/NecroticFocusBlock.java +++ b/src/main/java/elucent/eidolon/block/NecroticFocusBlock.java @@ -1,31 +1,27 @@ package elucent.eidolon.block; -import elucent.eidolon.tile.TileEntityBase; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; - -public class NecroticFocusBlock extends HorizontalWaterloggableBlock { - VoxelShape SOUTH = VoxelShapes.create(0, 0, 0, 1, 1, 0.5), - NORTH = VoxelShapes.create(0, 0, 0.5, 1, 1, 1), - WEST = VoxelShapes.create(0.5, 0, 0, 1, 1, 1), - EAST = VoxelShapes.create(0, 0, 0, 0.5, 1, 1); +import net.minecraft.world.level.block.state.BlockState; +import elucent.eidolon.tile.NecroticFocusTileEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; + +public class NecroticFocusBlock extends HorizontalWaterloggableBlock implements EntityBlock { + VoxelShape SOUTH = Shapes.box(0, 0, 0, 1, 1, 0.5), + NORTH = Shapes.box(0, 0, 0.5, 1, 1, 1), + WEST = Shapes.box(0.5, 0, 0, 1, 1, 1), + EAST = Shapes.box(0, 0, 0, 0.5, 1, 1); public NecroticFocusBlock(Properties properties) { super(properties); } VoxelShape shapeForState(BlockState state) { - switch (state.get(HORIZONTAL_FACING)) { + switch (state.getValue(HORIZONTAL_FACING)) { case NORTH: return NORTH; case SOUTH: @@ -39,17 +35,22 @@ VoxelShape shapeForState(BlockState state) { } @Override - public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { return shapeForState(state); } @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { return shapeForState(state); } @Override - public VoxelShape getRaytraceShape(BlockState state, IBlockReader world, BlockPos pos) { + public VoxelShape getInteractionShape(BlockState state, BlockGetter world, BlockPos pos) { return shapeForState(state); } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new NecroticFocusTileEntity(pos, state); + } } diff --git a/src/main/java/elucent/eidolon/block/PillarBlockBase.java b/src/main/java/elucent/eidolon/block/PillarBlockBase.java new file mode 100644 index 0000000..8c0e581 --- /dev/null +++ b/src/main/java/elucent/eidolon/block/PillarBlockBase.java @@ -0,0 +1,73 @@ +package elucent.eidolon.block; + +import elucent.eidolon.Registry; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.core.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.Level; + +public class PillarBlockBase extends BlockBase implements SimpleWaterloggedBlock { + public static final BooleanProperty TOP = BooleanProperty.create("top"); + public static final BooleanProperty BOTTOM = BooleanProperty.create("bottom"); + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + + public PillarBlockBase(Properties properties) { + super(properties); + } + + protected boolean canConnectTo(LevelAccessor world, BlockPos pos, Direction dir) { + BlockState state = world.getBlockState(pos); + if (state.getBlock() instanceof PillarBlockBase && dir.getAxis() == Direction.Axis.Y) return true; + if (dir == Direction.UP && state.getBlock() == Registry.STONE_HAND.get()) return true; + return false; + } + + protected BlockState getState(Level world, BlockPos pos) { + return this.defaultBlockState() + .setValue(TOP, canConnectTo(world, pos.above(), Direction.UP)) + .setValue(BOTTOM, canConnectTo(world, pos.below(), Direction.DOWN)) + .setValue(WATERLOGGED, Boolean.valueOf(world.getFluidState(pos).getType() == Fluids.WATER)); + } + + @Override + public FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return !state.getValue(WATERLOGGED); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return getState(context.getLevel(), context.getClickedPos()); + } + + @Override + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos pos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + } + + if (facing == Direction.UP) state = state.setValue(TOP, canConnectTo(world, pos.above(), Direction.UP)); + if (facing == Direction.DOWN) state = state.setValue(BOTTOM, canConnectTo(world, pos.below(), Direction.DOWN)); + + return state; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(TOP, BOTTOM, WATERLOGGED); + } +} diff --git a/src/main/java/elucent/eidolon/block/PipeBlock.java b/src/main/java/elucent/eidolon/block/PipeBlock.java new file mode 100644 index 0000000..7b5383f --- /dev/null +++ b/src/main/java/elucent/eidolon/block/PipeBlock.java @@ -0,0 +1,107 @@ +package elucent.eidolon.block; + +import com.google.common.base.Predicates; + +import elucent.eidolon.tile.reagent.PipeTileEntity; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.core.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; + +public class PipeBlock extends BlockBase implements EntityBlock { + static final VoxelShape + UP = Shapes.box(0.375, 0.625, 0.375, 0.625, 1, 0.625), + DOWN = Shapes.box(0.375, 0, 0.375, 0.625, 0.375, 0.625), + EAST = Shapes.box(0.625, 0.375, 0.375, 1, 0.625, 0.625), + WEST = Shapes.box(0, 0.375, 0.375, 0.375, 0.625, 0.625), + NORTH = Shapes.box(0.375, 0.375, 0, 0.625, 0.625, 0.375), + SOUTH = Shapes.box(0.375, 0.375, 0.625, 0.625, 0.625, 1), + CENTER = Shapes.box(0.375, 0.375, 0.375, 0.625, 0.625, 0.625); + + static final VoxelShape[] SHAPES = new VoxelShape[36]; + static { + VoxelShape[] FACES = new VoxelShape[]{ DOWN, UP, NORTH, SOUTH, WEST, EAST }; + for (Direction in : Direction.values()) { + for (Direction out : Direction.values()) { + SHAPES[in.ordinal() * 6 + out.ordinal()] = Shapes.or(FACES[in.ordinal()], FACES[out.ordinal()], CENTER); + } + } + } + + public static final DirectionProperty + IN = DirectionProperty.create("in", Predicates.alwaysTrue()), + OUT = DirectionProperty.create("out", Predicates.alwaysTrue()); + public static final BooleanProperty + IN_ATTACHED = BooleanProperty.create("attachin"), + OUT_ATTACHED = BooleanProperty.create("attachout"); + + public PipeBlock(Properties properties) { + super(properties); + } + + @Override + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { + return getInteractionShape(state, world, pos); + } + + @Override + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { + return getInteractionShape(state, world, pos); + } + + @Override + public VoxelShape getInteractionShape(BlockState state, BlockGetter world, BlockPos pos) { + return SHAPES[state.getValue(IN).ordinal() * 6 + state.getValue(OUT).ordinal()]; + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return defaultBlockState() + .setValue(IN, context.getClickedFace().getOpposite()) + .setValue(OUT, context.getClickedFace()) + .setValue(IN_ATTACHED, + context.getLevel() + .getBlockState(context.getClickedPos().relative(context.getClickedFace().getOpposite())) + .getBlock() == this) + .setValue(OUT_ATTACHED, + context.getLevel() + .getBlockState(context.getClickedPos().relative(context.getClickedFace())) + .getBlock() == this && + context.getLevel().getBlockState(context.getClickedPos().relative(context.getClickedFace())) + .getValue(IN) == context.getClickedFace()); + } + + @Override + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos pos, BlockPos facingPos) { + if (facing == state.getValue(OUT)) + state = state.setValue(OUT_ATTACHED, facingState.getBlock() == this && facingState.getValue(IN) == facing.getOpposite()); + if (facing == state.getValue(IN)) + state = state.setValue(IN_ATTACHED, facingState.getBlock() == this && facingState.getValue(OUT) == facing.getOpposite()); + if (facingState.getBlock() == this && facingPos.relative(facingState.getValue(IN)).equals(pos) + && facing != state.getValue(IN)) { + state = state.setValue(OUT, facing).setValue(OUT_ATTACHED, true); + } + return state; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(IN).add(OUT).add(IN_ATTACHED).add(OUT_ATTACHED); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new PipeTileEntity(pos, state); + } +} diff --git a/src/main/java/elucent/eidolon/block/PlinthBlockBase.java b/src/main/java/elucent/eidolon/block/PlinthBlockBase.java deleted file mode 100644 index 519c936..0000000 --- a/src/main/java/elucent/eidolon/block/PlinthBlockBase.java +++ /dev/null @@ -1,74 +0,0 @@ -package elucent.eidolon.block; - -import elucent.eidolon.Registry; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.IWaterLoggable; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.World; - -public class PlinthBlockBase extends BlockBase implements IWaterLoggable { - public static final BooleanProperty TOP = BooleanProperty.create("top"); - public static final BooleanProperty BOTTOM = BooleanProperty.create("bottom"); - public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - - public PlinthBlockBase(Properties properties) { - super(properties); - } - - protected boolean canConnectTo(IWorld world, BlockPos pos, Direction dir) { - BlockState state = world.getBlockState(pos); - if (state.getBlock() instanceof PlinthBlockBase && dir.getAxis() == Direction.Axis.Y) return true; - if (dir == Direction.UP && state.getBlock() == Registry.STONE_HAND.get()) return true; - return false; - } - - protected BlockState getState(World world, BlockPos pos) { - return this.getDefaultState() - .with(TOP, canConnectTo(world, pos.up(), Direction.UP)) - .with(BOTTOM, canConnectTo(world, pos.down(), Direction.DOWN)) - .with(WATERLOGGED, Boolean.valueOf(world.getFluidState(pos).getFluid() == Fluids.WATER)); - } - - @Override - public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); - } - - @Override - public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) { - return !state.get(WATERLOGGED); - } - - @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - return getState(context.getWorld(), context.getPos()); - } - - @Override - public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) { - if (state.get(WATERLOGGED)) { - world.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); - } - - if (facing == Direction.UP) state = state.with(TOP, canConnectTo(world, pos.up(), Direction.UP)); - if (facing == Direction.DOWN) state = state.with(BOTTOM, canConnectTo(world, pos.down(), Direction.DOWN)); - - return state; - } - - @Override - protected void fillStateContainer(StateContainer.Builder builder) { - builder.add(TOP, BOTTOM, WATERLOGGED); - } -} diff --git a/src/main/java/elucent/eidolon/block/ResearchTableBlock.java b/src/main/java/elucent/eidolon/block/ResearchTableBlock.java new file mode 100644 index 0000000..33dcfab --- /dev/null +++ b/src/main/java/elucent/eidolon/block/ResearchTableBlock.java @@ -0,0 +1,67 @@ +package elucent.eidolon.block; + +import javax.annotation.Nullable; + +import elucent.eidolon.gui.ResearchTableContainer; +import elucent.eidolon.gui.WoodenBrewingStandContainer; +import elucent.eidolon.gui.WorktableContainer; +import elucent.eidolon.tile.ResearchTableTileEntity; +import elucent.eidolon.tile.WoodenStandTileEntity; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.stats.Stats; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.Containers; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraftforge.network.NetworkHooks; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.Level; + +public class ResearchTableBlock extends HorizontalBlockBase implements EntityBlock { + public ResearchTableBlock(Properties properties) { + super(properties); + } + + @Override + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + if (worldIn.isClientSide) { + return InteractionResult.SUCCESS; + } else { + BlockEntity tileentity = worldIn.getBlockEntity(pos); + if (tileentity instanceof ResearchTableTileEntity) { + NetworkHooks.openGui((ServerPlayer)player, new SimpleMenuProvider((id, inventory, p) -> { + return new ResearchTableContainer(id, inventory, ((ResearchTableTileEntity)tileentity), ((ResearchTableTileEntity)tileentity).dataAccess); + }, ((ResearchTableTileEntity)tileentity).getDisplayName()), pos); + } + + return InteractionResult.CONSUME; + } + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new ResearchTableTileEntity(pos, state); + } + + @Override + @Nullable + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return new BlockEntityTicker() { + @Override + public void tick(Level level, BlockPos pos, BlockState state, T tile) { + ((ResearchTableTileEntity)tile).tick(); + } + }; + } +} diff --git a/src/main/java/elucent/eidolon/block/ShroomBlockBase.java b/src/main/java/elucent/eidolon/block/ShroomBlockBase.java deleted file mode 100644 index fcc5377..0000000 --- a/src/main/java/elucent/eidolon/block/ShroomBlockBase.java +++ /dev/null @@ -1,56 +0,0 @@ -package elucent.eidolon.block; - -import elucent.eidolon.Registry; -import net.minecraft.block.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.state.IntegerProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.server.ServerWorld; - -import java.util.Random; - -public class ShroomBlockBase extends BushBlock { - public static final IntegerProperty AGE = BlockStateProperties.AGE_0_3; - private static final VoxelShape[] SHAPES = new VoxelShape[]{Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 5.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 11.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D)}; - - public ShroomBlockBase(AbstractBlock.Properties builder) { - super(builder); - this.setDefaultState(this.stateContainer.getBaseState().with(AGE, Integer.valueOf(0))); - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return SHAPES[state.get(AGE)]; - } - - @Override - protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { - return false; // return state.isIn(Registry.PLANTER.get()); - } - - @Override - public boolean ticksRandomly(BlockState state) { - return state.get(AGE) < 3; - } - - @Override - public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { - int i = state.get(AGE); - if (i < 3 && !worldIn.canBlockSeeSky(pos) && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, random.nextInt(10) == 0)) { - state = state.with(AGE, i + 1); - worldIn.setBlockState(pos, state, 2); - net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state); - } - } - - @Override - protected void fillStateContainer(StateContainer.Builder builder) { - builder.add(AGE); - } -} diff --git a/src/main/java/elucent/eidolon/block/SoulEnchanterBlock.java b/src/main/java/elucent/eidolon/block/SoulEnchanterBlock.java index c88723c..62f4e3a 100644 --- a/src/main/java/elucent/eidolon/block/SoulEnchanterBlock.java +++ b/src/main/java/elucent/eidolon/block/SoulEnchanterBlock.java @@ -1,35 +1,56 @@ package elucent.eidolon.block; +import javax.annotation.Nullable; + import elucent.eidolon.gui.SoulEnchanterContainer; -import elucent.eidolon.gui.WorktableContainer; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; +import elucent.eidolon.tile.SoulEnchanterTileEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.SimpleMenuProvider; import net.minecraft.stats.Stats; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.IWorldPosCallable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; -public class SoulEnchanterBlock extends HorizontalBlockBase { +public class SoulEnchanterBlock extends HorizontalBlockBase implements EntityBlock { public SoulEnchanterBlock(Properties properties) { super(properties); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) { - if (world.isRemote) { - return ActionResultType.SUCCESS; + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + if (world.isClientSide) { + return InteractionResult.SUCCESS; } else { - player.openContainer(new SimpleNamedContainerProvider((id, inventory, p) -> { - return new SoulEnchanterContainer(id, inventory, IWorldPosCallable.of(world, pos)); - }, new StringTextComponent(""))); - player.addStat(Stats.INTERACT_WITH_CRAFTING_TABLE); - return ActionResultType.CONSUME; + player.openMenu(new SimpleMenuProvider((id, inventory, p) -> { + return new SoulEnchanterContainer(id, inventory, ContainerLevelAccess.create(world, pos)); + }, new TextComponent(""))); + player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); + return InteractionResult.CONSUME; } } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new SoulEnchanterTileEntity(pos, state); + } + + @Override + @Nullable + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return new BlockEntityTicker() { + @Override + public void tick(Level level, BlockPos pos, BlockState state, T tile) { + ((SoulEnchanterTileEntity)tile).tick(); + } + }; + } } diff --git a/src/main/java/elucent/eidolon/block/TableBlockBase.java b/src/main/java/elucent/eidolon/block/TableBlockBase.java index f943f63..8bc9abe 100644 --- a/src/main/java/elucent/eidolon/block/TableBlockBase.java +++ b/src/main/java/elucent/eidolon/block/TableBlockBase.java @@ -1,39 +1,28 @@ package elucent.eidolon.block; -import elucent.eidolon.tile.TileEntityBase; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.FenceGateBlock; -import net.minecraft.block.IWaterLoggable; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.core.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; -public class TableBlockBase extends BlockBase implements IWaterLoggable { - VoxelShape NORMAL = VoxelShapes.create(0, 0.75, 0, 1, 1, 1), - CORNER = VoxelShapes.combine( +public class TableBlockBase extends BlockBase implements SimpleWaterloggedBlock { + VoxelShape NORMAL = Shapes.box(0, 0.75, 0, 1, 1, 1), + CORNER = Shapes.joinUnoptimized( NORMAL, - VoxelShapes.create(0.0625, 0, 0.0625, 0.9375, 0.75, 0.9375), - IBooleanFunction.OR + Shapes.box(0.0625, 0, 0.0625, 0.9375, 0.75, 0.9375), + BooleanOp.OR ); public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; @@ -44,31 +33,31 @@ public class TableBlockBase extends BlockBase implements IWaterLoggable { public TableBlockBase(Properties properties) { super(properties); - setDefaultState(super.getDefaultState() - .with(NX, false) - .with(PX, false) - .with(NZ, false) - .with(PZ, false)); + registerDefaultState(super.defaultBlockState() + .setValue(NX, false) + .setValue(PX, false) + .setValue(NZ, false) + .setValue(PZ, false)); } public TableBlockBase setMainShape(VoxelShape shape) { NORMAL = shape; - CORNER = VoxelShapes.combine( + CORNER = Shapes.joinUnoptimized( NORMAL, - VoxelShapes.create(0.0625, 0, 0.0625, 0.9375, 0.75, 0.9375), - IBooleanFunction.OR + Shapes.box(0.0625, 0, 0.0625, 0.9375, 0.75, 0.9375), + BooleanOp.OR ); return this; } @Override - public VoxelShape getRaytraceShape(BlockState state, IBlockReader world, BlockPos pos) { - boolean nx = state.get(NX), px = state.get(PX), nz = state.get(NZ), pz = state.get(PZ); + public VoxelShape getInteractionShape(BlockState state, BlockGetter world, BlockPos pos) { + boolean nx = state.getValue(NX), px = state.getValue(PX), nz = state.getValue(NZ), pz = state.getValue(PZ); if ((!nx && !nz) || (!nx && !pz) || (!px && !pz) || (!px && !nz)) return CORNER; return NORMAL; } - protected BlockState updateCorners(IBlockReader world, BlockPos pos, BlockState state) { + protected BlockState updateCorners(BlockGetter world, BlockPos pos, BlockState state) { BlockState blockstate = world.getBlockState(pos.north()); BlockState blockstate1 = world.getBlockState(pos.east()); BlockState blockstate2 = world.getBlockState(pos.south()); @@ -78,37 +67,37 @@ protected BlockState updateCorners(IBlockReader world, BlockPos pos, BlockState conn3 = blockstate2.getBlock() == this, conn4 = blockstate3.getBlock() == this; return state - .with(NZ, conn1).with(PX, conn2) - .with(PZ, conn3).with(NX, conn4); + .setValue(NZ, conn1).setValue(PX, conn2) + .setValue(PZ, conn3).setValue(NX, conn4); } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - IBlockReader iblockreader = context.getWorld(); - BlockPos blockpos = context.getPos(); - return updateCorners(iblockreader, blockpos, super.getStateForPlacement(context)).with(WATERLOGGED, false); + public BlockState getStateForPlacement(BlockPlaceContext context) { + BlockGetter iblockreader = context.getLevel(); + BlockPos blockpos = context.getClickedPos(); + return updateCorners(iblockreader, blockpos, super.getStateForPlacement(context)).setValue(WATERLOGGED, false); } @Override - public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) { - if (state.get(WATERLOGGED)) { - world.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos pos, BlockPos facingPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } return updateCorners(world, pos, state); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(NX, PX, NZ, PZ, WATERLOGGED); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) { - return !state.get(WATERLOGGED); + public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { + return !state.getValue(WATERLOGGED); } } diff --git a/src/main/java/elucent/eidolon/block/TwoHighBlockBase.java b/src/main/java/elucent/eidolon/block/TwoHighBlockBase.java new file mode 100644 index 0000000..aecefe0 --- /dev/null +++ b/src/main/java/elucent/eidolon/block/TwoHighBlockBase.java @@ -0,0 +1,51 @@ +package elucent.eidolon.block; + +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.Level; + +public class TwoHighBlockBase extends BlockBase { + public static final EnumProperty HALF = BlockStateProperties.HALF; + + public TwoHighBlockBase(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return super.canSurvive(state, world, pos) && world.isEmptyBlock(pos.above()); + } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity entity, ItemStack stack) { + world.setBlockAndUpdate(pos.above(), defaultBlockState().setValue(HALF, Half.TOP)); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.defaultBlockState().setValue(HALF, Half.BOTTOM); + } + + @Override + public void breakBlock(BlockState state, Level world, BlockPos pos) { + if (state.getValue(HALF) == Half.BOTTOM && world.getBlockState(pos.above()).getBlock() == this) + world.destroyBlock(pos.above(), false); + else if (state.getValue(HALF) == Half.TOP && world.getBlockState(pos.below()).getBlock() == this) + world.destroyBlock(pos.below(), false); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(HALF); + } +} diff --git a/src/main/java/elucent/eidolon/block/TwoHighHorizontalBlockBase.java b/src/main/java/elucent/eidolon/block/TwoHighHorizontalBlockBase.java new file mode 100644 index 0000000..2d0b2a1 --- /dev/null +++ b/src/main/java/elucent/eidolon/block/TwoHighHorizontalBlockBase.java @@ -0,0 +1,55 @@ +package elucent.eidolon.block; + +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.Level; + +public class TwoHighHorizontalBlockBase extends BlockBase { + public static final EnumProperty HALF = BlockStateProperties.HALF; + public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; + + public TwoHighHorizontalBlockBase(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return super.canSurvive(state, world, pos) && world.isEmptyBlock(pos.above()); + } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity entity, ItemStack stack) { + world.setBlockAndUpdate(pos.above(), defaultBlockState().setValue(HALF, Half.TOP) + .setValue(HORIZONTAL_FACING, state.getValue(HORIZONTAL_FACING))); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.defaultBlockState().setValue(HALF, Half.BOTTOM) + .setValue(HORIZONTAL_FACING, context.getHorizontalDirection().getOpposite()); + } + + @Override + public void breakBlock(BlockState state, Level world, BlockPos pos) { + if (state.getValue(HALF) == Half.BOTTOM && world.getBlockState(pos.above()).getBlock() == this) + world.destroyBlock(pos.above(), false); + else if (state.getValue(HALF) == Half.TOP && world.getBlockState(pos.below()).getBlock() == this) + world.destroyBlock(pos.below(), false); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(HALF).add(HORIZONTAL_FACING); + } +} diff --git a/src/main/java/elucent/eidolon/block/WoodenStandBlock.java b/src/main/java/elucent/eidolon/block/WoodenStandBlock.java index c4ffd6f..85b4fb4 100644 --- a/src/main/java/elucent/eidolon/block/WoodenStandBlock.java +++ b/src/main/java/elucent/eidolon/block/WoodenStandBlock.java @@ -1,98 +1,107 @@ package elucent.eidolon.block; -import elucent.eidolon.gui.SoulEnchanterContainer; +import java.util.Random; + +import javax.annotation.Nullable; + import elucent.eidolon.gui.WoodenBrewingStandContainer; import elucent.eidolon.tile.WoodenStandTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BrewingStandBlock; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.particles.ParticleTypes; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.BrewingStandBlock; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.Containers; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.item.ItemStack; import net.minecraft.stats.Stats; -import net.minecraft.tileentity.BrewingStandTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.IWorldPosCallable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.network.NetworkHooks; - -import java.util.Random; +import net.minecraftforge.network.NetworkHooks; public class WoodenStandBlock extends BrewingStandBlock { - protected static final VoxelShape SHAPE = VoxelShapes.or(Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.makeCuboidShape(7.0D, 0.0D, 7.0D, 9.0D, 14.0D, 9.0D)); + protected static final VoxelShape SHAPE = Shapes.or(Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.box(7.0D, 0.0D, 7.0D, 9.0D, 14.0D, 9.0D)); public WoodenStandBlock(Properties properties) { super(properties); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { - return new WoodenStandTileEntity(); + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new WoodenStandTileEntity(pos, state); } @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { - if (worldIn.isRemote) { - return ActionResultType.SUCCESS; + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { + if (worldIn.isClientSide) { + return InteractionResult.SUCCESS; } else { - TileEntity tileentity = worldIn.getTileEntity(pos); + BlockEntity tileentity = worldIn.getBlockEntity(pos); if (tileentity instanceof WoodenStandTileEntity) { - NetworkHooks.openGui((ServerPlayerEntity)player, new SimpleNamedContainerProvider((id, inventory, p) -> { - return new WoodenBrewingStandContainer(id, inventory, ((WoodenStandTileEntity)tileentity), ((WoodenStandTileEntity)tileentity).field_213954_a); + NetworkHooks.openGui((ServerPlayer)player, new SimpleMenuProvider((id, inventory, p) -> { + return new WoodenBrewingStandContainer(id, inventory, ((WoodenStandTileEntity)tileentity), ((WoodenStandTileEntity)tileentity).dataAccess); }, ((WoodenStandTileEntity)tileentity).getDisplayName()), pos); - player.addStat(Stats.INTERACT_WITH_BREWINGSTAND); + player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); } - return ActionResultType.CONSUME; + return InteractionResult.CONSUME; } } @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { - if (stack.hasDisplayName()) { - TileEntity tileentity = worldIn.getTileEntity(pos); + public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { + if (stack.hasCustomHoverName()) { + BlockEntity tileentity = worldIn.getBlockEntity(pos); if (tileentity instanceof WoodenStandTileEntity) { - ((WoodenStandTileEntity)tileentity).setCustomName(stack.getDisplayName()); + ((WoodenStandTileEntity)tileentity).setCustomName(stack.getHoverName()); } } } @OnlyIn(Dist.CLIENT) @Override - public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { + public void animateTick(BlockState stateIn, Level worldIn, BlockPos pos, Random rand) { // no particles with this one } @Override - public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { - if (!state.isIn(newState.getBlock())) { - TileEntity tileentity = worldIn.getTileEntity(pos); + public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { + if (!state.is(newState.getBlock())) { + BlockEntity tileentity = worldIn.getBlockEntity(pos); if (tileentity instanceof WoodenStandTileEntity) { - InventoryHelper.dropInventoryItems(worldIn, pos, (WoodenStandTileEntity)tileentity); + Containers.dropContents(worldIn, pos, (WoodenStandTileEntity)tileentity); } - super.onReplaced(state, worldIn, pos, newState, isMoving); + super.onRemove(state, worldIn, pos, newState, isMoving); } } + + @Override + @Nullable + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return new BlockEntityTicker() { + @Override + public void tick(Level level, BlockPos pos, BlockState state, T tile) { + ((WoodenStandTileEntity)tile).tick(); + } + }; + } } diff --git a/src/main/java/elucent/eidolon/block/WorktableBlock.java b/src/main/java/elucent/eidolon/block/WorktableBlock.java index 9105d85..434597a 100644 --- a/src/main/java/elucent/eidolon/block/WorktableBlock.java +++ b/src/main/java/elucent/eidolon/block/WorktableBlock.java @@ -1,17 +1,17 @@ package elucent.eidolon.block; import elucent.eidolon.gui.WorktableContainer; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.container.SimpleNamedContainerProvider; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.SimpleMenuProvider; import net.minecraft.stats.Stats; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.IWorldPosCallable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.world.World; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.level.Level; public class WorktableBlock extends BlockBase { public WorktableBlock(Properties properties) { @@ -19,15 +19,15 @@ public WorktableBlock(Properties properties) { } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) { - if (world.isRemote) { - return ActionResultType.SUCCESS; + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + if (world.isClientSide) { + return InteractionResult.SUCCESS; } else { - player.openContainer(new SimpleNamedContainerProvider((id, inventory, p) -> { - return new WorktableContainer(id, inventory, IWorldPosCallable.of(world, pos)); - }, new StringTextComponent(""))); - player.addStat(Stats.INTERACT_WITH_CRAFTING_TABLE); - return ActionResultType.CONSUME; + player.openMenu(new SimpleMenuProvider((id, inventory, p) -> { + return new WorktableContainer(id, inventory, ContainerLevelAccess.create(world, pos)); + }, new TextComponent(""))); + player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); + return InteractionResult.CONSUME; } } } diff --git a/src/main/java/elucent/eidolon/capability/Facts.java b/src/main/java/elucent/eidolon/capability/Facts.java index d55d398..13f3205 100644 --- a/src/main/java/elucent/eidolon/capability/Facts.java +++ b/src/main/java/elucent/eidolon/capability/Facts.java @@ -1,7 +1,7 @@ package elucent.eidolon.capability; import elucent.eidolon.Eidolon; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; public class Facts { public static final ResourceLocation diff --git a/src/main/java/elucent/eidolon/capability/IKnowledge.java b/src/main/java/elucent/eidolon/capability/IKnowledge.java index 0ba94a5..6788eff 100644 --- a/src/main/java/elucent/eidolon/capability/IKnowledge.java +++ b/src/main/java/elucent/eidolon/capability/IKnowledge.java @@ -1,19 +1,63 @@ package elucent.eidolon.capability; -import elucent.eidolon.spell.Sign; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; - -import java.util.Map; import java.util.Set; -import java.util.UUID; + +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Sign; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.common.util.LazyOptional; public interface IKnowledge { + public static final Capability INSTANCE = CapabilityManager.get(new CapabilityToken<>(){}); + + public static class Provider implements ICapabilityProvider, INBTSerializable { + KnowledgeImpl impl = new KnowledgeImpl(); + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (cap == INSTANCE) return (LazyOptional) LazyOptional.of(() -> impl); + else return LazyOptional.empty(); + } + + @Override + public CompoundTag serializeNBT() { + return impl.serializeNBT(); + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + impl.deserializeNBT(nbt); + } + } + boolean knowsSign(Sign sign); void addSign(Sign sign); + void removeSign(Sign sign); + void resetSigns(); Set getKnownSigns(); boolean knowsFact(ResourceLocation fact); void addFact(ResourceLocation fact); + void removeFact(ResourceLocation fact); + void resetFacts(); Set getKnownFacts(); + + boolean knowsResearch(ResourceLocation research); + void addResearch(ResourceLocation research); + void removeResearch(ResourceLocation research); + void resetResearch(); + Set getKnownResearches(); + + boolean knowsRune(Rune rune); + void addRune(Rune rune); + void removeRune(Rune rune); + void resetRunes(); + Set getKnownRunes(); } diff --git a/src/main/java/elucent/eidolon/capability/IPlayerData.java b/src/main/java/elucent/eidolon/capability/IPlayerData.java new file mode 100644 index 0000000..87e8533 --- /dev/null +++ b/src/main/java/elucent/eidolon/capability/IPlayerData.java @@ -0,0 +1,89 @@ +package elucent.eidolon.capability; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import elucent.eidolon.Registry; +import elucent.eidolon.deity.Deities; +import elucent.eidolon.deity.Deity; +import elucent.eidolon.item.IWingsItem; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.common.util.LazyOptional; +import top.theillusivec4.curios.api.CuriosApi; + +public interface IPlayerData { + public static final Capability INSTANCE = CapabilityManager.get(new CapabilityToken<>(){}); + + public static class Provider implements ICapabilityProvider, INBTSerializable { + PlayerDataImpl impl = new PlayerDataImpl(); + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (cap == INSTANCE) return (LazyOptional) LazyOptional.of(() -> impl); + else return LazyOptional.empty(); + } + + @Override + public CompoundTag serializeNBT() { + return impl.serializeNBT(); + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + impl.deserializeNBT(nbt); + } + } + + default ItemStack getWingsItem(Player player) { + ItemStack result[] = new ItemStack[] { ItemStack.EMPTY }; + CuriosApi.getCuriosHelper().getEquippedCurios(player).ifPresent((h) -> { + for (int i = 0; i < h.getSlots(); i ++) { + ItemStack s = h.getStackInSlot(i); + if (s.getItem() instanceof IWingsItem) { + result[0] = s; + break; + } + } + }); + return result[0]; + } + + default int getMaxWingCharges(Player player) { + ItemStack wings = getWingsItem(player); + if (wings.getItem() instanceof IWingsItem i) return i.getMaxCharges(wings); + return 0; + } + + default boolean isDashing(Player player) { + return getDashTicks(player) > 0; + } + + default boolean canFlap(Player player) { + return !player.isOnGround() && !player.isInPowderSnow && !player.isSwimming() && !player.isPassenger() && !player.getAbilities().flying; + } + + int getDashTicks(Player player); + void doDashTick(Player player); + boolean tryDash(Player player); + int getWingCharges(Player player); + void rechargeWings(Player player); + boolean tryFlapWings(Player player); + long getFlightStartTime(Player player); + long getLastFlapTime(Player player); + boolean isFlying(Player player); + void startFlying(Player player); + void stopFlying(Player player); + void setDashTicks(int ticks); + void setLastFlapTime(long lastFlapTime); +} diff --git a/src/main/java/elucent/eidolon/capability/IReputation.java b/src/main/java/elucent/eidolon/capability/IReputation.java index be2ed18..f1f410b 100644 --- a/src/main/java/elucent/eidolon/capability/IReputation.java +++ b/src/main/java/elucent/eidolon/capability/IReputation.java @@ -1,58 +1,114 @@ package elucent.eidolon.capability; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; - -import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import elucent.eidolon.deity.Deities; +import elucent.eidolon.deity.Deity; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; + public interface IReputation { + public static final Capability INSTANCE = CapabilityManager.get(new CapabilityToken<>(){}); + + public static class Provider implements ICapabilityProvider, INBTSerializable { + ReputationImpl impl = new ReputationImpl(); + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (cap == INSTANCE) return (LazyOptional) LazyOptional.of(() -> impl); + else return LazyOptional.empty(); + } + + @Override + public CompoundTag serializeNBT() { + return impl.serializeNBT(); + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + impl.deserializeNBT(nbt); + } + } + double getReputation(UUID player, ResourceLocation deity); void addReputation(UUID player, ResourceLocation deity, double amount); void subtractReputation(UUID player, ResourceLocation deity, double amount); void setReputation(UUID player, ResourceLocation deity, double amount); boolean isLocked(UUID player, ResourceLocation deity); + boolean hasLock(UUID player, ResourceLocation deity, ResourceLocation lock); void lock(UUID player, ResourceLocation deity, ResourceLocation key); boolean unlock(UUID player, ResourceLocation deity, ResourceLocation key); - void pray(UUID player, long time); - boolean canPray(UUID player, long time); + void pray(UUID player, ResourceLocation spell, long time); + boolean canPray(UUID player, ResourceLocation spell, long time); - default double getReputation(PlayerEntity player, ResourceLocation deity) { - return getReputation(player.getUniqueID(), deity); + default double getReputation(Player player, ResourceLocation deity) { + return getReputation(player.getUUID(), deity); } - default void addReputation(PlayerEntity player, ResourceLocation deity, double amount) { - addReputation(player.getUniqueID(), deity, amount); + default void considerChange(Player player, ResourceLocation deity, double prev) { + double amount = getReputation(player, deity); + Deity d = Deities.find(deity); + if (d != null && amount != prev) d.onReputationChange(player, this, prev, amount); } - default void subtractReputation(PlayerEntity player, ResourceLocation deity, double amount) { - subtractReputation(player.getUniqueID(), deity, amount); + default void addReputation(Player player, ResourceLocation deity, double amount) { + double prev = getReputation(player.getUUID(), deity); + addReputation(player.getUUID(), deity, amount); + considerChange(player, deity, prev); } - default void setReputation(PlayerEntity player, ResourceLocation deity, double amount) { - setReputation(player.getUniqueID(), deity, amount); + default void subtractReputation(Player player, ResourceLocation deity, double amount) { + double prev = getReputation(player.getUUID(), deity); + subtractReputation(player.getUUID(), deity, amount); + considerChange(player, deity, prev); } - default void lock(PlayerEntity player, ResourceLocation deity, ResourceLocation key) { - lock(player.getUniqueID(), deity, key); + default void setReputation(Player player, ResourceLocation deity, double amount) { + double prev = getReputation(player.getUUID(), deity); + setReputation(player.getUUID(), deity, amount); + considerChange(player, deity, prev); } - default boolean unlock(PlayerEntity player, ResourceLocation deity, ResourceLocation key) { - return unlock(player.getUniqueID(), deity, key); + default void lock(Player player, ResourceLocation deity, ResourceLocation key) { + lock(player.getUUID(), deity, key); } - default void pray(PlayerEntity player, long time) { - pray(player.getUniqueID(), time); + default boolean unlock(Player player, ResourceLocation deity, ResourceLocation key) { + if (unlock(player.getUUID(), deity, key)) { + Deity d = Deities.find(deity); + if (d != null) d.onReputationUnlock(player, this, key); + return true; + } + return false; } - default boolean canPray(PlayerEntity player, long time) { - return player.isCreative() || canPray(player.getUniqueID(), time); + default boolean hasLock(Player player, ResourceLocation deity, ResourceLocation key) { + return hasLock(player.getUUID(), deity, key); } - Map getPrayerTimes(); + default void pray(Player player, ResourceLocation spell, long time) { + pray(player.getUUID(), spell, time); + } + + default boolean canPray(Player player, ResourceLocation spell, long time) { + return player.isCreative() || canPray(player.getUUID(), spell, time); + } + + Map> getPrayerTimes(); Map> getReputationMap(); + default Map getPrayerTimeMap(UUID player) { + return getPrayerTimes().computeIfAbsent(player, (k) -> new HashMap<>()); + } default Map getReputationMap(UUID player) { return getReputationMap().computeIfAbsent(player, (k) -> new HashMap<>()); } diff --git a/src/main/java/elucent/eidolon/capability/ISoul.java b/src/main/java/elucent/eidolon/capability/ISoul.java new file mode 100644 index 0000000..85e3d00 --- /dev/null +++ b/src/main/java/elucent/eidolon/capability/ISoul.java @@ -0,0 +1,85 @@ +package elucent.eidolon.capability; + +import java.util.Set; + +import javax.xml.stream.events.Attribute; + +import elucent.eidolon.Registry; +import elucent.eidolon.spell.Sign; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.common.util.LazyOptional; + +public interface ISoul { + public static final Capability INSTANCE = CapabilityManager.get(new CapabilityToken<>(){}); + + public static class Provider implements ICapabilityProvider, INBTSerializable { + SoulImpl impl = new SoulImpl(); + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (cap == INSTANCE) return (LazyOptional) LazyOptional.of(() -> impl); + else return LazyOptional.empty(); + } + + @Override + public CompoundTag serializeNBT() { + return impl.serializeNBT(); + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + impl.deserializeNBT(nbt); + } + } + + boolean hasEtherealHealth(); + float getMaxEtherealHealth(); + float getEtherealHealth(); + void setEtherealHealth(float health); + void setMaxEtherealHealth(float max); + + default void hurtEtherealHealth(float amount, float persistentHealth) { + amount = Math.max(0, amount); + float oldHealth = getEtherealHealth(); + setMaxEtherealHealth(Math.max(getMaxEtherealHealth() - amount, Math.min(persistentHealth, getMaxEtherealHealth()))); + setEtherealHealth(oldHealth - amount); + } + + default void healEtherealHealth(float amount, float persistentHealth) { + amount = Math.max(0, amount); + setEtherealHealth(Math.min(Math.max(getEtherealHealth(), persistentHealth), getEtherealHealth() + amount)); + } + + boolean hasMagic(); + float getMaxMagic(); + float getMagic(); + void setMagic(float magic); + void setMaxMagic(float max); + + default void takeMagic(float amount) { + amount = Math.max(0, amount); + setMagic(getMagic() - amount); + } + + default void giveMagic(float amount) { + amount = Math.max(0, amount); + setMagic(getMagic() + amount); + } + + public static float getPersistentHealth(LivingEntity entity) { + AttributeInstance attr = entity.getAttribute(Registry.PERSISTENT_SOUL_HEARTS.get()); + if (attr != null) return (float)attr.getValue(); + else return 0; + } +} diff --git a/src/main/java/elucent/eidolon/capability/KnowledgeCommand.java b/src/main/java/elucent/eidolon/capability/KnowledgeCommand.java new file mode 100644 index 0000000..3fbb139 --- /dev/null +++ b/src/main/java/elucent/eidolon/capability/KnowledgeCommand.java @@ -0,0 +1,252 @@ +package elucent.eidolon.capability; + +import java.util.Collection; +import java.util.concurrent.CompletableFuture; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import com.google.common.collect.ImmutableList; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.arguments.ArgumentType; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; +import com.mojang.brigadier.suggestion.Suggestions; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import com.mojang.brigadier.tree.LiteralCommandNode; + +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.commands.ExperienceCommand; +import net.minecraft.server.commands.KillCommand; +import net.minecraft.server.commands.MsgCommand; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; + +public class KnowledgeCommand { + public static class SignArgument implements ArgumentType { + private static final DynamicCommandExceptionType UNKNOWN = new DynamicCommandExceptionType((obj) -> new TranslatableComponent("argument.eidolon.sign.unknown", obj)); + + public static Sign getSign(final CommandContext context, final String name) { + return context.getArgument(name, Sign.class); + } + + @Override + public CompletableFuture listSuggestions(final CommandContext context, final SuggestionsBuilder builder) { + for (Sign s : Signs.getSigns()) + if (s.getRegistryName().toString().startsWith(builder.getRemainingLowerCase())) + builder.suggest(s.getRegistryName().toString()); + return builder.buildFuture(); + } + + @Override + public Sign parse(StringReader reader) throws CommandSyntaxException { + ResourceLocation rl = ResourceLocation.read(reader); + Sign s = Signs.find(rl); + if (s == null) throw UNKNOWN.create(rl.toString()); + return s; + } + } + + public static class ResearchArgument implements ArgumentType { + private static final DynamicCommandExceptionType UNKNOWN = new DynamicCommandExceptionType((obj) -> new TranslatableComponent("argument.eidolon.research.unknown", obj)); + + public static Research getResearch(final CommandContext context, final String name) { + return context.getArgument(name, Research.class); + } + + @Override + public CompletableFuture listSuggestions(final CommandContext context, final SuggestionsBuilder builder) { + for (Research r : Researches.getResearches()) + if (r.getRegistryName().toString().startsWith(builder.getRemainingLowerCase())) + builder.suggest(r.getRegistryName().toString()); + return builder.buildFuture(); + } + + @Override + public Research parse(StringReader reader) throws CommandSyntaxException { + ResourceLocation rl = ResourceLocation.read(reader); + Research r = Researches.find(rl); + if (r == null) throw UNKNOWN.create(rl.toString()); + return r; + } + } + + public static class RuneArgument implements ArgumentType { + private static final DynamicCommandExceptionType UNKNOWN = new DynamicCommandExceptionType((obj) -> new TranslatableComponent("argument.eidolon.rune.unknown", obj)); + + public static Rune getRune(final CommandContext context, final String name) { + return context.getArgument(name, Rune.class); + } + + @Override + public CompletableFuture listSuggestions(final CommandContext context, final SuggestionsBuilder builder) { + for (Rune r : Runes.getRunes()) + if (r.getRegistryName().toString().startsWith(builder.getRemainingLowerCase())) + builder.suggest(r.getRegistryName().toString()); + return builder.buildFuture(); + } + + @Override + public Rune parse(StringReader reader) throws CommandSyntaxException { + ResourceLocation rl = ResourceLocation.read(reader); + Rune r = Runes.find(rl); + if (r == null) throw UNKNOWN.create(rl.toString()); + return r; + } + } + + public static void register(CommandDispatcher dispatcher) { + dispatcher.register(Commands.literal("knowledge").requires((player) -> { + return player.hasPermission(2); + }).then(Commands.argument("targets", EntityArgument.players()) + .then(Commands.literal("reset").then(Commands.literal("signs").executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.resetSigns(player); + }); + }); + })) + .then(Commands.literal("facts").executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.resetFacts(player); + }); + }); + })) + .then(Commands.literal("research").executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.resetResearch(player); + }); + }); + })) + .then(Commands.literal("runes").executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.resetRunes(player); + }); + }); + })) + ) + .then(Commands.literal("grant") + .then(Commands.literal("sign").then(Commands.argument("sign", new SignArgument()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.grantSign(player, SignArgument.getSign(ctx, "sign")); + }); + }); + }))) + .then(Commands.literal("fact").then(Commands.argument("fact", ResourceLocationArgument.id()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.grantFact(player, ResourceLocationArgument.getId(ctx, "sign")); + }); + }); + }))) + .then(Commands.literal("research").then(Commands.argument("research", new ResearchArgument()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.grantResearch(player, ResearchArgument.getResearch(ctx, "research").getRegistryName()); + }); + }); + }))) + .then(Commands.literal("rune").then(Commands.argument("rune", new RuneArgument()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.grantRune(player, RuneArgument.getRune(ctx, "rune")); + }); + }); + }))) + ) +// .then(Commands.literal("grant") +// .then(Commands.literal("sign").then(Commands.argument("sign", new SignArgument()).executes((ctx) -> { +// return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { +// player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { +// KnowledgeUtil.grantSign(player, SignArgument.getSign(ctx, "sign")); +// }); +// }); +// }))) +// .then(Commands.literal("fact").then(Commands.argument("fact", ResourceLocationArgument.id()).executes((ctx) -> { +// return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { +// player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { +// KnowledgeUtil.grantFact(player, ResourceLocationArgument.getId(ctx, "sign")); +// }); +// }); +// }))) +// .then(Commands.literal("research").then(Commands.argument("research", new ResearchArgument()).executes((ctx) -> { +// return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { +// player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { +// KnowledgeUtil.grantResearch(player, ResearchArgument.getResearch(ctx, "research").getRegistryName()); +// }); +// }); +// }))) +// .then(Commands.literal("rune").then(Commands.argument("rune", new RuneArgument()).executes((ctx) -> { +// return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { +// player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { +// KnowledgeUtil.grantRune(player, RuneArgument.getRune(ctx, "rune")); +// }); +// }); +// }))) +// ) + .then(Commands.literal("remove") + .then(Commands.literal("sign").then(Commands.argument("sign", new SignArgument()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.removeSign(player, SignArgument.getSign(ctx, "sign")); + }); + }); + }))) + .then(Commands.literal("fact").then(Commands.argument("fact", ResourceLocationArgument.id()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.removeFact(player, ResourceLocationArgument.getId(ctx, "sign")); + }); + }); + }))) + .then(Commands.literal("research").then(Commands.argument("research", new ResearchArgument()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.removeResearch(player, ResearchArgument.getResearch(ctx, "research").getRegistryName()); + }); + }); + }))) + .then(Commands.literal("rune").then(Commands.argument("rune", new RuneArgument()).executes((ctx) -> { + return apply(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"), (player, sources) -> { + player.getCapability(IKnowledge.INSTANCE).ifPresent((k) -> { + KnowledgeUtil.removeRune(player, RuneArgument.getRune(ctx, "rune")); + }); + }); + }))) + ) + )); + } + + private static int apply(CommandSourceStack sources, Collection players, BiConsumer action) { + for (Player player : players) { + action.accept(player, sources); + } + + if (players.size() == 1) { + sources.sendSuccess(new TranslatableComponent("commands.eidolon.knowledge.success.single", players.iterator().next().getDisplayName()), true); + } else { + sources.sendSuccess(new TranslatableComponent("commands.eidolon.knowledge.success.multiple", players.size()), true); + } + + return players.size(); + } +} diff --git a/src/main/java/elucent/eidolon/capability/KnowledgeImpl.java b/src/main/java/elucent/eidolon/capability/KnowledgeImpl.java index f078281..90f575d 100644 --- a/src/main/java/elucent/eidolon/capability/KnowledgeImpl.java +++ b/src/main/java/elucent/eidolon/capability/KnowledgeImpl.java @@ -1,13 +1,24 @@ package elucent.eidolon.capability; -import elucent.eidolon.spell.Sign; -import net.minecraft.util.ResourceLocation; +import java.util.HashSet; +import java.util.Set; -import java.util.*; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.util.INBTSerializable; -public class KnowledgeImpl implements IKnowledge { +public class KnowledgeImpl implements IKnowledge, INBTSerializable { Set signs = new HashSet<>(); Set facts = new HashSet<>(); + Set researches = new HashSet<>(); + Set runes = new HashSet<>(); @Override public boolean knowsSign(Sign sign) { @@ -19,6 +30,16 @@ public void addSign(Sign sign) { signs.add(sign); } + @Override + public void removeSign(Sign sign) { + signs.remove(sign); + } + + @Override + public void resetSigns() { + signs.clear(); + } + @Override public Set getKnownSigns() { return signs; @@ -34,8 +55,134 @@ public void addFact(ResourceLocation fact) { facts.add(fact); } + @Override + public void removeFact(ResourceLocation fact) { + facts.remove(fact); + } + + @Override + public void resetFacts() { + facts.clear(); + } + @Override public Set getKnownFacts() { return facts; } + + @Override + public boolean knowsResearch(ResourceLocation research) { + return researches.contains(research); + } + + @Override + public void addResearch(ResourceLocation research) { + researches.add(research); + } + + @Override + public void removeResearch(ResourceLocation research) { + researches.remove(research); + } + + @Override + public void resetResearch() { + researches.clear(); + } + + @Override + public Set getKnownResearches() { + return researches; + } + + @Override + public boolean knowsRune(Rune rune) { + return runes.contains(rune); + } + + @Override + public void addRune(Rune rune) { + runes.add(rune); + } + + @Override + public void removeRune(Rune rune) { + runes.remove(rune); + } + + @Override + public void resetRunes() { + runes.clear(); + } + + @Override + public Set getKnownRunes() { + return runes; + } + + @Override + public CompoundTag serializeNBT() { + ListTag signs = new ListTag(); + for (Sign s : getKnownSigns()) { + signs.add(StringTag.valueOf(s.getRegistryName().toString())); + } + ListTag facts = new ListTag(); + for (ResourceLocation s : getKnownFacts()) { + facts.add(StringTag.valueOf(s.toString())); + } + ListTag researches = new ListTag(); + for (ResourceLocation s : getKnownResearches()) { + researches.add(StringTag.valueOf(s.toString())); + } + ListTag runes = new ListTag(); + for (Rune r : getKnownRunes()) { + runes.add(StringTag.valueOf(r.getRegistryName().toString())); + } + CompoundTag wrapper = new CompoundTag(); + wrapper.put("signs", signs); + wrapper.put("facts", facts); + wrapper.put("researches", researches); + wrapper.put("runes", runes); + return wrapper; + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + getKnownSigns().clear(); + getKnownFacts().clear(); + getKnownResearches().clear(); + getKnownRunes().clear(); + + if (((CompoundTag)nbt).contains("signs")) { + ListTag signs = ((CompoundTag) nbt).getList("signs", Tag.TAG_STRING); + for (int i = 0; i < signs.size(); i++) { + ResourceLocation loc = new ResourceLocation(signs.getString(i)); + Sign s = Signs.find(loc); + if (s != null) addSign(s); + } + } + + if (((CompoundTag)nbt).contains("facts")) { + ListTag facts = ((CompoundTag) nbt).getList("facts", Tag.TAG_STRING); + for (int i = 0; i < facts.size(); i++) { + addFact(new ResourceLocation(facts.getString(i))); + } + } + + if (((CompoundTag)nbt).contains("researches")) { + ListTag researches = ((CompoundTag) nbt).getList("researches", Tag.TAG_STRING); + for (int i = 0; i < researches.size(); i++) { + addResearch(new ResourceLocation(researches.getString(i))); + } + } + + if (((CompoundTag)nbt).contains("runes")) { + ListTag runes = ((CompoundTag) nbt).getList("runes", Tag.TAG_STRING); + for (int i = 0; i < runes.size(); i++) { + ResourceLocation loc = new ResourceLocation(runes.getString(i)); + Rune r = Runes.find(loc); + if (r != null) addRune(r); + } + } + } } diff --git a/src/main/java/elucent/eidolon/capability/KnowledgeProvider.java b/src/main/java/elucent/eidolon/capability/KnowledgeProvider.java deleted file mode 100644 index 423f22d..0000000 --- a/src/main/java/elucent/eidolon/capability/KnowledgeProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package elucent.eidolon.capability; - -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.Direction; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityInject; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.capabilities.ICapabilitySerializable; -import net.minecraftforge.common.util.LazyOptional; - -public class KnowledgeProvider implements ICapabilityProvider, ICapabilitySerializable { - @CapabilityInject(IKnowledge.class) - public static Capability CAPABILITY = null; - - IKnowledge instance = new KnowledgeImpl(); - - @Override - public LazyOptional getCapability(Capability cap, Direction side) { - return cap == CAPABILITY ? LazyOptional.of(() -> (T)instance) : LazyOptional.empty(); - } - - @Override - public CompoundNBT serializeNBT() { - return (CompoundNBT)CAPABILITY.getStorage().writeNBT(CAPABILITY, instance, null); - } - - @Override - public void deserializeNBT(CompoundNBT nbt) { - CAPABILITY.getStorage().readNBT(CAPABILITY, instance, null, nbt); - } -} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/capability/KnowledgeStorage.java b/src/main/java/elucent/eidolon/capability/KnowledgeStorage.java deleted file mode 100644 index 4bb4f4c..0000000 --- a/src/main/java/elucent/eidolon/capability/KnowledgeStorage.java +++ /dev/null @@ -1,52 +0,0 @@ -package elucent.eidolon.capability; - -import elucent.eidolon.spell.Sign; -import elucent.eidolon.spell.Signs; -import net.minecraft.nbt.*; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.Constants; - -import java.util.Map; -import java.util.UUID; - -public class KnowledgeStorage implements Capability.IStorage { - @Override - public INBT writeNBT(Capability capability, IKnowledge instance, Direction side) { - ListNBT signs = new ListNBT(); - for (Sign s : instance.getKnownSigns()) { - signs.add(StringNBT.valueOf(s.getRegistryName().toString())); - } - ListNBT facts = new ListNBT(); - for (ResourceLocation s : instance.getKnownFacts()) { - facts.add(StringNBT.valueOf(s.toString())); - } - CompoundNBT wrapper = new CompoundNBT(); - wrapper.put("signs", signs); - wrapper.put("facts", facts); - return wrapper; - } - - @Override - public void readNBT(Capability capability, IKnowledge instance, Direction side, INBT nbt) { - instance.getKnownSigns().clear(); - instance.getKnownFacts().clear(); - - if (((CompoundNBT)nbt).contains("signs")) { - ListNBT signs = ((CompoundNBT) nbt).getList("signs", Constants.NBT.TAG_STRING); - for (int i = 0; i < signs.size(); i++) { - ResourceLocation loc = new ResourceLocation(signs.getString(i)); - Sign s = Signs.find(loc); - if (s != null) instance.addSign(s); - } - } - - if (((CompoundNBT)nbt).contains("facts")) { - ListNBT facts = ((CompoundNBT) nbt).getList("facts", Constants.NBT.TAG_STRING); - for (int i = 0; i < facts.size(); i++) { - instance.addFact(new ResourceLocation(facts.getString(i))); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/capability/PlayerDataImpl.java b/src/main/java/elucent/eidolon/capability/PlayerDataImpl.java new file mode 100644 index 0000000..fff023f --- /dev/null +++ b/src/main/java/elucent/eidolon/capability/PlayerDataImpl.java @@ -0,0 +1,177 @@ +package elucent.eidolon.capability; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import elucent.eidolon.item.IWingsItem; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.WingsDashPacket; +import elucent.eidolon.network.WingsFlapPacket; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.ForgeMod; +import net.minecraftforge.common.util.INBTSerializable; + +public class PlayerDataImpl implements IPlayerData, INBTSerializable { + int wingCharges = 0, dashTicks = 0; + long lastFlapTime = 0, flightStartTime = 0; + boolean isFlying = false; + + @Override + public int getWingCharges(Player player) { + return wingCharges; + } + + @Override + public void rechargeWings(Player player) { + wingCharges = getMaxWingCharges(player); + } + + @Override + public boolean tryFlapWings(Player player) { + if (wingCharges <= 0 || getWingsItem(player).isEmpty()) { + wingCharges = 0; + return false; + } + else if (canFlap(player)) { + wingCharges --; + ItemStack wings = getWingsItem(player); + if (wings.getItem() instanceof IWingsItem i) { + if (isDashing(player)) { + i.onDashFlap(player, player.level, wings, getDashTicks(player)); + } + else { + i.onFlap(player, player.level, wings, getDashTicks(player)); + } + lastFlapTime = player.level.getGameTime(); + startFlying(player); + if (player.level.isClientSide) Networking.sendToServer(new WingsFlapPacket(player)); + } + return true; + } + return false; + } + + public int getDashTicks(Player player) { + return dashTicks; + } + + public void doDashTick(Player player) { + if (dashTicks > 0) { + ItemStack wings = getWingsItem(player); + if (wings.getItem() instanceof IWingsItem i) { + i.onDashTick(player, player.level, wings, dashTicks); + } + dashTicks --; + if (dashTicks == 0) { + if (wings.getItem() instanceof IWingsItem i) { + i.onDashEnd(player, player.level, wings); + } + } + } + } + + public boolean tryDash(Player player) { + if (wingCharges > 0 && canFlap(player)) { + wingCharges --; + ItemStack wings = getWingsItem(player); + if (wings.getItem() instanceof IWingsItem i) { + i.onDashStart(player, player.level, wings); + lastFlapTime = player.level.getGameTime(); + if (!isFlying) flightStartTime = lastFlapTime; + isFlying = true; + this.dashTicks = i.getDashTicks(wings); + if (player.level.isClientSide) Networking.sendToServer(new WingsDashPacket(player)); + } + return true; + } + else return false; + } + + @Override + public CompoundTag serializeNBT() { + CompoundTag tag = new CompoundTag(); + tag.putInt("wingCharges", wingCharges); + tag.putInt("dashTicks", dashTicks); + tag.putLong("lastFlapTime", lastFlapTime); + tag.putLong("flightStartTime", flightStartTime); + tag.putBoolean("isFlying", isFlying); + return tag; + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + wingCharges = nbt.getInt("wingCharges"); + dashTicks = nbt.getInt("dashTicks"); + lastFlapTime = nbt.getLong("lastFlapTime"); + flightStartTime = nbt.getLong("flightStartTime"); + isFlying = nbt.getBoolean("isFlying"); + } + + @Override + public long getLastFlapTime(Player player) { + return lastFlapTime; + } + + @Override + public boolean isFlying(Player player) { + return isFlying; + } + + static final AttributeModifier WINGS_SLOWFALL = new AttributeModifier(new UUID(4035878977813972397L, 2208061895106560443L), "Wings slow falling", -0.6, AttributeModifier.Operation.MULTIPLY_TOTAL); + + @Override + public void startFlying(Player player) { + if (!isFlying) { + this.flightStartTime = player.level.getGameTime(); + isFlying = true; + AttributeInstance attr = player.getAttribute(ForgeMod.ENTITY_GRAVITY.get()); + if (attr != null && !attr.hasModifier(WINGS_SLOWFALL)) attr.addTransientModifier(WINGS_SLOWFALL); + } + } + + @Override + public void stopFlying(Player player) { + if (isFlying) { + isFlying = false; + if (isDashing(player)) { + setDashTicks(0); + ItemStack wings = getWingsItem(player); + if (wings.getItem() instanceof IWingsItem i) { + i.onDashEnd(player, player.level, wings); + } + } + this.flightStartTime = player.level.getGameTime(); + AttributeInstance attr = player.getAttribute(ForgeMod.ENTITY_GRAVITY.get()); + if (attr != null && attr.hasModifier(WINGS_SLOWFALL)) attr.removeModifier(WINGS_SLOWFALL); + } + } + + @Override + public void setDashTicks(int ticks) { + dashTicks = ticks; + } + + @Override + public void setLastFlapTime(long lastFlapTime) { + this.lastFlapTime = lastFlapTime; + } + + @Override + public long getFlightStartTime(Player player) { + return this.flightStartTime; + } +} diff --git a/src/main/java/elucent/eidolon/capability/ReputationEntry.java b/src/main/java/elucent/eidolon/capability/ReputationEntry.java index 6c4f5ab..d53ccef 100644 --- a/src/main/java/elucent/eidolon/capability/ReputationEntry.java +++ b/src/main/java/elucent/eidolon/capability/ReputationEntry.java @@ -1,7 +1,7 @@ package elucent.eidolon.capability; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; public class ReputationEntry { double reputation; diff --git a/src/main/java/elucent/eidolon/capability/ReputationImpl.java b/src/main/java/elucent/eidolon/capability/ReputationImpl.java index 946db52..dc4e305 100644 --- a/src/main/java/elucent/eidolon/capability/ReputationImpl.java +++ b/src/main/java/elucent/eidolon/capability/ReputationImpl.java @@ -1,16 +1,17 @@ package elucent.eidolon.capability; -import elucent.eidolon.deity.Deities; -import elucent.eidolon.deity.Deity; -import net.minecraft.util.ResourceLocation; - import java.util.HashMap; import java.util.Map; import java.util.UUID; +import java.util.Map.Entry; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.util.INBTSerializable; -public class ReputationImpl implements IReputation { +public class ReputationImpl implements IReputation, INBTSerializable { Map> reputationMap = new HashMap<>(); - Map prayerTimes = new HashMap<>(); + Map> prayerTimes = new HashMap<>(); @Override public double getReputation(UUID player, ResourceLocation deity) { @@ -32,7 +33,10 @@ public void subtractReputation(UUID player, ResourceLocation deity, double amoun @Override public void setReputation(UUID player, ResourceLocation deity, double amount) { ReputationEntry entry = getReputationMap(player).computeIfAbsent(deity, (k) -> new ReputationEntry()); - if (entry.lock == null || amount < 0) entry.reputation = amount; + if (entry.lock == null || amount < 0) { + double prev = entry.reputation; + entry.reputation = amount; + } } @Override @@ -40,6 +44,13 @@ public boolean isLocked(UUID player, ResourceLocation deity) { return getReputationMap(player).computeIfAbsent(deity, (k) -> new ReputationEntry()).lock != null; } + @Override + public boolean hasLock(UUID player, ResourceLocation deity, ResourceLocation lock) { + ResourceLocation l = getReputationMap(player).computeIfAbsent(deity, (k) -> new ReputationEntry()).lock; + if (l != null && l.equals(lock)) return true; + return false; + } + @Override public void lock(UUID player, ResourceLocation deity, ResourceLocation key) { getReputationMap(player).computeIfAbsent(deity, (k) -> new ReputationEntry()).lock = key; @@ -56,17 +67,18 @@ public boolean unlock(UUID player, ResourceLocation deity, ResourceLocation key) } @Override - public void pray(UUID player, long time) { - getPrayerTimes().put(player, time); + public void pray(UUID player, ResourceLocation spell, long time) { + getPrayerTimes().computeIfAbsent(player, (p) -> new HashMap<>()).put(spell, time); } @Override - public boolean canPray(UUID player, long time) { - return !getPrayerTimes().containsKey(player) || getPrayerTimes().get(player) < time - 21000; + public boolean canPray(UUID player, ResourceLocation spell, long time) { + Map times = getPrayerTimes().computeIfAbsent(player, (p) -> new HashMap<>()); + return !times.containsKey(spell) || times.get(spell) < time - 21000; } @Override - public Map getPrayerTimes() { + public Map> getPrayerTimes() { return prayerTimes; } @@ -74,4 +86,58 @@ public Map getPrayerTimes() { public Map> getReputationMap() { return reputationMap; } + + @Override + public CompoundTag serializeNBT() { + CompoundTag data = new CompoundTag(); + CompoundTag reps = new CompoundTag(); + for (Entry> e : getReputationMap().entrySet()) { + CompoundTag tag = new CompoundTag(); + for (Entry e2 : e.getValue().entrySet()) { + CompoundTag entry = new CompoundTag(); + entry.putDouble("rep", e2.getValue().reputation); + if (e2.getValue().lock != null) entry.putString("lock", e2.getValue().lock.toString()); + tag.put(e2.getKey().toString(), entry); + } + reps.put(e.getKey().toString(), tag); + } + CompoundTag times = new CompoundTag(); + for (Entry> e : getPrayerTimes().entrySet()) { + CompoundTag nbt = new CompoundTag(); + for (Entry e2 : e.getValue().entrySet()) + nbt.putLong(e2.getKey().toString(), e2.getValue()); + times.put(e.getKey().toString(), nbt); + } + data.put("reps", reps); + data.put("times", times); + return data; + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + CompoundTag data = (CompoundTag)nbt; + getReputationMap().clear(); + if (data.contains("reps")) { + CompoundTag reps = data.getCompound("reps"); + for (String uuidString : reps.getAllKeys()) { + UUID uuid = UUID.fromString(uuidString); + CompoundTag tag = reps.getCompound(uuidString); + for (String deity : tag.getAllKeys()) { + CompoundTag entry = tag.getCompound(deity); + setReputation(uuid, new ResourceLocation(deity), entry.getDouble("rep")); + if (entry.contains("lock")) + lock(uuid, new ResourceLocation(deity), new ResourceLocation(entry.getString("lock"))); + } + } + } + if (data.contains("times")) { + CompoundTag times = data.getCompound("times"); + for (String uuidString : times.getAllKeys()) { + UUID uuid = UUID.fromString(uuidString); + CompoundTag spelltimes = times.getCompound(uuidString); + for (String rl : spelltimes.getAllKeys()) + pray(uuid, new ResourceLocation(rl), spelltimes.getLong(rl)); + } + } + } } diff --git a/src/main/java/elucent/eidolon/capability/ReputationProvider.java b/src/main/java/elucent/eidolon/capability/ReputationProvider.java deleted file mode 100644 index cc33d73..0000000 --- a/src/main/java/elucent/eidolon/capability/ReputationProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package elucent.eidolon.capability; - -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.Direction; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityInject; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.capabilities.ICapabilitySerializable; -import net.minecraftforge.common.util.LazyOptional; - -public class ReputationProvider implements ICapabilityProvider, ICapabilitySerializable { - @CapabilityInject(IReputation.class) - public static Capability CAPABILITY = null; - - IReputation instance = new ReputationImpl(); - - @Override - public LazyOptional getCapability(Capability cap, Direction side) { - return cap == CAPABILITY ? LazyOptional.of(() -> (T)instance) : LazyOptional.empty(); - } - - @Override - public CompoundNBT serializeNBT() { - return (CompoundNBT)CAPABILITY.getStorage().writeNBT(CAPABILITY, instance, null); - } - - @Override - public void deserializeNBT(CompoundNBT nbt) { - CAPABILITY.getStorage().readNBT(CAPABILITY, instance, null, nbt); - } -} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/capability/ReputationStorage.java b/src/main/java/elucent/eidolon/capability/ReputationStorage.java deleted file mode 100644 index eefda84..0000000 --- a/src/main/java/elucent/eidolon/capability/ReputationStorage.java +++ /dev/null @@ -1,63 +0,0 @@ -package elucent.eidolon.capability; - -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.INBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.capabilities.Capability; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.UUID; - -public class ReputationStorage implements Capability.IStorage { - @Override - public INBT writeNBT(Capability capability, IReputation instance, Direction side) { - CompoundNBT data = new CompoundNBT(); - CompoundNBT reps = new CompoundNBT(); - for (Entry> e : instance.getReputationMap().entrySet()) { - CompoundNBT tag = new CompoundNBT(); - for (Entry e2 : e.getValue().entrySet()) { - CompoundNBT entry = new CompoundNBT(); - entry.putDouble("rep", e2.getValue().reputation); - if (e2.getValue().lock != null) entry.putString("lock", e2.getValue().lock.toString()); - tag.put(e2.getKey().toString(), entry); - } - reps.put(e.getKey().toString(), tag); - } - CompoundNBT times = new CompoundNBT(); - for (Entry e : instance.getPrayerTimes().entrySet()) { - times.putLong(e.getKey().toString(), e.getValue()); - } - data.put("reps", reps); - data.put("times", times); - return data; - } - - @Override - public void readNBT(Capability capability, IReputation instance, Direction side, INBT nbt) { - CompoundNBT data = (CompoundNBT)nbt; - instance.getReputationMap().clear(); - if (data.contains("reps")) { - CompoundNBT reps = data.getCompound("reps"); - for (String uuidString : reps.keySet()) { - UUID uuid = UUID.fromString(uuidString); - CompoundNBT tag = reps.getCompound(uuidString); - for (String deity : tag.keySet()) { - CompoundNBT entry = tag.getCompound(deity); - instance.setReputation(uuid, new ResourceLocation(deity), entry.getDouble("rep")); - if (entry.contains("lock")) - instance.lock(uuid, new ResourceLocation(deity), new ResourceLocation(entry.getString("lock"))); - } - } - } - if (data.contains("times")) { - CompoundNBT times = data.getCompound("times"); - for (String uuidString : times.keySet()) { - UUID uuid = UUID.fromString(uuidString); - instance.pray(uuid, times.getLong(uuidString)); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/capability/SoulImpl.java b/src/main/java/elucent/eidolon/capability/SoulImpl.java new file mode 100644 index 0000000..dbb1d23 --- /dev/null +++ b/src/main/java/elucent/eidolon/capability/SoulImpl.java @@ -0,0 +1,90 @@ +package elucent.eidolon.capability; + +import java.util.HashSet; +import java.util.Set; + +import elucent.eidolon.Config; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraftforge.common.util.INBTSerializable; + +public class SoulImpl implements ISoul, INBTSerializable { + float maxMagic, magic; + float maxEtherealHealth, etherealHealth; + + @Override + public CompoundTag serializeNBT() { + CompoundTag tag = new CompoundTag(); + tag.putFloat("maxEtherealHealth", maxEtherealHealth); + tag.putFloat("etherealHealth", etherealHealth); + tag.putFloat("maxMagic", maxMagic); + tag.putFloat("magic", magic); + return tag; + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + maxEtherealHealth = nbt.contains("maxEtherealHealth") ? nbt.getFloat("maxEtherealHealth") : 0; + etherealHealth = nbt.contains("etherealHealth") ? nbt.getFloat("etherealHealth") : 0; + maxMagic = nbt.contains("maxMagic") ? nbt.getFloat("maxMagic") : 0; + magic = nbt.contains("magic") ? nbt.getFloat("magic") : 0; + } + + @Override + public boolean hasEtherealHealth() { + return maxEtherealHealth > 0; + } + + @Override + public float getMaxEtherealHealth() { + return maxEtherealHealth; + } + + @Override + public float getEtherealHealth() { + return etherealHealth; + } + + @Override + public boolean hasMagic() { + return maxMagic > 0; + } + + @Override + public float getMaxMagic() { + return maxMagic; + } + + @Override + public float getMagic() { + return magic; + } + + @Override + public void setEtherealHealth(float health) { + this.etherealHealth = Mth.clamp(health, 0, maxEtherealHealth); + } + + @Override + public void setMagic(float magic) { + this.magic = Mth.clamp(magic, 0, maxMagic); + } + + @Override + public void setMaxEtherealHealth(float max) { + this.maxEtherealHealth = Mth.clamp(max, 0, Config.MAX_ETHEREAL_HEALTH.get()); + this.etherealHealth = Math.min(maxEtherealHealth, etherealHealth); + } + + @Override + public void setMaxMagic(float max) { + this.maxMagic = Math.max(0, max); + this.magic = Math.min(maxMagic, magic); + } +} diff --git a/src/main/java/elucent/eidolon/codex/Category.java b/src/main/java/elucent/eidolon/codex/Category.java index 5fa6ac5..96770c5 100644 --- a/src/main/java/elucent/eidolon/codex/Category.java +++ b/src/main/java/elucent/eidolon/codex/Category.java @@ -1,18 +1,21 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.util.ColorUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldVertexBufferUploader; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Mirror; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.client.renderer.GameRenderer; + +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; +import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.minecraft.world.item.ItemStack; +import net.minecraft.util.Mth; +import com.mojang.math.Matrix4f; +import net.minecraft.network.chat.TranslatableComponent; public class Category { ItemStack icon; @@ -32,23 +35,23 @@ protected void reset() { hoveramount = 0; } - static void colorBlit(MatrixStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { - Matrix4f matrix = mStack.getLast().getMatrix(); + static void colorBlit(PoseStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); + Matrix4f matrix = mStack.last().pose(); int maxX = x + width, maxY = y + height; float minU = (float)uOffset / textureWidth, minV = (float)vOffset / textureHeight; float maxU = minU + (float)width / textureWidth, maxV = minV + (float)height / textureHeight; int r = ColorUtil.getRed(color), g = ColorUtil.getGreen(color), b = ColorUtil.getBlue(color); - BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(matrix, (float)x, (float)maxY, 0).tex(minU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)maxY, 0).tex(maxU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)y, 0).tex(maxU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)x, (float)y, 0).tex(minU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.finishDrawing(); - RenderSystem.enableAlphaTest(); - WorldVertexBufferUploader.draw(bufferbuilder); + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferbuilder.vertex(matrix, (float)x, (float)maxY, 0).uv(minU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)maxY, 0).uv(maxU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)y, 0).uv(maxU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)x, (float)y, 0).uv(minU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.end(); + BufferUploader.end(bufferbuilder); } public boolean click(CodexGui gui, int x, int y, boolean right, int mouseX, int mouseY) { @@ -67,34 +70,34 @@ public boolean click(CodexGui gui, int x, int y, boolean right, int mouseX, int return false; } - public void draw(CodexGui gui, MatrixStack mStack, int x, int y, boolean right, int mouseX, int mouseY) { + public void draw(CodexGui gui, PoseStack mStack, int x, int y, boolean right, int mouseX, int mouseY) { int w = 36; if (!right) x -= 36; w += hoveramount * 12; if (!right) x -= hoveramount * 12; boolean hover = mouseX >= x && mouseY >= y && mouseX <= x + w && mouseY <= y + 19; - if (hover && hoveramount < 1) hoveramount += Minecraft.getInstance().getRenderPartialTicks() / 4; - else if (!hover && hoveramount > 0) hoveramount -= Minecraft.getInstance().getRenderPartialTicks() / 4; - hoveramount = MathHelper.clamp(hoveramount, 0, 1); + if (hover && hoveramount < 1) hoveramount += Minecraft.getInstance().getFrameTime() / 4; + else if (!hover && hoveramount > 0) hoveramount -= Minecraft.getInstance().getFrameTime() / 4; + hoveramount = Mth.clamp(hoveramount, 0, 1); if (right) { x -= 12; x += hoveramount * 12; } - Minecraft.getInstance().getTextureManager().bindTexture(CodexGui.CODEX_BACKGROUND); + RenderSystem.setShaderTexture(0, CodexGui.CODEX_BACKGROUND); colorBlit(mStack, x, y, 208, right ? 208 : 227, 48, 19, 512, 512, color); - Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(icon, x + (right ? 23 : 9), y + 1); + Minecraft.getInstance().getItemRenderer().renderAndDecorateItem(icon, x + (right ? 23 : 9), y + 1); } - public void drawTooltip(CodexGui gui, MatrixStack mStack, int x, int y, boolean right, int mouseX, int mouseY) { + public void drawTooltip(CodexGui gui, PoseStack mStack, int x, int y, boolean right, int mouseX, int mouseY) { int w = 36; if (!right) x -= 36; w += hoveramount * 12; if (!right) x -= hoveramount * 12; boolean hover = mouseX >= x && mouseY >= y && mouseX <= x + w && mouseY <= y + 19; - if (hover) gui.renderTooltip(mStack, new TranslationTextComponent("eidolon.codex.category." + key), mouseX, mouseY); + if (hover) gui.renderTooltip(mStack, new TranslatableComponent("eidolon.codex.category." + key), mouseX, mouseY); } } diff --git a/src/main/java/elucent/eidolon/codex/ChantPage.java b/src/main/java/elucent/eidolon/codex/ChantPage.java index 3271009..4dde8ae 100644 --- a/src/main/java/elucent/eidolon/codex/ChantPage.java +++ b/src/main/java/elucent/eidolon/codex/ChantPage.java @@ -1,34 +1,30 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; import elucent.eidolon.capability.IKnowledge; -import elucent.eidolon.capability.KnowledgeProvider; import elucent.eidolon.spell.Sign; import elucent.eidolon.util.ColorUtil; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldVertexBufferUploader; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.util.text.TranslationTextComponent; +import com.mojang.blaze3d.vertex.BufferBuilder; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; +import com.mojang.blaze3d.vertex.BufferUploader; +import net.minecraft.client.renderer.texture.TextureAtlas; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; +import com.mojang.math.Matrix4f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; public class ChantPage extends Page { public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_chant_page.png"); @@ -43,66 +39,64 @@ public ChantPage(String textKey, Sign... chant) { } @OnlyIn(Dist.CLIENT) - static void colorBlit(MatrixStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { - Matrix4f matrix = mStack.getLast().getMatrix(); + static void colorBlit(PoseStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { + Matrix4f matrix = mStack.last().pose(); int maxX = x + width, maxY = y + height; float minU = (float)uOffset / textureWidth, minV = (float)vOffset / textureHeight; float maxU = minU + (float)width / textureWidth, maxV = minV + (float)height / textureHeight; int r = ColorUtil.getRed(color), g = ColorUtil.getGreen(color), b = ColorUtil.getBlue(color); - BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(matrix, (float)x, (float)maxY, 0).tex(minU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)maxY, 0).tex(maxU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)y, 0).tex(maxU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)x, (float)y, 0).tex(minU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.finishDrawing(); - RenderSystem.enableAlphaTest(); - WorldVertexBufferUploader.draw(bufferbuilder); + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferbuilder.vertex(matrix, (float)x, (float)maxY, 0).uv(minU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)maxY, 0).uv(maxU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)y, 0).uv(maxU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)x, (float)y, 0).uv(minU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.end(); + BufferUploader.end(bufferbuilder); } @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - String title = I18n.format(this.title); - int titleWidth = Minecraft.getInstance().fontRenderer.getStringWidth(title); - drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().fontRenderer.FONT_HEIGHT); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + String title = I18n.get(this.title); + int titleWidth = Minecraft.getInstance().font.width(title); + drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().font.lineHeight); - Minecraft.getInstance().getTextureManager().bindTexture(CodexGui.CODEX_BACKGROUND); - PlayerEntity entity = Minecraft.getInstance().player; - IKnowledge knowledge = entity.getCapability(KnowledgeProvider.CAPABILITY, null).resolve().get(); + RenderSystem.setShaderTexture(0, CodexGui.CODEX_BACKGROUND); + Player entity = Minecraft.getInstance().player; + IKnowledge knowledge = entity.getCapability(IKnowledge.INSTANCE, null).resolve().get(); int w = chant.length * 24; int baseX = x + 64 - w / 2; - gui.blit(mStack, baseX - 16, y + 28, 256, 208, 16, 32, 512, 512); + CodexGui.blit(mStack, baseX - 16, y + 28, 256, 208, 16, 32, 512, 512); for (int i = 0; i < chant.length; i ++) { - gui.blit(mStack, baseX + i * 24, y + 28, 272, 208, 24, 32, 512, 512); + CodexGui.blit(mStack, baseX + i * 24, y + 28, 272, 208, 24, 32, 512, 512); } - gui.blit(mStack, baseX + w, y + 28, 296, 208, 16, 32, 512, 512); + CodexGui.blit(mStack, baseX + w, y + 28, 296, 208, 16, 32, 512, 512); - Tessellator tess = Tessellator.getInstance(); + Tesselator tess = Tesselator.getInstance(); RenderSystem.enableBlend(); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 1f / 256f); for (int i = 0; i < chant.length; i ++) { - Minecraft.getInstance().getTextureManager().bindTexture(CodexGui.CODEX_BACKGROUND); + RenderSystem.setShaderTexture(0, CodexGui.CODEX_BACKGROUND); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - gui.blit(mStack, baseX + i * 24, y + 28, 312, 208, 24, 24, 512, 512); + CodexGui.blit(mStack, baseX + i * 24, y + 28, 312, 208, 24, 24, 512, 512); - Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); Sign sign = chant[i]; float flicker = 0.875f + 0.125f * (float)Math.sin(Math.toRadians(12 * ClientEvents.getClientTicks())); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), baseX + i * 24 + 4, y + 32, 16, 16, - sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(sign.getSprite())); - tess.draw(); - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), baseX + i * 24 + 4, y + 32, 16, 16, - sign.getRed() * flicker, sign.getGreen() * flicker, sign.getBlue() * flicker, Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(sign.getSprite())); - tess.draw(); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), baseX + i * 24 + 4, y + 32, 16, 16, + sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(sign.getSprite())); + tess.end(); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), baseX + i * 24 + 4, y + 32, 16, 16, + sign.getRed() * flicker, sign.getGreen() * flicker, sign.getBlue() * flicker, Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(sign.getSprite())); + tess.end(); } - RenderSystem.defaultAlphaFunc(); RenderSystem.disableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - drawWrappingText(gui, mStack, I18n.format(text), x + 4, y + 72, 120); + drawWrappingText(gui, mStack, I18n.get(text), x + 4, y + 72, 120); } } diff --git a/src/main/java/elucent/eidolon/codex/Chapter.java b/src/main/java/elucent/eidolon/codex/Chapter.java index 900e128..d34a4aa 100644 --- a/src/main/java/elucent/eidolon/codex/Chapter.java +++ b/src/main/java/elucent/eidolon/codex/Chapter.java @@ -1,10 +1,9 @@ package elucent.eidolon.codex; -import com.google.common.collect.Lists; - -import java.util.ArrayList; import java.util.List; +import com.google.common.collect.Lists; + public class Chapter { String titleKey; List pages; diff --git a/src/main/java/elucent/eidolon/codex/CodexChapters.java b/src/main/java/elucent/eidolon/codex/CodexChapters.java index be8deb8..05903ee 100644 --- a/src/main/java/elucent/eidolon/codex/CodexChapters.java +++ b/src/main/java/elucent/eidolon/codex/CodexChapters.java @@ -1,7 +1,8 @@ package elucent.eidolon.codex; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import elucent.eidolon.Eidolon; +import java.util.ArrayList; +import java.util.List; + import elucent.eidolon.Registry; import elucent.eidolon.capability.Facts; import elucent.eidolon.codex.CruciblePage.CrucibleStep; @@ -12,28 +13,24 @@ import elucent.eidolon.codex.RitualPage.RitualIngredient; import elucent.eidolon.codex.SignIndexPage.SignEntry; import elucent.eidolon.ritual.RitualRegistry; -import elucent.eidolon.spell.Sign; import elucent.eidolon.spell.Signs; import elucent.eidolon.util.ColorUtil; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.potion.PotionUtils; -import net.minecraft.potion.Potions; - -import java.util.ArrayList; -import java.util.List; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.Potions; public class CodexChapters { static List categories = new ArrayList<>(); - static Category NATURE, RITUALS, ARTIFICE, THEURGY, SIGNS; + static Category NATURE, RITUALS, ARTIFICE, THEURGY, SIGNS, RUNES; static Chapter NATURE_INDEX, MONSTERS, ORES, PEWTER, ENCHANTED_ASH, RITUALS_INDEX, BRAZIER, ITEM_PROVIDERS, CRYSTAL_RITUAL, SUMMON_RITUAL, ALLURE_RITUAL, REPELLING_RITUAL, DECEIT_RITUAL, TIME_RITUALS, PURIFY_RITUAL, SANGUINE_RITUAL, ARTIFICE_INDEX, WOODEN_STAND, TALLOW, CRUCIBLE, ARCANE_GOLD, REAGENTS, SOUL_GEMS, SHADOW_GEM, WARPED_SPROUTS, BASIC_ALCHEMY, INLAYS, BASIC_BAUBLES, MAGIC_WORKBENCH, VOID_AMULET, WARDED_MAIL, SOULFIRE_WAND, BONECHILL_WAND, REAPER_SCYTHE, CLEAVING_AXE, SOUL_ENCHANTER, REVERSAL_PICK, WARLOCK_ARMOR, GRAVITY_BELT, PRESTIGIOUS_PALM, MIND_SHIELDING_PLATE, RESOLUTE_BELT, GLASS_HAND, THEURGY_INDEX, INTRO_SIGNS, EFFIGY, ALTARS, ALTAR_LIGHTS, ALTAR_SKULLS, ALTAR_HERBS, GOBLET, DARK_PRAYER, ANIMAL_SACRIFICE, DARK_TOUCH, STONE_ALTAR, UNHOLY_EFFIGY, VILLAGER_SACRIFICE, - SIGNS_INDEX, WICKED_SIGN, SACRED_SIGN, BLOOD_SIGN, SOUL_SIGN, MIND_SIGN; + SIGNS_INDEX, WICKED_SIGN, SACRED_SIGN, BLOOD_SIGN, SOUL_SIGN, MIND_SIGN, FLAME_SIGN, WINTER_SIGN, HARMONY_SIGN, DEATH_SIGN, WARDING_SIGN, MAGIC_SIGN, + RUNES_INDEX; public static void init() { MONSTERS = new Chapter( @@ -215,7 +212,7 @@ ItemStack.EMPTY, new ItemStack(Blocks.STONE), ItemStack.EMPTY), new TitledRitualPage("eidolon.codex.page.purify_ritual", RitualRegistry.PURIFY_RITUAL, new ItemStack(Items.GLISTERING_MELON_SLICE), new RitualIngredient(new ItemStack(Registry.ENCHANTED_ASH.get()), false), new RitualIngredient(new ItemStack(Registry.ENCHANTED_ASH.get()), false), - new RitualIngredient(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HEALING), false), + new RitualIngredient(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.HEALING), false), new RitualIngredient(new ItemStack(Registry.SOUL_SHARD.get()), false), new RitualIngredient(new ItemStack(Registry.SOUL_SHARD.get()), false)), new TextPage("eidolon.codex.page.purify_ritual") @@ -223,7 +220,7 @@ ItemStack.EMPTY, new ItemStack(Blocks.STONE), ItemStack.EMPTY), SANGUINE_RITUAL = new Chapter( "eidolon.codex.chapter.sanguine_ritual", - new TitledRitualPage("eidolon.codex.page.sanguine_ritual.0", RitualRegistry.SANGUINE_SWORD, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HARMING), + new TitledRitualPage("eidolon.codex.page.sanguine_ritual.0", RitualRegistry.SANGUINE_SWORD, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.HARMING), new RitualIngredient(new ItemStack(Registry.SHADOW_GEM.get()), false), new RitualIngredient(new ItemStack(Registry.SOUL_SHARD.get()), false), new RitualIngredient(new ItemStack(Registry.SOUL_SHARD.get()), false), @@ -232,7 +229,7 @@ ItemStack.EMPTY, new ItemStack(Blocks.STONE), ItemStack.EMPTY), new RitualIngredient(new ItemStack(Items.NETHER_WART), false), new RitualIngredient(new ItemStack(Items.NETHER_WART), false)), new TextPage("eidolon.codex.page.sanguine_ritual.0"), - new TitledRitualPage("eidolon.codex.page.sanguine_ritual.1", RitualRegistry.SANGUINE_AMULET, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HARMING), + new TitledRitualPage("eidolon.codex.page.sanguine_ritual.1", RitualRegistry.SANGUINE_AMULET, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.HARMING), new RitualIngredient(new ItemStack(Items.REDSTONE), false), new RitualIngredient(new ItemStack(Items.REDSTONE), false), new RitualIngredient(new ItemStack(Items.DIAMOND), false), @@ -488,7 +485,7 @@ ItemStack.EMPTY, new ItemStack(Items.STICK), new ItemStack(Registry.PEWTER_INGOT new ItemStack(Registry.PEWTER_INGOT.get()), new ItemStack(Registry.PEWTER_INGOT.get()), ItemStack.EMPTY, ItemStack.EMPTY, new ItemStack(Items.STICK), new ItemStack(Registry.PEWTER_INGOT.get()), new ItemStack(Items.STICK), ItemStack.EMPTY, ItemStack.EMPTY, - new ItemStack(Registry.UNHOLY_SYMBOL.get()), new ItemStack(Registry.SOUL_SHARD.get()), new ItemStack(Registry.TATTERED_CLOTH.get()), new ItemStack(Registry.SOUL_SHARD.get())) + new ItemStack(Registry.UNHOLY_SYMBOL.get()), new ItemStack(Registry.TATTERED_CLOTH.get()), new ItemStack(Registry.SOUL_SHARD.get()), new ItemStack(Registry.TATTERED_CLOTH.get())) ); CLEAVING_AXE = new Chapter( @@ -808,6 +805,42 @@ ItemStack.EMPTY, new ItemStack(Blocks.STONE), ItemStack.EMPTY, new SignPage(Signs.MIND_SIGN) ); + FLAME_SIGN = new Chapter( + "eidolon.codex.chapter.flame_sign", + new TitlePage("eidolon.codex.page.flame_sign"), + new SignPage(Signs.FLAME_SIGN) + ); + + WINTER_SIGN = new Chapter( + "eidolon.codex.chapter.winter_sign", + new TitlePage("eidolon.codex.page.winter_sign"), + new SignPage(Signs.WINTER_SIGN) + ); + + HARMONY_SIGN = new Chapter( + "eidolon.codex.chapter.harmony_sign", + new TitlePage("eidolon.codex.page.harmony_sign"), + new SignPage(Signs.HARMONY_SIGN) + ); + + DEATH_SIGN = new Chapter( + "eidolon.codex.chapter.death_sign", + new TitlePage("eidolon.codex.page.death_sign"), + new SignPage(Signs.DEATH_SIGN) + ); + + WARDING_SIGN = new Chapter( + "eidolon.codex.chapter.warding_sign", + new TitlePage("eidolon.codex.page.warding_sign"), + new SignPage(Signs.WARDING_SIGN) + ); + + MAGIC_SIGN = new Chapter( + "eidolon.codex.chapter.magic_sign", + new TitlePage("eidolon.codex.page.magic_sign"), + new SignPage(Signs.MAGIC_SIGN) + ); + SIGNS_INDEX = new Chapter( "eidolon.codex.chapter.signs_index", new SignIndexPage( @@ -815,7 +848,15 @@ ItemStack.EMPTY, new ItemStack(Blocks.STONE), ItemStack.EMPTY, new SignEntry(SACRED_SIGN, Signs.SACRED_SIGN), new SignEntry(BLOOD_SIGN, Signs.BLOOD_SIGN), new SignEntry(SOUL_SIGN, Signs.SOUL_SIGN), - new SignEntry(MIND_SIGN, Signs.MIND_SIGN) + new SignEntry(MIND_SIGN, Signs.MIND_SIGN), + new SignEntry(FLAME_SIGN, Signs.FLAME_SIGN) + ), + new SignIndexPage( + new SignEntry(WINTER_SIGN, Signs.WINTER_SIGN), + new SignEntry(HARMONY_SIGN, Signs.HARMONY_SIGN), + new SignEntry(DEATH_SIGN, Signs.DEATH_SIGN), + new SignEntry(WARDING_SIGN, Signs.WARDING_SIGN), + new SignEntry(MAGIC_SIGN, Signs.MAGIC_SIGN) ) ); @@ -825,5 +866,17 @@ ItemStack.EMPTY, new ItemStack(Blocks.STONE), ItemStack.EMPTY, ColorUtil.packColor(255, 163, 74, 207), SIGNS_INDEX )); + + RUNES_INDEX = new Chapter( + "eidolon.codex.chapter.runes_index", + new RuneDescPage(), new RuneIndexPage() + ); + + categories.add(RUNES = new Category( + "runes", + new ItemStack(Registry.PARCHMENT.get()), + ColorUtil.packColor(255, 70, 70, 194), + RUNES_INDEX + )); } } diff --git a/src/main/java/elucent/eidolon/codex/CodexGui.java b/src/main/java/elucent/eidolon/codex/CodexGui.java index 249e8e6..a18dc7a 100644 --- a/src/main/java/elucent/eidolon/codex/CodexGui.java +++ b/src/main/java/elucent/eidolon/codex/CodexGui.java @@ -1,43 +1,43 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.ArrayList; +import java.util.List; + +import org.lwjgl.glfw.GLFW; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import elucent.eidolon.Events; import elucent.eidolon.network.AttemptCastPacket; import elucent.eidolon.network.Networking; -import elucent.eidolon.particle.SignParticleData; +import elucent.eidolon.spell.Rune; import elucent.eidolon.spell.Sign; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; -import org.lwjgl.glfw.GLFW; -import org.lwjgl.opengl.GL11; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.math.Matrix4f; -import java.util.ArrayList; -import java.util.List; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.level.Level; public class CodexGui extends Screen { public static final CodexGui DUMMY = new CodexGui(); public static final ResourceLocation CODEX_BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_bg.png"); static int xSize = 312, ySize = 208; - List chant = new ArrayList<>(); + List chant = new ArrayList<>(); + Rune hoveredRune = null; Chapter currentChapter; int currentPage = 0; @@ -50,7 +50,7 @@ public static CodexGui getInstance() { } protected CodexGui() { - super(new TranslationTextComponent("gui.eidolon.codex.title")); + super(new TranslatableComponent("gui.eidolon.codex.title")); currentChapter = CodexChapters.NATURE_INDEX; } @@ -65,24 +65,23 @@ protected void changeChapter(Chapter next) { currentPage = 0; } - public void addToChant(Sign sign) { - if (this.chant.size() < 9) this.chant.add(sign); + public void addToChant(Rune rune) { + if (this.chant.size() < 18) this.chant.add(rune); } - protected void renderChant(MatrixStack mStack, int x, int y, int mouseX, int mouseY, float pticks) { - int chantWidth = 32 + 24 * chant.size(); + protected void renderChant(PoseStack mStack, int x, int y, int mouseX, int mouseY, float pticks) { + int chantWidth = 32 + 12 * chant.size(); int baseX = x + this.xSize / 2 - chantWidth / 2, baseY = y + 180; RenderSystem.enableBlend(); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 1f / 256f); - + int bgx = baseX; blit(mStack, bgx, baseY, 256, 208, 16, 32, 512, 512); bgx += 16; for (int i = 0; i < chant.size(); i ++) { - blit(mStack, bgx, baseY, 272, 208, 24, 32, 512, 512); - blit(mStack, bgx, baseY, 312, 208, 24, 24, 512, 512); - bgx += 24; + blit(mStack, bgx, baseY, 272, 208, 12, 32, 512, 512); + blit(mStack, bgx, baseY + 6, 320, 240, 12, 12, 512, 512); + bgx += 12; } blit(mStack, bgx, baseY, 296, 208, 16, 32, 512, 512); bgx += 24; @@ -91,45 +90,59 @@ protected void renderChant(MatrixStack mStack, int x, int y, int mouseX, int mou bgx += 36; boolean cancelHover = mouseX >= bgx && mouseY >= baseY - 4 && mouseX <= bgx + 32 && mouseY <= baseY + 28; blit(mStack, bgx, baseY - 4, 368, cancelHover ? 240 : 208, 32, 32, 512, 512); - if (chantHover) renderTooltip(mStack, new TranslationTextComponent("eidolon.codex.chant_hover"), mouseX, mouseY); - if (cancelHover) renderTooltip(mStack, new TranslationTextComponent("eidolon.codex.cancel_hover"), mouseX, mouseY); + if (chantHover) renderTooltip(mStack, new TranslatableComponent("eidolon.codex.chant_hover"), mouseX, mouseY); + if (cancelHover) renderTooltip(mStack, new TranslatableComponent("eidolon.codex.cancel_hover"), mouseX, mouseY); RenderSystem.enableBlend(); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 1f / 256f); - Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); bgx = baseX + 16; - Tessellator tess = Tessellator.getInstance(); + Tesselator tess = Tesselator.getInstance(); for (int i = 0; i < chant.size(); i ++) { - Sign sign = chant.get(i); - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), bgx + 4, baseY + 4, 16, 16, - sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(sign.getSprite())); - tess.draw(); - bgx += 24; + Rune rune = chant.get(i); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), bgx + 2, baseY + 8, 8, 8, + 1, 1, 1, 0.5f, Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(rune.getSprite())); + tess.end(); + bgx += 12; } bgx = baseX + 16; RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); - float flicker = 0.875f + 0.125f * (float)Math.sin(Math.toRadians(12 * ClientEvents.getClientTicks())); for (int i = 0; i < chant.size(); i ++) { - Sign sign = chant.get(i); - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), bgx + 4, baseY + 4, 16, 16, - sign.getRed() * flicker, sign.getGreen() * flicker, sign.getBlue() * flicker, Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(sign.getSprite())); - tess.draw(); - bgx += 24; + float flicker = 0.75f + 0.25f * (float)Math.sin(Math.toRadians(12 * ClientEvents.getClientTicks() - 360.0f * i / chant.size())); + Rune rune = chant.get(i); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), bgx + 2, baseY + 8, 8, 8, + flicker, flicker, flicker, 0.5f * flicker, Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(rune.getSprite())); + tess.end(); + bgx += 12; } - RenderSystem.defaultAlphaFunc(); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND_LOCATION); + RenderSystem.setShaderTexture(0, BACKGROUND_LOCATION); + } + + boolean hasTooltip = false; + Matrix4f tooltipMatrix = null; + Component tooltipText = null; + int tooltipX = 0, tooltipY = 0; + + @Override + public void renderTooltip(PoseStack poseStack, Component text, int x, int y) { + tooltipMatrix = poseStack.last().pose(); + tooltipText = text; + tooltipX = x; + tooltipY = y; + hasTooltip = true; } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { + hasTooltip = false; renderBackground(matrixStack); Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(CODEX_BACKGROUND); + RenderSystem.setShaderTexture(0, CODEX_BACKGROUND); - this.width = mc.getMainWindow().getScaledWidth(); - this.height = mc.getMainWindow().getScaledHeight(); + this.width = mc.getWindow().getGuiScaledWidth(); + this.height = mc.getWindow().getGuiScaledHeight(); int guiLeft = (width - xSize) / 2, guiTop = (height - ySize) / 2; blit(matrixStack, guiLeft, guiTop, 0, 256, xSize, ySize, 512, 512); @@ -138,13 +151,13 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partia CodexChapters.categories.get(i).draw(this, matrixStack, guiLeft + (i >= 8 ? 304 : 8), y, i >= 8, mouseX, mouseY); } - mc.getTextureManager().bindTexture(CODEX_BACKGROUND); + RenderSystem.setShaderTexture(0, CODEX_BACKGROUND); blit(matrixStack, guiLeft, guiTop, 0, 0, xSize, ySize, 512, 512); Page left = currentChapter.get(currentPage), right = currentChapter.get(currentPage + 1); if (left != null) left.fullRender(this, matrixStack, guiLeft + 14, guiTop + 24, mouseX, mouseY); if (right != null) right.fullRender(this, matrixStack, guiLeft + 170, guiTop + 24, mouseX, mouseY); - mc.getTextureManager().bindTexture(CODEX_BACKGROUND); + RenderSystem.setShaderTexture(0, CODEX_BACKGROUND); if (currentPage > 0) { // left arrow int x = 10, y = 169; int v = 208; @@ -165,27 +178,35 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partia int y = guiTop + 28 + (i % 8) * 20; CodexChapters.categories.get(i).drawTooltip(this, matrixStack, guiLeft + (i >= 8 ? 304 : 8), y, i >= 8, mouseX, mouseY); } + + if (hasTooltip) { + matrixStack.pushPose(); + matrixStack.setIdentity(); + matrixStack.mulPoseMatrix(tooltipMatrix); + super.renderTooltip(matrixStack, tooltipText, tooltipX, tooltipY); + matrixStack.popPose(); + } } protected boolean interactChant(int x, int y, int mouseX, int mouseY) { - int chantWidth = 32 + 24 * chant.size(); + int chantWidth = 32 + 12 * chant.size(); int baseX = x + this.xSize / 2 - chantWidth / 2, baseY = y + 180; int bgx = baseX + chantWidth + 8; boolean chantHover = mouseX >= bgx && mouseY >= baseY - 4 && mouseX <= bgx + 32 && mouseY <= baseY + 28; bgx += 36; boolean cancelHover = mouseX >= bgx && mouseY >= baseY - 4 && mouseX <= bgx + 32 && mouseY <= baseY + 28; if (chantHover) { - PlayerEntity player = Minecraft.getInstance().player; - World world = Minecraft.getInstance().world; + Player player = Minecraft.getInstance().player; + Level world = Minecraft.getInstance().level; Networking.sendToServer(new AttemptCastPacket(player, chant)); chant.clear(); - player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.NEUTRAL, 1.0f, 1.0f); - this.closeScreen(); + player.playNotifySound(SoundEvents.UI_BUTTON_CLICK, SoundSource.NEUTRAL, 1.0f, 1.0f); + this.onClose(); return true; } if (cancelHover) { chant.clear(); - Minecraft.getInstance().player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.NEUTRAL, 1.0f, 1.0f); + Minecraft.getInstance().player.playNotifySound(SoundEvents.UI_BUTTON_CLICK, SoundSource.NEUTRAL, 1.0f, 1.0f); return true; } return false; @@ -200,15 +221,15 @@ public boolean isPauseScreen() { public boolean mouseClicked(double mouseX, double mouseY, int button) { if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) { Minecraft mc = Minecraft.getInstance(); - this.width = mc.getMainWindow().getScaledWidth(); - this.height = mc.getMainWindow().getScaledHeight(); + this.width = mc.getWindow().getGuiScaledWidth(); + this.height = mc.getWindow().getGuiScaledHeight(); int guiLeft = (width - xSize) / 2, guiTop = (height - ySize) / 2; if (currentPage > 0) { // left arrow int x = guiLeft + 10, y = guiTop + 169; if (mouseX >= x && mouseY >= y && mouseX <= x + 32 && mouseY <= y + 16) { currentPage -= 2; - Minecraft.getInstance().player.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.NEUTRAL, 1.0f, 1.0f); + Minecraft.getInstance().player.playNotifySound(SoundEvents.BOOK_PAGE_TURN, SoundSource.NEUTRAL, 1.0f, 1.0f); resetPages(); return true; } @@ -217,7 +238,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { int x = guiLeft + 270, y = guiTop + 169; if (mouseX >= x && mouseY >= y && mouseX <= x + 32 && mouseY <= y + 16) { currentPage += 2; - Minecraft.getInstance().player.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.NEUTRAL, 1.0f, 1.0f); + Minecraft.getInstance().player.playNotifySound(SoundEvents.BOOK_PAGE_TURN, SoundSource.NEUTRAL, 1.0f, 1.0f); resetPages(); return true; } @@ -238,7 +259,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { } @Override - public void renderTooltip(MatrixStack mStack, ItemStack stack, int x, int y) { + public void renderTooltip(PoseStack mStack, ItemStack stack, int x, int y) { if (!stack.isEmpty()) super.renderTooltip(mStack, stack, x, y); } } diff --git a/src/main/java/elucent/eidolon/codex/CraftingPage.java b/src/main/java/elucent/eidolon/codex/CraftingPage.java index 307cda9..56426fa 100644 --- a/src/main/java/elucent/eidolon/codex/CraftingPage.java +++ b/src/main/java/elucent/eidolon/codex/CraftingPage.java @@ -1,11 +1,10 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -22,7 +21,7 @@ public CraftingPage(ItemStack result, ItemStack... inputs) { @Override @OnlyIn(Dist.CLIENT) - public void renderIngredients(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void renderIngredients(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { for (int i = 0; i < 3; i ++) { for (int j = 0; j < 3; j ++) { int index = i * 3 + j; diff --git a/src/main/java/elucent/eidolon/codex/CruciblePage.java b/src/main/java/elucent/eidolon/codex/CruciblePage.java index b3052b4..1450fa7 100644 --- a/src/main/java/elucent/eidolon/codex/CruciblePage.java +++ b/src/main/java/elucent/eidolon/codex/CruciblePage.java @@ -1,14 +1,14 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import elucent.eidolon.recipe.CrucibleRecipe; import elucent.eidolon.recipe.CrucibleRegistry; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.gui.Font; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -43,7 +43,7 @@ public CruciblePage(ItemStack result, CrucibleStep... steps) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { int h = steps.length * 20 + 32; int yoff = 80 - h / 2; for (int i = 0; i < steps.length; i ++) { @@ -63,10 +63,10 @@ public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, i } gui.blit(mStack, x, y + yoff + steps.length * 20, 128, 64, 128, 32); - FontRenderer font = Minecraft.getInstance().fontRenderer; + Font font = Minecraft.getInstance().font; for (int i = 0; i < steps.length; i ++) { int tx = x, ty = y + yoff + i * 20; - drawText(gui, mStack, I18n.format("enchantment.level." + (i + 1)) + ".", tx + 7, ty + 17 - font.FONT_HEIGHT); + drawText(gui, mStack, I18n.get("enchantment.level." + (i + 1)) + ".", tx + 7, ty + 17 - font.lineHeight); tx += 24; } } @@ -74,7 +74,7 @@ public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, i @Override @OnlyIn(Dist.CLIENT) - public void renderIngredients(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void renderIngredients(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { int h = steps.length * 20 + 32; int yoff = 80 - h / 2; for (int i = 0; i < steps.length; i ++) { diff --git a/src/main/java/elucent/eidolon/codex/EntityPage.java b/src/main/java/elucent/eidolon/codex/EntityPage.java index 39a3bea..b8aad10 100644 --- a/src/main/java/elucent/eidolon/codex/EntityPage.java +++ b/src/main/java/elucent/eidolon/codex/EntityPage.java @@ -1,25 +1,20 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.Eidolon; -import elucent.eidolon.Events; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.resources.ResourceLocation; +import com.mojang.math.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; - -import java.util.function.Supplier; public class EntityPage extends Page { public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_entity_page.png"); @@ -33,27 +28,27 @@ public EntityPage(EntityType type) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Entity e = type.create(Minecraft.getInstance().world); - EntityRenderer renderer = Minecraft.getInstance().getRenderManager().getRenderer(e); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + Entity e = type.create(Minecraft.getInstance().level); + EntityRenderer renderer = Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(e); RenderSystem.disableCull(); RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); - RenderSystem.enableLighting(); - Tessellator tess = Tessellator.getInstance(); - mStack.push(); + Tesselator tess = Tesselator.getInstance(); + mStack.pushPose(); mStack.translate(x + 64, y + 136, 64); - mStack.rotate(Vector3f.XP.rotationDegrees(-15)); - mStack.rotate(Vector3f.YP.rotationDegrees(-30)); - float scale = 112 / e.getHeight(); + mStack.mulPose(Vector3f.XP.rotationDegrees(-15)); + mStack.mulPose(Vector3f.YP.rotationDegrees(-30)); + float scale = 112 / e.getBbHeight(); mStack.scale(scale, -scale, scale); - Minecraft.getInstance().getTextureManager().bindTexture(renderer.getEntityTexture(e)); - renderer.render(e, e.rotationYaw, 0, mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), 0xf000f0); - tess.draw(); - mStack.pop(); + RenderSystem.setShader(GameRenderer::getRendertypeEntityAlphaShader); + RenderSystem.setupShaderLights(RenderSystem.getShader()); + RenderSystem.setShaderTexture(0, renderer.getTextureLocation(e)); + renderer.render(e, e.getYRot(), 0, mStack, MultiBufferSource.immediate(tess.getBuilder()), 0xf000f0); + tess.end(); + mStack.popPose(); RenderSystem.enableCull(); RenderSystem.disableBlend(); RenderSystem.disableDepthTest(); - RenderSystem.disableLighting(); } } diff --git a/src/main/java/elucent/eidolon/codex/IndexPage.java b/src/main/java/elucent/eidolon/codex/IndexPage.java index 4471464..56c9a9f 100644 --- a/src/main/java/elucent/eidolon/codex/IndexPage.java +++ b/src/main/java/elucent/eidolon/codex/IndexPage.java @@ -1,15 +1,17 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import elucent.eidolon.spell.KnowledgeUtil; import elucent.eidolon.spell.Sign; +import elucent.eidolon.util.KnowledgeUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -71,7 +73,7 @@ public boolean click(CodexGui gui, int x, int y, int mouseX, int mouseY) { for (int i = 0; i < entries.length; i ++) if (entries[i].isUnlocked()) { if (mouseX >= x + 2 && mouseX <= x + 124 && mouseY >= y + 8 + i * 20 && mouseY <= y + 26 + i * 20) { gui.changeChapter(entries[i].chapter); - Minecraft.getInstance().player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.NEUTRAL, 1.0f, 1.0f); + Minecraft.getInstance().player.playNotifySound(SoundEvents.UI_BUTTON_CLICK, SoundSource.NEUTRAL, 1.0f, 1.0f); return true; } } @@ -80,15 +82,15 @@ public boolean click(CodexGui gui, int x, int y, int mouseX, int mouseY) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + RenderSystem.setShaderTexture(0, BACKGROUND); for (int i = 0; i < entries.length; i ++) { gui.blit(mStack, x + 1, y + 7 + i * 20, 128, entries[i].isUnlocked() ? 0 : 96, 122, 18); } for (int i = 0; i < entries.length; i ++) if (entries[i].isUnlocked()) { - Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(entries[i].icon, x + 2, y + 8 + i * 20); - drawText(gui, mStack, I18n.format(entries[i].chapter.titleKey), x + 24, y + 20 + i * 20 - Minecraft.getInstance().fontRenderer.FONT_HEIGHT); + Minecraft.getInstance().getItemRenderer().renderAndDecorateItem(entries[i].icon, x + 2, y + 8 + i * 20); + drawText(gui, mStack, I18n.get(entries[i].chapter.titleKey), x + 24, y + 20 + i * 20 - Minecraft.getInstance().font.lineHeight); } } } diff --git a/src/main/java/elucent/eidolon/codex/ListPage.java b/src/main/java/elucent/eidolon/codex/ListPage.java index 7ca340c..00398a8 100644 --- a/src/main/java/elucent/eidolon/codex/ListPage.java +++ b/src/main/java/elucent/eidolon/codex/ListPage.java @@ -1,15 +1,13 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import elucent.eidolon.spell.KnowledgeUtil; -import elucent.eidolon.spell.Sign; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -37,15 +35,15 @@ public ListPage(String key, ListEntry... pages) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + RenderSystem.setShaderTexture(0, BACKGROUND); for (int i = 0; i < entries.length; i ++) { gui.blit(mStack, x + 1, y + 7 + i * 20, 128, 0, 122, 18); } for (int i = 0; i < entries.length; i ++) { drawItem(gui, mStack, entries[i].icon, x + 2, y + 8 + i * 20, mouseX, mouseY); - drawText(gui, mStack, I18n.format(key + "." + entries[i].key), x + 24, y + 20 + i * 20 - Minecraft.getInstance().fontRenderer.FONT_HEIGHT); + drawText(gui, mStack, I18n.get(key + "." + entries[i].key), x + 24, y + 20 + i * 20 - Minecraft.getInstance().font.lineHeight); } } } diff --git a/src/main/java/elucent/eidolon/codex/Page.java b/src/main/java/elucent/eidolon/codex/Page.java index 0ed46de..9f91d5a 100644 --- a/src/main/java/elucent/eidolon/codex/Page.java +++ b/src/main/java/elucent/eidolon/codex/Page.java @@ -1,20 +1,19 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.ArrayList; +import java.util.List; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.util.ColorUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; - -import java.util.ArrayList; -import java.util.List; public abstract class Page { ResourceLocation bg; @@ -28,33 +27,33 @@ public void reset() { } @OnlyIn(Dist.CLIENT) - public static void drawItem(CodexGui gui, MatrixStack mStack, ItemStack stack, int x, int y, int mouseX, int mouseY) { + public static void drawItem(CodexGui gui, PoseStack mStack, ItemStack stack, int x, int y, int mouseX, int mouseY) { ItemRenderer ir = Minecraft.getInstance().getItemRenderer(); - ir.renderItemAndEffectIntoGUI(stack, x, y); - ir.renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, stack, x, y, null); + ir.renderAndDecorateItem(stack, x, y); + ir.renderGuiItemDecorations(Minecraft.getInstance().font, stack, x, y, null); if (mouseX >= x && mouseY >= y && mouseX <= x + 16 && mouseY <= y + 16) { gui.renderTooltip(mStack, stack, mouseX, mouseY); } } @OnlyIn(Dist.CLIENT) - public static void drawText(CodexGui gui, MatrixStack mStack, String text, int x, int y) { - FontRenderer font = Minecraft.getInstance().fontRenderer; - font.drawString(mStack, text, x, y - 1, ColorUtil.packColor(128, 255, 255, 255)); - font.drawString(mStack, text, x - 1, y, ColorUtil.packColor(128, 219, 212, 184)); - font.drawString(mStack, text, x + 1, y, ColorUtil.packColor(128, 219, 212, 184)); - font.drawString(mStack, text, x, y + 1, ColorUtil.packColor(128, 191, 179, 138)); - font.drawString(mStack, text, x, y, ColorUtil.packColor(255, 79, 59, 47)); + public static void drawText(CodexGui gui, PoseStack mStack, String text, int x, int y) { + Font font = Minecraft.getInstance().font; + font.draw(mStack, text, x, y - 1, ColorUtil.packColor(128, 255, 255, 255)); + font.draw(mStack, text, x - 1, y, ColorUtil.packColor(128, 219, 212, 184)); + font.draw(mStack, text, x + 1, y, ColorUtil.packColor(128, 219, 212, 184)); + font.draw(mStack, text, x, y + 1, ColorUtil.packColor(128, 191, 179, 138)); + font.draw(mStack, text, x, y, ColorUtil.packColor(255, 79, 59, 47)); } @OnlyIn(Dist.CLIENT) - public static void drawWrappingText(CodexGui gui, MatrixStack mStack, String text, int x, int y, int w) { - FontRenderer font = Minecraft.getInstance().fontRenderer; + public static void drawWrappingText(CodexGui gui, PoseStack mStack, String text, int x, int y, int w) { + Font font = Minecraft.getInstance().font; List lines = new ArrayList<>(); String[] words = text.split(" "); String line = ""; for (String s : words) { - if (font.getStringWidth(line) + font.getStringWidth(s) > w) { + if (font.width(line) + font.width(s) > w) { lines.add(line); line = s + " "; } @@ -62,21 +61,21 @@ public static void drawWrappingText(CodexGui gui, MatrixStack mStack, String tex } if (!line.isEmpty()) lines.add(line); for (int i = 0; i < lines.size(); i ++) { - drawText(gui, mStack, lines.get(i), x, y + i * (font.FONT_HEIGHT + 1)); + drawText(gui, mStack, lines.get(i), x, y + i * (font.lineHeight + 1)); } } @OnlyIn(Dist.CLIENT) - public void fullRender(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Minecraft.getInstance().getTextureManager().bindTexture(bg); + public void fullRender(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + RenderSystem.setShaderTexture(0, bg); renderBackground(gui, mStack, x, y, mouseX, mouseY); render(gui, mStack, x, y, mouseX, mouseY); renderIngredients(gui, mStack, x, y, mouseX, mouseY); } @OnlyIn(Dist.CLIENT) - public void renderBackground(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Minecraft.getInstance().getTextureManager().bindTexture(bg); + public void renderBackground(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + RenderSystem.setShaderTexture(0, bg); gui.blit(mStack, x, y, 0, 0, 128, 160); } @@ -86,8 +85,8 @@ public boolean click(CodexGui gui, int x, int y, int mouseX, int mouseY) { } @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) {} + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) {} @OnlyIn(Dist.CLIENT) - public void renderIngredients(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) {} + public void renderIngredients(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) {} } diff --git a/src/main/java/elucent/eidolon/codex/RitualPage.java b/src/main/java/elucent/eidolon/codex/RitualPage.java index 1600c3c..0cc10d5 100644 --- a/src/main/java/elucent/eidolon/codex/RitualPage.java +++ b/src/main/java/elucent/eidolon/codex/RitualPage.java @@ -1,22 +1,23 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; + +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; import elucent.eidolon.ritual.Ritual; -import elucent.eidolon.spell.Sign; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; public class RitualPage extends Page { public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_ritual_page.png"); @@ -43,7 +44,7 @@ public RitualPage(Ritual ritual, ItemStack center, RitualIngredient... inputs) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { float angleStep = Math.min(30, 180 / inputs.length); double rootAngle = 90 - (inputs.length - 1) * angleStep / 2; for (int i = 0; i < inputs.length; i ++) { @@ -55,31 +56,30 @@ public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, i } RenderSystem.enableBlend(); - RenderSystem.shadeModel(GL11.GL_SMOOTH); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 1f / 256f); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); - Tessellator tess = Tessellator.getInstance(); + Tesselator tess = Tesselator.getInstance(); RenderSystem.disableTexture(); RenderSystem.depthMask(false); - RenderUtil.dragon(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), x + 64, y + 48, 20, 20, ritual.getRed(), ritual.getGreen(), ritual.getBlue()); - tess.draw(); + RenderSystem.setShader(ClientRegistry::getGlowingShader); + RenderUtil.dragon(mStack, MultiBufferSource.immediate(tess.getBuilder()), x + 64, y + 48, 20, 20, ritual.getRed(), ritual.getGreen(), ritual.getBlue()); + tess.end(); RenderSystem.enableTexture(); - Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); for (int j = 0; j < 2; j++) { - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), x + 52, y + 36, 24, 24, - ritual.getRed(), ritual.getGreen(), ritual.getBlue(), Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(ritual.getSymbol())); - tess.draw(); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), x + 52, y + 36, 24, 24, + ritual.getRed(), ritual.getGreen(), ritual.getBlue(), Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(ritual.getSymbol())); + tess.end(); } - RenderSystem.defaultAlphaFunc(); RenderSystem.disableBlend(); - RenderSystem.shadeModel(GL11.GL_FLAT); RenderSystem.depthMask(true); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.setShader(GameRenderer::getPositionTexShader); } @Override @OnlyIn(Dist.CLIENT) - public void renderIngredients(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void renderIngredients(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { float angleStep = Math.min(30, 180 / inputs.length); double rootAngle = 90 - (inputs.length - 1) * angleStep / 2; for (int i = 0; i < inputs.length; i ++) { diff --git a/src/main/java/elucent/eidolon/codex/RuneDescPage.java b/src/main/java/elucent/eidolon/codex/RuneDescPage.java new file mode 100644 index 0000000..1edd8ad --- /dev/null +++ b/src/main/java/elucent/eidolon/codex/RuneDescPage.java @@ -0,0 +1,35 @@ +package elucent.eidolon.codex; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.Eidolon; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public class RuneDescPage extends Page { + public static final ResourceLocation BLANK = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_blank_page.png"); + public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_title_page.png"); + + public RuneDescPage() { + super(BACKGROUND); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + if (gui.hoveredRune == null) { + } + else { + ResourceLocation rl = gui.hoveredRune.getRegistryName(); + String title = I18n.get(rl.getNamespace() + ".rune." + rl.getPath()); + String text = I18n.get(rl.getNamespace() + ".codex.rune." + rl.getPath()); + int titleWidth = Minecraft.getInstance().font.width(title); + drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().font.lineHeight); + drawWrappingText(gui, mStack, text, x + 4, y + 24, 120); + } + } +} diff --git a/src/main/java/elucent/eidolon/codex/RuneIndexPage.java b/src/main/java/elucent/eidolon/codex/RuneIndexPage.java new file mode 100644 index 0000000..4b48e0f --- /dev/null +++ b/src/main/java/elucent/eidolon/codex/RuneIndexPage.java @@ -0,0 +1,136 @@ +package elucent.eidolon.codex; + +import com.mojang.blaze3d.vertex.PoseStack; + +import java.util.Optional; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; + +import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.util.ColorUtil; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.Minecraft; +import com.mojang.blaze3d.vertex.BufferBuilder; + +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; +import com.mojang.blaze3d.vertex.BufferUploader; +import net.minecraft.client.renderer.texture.TextureAtlas; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public class RuneIndexPage extends Page { + public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_rune_index_page.png"); + Rune[] runes; + int scroll = 0; + + public static class SignEntry { + Chapter chapter; + Sign sign; + + public SignEntry(Chapter chapter, Sign sign) { + this.chapter = chapter; + this.sign = sign; + } + } + + public RuneIndexPage() { + super(BACKGROUND); + this.runes = Runes.getRunes().toArray((i) -> new Rune[i]); + } + + @Override + @OnlyIn(Dist.CLIENT) + public boolean click(CodexGui gui, int x, int y, int mouseX, int mouseY) { + Player entity = Minecraft.getInstance().player; + if (entity.getCapability(IKnowledge.INSTANCE, null).resolve().isEmpty()) return false; + IKnowledge knowledge = entity.getCapability(IKnowledge.INSTANCE, null).resolve().get(); + for (int i = 0; i < runes.length; i ++) { + int xx = x + 2 + (i % 6) * 20, yy = y + 2 + (i / 6) * 20; + if (knowledge.knowsRune(runes[i]) && mouseX >= xx && mouseX <= xx + 16 && mouseY >= yy && mouseY <= yy + 16) { + gui.addToChant(runes[i]); + entity.playNotifySound(Registry.SELECT_RUNE.get(), SoundSource.NEUTRAL, 0.5f, entity.level.random.nextFloat() * 0.25f + 0.75f); + return true; + } + } + return false; + } + + @OnlyIn(Dist.CLIENT) + static void colorBlit(PoseStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { + Matrix4f matrix = mStack.last().pose(); + int maxX = x + width, maxY = y + height; + float minU = (float)uOffset / textureWidth, minV = (float)vOffset / textureHeight; + float maxU = minU + (float)width / textureWidth, maxV = minV + (float)height / textureHeight; + int r = ColorUtil.getRed(color), + g = ColorUtil.getGreen(color), + b = ColorUtil.getBlue(color); + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferbuilder.vertex(matrix, (float)x, (float)maxY, 0).uv(minU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)maxY, 0).uv(maxU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)y, 0).uv(maxU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)x, (float)y, 0).uv(minU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.end(); + BufferUploader.end(bufferbuilder); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + gui.hoveredRune = null; + Player entity = Minecraft.getInstance().player; + Optional knowledge = entity.getCapability(IKnowledge.INSTANCE, null).resolve(); + for (int i = 0; i < runes.length; i ++) { + RenderSystem.setShaderTexture(0, BACKGROUND); + int xx = x + 2 + (i % 6) * 20, yy = y + 2 + (i / 6) * 20; + boolean hover = knowledge.isPresent() && knowledge.get().knowsRune(runes[i]) && mouseX >= xx && mouseX <= xx + 16 && mouseY >= yy && mouseY <= yy + 16; + if (hover) gui.hoveredRune = runes[i]; + gui.blit(mStack, xx, yy, knowledge.isPresent() && knowledge.get().knowsRune(runes[i]) ? 128 : 148, 0, 20, 20); + + if (knowledge.isPresent() && knowledge.get().knowsRune(runes[i])) { + Tesselator tess = Tesselator.getInstance(); + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); + if (hover) { + mStack.pushPose(); + mStack.translate(xx + 10, yy + 10, 0); + mStack.mulPose(Vector3f.ZP.rotationDegrees(ClientEvents.getClientTicks() * 1.5f)); + mStack.scale(0.5f, 0.5f, 1); + colorBlit(mStack, -12, -12, 128, 20, 24, 24, 256, 256, ColorUtil.packColor(255, 255, 255, 255)); + mStack.popPose(); + } + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); + for (int j = 0; j < (hover ? 2 : 1); j++) { + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), xx + 6, yy + 6, 8, 8, + 1, 1, 1, 0.75f, Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(runes[i].getSprite())); + tess.end(); + } + RenderSystem.disableBlend(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderTexture(0, BACKGROUND); + } + } + } +} diff --git a/src/main/java/elucent/eidolon/codex/SignIndexPage.java b/src/main/java/elucent/eidolon/codex/SignIndexPage.java index afb89de..c1489b6 100644 --- a/src/main/java/elucent/eidolon/codex/SignIndexPage.java +++ b/src/main/java/elucent/eidolon/codex/SignIndexPage.java @@ -1,36 +1,36 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import elucent.eidolon.Events; import elucent.eidolon.Registry; import elucent.eidolon.capability.IKnowledge; -import elucent.eidolon.capability.KnowledgeProvider; import elucent.eidolon.spell.Sign; import elucent.eidolon.util.ColorUtil; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldVertexBufferUploader; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.util.text.TranslationTextComponent; +import com.mojang.blaze3d.vertex.BufferBuilder; + +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; +import com.mojang.blaze3d.vertex.BufferUploader; +import net.minecraft.client.renderer.texture.TextureAtlas; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; public class SignIndexPage extends Page { public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_sign_index_page.png"); @@ -54,84 +54,84 @@ public SignIndexPage(SignEntry... pages) { @Override @OnlyIn(Dist.CLIENT) public boolean click(CodexGui gui, int x, int y, int mouseX, int mouseY) { - PlayerEntity entity = Minecraft.getInstance().player; - IKnowledge knowledge = entity.getCapability(KnowledgeProvider.CAPABILITY, null).resolve().get(); + Player entity = Minecraft.getInstance().player; + IKnowledge knowledge = entity.getCapability(IKnowledge.INSTANCE, null).resolve().get(); for (int i = 0; i < entries.length; i ++) { int xx = x + 8 + (i % 2) * 56, yy = y + 4 + (i / 2) * 52; - if (mouseX >= xx + 38 && mouseY >= yy + 38 && mouseX <= xx + 50 && mouseY <= yy + 50) { + if (knowledge.knowsSign(entries[i].sign) && mouseX >= xx && mouseX <= xx + 48 && mouseY >= yy && mouseY <= yy + 48) { gui.changeChapter(entries[i].chapter); - Minecraft.getInstance().player.playSound(SoundEvents.UI_BUTTON_CLICK, SoundCategory.NEUTRAL, 1.0f, 1.0f); - return true; - } - else if (knowledge.knowsSign(entries[i].sign) && mouseX >= xx && mouseX <= xx + 48 && mouseY >= yy && mouseY <= yy + 48) { - gui.addToChant(entries[i].sign); - entity.playSound(Registry.SELECT_SIGN.get(), SoundCategory.NEUTRAL, 0.5f, entity.world.rand.nextFloat() * 0.25f + 0.75f); + Minecraft.getInstance().player.playNotifySound(SoundEvents.UI_BUTTON_CLICK, SoundSource.NEUTRAL, 1.0f, 1.0f); return true; } +// else if (knowledge.knowsSign(entries[i].sign) && mouseX >= xx && mouseX <= xx + 48 && mouseY >= yy && mouseY <= yy + 48) { +// gui.addToChant(entries[i].sign); +// entity.playNotifySound(Registry.SELECT_SIGN.get(), SoundSource.NEUTRAL, 0.5f, entity.level.random.nextFloat() * 0.25f + 0.75f); +// return true; +// } } return false; } @OnlyIn(Dist.CLIENT) - static void colorBlit(MatrixStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { - Matrix4f matrix = mStack.getLast().getMatrix(); + static void colorBlit(PoseStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { + Matrix4f matrix = mStack.last().pose(); int maxX = x + width, maxY = y + height; float minU = (float)uOffset / textureWidth, minV = (float)vOffset / textureHeight; float maxU = minU + (float)width / textureWidth, maxV = minV + (float)height / textureHeight; int r = ColorUtil.getRed(color), g = ColorUtil.getGreen(color), b = ColorUtil.getBlue(color); - BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(matrix, (float)x, (float)maxY, 0).tex(minU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)maxY, 0).tex(maxU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)y, 0).tex(maxU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)x, (float)y, 0).tex(minU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.finishDrawing(); - RenderSystem.enableAlphaTest(); - WorldVertexBufferUploader.draw(bufferbuilder); + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferbuilder.vertex(matrix, (float)x, (float)maxY, 0).uv(minU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)maxY, 0).uv(maxU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)y, 0).uv(maxU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)x, (float)y, 0).uv(minU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.end(); + BufferUploader.end(bufferbuilder); } @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - PlayerEntity entity = Minecraft.getInstance().player; - IKnowledge knowledge = entity.getCapability(KnowledgeProvider.CAPABILITY, null).resolve().get(); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + Player entity = Minecraft.getInstance().player; + IKnowledge knowledge = entity.getCapability(IKnowledge.INSTANCE, null).resolve().get(); for (int i = 0; i < entries.length; i ++) { - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + RenderSystem.setShaderTexture(0, BACKGROUND); int xx = x + 8 + (i % 2) * 56, yy = y + 4 + (i / 2) * 52; Sign sign = entries[i].sign; boolean hover = knowledge.knowsSign(sign) && mouseX >= xx && mouseX <= xx + 48 && mouseY >= yy && mouseY <= yy + 48; - boolean infoHover = mouseX >= xx + 38 && mouseY >= yy + 38 && mouseX <= xx + 50 && mouseY <= yy + 50; + boolean infoHover = knowledge.knowsSign(sign) && mouseX >= xx + 38 && mouseY >= yy + 38 && mouseX <= xx + 50 && mouseY <= yy + 50; gui.blit(mStack, xx, yy, knowledge.knowsSign(entries[i].sign) ? 128 : 176, 0, 48, 48); if (knowledge.knowsSign(sign)) { - Tessellator tess = Tessellator.getInstance(); + Tesselator tess = Tesselator.getInstance(); RenderSystem.enableBlend(); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 1f / 256f); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); if (hover && !infoHover) { - mStack.push(); + mStack.pushPose(); mStack.translate(xx + 24, yy + 24, 0); - mStack.rotate(Vector3f.ZP.rotationDegrees(ClientEvents.getClientTicks() * 1.5f)); + mStack.mulPose(Vector3f.ZP.rotationDegrees(ClientEvents.getClientTicks() * 1.5f)); colorBlit(mStack, -18, -18, 128, 48, 36, 36, 256, 256, sign.getColor()); - mStack.pop(); + mStack.popPose(); } - Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); for (int j = 0; j < (hover && !infoHover ? 2 : 1); j++) { - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), xx + 12, yy + 12, 24, 24, - sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(sign.getSprite())); - tess.draw(); + float r = sign.getRed(), g = sign.getGreen(), b = sign.getBlue(); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), xx + 12, yy + 12, 24, 24, + sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(sign.getSprite())); + tess.end(); } - RenderSystem.defaultAlphaFunc(); RenderSystem.disableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderTexture(0, BACKGROUND); gui.blit(mStack, xx + 38, yy + 38, infoHover ? 188 : 176, 48, 12, 14); - + if (infoHover) { - gui.renderTooltip(mStack, new TranslationTextComponent("eidolon.codex.sign_suffix", new TranslationTextComponent(sign.getRegistryName().getNamespace() + ".sign." + sign.getRegistryName().getPath())), mouseX, mouseY); + gui.renderTooltip(mStack, new TranslatableComponent("eidolon.codex.sign_suffix", new TranslatableComponent(sign.getRegistryName().getNamespace() + ".sign." + sign.getRegistryName().getPath())), mouseX, mouseY); } } } diff --git a/src/main/java/elucent/eidolon/codex/SignPage.java b/src/main/java/elucent/eidolon/codex/SignPage.java index 528622d..b286225 100644 --- a/src/main/java/elucent/eidolon/codex/SignPage.java +++ b/src/main/java/elucent/eidolon/codex/SignPage.java @@ -1,29 +1,29 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import elucent.eidolon.Events; +import elucent.eidolon.Registry; import elucent.eidolon.spell.Sign; import elucent.eidolon.util.ColorUtil; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldVertexBufferUploader; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; +import com.mojang.blaze3d.vertex.BufferBuilder; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; +import com.mojang.blaze3d.vertex.BufferUploader; +import net.minecraft.client.renderer.texture.TextureAtlas; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.minecraft.resources.ResourceLocation; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; public class SignPage extends Page { public static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID, "textures/gui/codex_sign_page.png"); @@ -35,46 +35,44 @@ public SignPage(Sign sign) { } @OnlyIn(Dist.CLIENT) - static void colorBlit(MatrixStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { - Matrix4f matrix = mStack.getLast().getMatrix(); + static void colorBlit(PoseStack mStack, int x, int y, int uOffset, int vOffset, int width, int height, int textureWidth, int textureHeight, int color) { + Matrix4f matrix = mStack.last().pose(); int maxX = x + width, maxY = y + height; float minU = (float)uOffset / textureWidth, minV = (float)vOffset / textureHeight; float maxU = minU + (float)width / textureWidth, maxV = minV + (float)height / textureHeight; int r = ColorUtil.getRed(color), g = ColorUtil.getGreen(color), b = ColorUtil.getBlue(color); - BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(matrix, (float)x, (float)maxY, 0).tex(minU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)maxY, 0).tex(maxU, maxV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)maxX, (float)y, 0).tex(maxU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.pos(matrix, (float)x, (float)y, 0).tex(minU, minV).color(r, g, b, 255).endVertex(); - bufferbuilder.finishDrawing(); - RenderSystem.enableAlphaTest(); - WorldVertexBufferUploader.draw(bufferbuilder); + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferbuilder.vertex(matrix, (float)x, (float)maxY, 0).uv(minU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)maxY, 0).uv(maxU, maxV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)maxX, (float)y, 0).uv(maxU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.vertex(matrix, (float)x, (float)y, 0).uv(minU, minV).color(r, g, b, 255).endVertex(); + bufferbuilder.end(); + BufferUploader.end(bufferbuilder); } @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); - Tessellator tess = Tessellator.getInstance(); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + RenderSystem.setShaderTexture(0, BACKGROUND); + Tesselator tess = Tesselator.getInstance(); RenderSystem.enableBlend(); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 1f / 256f); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); - mStack.push(); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); + mStack.pushPose(); mStack.translate(x + 64, y + 80, 0); // mStack.scale(0.9f, 0.9f, 0.9f); - mStack.rotate(Vector3f.ZP.rotationDegrees(ClientEvents.getClientTicks() * 1.5f)); + mStack.mulPose(Vector3f.ZP.rotationDegrees(ClientEvents.getClientTicks() * 1.5f)); colorBlit(mStack, -40, -40, 128, 96, 80, 80, 256, 256, sign.getColor()); - mStack.pop(); - Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + mStack.popPose(); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); for (int i = 0; i < 2; i ++) { - RenderUtil.litQuad(mStack, IRenderTypeBuffer.getImpl(tess.getBuffer()), x + 44, y + 60, 40, 40, - sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(sign.getSprite())); - tess.draw(); + RenderUtil.litQuad(mStack, MultiBufferSource.immediate(tess.getBuilder()), x + 44, y + 60, 40, 40, + sign.getRed(), sign.getGreen(), sign.getBlue(), Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(sign.getSprite())); + tess.end(); } - RenderSystem.defaultAlphaFunc(); RenderSystem.disableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); } diff --git a/src/main/java/elucent/eidolon/codex/SmeltingPage.java b/src/main/java/elucent/eidolon/codex/SmeltingPage.java index cf9b5e9..17a7d91 100644 --- a/src/main/java/elucent/eidolon/codex/SmeltingPage.java +++ b/src/main/java/elucent/eidolon/codex/SmeltingPage.java @@ -1,9 +1,10 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -20,7 +21,7 @@ public SmeltingPage(ItemStack result, ItemStack input) { @Override @OnlyIn(Dist.CLIENT) - public void renderIngredients(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void renderIngredients(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { drawItem(gui, mStack, input, x + 56, y + 34, mouseX, mouseY); drawItem(gui, mStack, result,x + 56, y + 107, mouseX, mouseY); } diff --git a/src/main/java/elucent/eidolon/codex/TextPage.java b/src/main/java/elucent/eidolon/codex/TextPage.java index b60267c..149b308 100644 --- a/src/main/java/elucent/eidolon/codex/TextPage.java +++ b/src/main/java/elucent/eidolon/codex/TextPage.java @@ -1,9 +1,10 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -18,7 +19,7 @@ public TextPage(String textKey) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - drawWrappingText(gui, mStack, I18n.format(text), x + 4, y + 4, 120); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + drawWrappingText(gui, mStack, I18n.get(text), x + 4, y + 4, 120); } } diff --git a/src/main/java/elucent/eidolon/codex/TitlePage.java b/src/main/java/elucent/eidolon/codex/TitlePage.java index 0635146..6da1109 100644 --- a/src/main/java/elucent/eidolon/codex/TitlePage.java +++ b/src/main/java/elucent/eidolon/codex/TitlePage.java @@ -1,10 +1,11 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -20,10 +21,10 @@ public TitlePage(String textKey) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - String title = I18n.format(this.title); - int titleWidth = Minecraft.getInstance().fontRenderer.getStringWidth(title); - drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().fontRenderer.FONT_HEIGHT); - drawWrappingText(gui, mStack, I18n.format(text), x + 4, y + 24, 120); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + String title = I18n.get(this.title); + int titleWidth = Minecraft.getInstance().font.width(title); + drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().font.lineHeight); + drawWrappingText(gui, mStack, I18n.get(text), x + 4, y + 24, 120); } } diff --git a/src/main/java/elucent/eidolon/codex/TitledIndexPage.java b/src/main/java/elucent/eidolon/codex/TitledIndexPage.java index 7fbe7d8..ae0d0d0 100644 --- a/src/main/java/elucent/eidolon/codex/TitledIndexPage.java +++ b/src/main/java/elucent/eidolon/codex/TitledIndexPage.java @@ -1,11 +1,10 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; -import elucent.eidolon.Eidolon; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.resources.language.I18n; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -25,13 +24,13 @@ public boolean click(CodexGui gui, int x, int y, int mouseX, int mouseY) { @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { gui.blit(mStack, x, y, 128, 64, 128, 32); - String title = I18n.format(this.title); - int titleWidth = Minecraft.getInstance().fontRenderer.getStringWidth(title); - drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().fontRenderer.FONT_HEIGHT); + String title = I18n.get(this.title); + int titleWidth = Minecraft.getInstance().font.width(title); + drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().font.lineHeight); - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + RenderSystem.setShaderTexture(0, BACKGROUND); super.render(gui, mStack, x, y + 16, mouseX, mouseY); } } diff --git a/src/main/java/elucent/eidolon/codex/TitledRitualPage.java b/src/main/java/elucent/eidolon/codex/TitledRitualPage.java index a34240d..3151093 100644 --- a/src/main/java/elucent/eidolon/codex/TitledRitualPage.java +++ b/src/main/java/elucent/eidolon/codex/TitledRitualPage.java @@ -1,10 +1,12 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.ritual.Ritual; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -18,14 +20,14 @@ public TitledRitualPage(String textKey, Ritual ritual, ItemStack center, RitualI @Override @OnlyIn(Dist.CLIENT) - public void render(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + public void render(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { + RenderSystem.setShaderTexture(0, BACKGROUND); gui.blit(mStack, x, y, 128, 64, 128, 24); - String title = I18n.format(this.title); - int titleWidth = Minecraft.getInstance().fontRenderer.getStringWidth(title); - drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().fontRenderer.FONT_HEIGHT); + String title = I18n.get(this.title); + int titleWidth = Minecraft.getInstance().font.width(title); + drawText(gui, mStack, title, x + 64 - titleWidth / 2, y + 15 - Minecraft.getInstance().font.lineHeight); - Minecraft.getInstance().getTextureManager().bindTexture(BACKGROUND); + RenderSystem.setShaderTexture(0, BACKGROUND); super.render(gui, mStack, x, y, mouseX, mouseY); } } diff --git a/src/main/java/elucent/eidolon/codex/WorktablePage.java b/src/main/java/elucent/eidolon/codex/WorktablePage.java index 27daa28..1fc0a3b 100644 --- a/src/main/java/elucent/eidolon/codex/WorktablePage.java +++ b/src/main/java/elucent/eidolon/codex/WorktablePage.java @@ -1,9 +1,10 @@ package elucent.eidolon.codex; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -20,7 +21,7 @@ public WorktablePage(ItemStack result, ItemStack... inputs) { @Override @OnlyIn(Dist.CLIENT) - public void renderIngredients(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) { + public void renderIngredients(CodexGui gui, PoseStack mStack, int x, int y, int mouseX, int mouseY) { for (int i = 0; i < 3; i ++) { for (int j = 0; j < 3; j ++) { int index = i * 3 + j; diff --git a/src/main/java/elucent/eidolon/deity/DarkDeity.java b/src/main/java/elucent/eidolon/deity/DarkDeity.java index a214281..535d03a 100644 --- a/src/main/java/elucent/eidolon/deity/DarkDeity.java +++ b/src/main/java/elucent/eidolon/deity/DarkDeity.java @@ -2,10 +2,10 @@ import elucent.eidolon.capability.Facts; import elucent.eidolon.capability.IReputation; -import elucent.eidolon.spell.KnowledgeUtil; import elucent.eidolon.spell.Signs; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; public class DarkDeity extends Deity { public DarkDeity(ResourceLocation id, int red, int green, int blue) { @@ -13,7 +13,7 @@ public DarkDeity(ResourceLocation id, int red, int green, int blue) { } @Override - public void onReputationUnlock(PlayerEntity player, IReputation rep, ResourceLocation lock) { + public void onReputationUnlock(Player player, IReputation rep, ResourceLocation lock) { if (lock.equals(DeityLocks.SACRIFICE_MOB)) { KnowledgeUtil.grantSign(player, Signs.SOUL_SIGN); } @@ -23,13 +23,13 @@ else if (lock.equals(DeityLocks.SACRIFICE_VILLAGER)) { } @Override - public void onReputationChange(PlayerEntity player, IReputation rep, double prev, double current) { - if (!KnowledgeUtil.knowsSign(player, Signs.BLOOD_SIGN) && current >= 3) { + public void onReputationChange(Player player, IReputation rep, double prev, double current) { + if (!KnowledgeUtil.knowsSign(player, Signs.BLOOD_SIGN) && (current >= 3 || rep.hasLock(player, id, DeityLocks.SACRIFICE_MOB))) { rep.setReputation(player, id, 3); rep.lock(player, id, DeityLocks.SACRIFICE_MOB); KnowledgeUtil.grantSign(player, Signs.BLOOD_SIGN); } - else if (!KnowledgeUtil.knowsFact(player, Facts.VILLAGER_SACRIFICE) && current >= 15) { + else if (!KnowledgeUtil.knowsFact(player, Facts.VILLAGER_SACRIFICE) && (current >= 15 || rep.hasLock(player, id, DeityLocks.SACRIFICE_VILLAGER))) { rep.setReputation(player, id, 15); rep.lock(player, id, DeityLocks.SACRIFICE_VILLAGER); KnowledgeUtil.grantFact(player, Facts.VILLAGER_SACRIFICE); diff --git a/src/main/java/elucent/eidolon/deity/Deities.java b/src/main/java/elucent/eidolon/deity/Deities.java index df295b6..6539911 100644 --- a/src/main/java/elucent/eidolon/deity/Deities.java +++ b/src/main/java/elucent/eidolon/deity/Deities.java @@ -1,12 +1,11 @@ package elucent.eidolon.deity; -import elucent.eidolon.Eidolon; -import net.minecraft.util.ResourceLocation; - -import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; + public class Deities { static Map deities = new HashMap<>(); @@ -20,6 +19,6 @@ public static Deity find(ResourceLocation deity) { } public static final Deity - DARK_DEITY = register(new DarkDeity(new ResourceLocation(Eidolon.MODID, "dark"), 154, 77, 255)); - // LIGHT = new new ResourceLocation(Eidolon.MODID, "light"); + DARK_DEITY = register(new DarkDeity(new ResourceLocation(Eidolon.MODID, "dark"), 154, 77, 255)), + LIGHT_DEITY = register(new LightDeity(new ResourceLocation(Eidolon.MODID, "light"), 255, 230, 117)); } diff --git a/src/main/java/elucent/eidolon/deity/Deity.java b/src/main/java/elucent/eidolon/deity/Deity.java index 0e3afa0..109f94b 100644 --- a/src/main/java/elucent/eidolon/deity/Deity.java +++ b/src/main/java/elucent/eidolon/deity/Deity.java @@ -1,13 +1,16 @@ package elucent.eidolon.deity; -import elucent.eidolon.capability.IReputation; -import elucent.eidolon.capability.ReputationEntry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; - -import javax.annotation.Resource; +import java.util.List; +import java.util.TreeMap; import java.util.UUID; +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.research.Research; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; + public abstract class Deity { ResourceLocation id; int red, green, blue; @@ -34,7 +37,89 @@ public float getBlue() { public ResourceLocation getId() { return id; } + + public interface StageRequirement { + boolean isMet(Player player); + } + + public class ResearchRequirement implements StageRequirement { + Research r; + public ResearchRequirement(Research r) { + this.r = r; + } + + @Override + public boolean isMet(Player player) { + return KnowledgeUtil.knowsResearch(player, r.getRegistryName()); + } + } + + public class SignRequirement implements StageRequirement { + Sign sign; + public SignRequirement(Sign sign) { + this.sign = sign; + } + + @Override + public boolean isMet(Player player) { + return KnowledgeUtil.knowsSign(player, sign); + } + } + + public class Stage { + ResourceLocation id; + int rep; // Required reputation to meet this stage. + List reqs; // Requirements to meet this stage. + boolean major; // Whether or not this is considered a major stage. + + public Stage(ResourceLocation id, int rep, boolean major) { + this.id = id; + this.rep = rep; + this.major = major; + } + + boolean satisfiedBy(Player player) { + for (StageRequirement req : reqs) { + + } + return true; + } + } + + public class Progression { + TreeMap steps; + int max; + + public Progression(Stage... stages) { + this.steps = new TreeMap(); + for (Stage s : stages) this.steps.put(s.rep, s); + max = this.steps.lastKey(); + } + + public Stage next(double rep) { + return steps.ceilingEntry((int)(rep + 0.5f)).getValue(); + } + + public Stage last(double rep) { + return steps.floorEntry((int)rep).getValue(); + } + + public boolean progress(IReputation rep, Player player) { + double level = rep.getReputation(player, Deity.this.getId()); + if (level >= max) return false; // Can't progress past max. + Stage s = next(level); + if (s.satisfiedBy(player)) return true; + else if (level > s.rep) { + rep.setReputation(player, Deity.this.getId(), s.rep); + } + return false; + } + + public void regress(IReputation rep, Player player) { + + } + } - public abstract void onReputationUnlock(PlayerEntity player, IReputation rep, ResourceLocation lock); - public abstract void onReputationChange(PlayerEntity player, IReputation rep, double prev, double current); + public abstract void onReputationUnlock(Player player, IReputation rep, ResourceLocation lock); + public abstract void onReputationChange(Player player, IReputation rep, double prev, double current); } diff --git a/src/main/java/elucent/eidolon/deity/DeityLocks.java b/src/main/java/elucent/eidolon/deity/DeityLocks.java index 5dfe806..46b913c 100644 --- a/src/main/java/elucent/eidolon/deity/DeityLocks.java +++ b/src/main/java/elucent/eidolon/deity/DeityLocks.java @@ -1,10 +1,12 @@ package elucent.eidolon.deity; import elucent.eidolon.Eidolon; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; public class DeityLocks { public static final ResourceLocation SACRIFICE_MOB = new ResourceLocation(Eidolon.MODID, "sacrifice_mob"), - SACRIFICE_VILLAGER = new ResourceLocation(Eidolon.MODID, "sacrifice_villager"); + SACRIFICE_VILLAGER = new ResourceLocation(Eidolon.MODID, "sacrifice_villager"), + BASIC_INCENSE_PRAYER = new ResourceLocation(Eidolon.MODID, "basic_incense"), + SMITE_UNDEAD = new ResourceLocation(Eidolon.MODID, "smite_undead"); } diff --git a/src/main/java/elucent/eidolon/deity/LightDeity.java b/src/main/java/elucent/eidolon/deity/LightDeity.java new file mode 100644 index 0000000..8b1bbad --- /dev/null +++ b/src/main/java/elucent/eidolon/deity/LightDeity.java @@ -0,0 +1,29 @@ +package elucent.eidolon.deity; + +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.spell.Signs; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; + +public class LightDeity extends Deity { + public LightDeity(ResourceLocation id, int red, int green, int blue) { + super(id, red, green, blue); + } + + @Override + public void onReputationUnlock(Player player, IReputation rep, ResourceLocation lock) { + if (lock.equals(DeityLocks.BASIC_INCENSE_PRAYER)) { + KnowledgeUtil.grantSign(player, Signs.SOUL_SIGN); + } + } + + @Override + public void onReputationChange(Player player, IReputation rep, double prev, double current) { + if (!KnowledgeUtil.knowsSign(player, Signs.FLAME_SIGN) && current >= 3) { + rep.setReputation(player, id, 3); + rep.lock(player, id, DeityLocks.BASIC_INCENSE_PRAYER); + KnowledgeUtil.grantSign(player, Signs.FLAME_SIGN); + } + } +} diff --git a/src/main/java/elucent/eidolon/deity/RegisterDeitiesEvent.java b/src/main/java/elucent/eidolon/deity/RegisterDeitiesEvent.java new file mode 100644 index 0000000..3deba46 --- /dev/null +++ b/src/main/java/elucent/eidolon/deity/RegisterDeitiesEvent.java @@ -0,0 +1,8 @@ +package elucent.eidolon.deity; + +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.event.IModBusEvent; + +public class RegisterDeitiesEvent extends Event implements IModBusEvent { + +} diff --git a/src/main/java/elucent/eidolon/entity/AngelArrowEntity.java b/src/main/java/elucent/eidolon/entity/AngelArrowEntity.java new file mode 100644 index 0000000..9b01713 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/AngelArrowEntity.java @@ -0,0 +1,137 @@ +package elucent.eidolon.entity; + +import java.util.Comparator; +import java.util.List; + +import elucent.eidolon.Registry; +import elucent.eidolon.mixin.AbstractArrowMixin; +import net.minecraft.client.Minecraft; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; +import net.minecraftforge.entity.IEntityAdditionalSpawnData; +import net.minecraftforge.network.NetworkHooks; +import net.minecraftforge.registries.ForgeRegistries; + +public class AngelArrowEntity extends AbstractArrow implements IEntityAdditionalSpawnData { + AbstractArrow internal = null; + + public AngelArrowEntity(EntityType type, Level worldIn) { + super(type, worldIn); + } + public AngelArrowEntity(Level worldIn, LivingEntity shooter) { + super(Registry.ANGEL_ARROW.get(), shooter, worldIn); + } + + public void setArrow(AbstractArrow entity) { + this.internal = entity; + internal.copyPosition(this); + } + + public static float lerpDegrees(float a, float b, float t) { + float d1 = Math.abs(b - a), d2 = Math.abs((b - 360) - a), d3 = Math.abs((b + 360) - a); + if (d2 > d3 && d2 > d1) { + b -= 360; + d1 = d2; + } + if (d3 > d2 && d3 > d1) { + b += 360; + d1 = d3; + } + return a + d1 * t; + } + + @Override + public void tick() { + if (internal == null) { + removeAfterChangingDimensions(); + return; + } + super.tick(); + internal.tick(); + internal.xo = xo; + internal.yo = yo; + internal.zo = zo; + internal.xRotO = xRotO; + internal.yRotO = yRotO; + internal.copyPosition(this); + internal.setDeltaMovement(getDeltaMovement()); + if (!inGround) { + List entities = level.getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(12), (e) -> { + return e != getOwner() && e.isAlive() && (!level.isClientSide || e != Minecraft.getInstance().player); + }); + if (!entities.isEmpty()) { + for (Entity e : entities) System.out.println(e); + LivingEntity nearest = entities.stream().min(Comparator.comparingDouble((e) -> e.distanceToSqr(this))).get(); + Vec3 diff = nearest.position().add(0, nearest.getBbHeight() / 2, 0).subtract(position()); + double speed = getDeltaMovement().length(); + Vec3 newmotion = getDeltaMovement().add(diff.normalize().scale(speed)).scale(0.5); + if (newmotion.length() == 0) newmotion = newmotion.add(0.01, 0, 0); // avoid divide by zero + setDeltaMovement(newmotion.scale(speed / newmotion.length())); + } + } + } + + @Override + protected ItemStack getPickupItem() { + return internal == null ? ItemStack.EMPTY : + ((AbstractArrowMixin)(Object)internal).callGetPickupItem(); + } + + @Override + public void onHitEntity(EntityHitResult result) { + ((AbstractArrowMixin)(Object)internal).callOnHitEntity(result); + if (internal.isRemoved()) remove(RemovalReason.DISCARDED); + } + + @Override + public void addAdditionalSaveData(CompoundTag nbt) { + super.addAdditionalSaveData(nbt); + nbt.putString("type", internal.getType().getRegistryName().toString()); + nbt.put("data", internal.serializeNBT()); + } + + @Override + public void readAdditionalSaveData(CompoundTag nbt) { + super.readAdditionalSaveData(nbt); + ResourceLocation rl = new ResourceLocation(nbt.getString("type")); + EntityType type = ForgeRegistries.ENTITIES.getValue(rl); + if (type == null) removeAfterChangingDimensions(); + + internal = (AbstractArrow)type.create(level); + internal.deserializeNBT(nbt.getCompound("data")); + } + + @Override + public Packet getAddEntityPacket() { + return NetworkHooks.getEntitySpawningPacket(this); + } + + @Override + public void writeSpawnData(FriendlyByteBuf buffer) { + CompoundTag extra = new CompoundTag(); + extra.putString("type", internal.getType().getRegistryName().toString()); + extra.put("data", internal.serializeNBT()); + buffer.writeNbt(extra); + } + + @Override + public void readSpawnData(FriendlyByteBuf additionalData) { + CompoundTag extra = additionalData.readNbt(); + ResourceLocation rl = new ResourceLocation(extra.getString("type")); + EntityType type = ForgeRegistries.ENTITIES.getValue(rl); + if (type == null) removeAfterChangingDimensions(); + + internal = (AbstractArrow)type.create(level); + internal.deserializeNBT(extra.getCompound("data")); + } +} diff --git a/src/main/java/elucent/eidolon/entity/AngelArrowRenderer.java b/src/main/java/elucent/eidolon/entity/AngelArrowRenderer.java new file mode 100644 index 0000000..dd93005 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/AngelArrowRenderer.java @@ -0,0 +1,24 @@ +package elucent.eidolon.entity; + +import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +import net.minecraft.resources.ResourceLocation; + +public class AngelArrowRenderer extends EntityRenderer { + public AngelArrowRenderer(Context erm) { + super(erm); + } + + @Override + public void render(AngelArrowEntity entityIn, float entityYaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) { + if (entityIn.internal != null) entityRenderDispatcher.getRenderer(entityIn.internal).render(entityIn.internal, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); + } + + @Override + public ResourceLocation getTextureLocation(AngelArrowEntity entity) { + return entity.internal == null ? new ResourceLocation("unknown") : entityRenderDispatcher.getRenderer(entity.internal).getTextureLocation(entity.internal); + } +} diff --git a/src/main/java/elucent/eidolon/entity/BonechillProjectileEntity.java b/src/main/java/elucent/eidolon/entity/BonechillProjectileEntity.java index 0ffaa34..d7e641c 100644 --- a/src/main/java/elucent/eidolon/entity/BonechillProjectileEntity.java +++ b/src/main/java/elucent/eidolon/entity/BonechillProjectileEntity.java @@ -5,20 +5,19 @@ import elucent.eidolon.network.Networking; import elucent.eidolon.particle.Particles; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.potion.EffectInstance; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IndirectEntityDamageSource; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.damagesource.IndirectEntityDamageSource; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; public class BonechillProjectileEntity extends SpellProjectileEntity { - public BonechillProjectileEntity(EntityType entityTypeIn, World worldIn) { + public BonechillProjectileEntity(EntityType entityTypeIn, Level worldIn) { super(entityTypeIn, worldIn); } @@ -26,43 +25,43 @@ public BonechillProjectileEntity(EntityType entityTypeIn, World worldIn) { public void tick() { super.tick(); - Vector3d motion = getMotion(); - Vector3d pos = getPositionVec(); - Vector3d norm = motion.normalize().scale(0.025f); + Vec3 motion = getDeltaMovement(); + Vec3 pos = position(); + Vec3 norm = motion.normalize().scale(0.025f); for (int i = 0; i < 8; i ++) { - double lerpX = MathHelper.lerp(i / 8.0f, prevPosX, pos.x); - double lerpY = MathHelper.lerp(i / 8.0f, prevPosY, pos.y); - double lerpZ = MathHelper.lerp(i / 8.0f, prevPosZ, pos.z); + double lerpX = Mth.lerp(i / 8.0f, xOld, pos.x); + double lerpY = Mth.lerp(i / 8.0f, yOld, pos.y); + double lerpZ = Mth.lerp(i / 8.0f, zOld, pos.z); Particles.create(Registry.WISP_PARTICLE) .addVelocity(-norm.x, -norm.y, -norm.z) .setAlpha(0.0625f, 0).setScale(0.625f, 0) .setColor(0.875f, 1, 1, 0.375f, 0.5f, 0.75f) .setLifetime(5) - .spawn(world, lerpX, lerpY, lerpZ); + .spawn(level, lerpX, lerpY, lerpZ); Particles.create(Registry.WISP_PARTICLE) .addVelocity(-norm.x, -norm.y, -norm.z) .setAlpha(0.125f, 0).setScale(0.25f, 0.125f) .setColor(1, 0.75f, 0.875f, 0.375f, 0.5f, 0.75f) .setLifetime(20) - .spawn(world, lerpX, lerpY, lerpZ); + .spawn(level, lerpX, lerpY, lerpZ); } } @Override - protected void onImpact(RayTraceResult ray, Entity target) { - target.attackEntityFrom(new IndirectEntityDamageSource(Registry.FROST_DAMAGE.getDamageType(), this, world.getPlayerByUuid(casterId)), 4.0f); + protected void onImpact(HitResult ray, Entity target) { + target.hurt(new IndirectEntityDamageSource(Registry.FROST_DAMAGE.getMsgId(), this, level.getPlayerByUUID(casterId)), 4.0f); if (target instanceof LivingEntity) - ((LivingEntity)target).addPotionEffect(new EffectInstance(Registry.CHILLED_EFFECT.get(), 300, 0)); + ((LivingEntity)target).addEffect(new MobEffectInstance(Registry.CHILLED_EFFECT.get(), 300, 0)); onImpact(ray); } @Override - protected void onImpact(RayTraceResult ray) { - setDead(); - if (!world.isRemote) { - Vector3d pos = ray.getHitVec(); - world.playSound(null, pos.x, pos.y, pos.z, Registry.SPLASH_BONECHILL_EVENT.get(), SoundCategory.NEUTRAL, 0.5f, rand.nextFloat() * 0.2f + 0.9f); - Networking.sendToTracking(world, getPosition(), new MagicBurstEffectPacket(pos.x, pos.y, pos.z, ColorUtil.packColor(255, 192, 224, 255), ColorUtil.packColor(255, 96, 128, 192))); + protected void onImpact(HitResult ray) { + kill(); + if (!level.isClientSide) { + Vec3 pos = ray.getLocation(); + level.playSound(null, pos.x, pos.y, pos.z, Registry.SPLASH_BONECHILL_EVENT.get(), SoundSource.NEUTRAL, 0.5f, random.nextFloat() * 0.2f + 0.9f); + Networking.sendToTracking(level, blockPosition(), new MagicBurstEffectPacket(pos.x, pos.y, pos.z, ColorUtil.packColor(255, 192, 224, 255), ColorUtil.packColor(255, 96, 128, 192))); } } } diff --git a/src/main/java/elucent/eidolon/entity/ChantCasterEntity.java b/src/main/java/elucent/eidolon/entity/ChantCasterEntity.java index 5c5c296..618b74f 100644 --- a/src/main/java/elucent/eidolon/entity/ChantCasterEntity.java +++ b/src/main/java/elucent/eidolon/entity/ChantCasterEntity.java @@ -1,122 +1,212 @@ package elucent.eidolon.entity; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +import com.mojang.math.Vector3f; + import elucent.eidolon.Registry; import elucent.eidolon.network.Networking; import elucent.eidolon.network.SpellCastPacket; +import elucent.eidolon.particle.RuneParticleData; import elucent.eidolon.particle.SignParticleData; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Rune.RuneResult; +import elucent.eidolon.spell.Runes; import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.SignSequence; import elucent.eidolon.spell.Signs; import elucent.eidolon.spell.Spell; import elucent.eidolon.spell.Spells; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.nbt.StringNBT; -import net.minecraft.network.IPacket; -import net.minecraft.network.datasync.DataParameter; -import net.minecraft.network.datasync.DataSerializers; -import net.minecraft.network.datasync.EntityDataManager; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.entity.IEntityAdditionalSpawnData; +import net.minecraftforge.network.NetworkHooks; -import java.util.*; +public class ChantCasterEntity extends Entity implements IEntityAdditionalSpawnData { + public static final EntityDataAccessor RUNES = SynchedEntityData.defineId(ChantCasterEntity.class, EntityDataSerializers.COMPOUND_TAG); + public static final EntityDataAccessor SIGNS = SynchedEntityData.defineId(ChantCasterEntity.class, EntityDataSerializers.COMPOUND_TAG); + public static final EntityDataAccessor INDEX = SynchedEntityData.defineId(ChantCasterEntity.class, EntityDataSerializers.INT); + public static final EntityDataAccessor> CASTER_ID = SynchedEntityData.>defineId(ChantCasterEntity.class, EntityDataSerializers.OPTIONAL_UUID); + public static final EntityDataAccessor SUCCEEDED = SynchedEntityData.defineId(ChantCasterEntity.class, EntityDataSerializers.BOOLEAN); + int timer = 0, deathTimer = 0; + Vec3 look; -public class ChantCasterEntity extends Entity { - public static final DataParameter SIGNS = EntityDataManager.createKey(ChantCasterEntity.class, DataSerializers.COMPOUND_NBT); - public static final DataParameter INDEX = EntityDataManager.createKey(ChantCasterEntity.class, DataSerializers.VARINT); - public static final DataParameter> CASTER_ID = EntityDataManager.>createKey(ChantCasterEntity.class, DataSerializers.OPTIONAL_UNIQUE_ID); - int timer = 0; - - public ChantCasterEntity(World world, PlayerEntity caster, List signs) { + public ChantCasterEntity(Level world, Player caster, List runes, Vec3 look) { super(Registry.CHANT_CASTER.get(), world); - ListNBT list = new ListNBT(); - for (Sign sign : signs) list.add(StringNBT.valueOf(sign.getRegistryName().toString())); - CompoundNBT nbt = new CompoundNBT(); - nbt.put("signs", list); - getDataManager().set(SIGNS, nbt); - getDataManager().set(CASTER_ID, Optional.of(caster.getUniqueID())); + this.look = look; + setRunesTag(runes); + getEntityData().set(CASTER_ID, Optional.of(caster.getUUID())); } - public ChantCasterEntity(EntityType entityTypeIn, World worldIn) { + public ChantCasterEntity(EntityType entityTypeIn, Level worldIn) { super(entityTypeIn, worldIn); } + + protected CompoundTag getNoRunesTag() { + CompoundTag emptyRunes = new CompoundTag(); + emptyRunes.put("runes", new ListTag()); + return emptyRunes; + } + + protected List loadRunesTag() { + List runes = new ArrayList<>(); + ListTag runesTag = getEntityData().get(RUNES).getList("runes", Tag.TAG_STRING); + for (int i = 0; i < runesTag.size(); i ++) { + Rune r = Runes.find(new ResourceLocation(runesTag.getString(i))); + if (r != null) runes.add(r); + } + return runes; + } + + protected void setRunesTag(List runes) { + ListTag runesList = new ListTag(); + CompoundTag runesTag = new CompoundTag(); + for (Rune r : runes) runesList.add(StringTag.valueOf(r.getRegistryName().toString())); + runesTag.put("runes", runesList); + getEntityData().set(RUNES, runesTag); + } @Override - protected void registerData() { - getDataManager().register(SIGNS, new CompoundNBT()); - getDataManager().register(INDEX, 0); - getDataManager().register(CASTER_ID, Optional.empty()); + protected void defineSynchedData() { + getEntityData().define(RUNES, getNoRunesTag()); + getEntityData().define(SIGNS, new SignSequence().serializeNbt()); + getEntityData().define(INDEX, 0); + getEntityData().define(CASTER_ID, Optional.empty()); + getEntityData().define(SUCCEEDED, false); } @Override public void tick() { super.tick(); - + if (deathTimer > 0) { + deathTimer --; + if (deathTimer <= 0) remove(RemovalReason.KILLED); + return; + } if (timer > 0) { timer --; - if (timer == 0) { - ListNBT signData = getDataManager().get(SIGNS).getList("signs", Constants.NBT.TAG_STRING); - Optional optuuid = getDataManager().get(CASTER_ID); - if (!world.isRemote && optuuid.isPresent()) { - List signs = new ArrayList<>(); - for (int i = 0; i < signData.size(); i++) - signs.add(Signs.find(new ResourceLocation(signData.getString(i)))); - Spell spell = Spells.find(signs); - PlayerEntity player = world.getPlayerByUuid(optuuid.get()); - if (spell != null && player != null && spell.canCast(world, getPosition(), player, signs)) { - spell.cast(world, getPosition(), player, signs); - Networking.sendToTracking(world, getPosition(), new SpellCastPacket(player, getPosition(), spell, signs)); + if (timer <= 0) { + CompoundTag signData = getEntityData().get(SIGNS); + Optional optuuid = getEntityData().get(CASTER_ID); + if (!level.isClientSide && optuuid.isPresent()) { + SignSequence seq = SignSequence.deserializeNbt(signData); + Spell spell = Spells.find(seq); + Player player = level.getPlayerByUUID(optuuid.get()); + if (spell != null && player != null && spell.canCast(level, blockPosition(), player, seq)) { + spell.cast(level, blockPosition(), player, seq); + Networking.sendToTracking(level, blockPosition(), new SpellCastPacket(player, blockPosition(), spell, seq)); + getEntityData().set(SUCCEEDED, true); + } + else { + level.playSound(null, blockPosition(), SoundEvents.FIRE_EXTINGUISH, SoundSource.NEUTRAL, 1.0f, 1.0f); + getEntityData().set(SUCCEEDED, false); } - else world.playSound(null, getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 1.0f, 1.0f); } - if (!world.isRemote) setDead(); + deathTimer = 20; return; } } - if (ticksExisted % 5 == 0) { - ListNBT signs = getDataManager().get(SIGNS).getList("signs", Constants.NBT.TAG_STRING); - int index = getDataManager().get(INDEX); - if (index >= signs.size()) return; - Sign sign = Signs.find(new ResourceLocation(signs.getString(index))); - double x = getPosX() + 0.2 * rand.nextGaussian(), - y = getPosY() + 0.2 * rand.nextGaussian(), - z = getPosZ() + 0.2 * rand.nextGaussian(); - for (int i = 0; i < 2; i ++) { - world.addParticle(new SignParticleData(sign), x, y, z, 0, 0, 0); + if (tickCount % 5 == 0) { + List runes = loadRunesTag(); + SignSequence seq = SignSequence.deserializeNbt(getEntityData().get(SIGNS)); + Vector3f initColor = seq.getAverageColor(); + + int index = getEntityData().get(INDEX); + if (index >= runes.size()) return; + Rune rune = runes.get(index); + RuneResult result = rune.doEffect(seq); + if (result == RuneResult.FAIL) { + if (!level.isClientSide) { + level.playSound(null, blockPosition(), SoundEvents.FIRE_EXTINGUISH, SoundSource.NEUTRAL, 1.0f, 1.0f); + getEntityData().set(INDEX, runes.size()); + getEntityData().set(SUCCEEDED, false); + } + deathTimer = 20; + return; } - world.playSound(null, getPosition(), Registry.CHANT_WORD.get(), SoundCategory.NEUTRAL, 0.7f, rand.nextFloat() * 0.375f + 0.625f); - if (index + 1 >= signs.size()) { - timer = 40; + else { + Vector3f afterColor = seq.getAverageColor(); + double x = getX() + 0.1 * random.nextGaussian(), + y = getY() + 0.1 * random.nextGaussian(), + z = getZ() + 0.1 * random.nextGaussian(); + for (int i = 0; i < 2; i ++) { + level.addParticle(new RuneParticleData( + rune, + initColor.x(), initColor.y(), initColor.z(), + afterColor.x(), afterColor.y(), afterColor.z() + ), x, y, z, look.x * 0.03, look.y * 0.03, look.z * 0.03); + } + level.playSound(null, blockPosition(), Registry.CHANT_WORD.get(), SoundSource.NEUTRAL, 0.7f, random.nextFloat() * 0.375f + 0.625f); + if (index + 1 >= runes.size()) { + timer = 20; + } + if (!level.isClientSide) { + getEntityData().set(INDEX, index + 1); + getEntityData().set(SIGNS, seq.serializeNbt()); + } } - if (!world.isRemote) getDataManager().set(INDEX, index + 1); } } @Override - protected void readAdditional(CompoundNBT compound) { - getDataManager().set(SIGNS, compound.getCompound("signs_tag")); - getDataManager().set(INDEX, compound.getInt("index")); - getDataManager().set(CASTER_ID, Optional.of(compound.getUniqueId("caster_id"))); + protected void readAdditionalSaveData(CompoundTag compound) { + getEntityData().set(RUNES, compound.getCompound("runes_tag")); + getEntityData().set(SIGNS, compound.getCompound("signs_tag")); + getEntityData().set(INDEX, compound.getInt("index")); + getEntityData().set(CASTER_ID, Optional.of(compound.getUUID("caster_id"))); + look = new Vec3(compound.getDouble("lookX"), compound.getDouble("lookY"), compound.getDouble("lookZ")); timer = compound.getInt("timer"); + deathTimer = compound.getInt("deathTimer"); + getEntityData().set(SUCCEEDED, compound.getBoolean("succeeded")); } @Override - protected void writeAdditional(CompoundNBT compound) { - compound.put("signs_tag", getDataManager().get(SIGNS)); - compound.putInt("index", getDataManager().get(INDEX)); + protected void addAdditionalSaveData(CompoundTag compound) { + compound.put("runes_tag", getEntityData().get(RUNES)); + compound.put("signs_tag", getEntityData().get(SIGNS)); + compound.putInt("index", getEntityData().get(INDEX)); compound.putInt("timer", timer); - compound.putUniqueId("caster_id", getDataManager().get(CASTER_ID).get()); + compound.putUUID("caster_id", getEntityData().get(CASTER_ID).get()); + compound.putDouble("lookX", look.x); + compound.putDouble("lookY", look.y); + compound.putDouble("lookZ", look.z); + compound.putInt("deathTimer", deathTimer); + compound.putBoolean("succeeded", getEntityData().get(SUCCEEDED)); } @Override - public IPacket createSpawnPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } + + @Override + public void writeSpawnData(FriendlyByteBuf buffer) { + buffer.writeDouble(look.x); + buffer.writeDouble(look.y); + buffer.writeDouble(look.z); + } + + @Override + public void readSpawnData(FriendlyByteBuf buf) { + look = new Vec3(buf.readDouble(), buf.readDouble(), buf.readDouble()); + } } diff --git a/src/main/java/elucent/eidolon/entity/ChantCasterRenderer.java b/src/main/java/elucent/eidolon/entity/ChantCasterRenderer.java new file mode 100644 index 0000000..4c520ac --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/ChantCasterRenderer.java @@ -0,0 +1,189 @@ +package elucent.eidolon.entity; + +import java.util.Iterator; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Vector3f; + +import elucent.eidolon.ClientConfig; +import elucent.eidolon.ClientEvents; +import elucent.eidolon.Eidolon; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.SignSequence; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; + +public class ChantCasterRenderer extends EntityRenderer { + public ChantCasterRenderer(Context erm) { + super(erm); + } + + @Override + public void render(ChantCasterEntity entity, float yaw, float pticks, PoseStack mStack, MultiBufferSource mb, int lmap) { + mStack.pushPose(); + VertexConsumer b = ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_SPRITE); + VertexConsumer sb = ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_BLOCK_PARTICLE); + + Minecraft mc = Minecraft.getInstance(); + double ex = Mth.lerp(pticks, entity.xOld, entity.getX()); + double ey = Mth.lerp(pticks, entity.yOld, entity.getY()); + double ez = Mth.lerp(pticks, entity.zOld, entity.getZ()); + double px = Mth.lerp(pticks, mc.player.xOld, mc.player.getX()); + double py = Mth.lerp(pticks, mc.player.yOld, mc.player.getY()); + double pz = Mth.lerp(pticks, mc.player.zOld, mc.player.getZ()); +// mStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); +// mStack.translate(-px, -py, -pz); + TextureAtlasSprite beam = mc.getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(new ResourceLocation(Eidolon.MODID, "particle/beam")); + TextureAtlasSprite ring = mc.getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(new ResourceLocation(Eidolon.MODID, "particle/ring")); + + Vec3 look = entity.look; + yaw = (float) Mth.atan2(look.x, look.z); + Vec3 left = new Vec3(Math.cos(yaw), 0, -Math.sin(yaw)); + Vec3 up = left.cross(look); + + SignSequence spell = SignSequence.deserializeNbt(entity.getEntityData().get(entity.SIGNS)); + int i = 0; + int sz = Math.max(0, spell.seq.size() - 1); + float r = Mth.sqrt(sz) / 4f; + if (sz > 0) r = Math.max(0.3f, r); + Vec3 center = look.add(0, 0.5f, 0); + int nreps = entity.deathTimer > 0 && entity.getEntityData().get(entity.SUCCEEDED) ? 3 : 1; + float alphaMod = 1; + if (entity.deathTimer > 0) { + alphaMod = entity.deathTimer / 20.0f; + alphaMod *= alphaMod; + if (!entity.getEntityData().get(entity.SUCCEEDED)) { + alphaMod *= alphaMod; + center = center.add(look.scale(1 - alphaMod)); + r += 0.25f - 0.25f * alphaMod; + } + } + for (int k = 0; k < nreps; k ++) { + for (Sign s : spell.seq) { + float a = -Mth.PI / 2 - i * 2 * Mth.PI / spell.seq.size(); + float sa = Mth.sin(a), ca = Mth.cos(a); + + Vec3 od = center.add(left.scale(r * ca)).add(up.scale(r * sa)); + Vec3 dxd = left.scale(0.175), dyd = up.scale(0.175); + Vector3f o = new Vector3f((float)od.x, (float)od.y, (float)od.z); + Vector3f dx = new Vector3f((float)dxd.x, (float)dxd.y, (float)dxd.z); + Vector3f dy = new Vector3f((float)dyd.x, (float)dyd.y, (float)dyd.z); + + TextureAtlasSprite spr = mc.getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(s.getSprite()); + + float brightMod = Mth.clamp(Mth.sin(a + Mth.TWO_PI * entity.tickCount / 20), 0, 1); + brightMod *= brightMod; + brightMod = 0.6f + 0.4f * brightMod; + + for (int j = 0; j < 2; j ++) { + sb.vertex(mStack.last().pose(), o.x() - dx.x() + dy.x(), o.y() - dx.y() + dy.y(), o.z() - dx.z() + dy.z()).uv(spr.getU1(), spr.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() - dx.x() - dy.x(), o.y() - dx.y() - dy.y(), o.z() - dx.z() - dy.z()).uv(spr.getU1(), spr.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() + dx.x() - dy.x(), o.y() + dx.y() - dy.y(), o.z() + dx.z() - dy.z()).uv(spr.getU0(), spr.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() + dx.x() + dy.x(), o.y() + dx.y() + dy.y(), o.z() + dx.z() + dy.z()).uv(spr.getU0(), spr.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + + sb.vertex(mStack.last().pose(), o.x() + dx.x() + dy.x(), o.y() + dx.y() + dy.y(), o.z() + dx.z() + dy.z()).uv(spr.getU1(), spr.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() + dx.x() - dy.x(), o.y() + dx.y() - dy.y(), o.z() + dx.z() - dy.z()).uv(spr.getU1(), spr.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() - dx.x() - dy.x(), o.y() - dx.y() - dy.y(), o.z() - dx.z() - dy.z()).uv(spr.getU0(), spr.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() - dx.x() + dy.x(), o.y() - dx.y() + dy.y(), o.z() - dx.z() + dy.z()).uv(spr.getU0(), spr.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), brightMod * alphaMod).uv2(0).endVertex(); + } + + dx.mul(1.75f); + dy.mul(1.75f); + sb.vertex(mStack.last().pose(), o.x() - dx.x() + dy.x(), o.y() - dx.y() + dy.y(), o.z() - dx.z() + dy.z()).uv(ring.getU1(), ring.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() - dx.x() - dy.x(), o.y() - dx.y() - dy.y(), o.z() - dx.z() - dy.z()).uv(ring.getU1(), ring.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() + dx.x() - dy.x(), o.y() + dx.y() - dy.y(), o.z() + dx.z() - dy.z()).uv(ring.getU0(), ring.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() + dx.x() + dy.x(), o.y() + dx.y() + dy.y(), o.z() + dx.z() + dy.z()).uv(ring.getU0(), ring.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + + sb.vertex(mStack.last().pose(), o.x() + dx.x() + dy.x(), o.y() + dx.y() + dy.y(), o.z() + dx.z() + dy.z()).uv(ring.getU1(), ring.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() + dx.x() - dy.x(), o.y() + dx.y() - dy.y(), o.z() + dx.z() - dy.z()).uv(ring.getU1(), ring.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() - dx.x() - dy.x(), o.y() - dx.y() - dy.y(), o.z() - dx.z() - dy.z()).uv(ring.getU0(), ring.getV0()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o.x() - dx.x() + dy.x(), o.y() - dx.y() + dy.y(), o.z() - dx.z() + dy.z()).uv(ring.getU0(), ring.getV1()).color(s.getRed(), s.getGreen(), s.getBlue(), alphaMod * 0.5f).uv2(0).endVertex(); + + i ++; + } + i = 0; + if (!spell.seq.isEmpty()) { + Iterator iter = spell.seq.iterator(); + Sign cur = null, next = spell.seq.getLast(); + float rr = r + 0.1375f; + float rr2 = rr + 0.2f; + float rs = r - 0.3f; + float rs2 = rs + 0.2f; + int steps = Math.max(24, spell.seq.size() * 4); + if (steps % spell.seq.size() != 0) steps += spell.seq.size() - steps % spell.seq.size(); + int periodicity = Math.max(4, steps / spell.seq.size()); + for (i = 0; i < steps; i ++) { + if (i % periodicity == 0) { + cur = next; + next = iter.next(); + if (!iter.hasNext()) iter = spell.seq.iterator(); + } + float a1 = -Mth.PI / 2 - (i - periodicity) * Mth.TWO_PI / steps, a2 = -Mth.PI / 2 - (i - periodicity + 1) * Mth.TWO_PI / steps; + float sa1 = Mth.sin(a1), ca1 = Mth.cos(a1); + float sa2 = Mth.sin(a2), ca2 = Mth.cos(a2); + + float r1 = Mth.lerp((i % periodicity) / (float)periodicity, cur.getRed(), next.getRed()); + float r2 = Mth.lerp((i % periodicity + 1) / (float)periodicity, cur.getRed(), next.getRed()); + float g1 = Mth.lerp((i % periodicity) / (float)periodicity, cur.getGreen(), next.getGreen()); + float g2 = Mth.lerp((i % periodicity + 1) / (float)periodicity, cur.getGreen(), next.getGreen()); + float b1 = Mth.lerp((i % periodicity) / (float)periodicity, cur.getBlue(), next.getBlue()); + float b2 = Mth.lerp((i % periodicity + 1) / (float)periodicity, cur.getBlue(), next.getBlue()); + + Vec3 id1 = center.add(left.scale(rr * ca1)).add(up.scale(rr * sa1)); + Vec3 id2 = center.add(left.scale(rr * ca2)).add(up.scale(rr * sa2)); + Vec3 od1 = center.add(left.scale(rr2 * ca1)).add(up.scale(rr2 * sa1)); + Vec3 od2 = center.add(left.scale(rr2 * ca2)).add(up.scale(rr2 * sa2)); + Vector3f i1 = new Vector3f((float)id1.x, (float)id1.y, (float)id1.z); + Vector3f i2 = new Vector3f((float)id2.x, (float)id2.y, (float)id2.z); + Vector3f o1 = new Vector3f((float)od1.x, (float)od1.y, (float)od1.z); + Vector3f o2 = new Vector3f((float)od2.x, (float)od2.y, (float)od2.z); + + sb.vertex(mStack.last().pose(), o1.x(), o1.y(), o1.z()).uv(beam.getU1(), beam.getV1()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o2.x(), o2.y(), o2.z()).uv(beam.getU0(), beam.getV1()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i2.x(), i2.y(), i2.z()).uv(beam.getU0(), beam.getV0()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i1.x(), i1.y(), i1.z()).uv(beam.getU1(), beam.getV0()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + + sb.vertex(mStack.last().pose(), o2.x(), o2.y(), o2.z()).uv(beam.getU1(), beam.getV1()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o1.x(), o1.y(), o1.z()).uv(beam.getU0(), beam.getV1()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i1.x(), i1.y(), i1.z()).uv(beam.getU0(), beam.getV0()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i2.x(), i2.y(), i2.z()).uv(beam.getU1(), beam.getV0()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + + id1 = center.add(left.scale(rs * ca1)).add(up.scale(rs * sa1)); + id2 = center.add(left.scale(rs * ca2)).add(up.scale(rs * sa2)); + od1 = center.add(left.scale(rs2 * ca1)).add(up.scale(rs2 * sa1)); + od2 = center.add(left.scale(rs2 * ca2)).add(up.scale(rs2 * sa2)); + i1 = new Vector3f((float)id1.x, (float)id1.y, (float)id1.z); + i2 = new Vector3f((float)id2.x, (float)id2.y, (float)id2.z); + o1 = new Vector3f((float)od1.x, (float)od1.y, (float)od1.z); + o2 = new Vector3f((float)od2.x, (float)od2.y, (float)od2.z); + + sb.vertex(mStack.last().pose(), o1.x(), o1.y(), o1.z()).uv(beam.getU1(), beam.getV1()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o2.x(), o2.y(), o2.z()).uv(beam.getU0(), beam.getV1()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i2.x(), i2.y(), i2.z()).uv(beam.getU0(), beam.getV0()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i1.x(), i1.y(), i1.z()).uv(beam.getU1(), beam.getV0()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + + sb.vertex(mStack.last().pose(), o2.x(), o2.y(), o2.z()).uv(beam.getU1(), beam.getV1()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), o1.x(), o1.y(), o1.z()).uv(beam.getU0(), beam.getV1()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i1.x(), i1.y(), i1.z()).uv(beam.getU0(), beam.getV0()).color(r1, g1, b1, alphaMod * 0.5f).uv2(0).endVertex(); + sb.vertex(mStack.last().pose(), i2.x(), i2.y(), i2.z()).uv(beam.getU1(), beam.getV0()).color(r2, g2, b2, alphaMod * 0.5f).uv2(0).endVertex(); + } + } + } + mStack.popPose(); + } + + @Override + public ResourceLocation getTextureLocation(ChantCasterEntity entity) { + return new ResourceLocation(Eidolon.MODID, "textures/particle/beam.png"); + } +} diff --git a/src/main/java/elucent/eidolon/entity/EmptyRenderer.java b/src/main/java/elucent/eidolon/entity/EmptyRenderer.java deleted file mode 100644 index 977beba..0000000 --- a/src/main/java/elucent/eidolon/entity/EmptyRenderer.java +++ /dev/null @@ -1,26 +0,0 @@ -package elucent.eidolon.entity; - -import elucent.eidolon.Eidolon; -import net.minecraft.client.renderer.culling.ClippingHelper; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererManager; -import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; - -public class EmptyRenderer extends EntityRenderer { - public EmptyRenderer(EntityRendererManager rendererManager) { - super(rendererManager); - } - - @Override - public boolean shouldRender(T livingEntityIn, ClippingHelper camera, double camX, double camY, double camZ) { - return false; - } - - @Override - public ResourceLocation getEntityTexture(T entity) { - return null; - } -} diff --git a/src/main/java/elucent/eidolon/entity/NecromancerEntity.java b/src/main/java/elucent/eidolon/entity/NecromancerEntity.java index 68db005..9a48979 100644 --- a/src/main/java/elucent/eidolon/entity/NecromancerEntity.java +++ b/src/main/java/elucent/eidolon/entity/NecromancerEntity.java @@ -1,52 +1,60 @@ package elucent.eidolon.entity; +import java.util.UUID; + import elucent.eidolon.Registry; +import elucent.eidolon.capability.IReputation; import elucent.eidolon.deity.Deities; -import elucent.eidolon.capability.ReputationProvider; import elucent.eidolon.network.MagicBurstEffectPacket; import elucent.eidolon.network.Networking; import elucent.eidolon.particle.Particles; import elucent.eidolon.util.ColorUtil; import elucent.eidolon.util.EntityUtil; -import net.minecraft.entity.CreatureAttribute; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.MobEntity; -import net.minecraft.entity.ai.attributes.AttributeModifierMap; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.monster.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.*; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraft.world.biome.Biome; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.monster.SpellcasterIllager; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.biome.Biome; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.registries.ForgeRegistries; -import java.util.UUID; - -public class NecromancerEntity extends SpellcastingIllagerEntity { - public NecromancerEntity(EntityType type, World worldIn) { +public class NecromancerEntity extends SpellcasterIllager { + public NecromancerEntity(EntityType type, Level worldIn) { super(type, worldIn); } @Override - public CreatureAttribute getCreatureAttribute() { - return CreatureAttribute.UNDEAD; + public MobType getMobType() { + return MobType.UNDEAD; } @Override - public boolean canDespawn(double dist) { + public boolean removeWhenFarAway(double dist) { return false; } boolean hack = false; @Override - public boolean isSpellcasting() { - return world.isRemote && hack ? false : super.isSpellcasting(); + public boolean isCastingSpell() { + return level.isClientSide && hack ? false : super.isCastingSpell(); } @Override @@ -54,47 +62,47 @@ public void tick() { hack = true; // Used to avoid the default spell particles from SpellcastingIllagerEntity super.tick(); hack = false; - if (this.world.isRemote && this.isSpellcasting()) { - SpellType spelltype = getSpellType(); - float f = this.renderYawOffset * ((float)Math.PI / 180F) + MathHelper.cos((float)this.ticksExisted * 0.6662F) * 0.25F; - float f1 = MathHelper.cos(f); - float f2 = MathHelper.sin(f); - if (spelltype == SpellType.FANGS) { + if (this.level.isClientSide && this.isCastingSpell()) { + IllagerSpell spelltype = getCurrentSpell(); + float f = this.yBodyRot * ((float)Math.PI / 180F) + Mth.cos((float)this.tickCount * 0.6662F) * 0.25F; + float f1 = Mth.cos(f); + float f2 = Mth.sin(f); + if (spelltype == IllagerSpell.FANGS) { Particles.create(Registry.SPARKLE_PARTICLE) .setColor(1, 0.3125f, 0.375f, 0.75f, 0.375f, 1) .randomVelocity(0.05f).randomOffset(0.025f) .setScale(0.25f, 0.125f).setAlpha(0.25f, 0) .setSpin(0.4f) - .spawn(world, getPosX() + f1 * 0.875, getPosY() + 2.0, getPosZ() + f2 * 0.875) - .spawn(world, getPosX() - f1 * 0.875, getPosY() + 2.0, getPosZ() - f2 * 0.875); + .spawn(level, getX() + f1 * 0.875, getY() + 2.0, getZ() + f2 * 0.875) + .spawn(level, getX() - f1 * 0.875, getY() + 2.0, getZ() - f2 * 0.875); } - else if (spelltype == SpellType.SUMMON_VEX) { + else if (spelltype == IllagerSpell.SUMMON_VEX) { Particles.create(Registry.WISP_PARTICLE) .setColor(0.75f, 1, 1, 0.125f, 0.125f, 0.875f) .randomVelocity(0.05f).randomOffset(0.025f) .setScale(0.25f, 0.125f).setAlpha(0.25f, 0) - .spawn(world, getPosX() + f1 * 0.875, getPosY() + 2.0, getPosZ() + f2 * 0.875) - .spawn(world, getPosX() - f1 * 0.875, getPosY() + 2.0, getPosZ() - f2 * 0.875); + .spawn(level, getX() + f1 * 0.875, getY() + 2.0, getZ() + f2 * 0.875) + .spawn(level, getX() - f1 * 0.875, getY() + 2.0, getZ() - f2 * 0.875); } } } @Override - public boolean isEntityUndead() { + public boolean isInvertedHealAndHarm() { return true; } - class AttackSpellGoal extends SpellcastingIllagerEntity.UseSpellGoal { + class AttackSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { private AttackSpellGoal() { } - public boolean shouldExecute() { - LivingEntity livingentity = NecromancerEntity.this.getAttackTarget(); + public boolean canUse() { + LivingEntity livingentity = NecromancerEntity.this.getTarget(); if (livingentity != null && livingentity.isAlive()) { - if (NecromancerEntity.this.isSpellcasting()) { + if (NecromancerEntity.this.isCastingSpell()) { return false; } else { - if (NecromancerEntity.this.ticksExisted >= this.spellCooldown) { + if (NecromancerEntity.this.tickCount >= this.nextAttackTickCount) { return true; } } @@ -114,30 +122,30 @@ protected int getCastingInterval() { @Override protected SoundEvent getSpellPrepareSound() { - return SoundEvents.ENTITY_EVOKER_PREPARE_SUMMON; + return SoundEvents.EVOKER_PREPARE_SUMMON; } @Override - protected SpellType getSpellType() { - return SpellType.FANGS; + protected IllagerSpell getSpell() { + return IllagerSpell.FANGS; } @Override - protected void castSpell() { - LivingEntity target = NecromancerEntity.this.getAttackTarget(); - Vector3d diff = target.getPositionVec().subtract(NecromancerEntity.this.getPositionVec()); - Vector3d norm = diff.normalize(); - if (!world.isRemote) { + protected void performSpellCasting() { + LivingEntity target = NecromancerEntity.this.getTarget(); + Vec3 diff = target.position().subtract(NecromancerEntity.this.position()); + Vec3 norm = diff.normalize(); + if (!level.isClientSide) { for (int i = 0; i < 3; i ++) { - NecromancerSpellEntity spell = new NecromancerSpellEntity(world, getPosX(), getPosYEye(), getPosZ(), norm.x + rand.nextFloat() * 0.1 - 0.05, norm.y + 0.04 * diff.length() / 2 + rand.nextFloat() * 0.1 - 0.05, norm.z + rand.nextFloat() * 0.1 - 0.05, i * 5); - spell.casterId = new UUID(0, getEntityId()); - world.addEntity(spell); + NecromancerSpellEntity spell = new NecromancerSpellEntity(level, getX(), getEyeY(), getZ(), norm.x + random.nextFloat() * 0.1 - 0.05, norm.y + 0.04 * diff.length() / 2 + random.nextFloat() * 0.1 - 0.05, norm.z + random.nextFloat() * 0.1 - 0.05, i * 5); + spell.casterId = new UUID(0, getId()); + level.addFreshEntity(spell); } } } } - class SummonSpellGoal extends SpellcastingIllagerEntity.UseSpellGoal { + class SummonSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { private SummonSpellGoal() { } @@ -153,78 +161,78 @@ protected int getCastingInterval() { @Override protected SoundEvent getSpellPrepareSound() { - return SoundEvents.ENTITY_EVOKER_PREPARE_SUMMON; + return SoundEvents.EVOKER_PREPARE_SUMMON; } @Override - protected SpellType getSpellType() { - return SpellType.SUMMON_VEX; + protected IllagerSpell getSpell() { + return IllagerSpell.SUMMON_VEX; } @Override - protected void castSpell() { - if (!world.isRemote) { - EntityType type = rand.nextBoolean() ? EntityType.SKELETON : EntityType.ZOMBIE; - ResourceLocation biomeKey = ForgeRegistries.BIOMES.getKey(world.getBiome(getPosition())); - RegistryKey biomeEntry = RegistryKey.getOrCreateKey(ForgeRegistries.Keys.BIOMES, biomeKey); + protected void performSpellCasting() { + if (!level.isClientSide) { + EntityType type = random.nextBoolean() ? EntityType.SKELETON : EntityType.ZOMBIE; + ResourceLocation biomeKey = ForgeRegistries.BIOMES.getKey(level.getBiome(blockPosition())); + ResourceKey biomeEntry = ResourceKey.create(ForgeRegistries.Keys.BIOMES, biomeKey); if (type == EntityType.SKELETON && BiomeDictionary.hasType(biomeEntry, BiomeDictionary.Type.SNOWY)) type = EntityType.STRAY; if (type == EntityType.ZOMBIE && BiomeDictionary.hasType(biomeEntry, BiomeDictionary.Type.SANDY)) type = EntityType.HUSK; if (type == EntityType.ZOMBIE && BiomeDictionary.hasType(biomeEntry, BiomeDictionary.Type.OCEAN)) type = EntityType.DROWNED; - MonsterEntity entity = (MonsterEntity)type.create(world); - entity.setPosition(getPosX(), getPosY(), getPosZ()); - world.addEntity(entity); - entity.setAttackTarget(getAttackTarget()); + Monster entity = (Monster)type.create(level); + entity.setPos(getX(), getY(), getZ()); + level.addFreshEntity(entity); + entity.setTarget(getTarget()); EntityUtil.enthrall(NecromancerEntity.this, entity); - Networking.sendToTracking(world, getPosition(), new MagicBurstEffectPacket(getPosX(), getPosY() + 1, getPosZ(), ColorUtil.packColor(255, 181, 255, 255), ColorUtil.packColor(255, 28, 31, 212))); + Networking.sendToTracking(level, blockPosition(), new MagicBurstEffectPacket(getX(), getY() + 1, getZ(), ColorUtil.packColor(255, 181, 255, 255), ColorUtil.packColor(255, 28, 31, 212))); } } } - class CastingSpellGoal extends SpellcastingIllagerEntity.CastingASpellGoal { + class CastingSpellGoal extends SpellcasterIllager.SpellcasterCastingSpellGoal { private CastingSpellGoal() { } public void tick() { - if (NecromancerEntity.this.getAttackTarget() != null) { - NecromancerEntity.this.getLookController().setLookPositionWithEntity(NecromancerEntity.this.getAttackTarget(), (float)NecromancerEntity.this.getHorizontalFaceSpeed(), (float)NecromancerEntity.this.getVerticalFaceSpeed()); + if (NecromancerEntity.this.getTarget() != null) { + NecromancerEntity.this.getLookControl().setLookAt(NecromancerEntity.this.getTarget(), (float)NecromancerEntity.this.getMaxHeadYRot(), (float)NecromancerEntity.this.getMaxHeadXRot()); } } } protected void registerGoals() { - this.goalSelector.addGoal(0, new SwimGoal(this)); + this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new CastingSpellGoal()); this.goalSelector.addGoal(5, new AttackSpellGoal()); this.goalSelector.addGoal(4, new SummonSpellGoal()); this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); - this.goalSelector.addGoal(9, new LookAtGoal(this, PlayerEntity.class, 3.0F, 1.0F)); - this.goalSelector.addGoal(10, new LookAtGoal(this, MobEntity.class, 8.0F)); - this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); - this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, PlayerEntity.class, 10, false, false, (e) -> e.getEntityWorld().getCapability(ReputationProvider.CAPABILITY).isPresent() && e.getEntityWorld().getCapability(ReputationProvider.CAPABILITY).resolve().get().getReputation((PlayerEntity)e, Deities.DARK_DEITY.getId()) >= 50)).setUnseenMemoryTicks(300)); + this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F)); + this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F)); + this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, (e) -> e.getCommandSenderWorld().getCapability(IReputation.INSTANCE).isPresent() && e.getCommandSenderWorld().getCapability(IReputation.INSTANCE).resolve().get().getReputation((Player)e, Deities.DARK_DEITY.getId()) >= 50)).setUnseenMemoryTicks(300)); } - protected SoundEvent getSpellSound() { - return SoundEvents.ENTITY_EVOKER_CAST_SPELL; + protected SoundEvent getCastingSoundEvent() { + return SoundEvents.EVOKER_CAST_SPELL; } - public static AttributeModifierMap createAttributes() { - return MonsterEntity.func_234295_eP_() - .createMutableAttribute(Attributes.MAX_HEALTH, 100.0D) - .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.25D) - .createMutableAttribute(Attributes.FOLLOW_RANGE, 12.0D) - .create(); + public static AttributeSupplier createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 100.0D) + .add(Attributes.MOVEMENT_SPEED, 0.25D) + .add(Attributes.FOLLOW_RANGE, 12.0D) + .build(); } @Override - public void applyWaveBonus(int wave, boolean p_213660_2_) { + public void applyRaidBuffs(int wave, boolean p_213660_2_) { return; } @Override - public SoundEvent getRaidLossSound() { - return SoundEvents.ENTITY_EVOKER_CELEBRATE; + public SoundEvent getCelebrateSound() { + return SoundEvents.EVOKER_CELEBRATE; } } diff --git a/src/main/java/elucent/eidolon/entity/NecromancerModel.java b/src/main/java/elucent/eidolon/entity/NecromancerModel.java index 018cec4..fbe2bed 100644 --- a/src/main/java/elucent/eidolon/entity/NecromancerModel.java +++ b/src/main/java/elucent/eidolon/entity/NecromancerModel.java @@ -1,166 +1,152 @@ -package elucent.eidolon.entity; -// Made with Blockbench 3.7.4 -// Exported for Minecraft version 1.15 -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.renderer.entity.model.EntityModel; -import net.minecraft.client.renderer.model.ModelHelper; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.AbstractIllagerEntity; -import net.minecraft.util.math.MathHelper; - -public class NecromancerModel extends EntityModel { - private final ModelRenderer body; - private final ModelRenderer clothing; - private final ModelRenderer leftLeg; - private final ModelRenderer rightLeg; - private final ModelRenderer head; - private final ModelRenderer arms; - private final ModelRenderer rightArm; - private final ModelRenderer leftArm; - - public NecromancerModel(float delta) { - textureWidth = 64; - textureHeight = 64; - - body = new ModelRenderer(this); - body.setRotationPoint(0.0F, 24.0F, 0.0F); - body.setTextureOffset(16, 20).addBox(-4.0F, -24.0F, -3.0F, 8.0F, 12.0F, 6.0F, delta, false); - - clothing = new ModelRenderer(this); - clothing.setRotationPoint(0.0F, -24.0F, 0.0F); - body.addChild(clothing); - clothing.setTextureOffset(0, 38).addBox(-4.0F, 0.0F, -3.0F, 8.0F, 20.0F, 6.0F, delta + 0.5F, false); - // clothing.setTextureOffset(64, 0).addBox(-4.5F, 17.0F, -3.5F, 9.0F, 4.0F, 7.0F, delta + 0.5F, false); - - leftLeg = new ModelRenderer(this); - leftLeg.setRotationPoint(2.0F, -12.0F, 0.0F); - body.addChild(leftLeg); - leftLeg.setTextureOffset(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, delta, true); - - rightLeg = new ModelRenderer(this); - rightLeg.setRotationPoint(-2.0F, -12.0F, 0.0F); - body.addChild(rightLeg); - rightLeg.setTextureOffset(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, delta, false); - - head = new ModelRenderer(this); - head.setRotationPoint(0.0F, -24.0F, 0.0F); - body.addChild(head); - head.setTextureOffset(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, delta, false); - head.setTextureOffset(32, 0).addBox(-4.0F, -12.0F, -4.0F, 8.0F, 12.0F, 8.0F, delta + 0.45F, false); - head.setTextureOffset(24, 0).addBox(-1.0F, -3.0F, -6.0F, 2.0F, 4.0F, 2.0F, delta, false); - - arms = new ModelRenderer(this); - arms.setRotationPoint(0.0F, -20.0F, -2.0F); - body.addChild(arms); - setRotationAngle(arms, -0.7854F, 0.0F, 0.0F); - arms.setTextureOffset(40, 38).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 4.0F, 4.0F, delta, false); - arms.setTextureOffset(44, 22).addBox(4.0F, -4.0F, -2.0F, 4.0F, 8.0F, 4.0F, delta, true); - arms.setTextureOffset(44, 22).addBox(-8.0F, -4.0F, -2.0F, 4.0F, 8.0F, 4.0F, delta, false); - - rightArm = new ModelRenderer(this); - rightArm.setRotationPoint(-6.0F, -24.0F, 0.0F); - body.addChild(rightArm); - rightArm.setTextureOffset(40, 46).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, delta, false); - - leftArm = new ModelRenderer(this); - leftArm.setRotationPoint(6.0F, -24.0F, 0.0F); - body.addChild(leftArm); - leftArm.setTextureOffset(40, 46).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, delta, true); - } - - @Override - public void setRotationAngles(NecromancerEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ - this.head.rotateAngleY = netHeadYaw * ((float)Math.PI / 180F); - this.head.rotateAngleX = headPitch * ((float)Math.PI / 180F); - this.arms.rotateAngleX = -0.75F; - if (this.isSitting) { - this.rightArm.rotateAngleX = (-(float)Math.PI / 5F); - this.rightArm.rotateAngleY = 0.0F; - this.rightArm.rotateAngleZ = 0.0F; - this.leftArm.rotateAngleX = (-(float)Math.PI / 5F); - this.leftArm.rotateAngleY = 0.0F; - this.leftArm.rotateAngleZ = 0.0F; - this.rightLeg.rotateAngleX = -1.4137167F; - this.rightLeg.rotateAngleY = ((float)Math.PI / 10F); - this.rightLeg.rotateAngleZ = 0.07853982F; - this.leftLeg.rotateAngleX = -1.4137167F; - this.leftLeg.rotateAngleY = (-(float)Math.PI / 10F); - this.leftLeg.rotateAngleZ = -0.07853982F; - } else { - this.rightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 2.0F * limbSwingAmount * 0.5F; - this.rightArm.rotateAngleY = 0.0F; - this.rightArm.rotateAngleZ = 0.0F; - this.leftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F; - this.leftArm.rotateAngleY = 0.0F; - this.leftArm.rotateAngleZ = 0.0F; - this.rightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F; - this.rightLeg.rotateAngleY = 0.0F; - this.rightLeg.rotateAngleZ = 0.0F; - this.leftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount * 0.5F; - this.leftLeg.rotateAngleY = 0.0F; - this.leftLeg.rotateAngleZ = 0.0F; - } - - AbstractIllagerEntity.ArmPose armpose = entity.getArmPose(); - if (armpose == AbstractIllagerEntity.ArmPose.ATTACKING) { - if (entity.getHeldItemMainhand().isEmpty()) { - ModelHelper.func_239105_a_(this.leftArm, this.rightArm, true, this.swingProgress, ageInTicks); - } else { - ModelHelper.func_239103_a_(this.rightArm, this.leftArm, entity, this.swingProgress, ageInTicks); - } - } else if (armpose == AbstractIllagerEntity.ArmPose.SPELLCASTING) { - this.rightArm.rotationPointZ = 0.0F; - this.rightArm.rotationPointX = -5.0F; - this.leftArm.rotationPointZ = 0.0F; - this.leftArm.rotationPointX = 5.0F; - this.rightArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F; - this.leftArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F; - this.rightArm.rotateAngleZ = 2.3561945F; - this.leftArm.rotateAngleZ = -2.3561945F; - this.rightArm.rotateAngleY = 0.0F; - this.leftArm.rotateAngleY = 0.0F; - } else if (armpose == AbstractIllagerEntity.ArmPose.BOW_AND_ARROW) { - this.rightArm.rotateAngleY = -0.1F + this.head.rotateAngleY; - this.rightArm.rotateAngleX = (-(float)Math.PI / 2F) + this.head.rotateAngleX; - this.leftArm.rotateAngleX = -0.9424779F + this.head.rotateAngleX; - this.leftArm.rotateAngleY = this.head.rotateAngleY - 0.4F; - this.leftArm.rotateAngleZ = ((float)Math.PI / 2F); - } else if (armpose == AbstractIllagerEntity.ArmPose.CROSSBOW_HOLD) { - ModelHelper.func_239104_a_(this.rightArm, this.leftArm, this.head, true); - } else if (armpose == AbstractIllagerEntity.ArmPose.CROSSBOW_CHARGE) { - ModelHelper.func_239102_a_(this.rightArm, this.leftArm, entity, true); - } else if (armpose == AbstractIllagerEntity.ArmPose.CELEBRATING) { - this.rightArm.rotationPointZ = 0.0F; - this.rightArm.rotationPointX = -5.0F; - this.rightArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.05F; - this.rightArm.rotateAngleZ = 2.670354F; - this.rightArm.rotateAngleY = 0.0F; - this.leftArm.rotationPointZ = 0.0F; - this.leftArm.rotationPointX = 5.0F; - this.leftArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.05F; - this.leftArm.rotateAngleZ = -2.3561945F; - this.leftArm.rotateAngleY = 0.0F; - } - - boolean flag = armpose == AbstractIllagerEntity.ArmPose.CROSSED; - this.arms.showModel = flag; - this.leftArm.showModel = !flag; - this.rightArm.showModel = !flag; - } - - @Override - public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ - body.render(matrixStack, buffer, packedLight, packedOverlay); - } - - public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +package elucent.eidolon.entity; +// Made with Blockbench 3.7.4 +// Exported for Minecraft version 1.15 +// Paste this class into your mod and generate all required imports + + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.AnimationUtils; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.monster.AbstractIllager; +import net.minecraft.util.Mth; + +public class NecromancerModel extends EntityModel { + private final ModelPart body, head, arms, leftArm, rightArm, leftLeg, rightLeg; + + public NecromancerModel(ModelPart root) { + this.body = root.getChild("body"); + this.head = body.getChild("head"); + this.arms = body.getChild("arms"); + this.leftArm = body.getChild("left_arm"); + this.rightArm = body.getChild("right_arm"); + this.leftLeg = body.getChild("left_leg"); + this.rightLeg = body.getChild("right_leg"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(16, 20).addBox(-4.0F, -24.0F, -3.0F, 8.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + + PartDefinition clothing = body.addOrReplaceChild("clothing", CubeListBuilder.create().texOffs(0, 38).addBox(-4.0F, 0.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.5F)), PartPose.offset(0.0F, -24.0F, 0.0F)); + + PartDefinition left_leg = body.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 22).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(2.0F, -12.0F, 0.0F)); + + PartDefinition right_leg = body.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.0F, -12.0F, 0.0F)); + + PartDefinition head = body.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(32, 0).addBox(-4.0F, -12.0F, -4.0F, 8.0F, 12.0F, 8.0F, new CubeDeformation(0.45F)) + .texOffs(24, 0).addBox(-1.0F, -3.0F, -6.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -24.0F, 0.0F)); + + PartDefinition arms = body.addOrReplaceChild("arms", CubeListBuilder.create().texOffs(40, 38).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(44, 22).mirror().addBox(4.0F, -4.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(44, 22).addBox(-8.0F, -4.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -20.0F, -2.0F, -0.7854F, 0.0F, 0.0F)); + + PartDefinition right_arm = body.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 46).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-6.0F, -24.0F, 0.0F)); + + PartDefinition left_arm = body.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(40, 46).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(6.0F, -24.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(NecromancerEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ + this.head.yRot = netHeadYaw * ((float)Math.PI / 180F); + this.head.xRot = headPitch * ((float)Math.PI / 180F); + this.arms.xRot = -0.75F; + if (this.riding) { + this.rightArm.xRot = (-(float)Math.PI / 5F); + this.rightArm.yRot = 0.0F; + this.rightArm.zRot = 0.0F; + this.leftArm.xRot = (-(float)Math.PI / 5F); + this.leftArm.yRot = 0.0F; + this.leftArm.zRot = 0.0F; + this.rightLeg.xRot = -1.4137167F; + this.rightLeg.yRot = ((float)Math.PI / 10F); + this.rightLeg.zRot = 0.07853982F; + this.leftLeg.xRot = -1.4137167F; + this.leftLeg.yRot = (-(float)Math.PI / 10F); + this.leftLeg.zRot = -0.07853982F; + } else { + this.rightArm.xRot = Mth.cos(limbSwing * 0.6662F + (float)Math.PI) * 2.0F * limbSwingAmount * 0.5F; + this.rightArm.yRot = 0.0F; + this.rightArm.zRot = 0.0F; + this.leftArm.xRot = Mth.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F; + this.leftArm.yRot = 0.0F; + this.leftArm.zRot = 0.0F; + this.rightLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F; + this.rightLeg.yRot = 0.0F; + this.rightLeg.zRot = 0.0F; + this.leftLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount * 0.5F; + this.leftLeg.yRot = 0.0F; + this.leftLeg.zRot = 0.0F; + } + + AbstractIllager.IllagerArmPose armpose = entity.getArmPose(); + if (armpose == AbstractIllager.IllagerArmPose.ATTACKING) { + if (entity.getMainHandItem().isEmpty()) { + AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, true, this.attackTime, ageInTicks); + } else { + AnimationUtils.swingWeaponDown(this.rightArm, this.leftArm, entity, this.attackTime, ageInTicks); + } + } else if (armpose == AbstractIllager.IllagerArmPose.SPELLCASTING) { + this.rightArm.z = 0.0F; + this.rightArm.x = -5.0F; + this.leftArm.z = 0.0F; + this.leftArm.x = 5.0F; + this.rightArm.xRot = Mth.cos(ageInTicks * 0.6662F) * 0.25F; + this.leftArm.xRot = Mth.cos(ageInTicks * 0.6662F) * 0.25F; + this.rightArm.zRot = 2.3561945F; + this.leftArm.zRot = -2.3561945F; + this.rightArm.yRot = 0.0F; + this.leftArm.yRot = 0.0F; + } else if (armpose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) { + this.rightArm.yRot = -0.1F + this.head.yRot; + this.rightArm.xRot = (-(float)Math.PI / 2F) + this.head.xRot; + this.leftArm.xRot = -0.9424779F + this.head.xRot; + this.leftArm.yRot = this.head.yRot - 0.4F; + this.leftArm.zRot = ((float)Math.PI / 2F); + } else if (armpose == AbstractIllager.IllagerArmPose.CROSSBOW_HOLD) { + AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, true); + } else if (armpose == AbstractIllager.IllagerArmPose.CROSSBOW_CHARGE) { + AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, entity, true); + } else if (armpose == AbstractIllager.IllagerArmPose.CELEBRATING) { + this.rightArm.z = 0.0F; + this.rightArm.x = -5.0F; + this.rightArm.xRot = Mth.cos(ageInTicks * 0.6662F) * 0.05F; + this.rightArm.zRot = 2.670354F; + this.rightArm.yRot = 0.0F; + this.leftArm.z = 0.0F; + this.leftArm.x = 5.0F; + this.leftArm.xRot = Mth.cos(ageInTicks * 0.6662F) * 0.05F; + this.leftArm.zRot = -2.3561945F; + this.leftArm.yRot = 0.0F; + } + + boolean flag = armpose == AbstractIllager.IllagerArmPose.CROSSED; + this.arms.visible = flag; + this.leftArm.visible = !flag; + this.rightArm.visible = !flag; + } + + @Override + public void renderToBuffer(PoseStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ + body.render(matrixStack, buffer, packedLight, packedOverlay); + } + + public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) { + modelRenderer.xRot = x; + modelRenderer.yRot = y; + modelRenderer.zRot = z; + } } \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/entity/NecromancerRenderer.java b/src/main/java/elucent/eidolon/entity/NecromancerRenderer.java index 7295dcc..53f3708 100644 --- a/src/main/java/elucent/eidolon/entity/NecromancerRenderer.java +++ b/src/main/java/elucent/eidolon/entity/NecromancerRenderer.java @@ -1,55 +1,50 @@ package elucent.eidolon.entity; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.RenderState; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderStateShard; +import net.minecraft.client.renderer.RenderStateShard.ShaderStateShard; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.EntityRendererManager; -import net.minecraft.client.renderer.entity.IEntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.client.renderer.entity.layers.AbstractEyesLayer; -import net.minecraft.client.renderer.entity.layers.LayerRenderer; -import net.minecraft.client.renderer.entity.layers.SpiderEyesLayer; -import net.minecraft.client.renderer.entity.model.SpiderModel; +import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.minecraft.resources.ResourceLocation; public class NecromancerRenderer extends MobRenderer { - public NecromancerRenderer(EntityRendererManager rendererManager, NecromancerModel model, float shadowSizeIn) { - super(rendererManager, model, shadowSizeIn); + public NecromancerRenderer(Context erm) { + super(erm, new NecromancerModel(erm.bakeLayer(ClientRegistry.NECROMANCER_LAYER)), 0.6f); this.addLayer(new NecromancerEyesLayer(this)); } - public static class NecromancerEyesLayer extends LayerRenderer { + public static class NecromancerEyesLayer extends RenderLayer { NecromancerModel model; - private static final RenderType RENDER_TYPE = RenderType.makeType( + private static final RenderType RENDER_TYPE = RenderType.create( Eidolon.MODID+":necromancer_eyes", - DefaultVertexFormats.ENTITY, - GL11.GL_QUADS, 256, - RenderType.State.getBuilder() - .shadeModel(new RenderState.ShadeModelState(true)) - .writeMask(new RenderState.WriteMaskState(true, false)) - .lightmap(new RenderState.LightmapState(false)) - .diffuseLighting(new RenderState.DiffuseLightingState(false)) - .transparency(RenderUtil.ADDITIVE_TRANSPARENCY) - .texture(new RenderState.TextureState(new ResourceLocation(Eidolon.MODID,"textures/entity/necromancer_eyes.png"), false, false)) - .build(false) + DefaultVertexFormat.NEW_ENTITY, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setShaderState(new ShaderStateShard(ClientRegistry::getGlowingEntityShader)) + .setWriteMaskState(new RenderStateShard.WriteMaskStateShard(true, false)) + .setLightmapState(new RenderStateShard.LightmapStateShard(false)) + .setTransparencyState(RenderUtil.ADDITIVE_TRANSPARENCY) + .setTextureState(new RenderStateShard.TextureStateShard(new ResourceLocation(Eidolon.MODID,"textures/entity/necromancer_eyes.png"), false, false)) + .createCompositeState(false) ); - public NecromancerEyesLayer(IEntityRenderer entityRendererIn) { + public NecromancerEyesLayer(RenderLayerParent entityRendererIn) { super(entityRendererIn); - this.model = new NecromancerModel(0.5f); + this.model = entityRendererIn.getModel(); } public RenderType getRenderType() { @@ -57,15 +52,15 @@ public RenderType getRenderType() { } @Override - public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, NecromancerEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { - IVertexBuilder ivertexbuilder = bufferIn.getBuffer(this.getRenderType()); - this.model.setRotationAngles(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - model.render(matrixStackIn, ivertexbuilder, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + public void render(PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn, NecromancerEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + VertexConsumer ivertexbuilder = bufferIn.getBuffer(this.getRenderType()); + this.model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + model.renderToBuffer(matrixStackIn, ivertexbuilder, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } } @Override - public ResourceLocation getEntityTexture(NecromancerEntity entity) { + public ResourceLocation getTextureLocation(NecromancerEntity entity) { return new ResourceLocation(Eidolon.MODID, "textures/entity/necromancer.png"); } } diff --git a/src/main/java/elucent/eidolon/entity/NecromancerSpellEntity.java b/src/main/java/elucent/eidolon/entity/NecromancerSpellEntity.java index 02e2823..d419b59 100644 --- a/src/main/java/elucent/eidolon/entity/NecromancerSpellEntity.java +++ b/src/main/java/elucent/eidolon/entity/NecromancerSpellEntity.java @@ -5,81 +5,79 @@ import elucent.eidolon.network.Networking; import elucent.eidolon.particle.Particles; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.network.datasync.DataParameter; -import net.minecraft.network.datasync.DataSerializers; -import net.minecraft.network.datasync.EntityDataManager; -import net.minecraft.potion.EffectInstance; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IndirectEntityDamageSource; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.IndirectEntityDamageSource; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; public class NecromancerSpellEntity extends SpellProjectileEntity { - public static final DataParameter DELAY = EntityDataManager.createKey(NecromancerEntity.class, DataSerializers.VARINT); + public static final EntityDataAccessor DELAY = SynchedEntityData.defineId(NecromancerEntity.class, EntityDataSerializers.INT); - public NecromancerSpellEntity(EntityType entityTypeIn, World worldIn) { + public NecromancerSpellEntity(EntityType entityTypeIn, Level worldIn) { super(entityTypeIn, worldIn); - getDataManager().register(DELAY, 0); + getEntityData().define(DELAY, 0); } - public NecromancerSpellEntity(World worldIn, double x, double y, double z, double vx, double vy, double vz, int delay) { + public NecromancerSpellEntity(Level worldIn, double x, double y, double z, double vx, double vy, double vz, int delay) { super(Registry.NECROMANCER_SPELL.get(), worldIn); - setPosition(x, y, z); - setMotion(vx, vy, vz); - getDataManager().register(DELAY, delay); + setPos(x, y, z); + setDeltaMovement(vx, vy, vz); + getEntityData().define(DELAY, delay); } @Override public void tick() { - if (getDataManager().get(DELAY) > 0) { - getDataManager().set(DELAY, getDataManager().get(DELAY) - 1); + if (getEntityData().get(DELAY) > 0) { + getEntityData().set(DELAY, getEntityData().get(DELAY) - 1); return; } super.tick(); - Vector3d motion = getMotion(); - Vector3d pos = getPositionVec(); - Vector3d norm = motion.normalize().scale(0.025f); + Vec3 motion = getDeltaMovement(); + Vec3 pos = position(); + Vec3 norm = motion.normalize().scale(0.025f); for (int i = 0; i < 8; i ++) { - double lerpX = MathHelper.lerp(i / 8.0f, prevPosX, pos.x); - double lerpY = MathHelper.lerp(i / 8.0f, prevPosY, pos.y); - double lerpZ = MathHelper.lerp(i / 8.0f, prevPosZ, pos.z); + double lerpX = Mth.lerp(i / 8.0f, xo, pos.x); + double lerpY = Mth.lerp(i / 8.0f, yo, pos.y); + double lerpZ = Mth.lerp(i / 8.0f, zo, pos.z); Particles.create(Registry.WISP_PARTICLE) .addVelocity(-norm.x, -norm.y, -norm.z) .setAlpha(0.375f, 0).setScale(0.25f, 0) .setColor(1, 0.3125f, 0.375f, 0.75f, 0.375f, 1) .setLifetime(5) - .spawn(world, lerpX, lerpY, lerpZ); + .spawn(level, lerpX, lerpY, lerpZ); Particles.create(Registry.SMOKE_PARTICLE) .addVelocity(-norm.x, -norm.y, -norm.z) .setAlpha(0.0625f, 0).setScale(0.3125f, 0.125f) .setColor(0.625f, 0.375f, 1, 0.25f, 0.25f, 0.75f) .randomVelocity(0.025f, 0.025f) .setLifetime(20) - .spawn(world, lerpX, lerpY, lerpZ); + .spawn(level, lerpX, lerpY, lerpZ); } } @Override - protected void onImpact(RayTraceResult ray, Entity target) { - target.attackEntityFrom(new IndirectEntityDamageSource(DamageSource.WITHER.getDamageType(), this, world.getEntityByID((int)casterId.getLeastSignificantBits())), 3.0f + world.getDifficulty().getId()); + protected void onImpact(HitResult ray, Entity target) { + target.hurt(new IndirectEntityDamageSource(DamageSource.WITHER.getMsgId(), this, level.getEntity((int)casterId.getLeastSignificantBits())), 3.0f + level.getDifficulty().getId()); onImpact(ray); } @Override - protected void onImpact(RayTraceResult ray) { - setDead(); - if (!world.isRemote) { - Vector3d pos = ray.getHitVec(); - world.playSound(null, pos.x, pos.y, pos.z, SoundEvents.ENTITY_WITHER_SHOOT, SoundCategory.HOSTILE, 0.5f, rand.nextFloat() * 0.2f + 0.9f); - Networking.sendToTracking(world, getPosition(), new MagicBurstEffectPacket(pos.x, pos.y, pos.z, ColorUtil.packColor(255, 158, 92, 255), ColorUtil.packColor(255, 60, 62, 186))); + protected void onImpact(HitResult ray) { + removeAfterChangingDimensions(); + if (!level.isClientSide) { + Vec3 pos = ray.getLocation(); + level.playSound(null, pos.x, pos.y, pos.z, SoundEvents.WITHER_SHOOT, SoundSource.HOSTILE, 0.5f, random.nextFloat() * 0.2f + 0.9f); + Networking.sendToTracking(level, blockPosition(), new MagicBurstEffectPacket(pos.x, pos.y, pos.z, ColorUtil.packColor(255, 158, 92, 255), ColorUtil.packColor(255, 60, 62, 186))); } } } diff --git a/src/main/java/elucent/eidolon/entity/RavenEntity.java b/src/main/java/elucent/eidolon/entity/RavenEntity.java new file mode 100644 index 0000000..ea0794a --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/RavenEntity.java @@ -0,0 +1,174 @@ +package elucent.eidolon.entity; + +import elucent.eidolon.Registry; +import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.control.FlyingMoveControl; +import net.minecraft.world.entity.ai.goal.BreedGoal; +import net.minecraft.world.entity.ai.goal.FollowOwnerGoal; +import net.minecraft.world.entity.ai.goal.FollowParentGoal; +import net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.PanicGoal; +import net.minecraft.world.entity.ai.goal.SitWhenOrderedToGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.TemptGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.animal.FlyingAnimal; +import net.minecraft.world.entity.animal.ShoulderRidingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; + +public class RavenEntity extends ShoulderRidingEntity implements FlyingAnimal { + private static final Ingredient TEMPTATION_ITEMS = Ingredient.of(Items.RABBIT, Items.BEETROOT_SEEDS); + public int featherTime = this.random.nextInt(12000) + 12000; + + public RavenEntity(EntityType type, Level worldIn) { + super(type, worldIn); + registerGoals(); + this.moveControl = new FlyingMoveControl(this, 10, false); + this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F); + this.setPathfindingMalus(BlockPathTypes.DAMAGE_FIRE, -1.0F); + this.setPathfindingMalus(BlockPathTypes.LEAVES, 4.0F); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new FloatGoal(this)); + this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D)); + this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this)); + this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0D, 5.0F, 1.0F, true)); + this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D)); + this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, TEMPTATION_ITEMS, false)); + this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D)); + this.goalSelector.addGoal(4, new WaterAvoidingRandomFlyingGoal(this, 1.0D)); + this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.goalSelector.addGoal(6, new LandOnOwnersShoulderGoal(this)); + this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + } + + @Override + protected PathNavigation createNavigation(Level worldIn) { + FlyingPathNavigation flyingpathnavigator = new FlyingPathNavigation(this, worldIn); + flyingpathnavigator.setCanOpenDoors(false); + flyingpathnavigator.setCanFloat(true); + flyingpathnavigator.setCanPassDoors(true); + return flyingpathnavigator; + } + + public static AttributeSupplier createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 8.0D) + .add(Attributes.FLYING_SPEED, (double)0.4F) + .add(Attributes.MOVEMENT_SPEED, (double)0.2F) + .add(Attributes.ARMOR, 0.0D) + .build(); + } + + @Override + public void aiStep() { + super.aiStep(); + Vec3 motion = this.getDeltaMovement(); + if (!this.onGround && motion.y < 0.0D) { + this.setDeltaMovement(motion.multiply(1.0D, 0.6D, 1.0D)); + } + + if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && --this.featherTime <= 0) { + this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.spawnAtLocation(Registry.RAVEN_FEATHER.get()); + this.featherTime = this.random.nextInt(12000) + 12000; + } + } + + @Override + public int calculateFallDamage(float distance, float damageMultiplier) { + return 0; + } + + @Override + public boolean isFood(ItemStack stack) { + return stack.getItem() == Items.BEETROOT_SEEDS; + } + + @Override + public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { + return Registry.RAVEN.get().create(world); + } + + @Override + public boolean setEntityOnShoulder(ServerPlayer player) { + if (player.getShoulderEntityLeft().contains("UUID") + && player.getShoulderEntityLeft().getUUID("UUID").equals(getUUID())) + return false; + if (player.getShoulderEntityRight().contains("UUID") + && player.getShoulderEntityRight().getUUID("UUID").equals(getUUID())) + return false; + CompoundTag compoundnbt = new CompoundTag(); + compoundnbt.putString("id", this.getEncodeId()); + this.saveWithoutId(compoundnbt); + if (player.setEntityOnShoulder(compoundnbt)) { + this.remove(RemovalReason.DISCARDED); + return true; + } else { + return false; + } + } + + @Override + public InteractionResult mobInteract(Player player, InteractionHand hand) { + ItemStack itemstack = player.getItemInHand(hand); + if (!this.isTame() && itemstack.getItem() == Items.BEETROOT_SEEDS) { + if (!player.getAbilities().instabuild) { + itemstack.shrink(1); + } + if (!this.level.isClientSide) { + if (this.random.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player)) { + this.tame(player); + this.level.broadcastEntityEvent(this, (byte)7); + } else { + this.level.broadcastEntityEvent(this, (byte)6); + } + } + return InteractionResult.sidedSuccess(this.level.isClientSide); + } else if (onGround && this.isTame() && this.isOwnedBy(player)) { + if (!this.level.isClientSide) { + this.setOrderedToSit(!this.isOrderedToSit()); + } + return InteractionResult.sidedSuccess(this.level.isClientSide); + } else { + return super.mobInteract(player, hand); + } + } + + @Override + public boolean isFlying() { + return !onGround; + } + + @Override + protected void doPush(Entity entityIn) { + if (!(entityIn instanceof Player)) { + super.doPush(entityIn); + } + } +} diff --git a/src/main/java/elucent/eidolon/entity/RavenModel.java b/src/main/java/elucent/eidolon/entity/RavenModel.java new file mode 100644 index 0000000..5fdb1a5 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/RavenModel.java @@ -0,0 +1,116 @@ +package elucent.eidolon.entity;// Made with Blockbench 3.7.4 +// Exported for Minecraft version 1.15 +// Paste this class into your mod and generate all required imports + + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientEvents; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class RavenModel extends EntityModel { + private final ModelPart body; + + public RavenModel(ModelPart root) { + this.body = root.getChild("body"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, -0.5F)); + + PartDefinition head = body.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-1.5F, -3.0F, -3.0F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 6).addBox(-0.5F, -2.0F, -5.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -5.0F, -1.5F)); + + PartDefinition wings = body.addOrReplaceChild("wings", CubeListBuilder.create().texOffs(0, 14).addBox(-2.0F, -3.5F, -0.5F, 4.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -4.0F, -2.5F, -0.5236F, 0.0F, 0.0F)); + + PartDefinition tailMid = body.addOrReplaceChild("tailMid", CubeListBuilder.create().texOffs(13, 0).addBox(-1.0F, 0.0F, 0.0F, 2.0F, 0.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.5F, 3.0F, -0.2618F, 0.0F, 0.0F)); + + PartDefinition leftTail = body.addOrReplaceChild("leftTail", CubeListBuilder.create().texOffs(16, 14).mirror().addBox(-1.0F, 0.0F, 0.0F, 2.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.75F, -3.0F, 2.5F, -0.2618F, 0.2618F, 0.0F)); + + PartDefinition rightTail = body.addOrReplaceChild("rightTail", CubeListBuilder.create().texOffs(16, 14).addBox(-1.0F, 0.0F, 0.0F, 2.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.75F, -3.0F, 2.5F, -0.2618F, -0.2618F, 0.0F)); + + PartDefinition leftWing = body.addOrReplaceChild("leftWing", CubeListBuilder.create().texOffs(0, 25).addBox(0.0F, 0.0F, 0.0F, 10.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, -5.5F, -1.5F)); + + PartDefinition rightWing = body.addOrReplaceChild("rightWing", CubeListBuilder.create().texOffs(0, 25).mirror().addBox(-10.0F, 0.0F, 0.0F, 10.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-1.0F, -5.5F, -1.5F)); + + PartDefinition leftLeg = body.addOrReplaceChild("leftLeg", CubeListBuilder.create().texOffs(12, 7).addBox(-0.5F, 0.0F, -1.0F, 1.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, -3.0F, 0.5F)); + + PartDefinition rightLeg = body.addOrReplaceChild("rightLeg", CubeListBuilder.create().texOffs(12, 7).addBox(-0.5F, 0.0F, -1.0F, 1.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, -3.0F, 0.5F)); + + PartDefinition chest = body.addOrReplaceChild("chest", CubeListBuilder.create().texOffs(1, 6).addBox(-1.5F, -3.0F, 0.0F, 3.0F, 3.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -4.0F, -2.5F, -0.5236F, 0.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 32, 32); + } + + public void renderOnShoulder(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float p_228284_5_, float p_228284_6_, float p_228284_7_, float p_228284_8_, int p_228284_9_) { + body.getChild("leftWing").visible = false; + body.getChild("rightWing").visible = false; + body.getChild("wings").visible = true; + body.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); + } + + @Override + public void setupAnim(RavenEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ + ModelPart leftWing = body.getChild("leftWing"), rightWing = body.getChild("rightWing"), + wings = body.getChild("wings"), rightLeg = body.getChild("rightLeg"), leftLeg = body.getChild("leftLeg"), + head = body.getChild("head"); + body.y = 24.0f; + if (entity.isOnGround()) { + leftWing.visible = false; + rightWing.visible = false; + wings.visible = true; + + if (entity.isTame() && entity.isInSittingPose()) { + rightLeg.xRot = -(float)Math.PI / 3; + leftLeg.xRot = -(float)Math.PI / 3; + body.y = 25.5f; + } + else { + rightLeg.xRot = Mth.cos(limbSwing * 2F + (float)Math.PI) * 2F * limbSwingAmount; + leftLeg.xRot = Mth.cos(limbSwing * 2F) * 2F * limbSwingAmount; + } + } + else { + leftWing.visible = true; + rightWing.visible = true; + wings.visible = false; + rightLeg.xRot = 0; + leftLeg.xRot = 0; + + if (entity.getDeltaMovement().y < 0) { + rightWing.zRot = Mth.sin(ClientEvents.getClientTicks()) * 0.1f; + leftWing.zRot = -Mth.sin(0.97f + ClientEvents.getClientTicks()) * 0.1f; + } + else { + rightWing.zRot = (float)Math.sin(ClientEvents.getClientTicks()) * 0.4f; + leftWing.zRot = -(float)Math.sin(ClientEvents.getClientTicks()) * 0.4f; + } + } + + head.xRot = (float)Math.toRadians(headPitch); + head.yRot = (float)Math.toRadians(netHeadYaw); + } + + @Override + public void renderToBuffer(PoseStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ + body.render(matrixStack, buffer, packedLight, packedOverlay); + } + + public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) { + modelRenderer.xRot = x; + modelRenderer.yRot = y; + modelRenderer.zRot = z; + } +} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/entity/RavenRenderer.java b/src/main/java/elucent/eidolon/entity/RavenRenderer.java new file mode 100644 index 0000000..762d297 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/RavenRenderer.java @@ -0,0 +1,35 @@ +package elucent.eidolon.entity; + +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; + +public class RavenRenderer extends MobRenderer { + protected static final ResourceLocation TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/entity/raven.png"); + public RavenRenderer(Context erm) { + super(erm, new RavenModel(erm.bakeLayer(ClientRegistry.RAVEN_LAYER)), 0.25f); + } + + @Override + public ResourceLocation getTextureLocation(RavenEntity entity) { + return TEXTURE; + } + + @Override + protected void scale(RavenEntity entitylivingbaseIn, PoseStack matrixStackIn, float partialTickTime) { + float f = 1; + if (entitylivingbaseIn.isBaby()) { + f *= 0.5f; + this.shadowRadius = 0.125F; + } else { + this.shadowRadius = 0.25F; + } + + matrixStackIn.scale(f, f, f); + } +} diff --git a/src/main/java/elucent/eidolon/entity/RavenVariantLayer.java b/src/main/java/elucent/eidolon/entity/RavenVariantLayer.java new file mode 100644 index 0000000..af8ae62 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/RavenVariantLayer.java @@ -0,0 +1,43 @@ +package elucent.eidolon.entity; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Registry; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.PlayerModel; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.nbt.CompoundTag; + +public class RavenVariantLayer extends RenderLayer> { + private RavenModel model = null; + + public RavenVariantLayer(RenderLayerParent> rendererIn) { + super(rendererIn); + } + + public void render(PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn, T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + this.renderRaven(matrixStackIn, bufferIn, packedLightIn, entitylivingbaseIn, limbSwing, limbSwingAmount, netHeadYaw, headPitch, true); + this.renderRaven(matrixStackIn, bufferIn, packedLightIn, entitylivingbaseIn, limbSwing, limbSwingAmount, netHeadYaw, headPitch, false); + } + + private void renderRaven(PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn, T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float netHeadYaw, float headPitch, boolean leftShoulderIn) { + if (model == null) { + model = new RavenModel(Minecraft.getInstance().getEntityModels().bakeLayer(ClientRegistry.RAVEN_LAYER)); + } + CompoundTag compoundnbt = leftShoulderIn ? entitylivingbaseIn.getShoulderEntityLeft() : entitylivingbaseIn.getShoulderEntityRight(); + EntityType.byString(compoundnbt.getString("id")).filter((p_215344_0_) -> p_215344_0_ == Registry.RAVEN.get()).ifPresent((p_229137_11_) -> { + matrixStackIn.pushPose(); + matrixStackIn.translate(leftShoulderIn ? (double)0.4F : (double)-0.4F, entitylivingbaseIn.isCrouching() ? (double)-1.3F : -1.5D, 0.0D); + VertexConsumer ivertexbuilder = bufferIn.getBuffer(model.renderType(RavenRenderer.TEXTURE)); + model.renderOnShoulder(matrixStackIn, ivertexbuilder, packedLightIn, OverlayTexture.NO_OVERLAY, limbSwing, limbSwingAmount, netHeadYaw, headPitch, entitylivingbaseIn.tickCount); + matrixStackIn.popPose(); + }); + } +} diff --git a/src/main/java/elucent/eidolon/entity/SlimySlugEntity.java b/src/main/java/elucent/eidolon/entity/SlimySlugEntity.java new file mode 100644 index 0000000..9ea1667 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/SlimySlugEntity.java @@ -0,0 +1,105 @@ +package elucent.eidolon.entity; + +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.PanicGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.TemptGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; + +import java.util.Optional; +import java.util.UUID; + +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.deity.Deities; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.util.Mth; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biomes; +import net.minecraftforge.common.extensions.IForgeEntity; +import net.minecraftforge.registries.ForgeRegistries; + +public class SlimySlugEntity extends PathfinderMob implements IForgeEntity { + private static final Ingredient TEMPTATION_ITEMS = Ingredient.of(Items.PUMPKIN_SEEDS); + float yRotTrail = 0.0f; + float squishAmount = 1.0f; + public static final EntityDataAccessor TYPE = SynchedEntityData.defineId(SlimySlugEntity.class, EntityDataSerializers.INT); + + public SlimySlugEntity(EntityType type, Level worldIn) { + super(type, worldIn); + registerGoals(); + yRotTrail = this.getYRot(); + getEntityData().set(TYPE, 0); + } + + @Override + public void onAddedToWorld() { + Biome b = level.getBiome(getOnPos()); + if (Biomes.LUSH_CAVES.getRegistryName().equals(b.getRegistryName())) { + getEntityData().set(TYPE, 0); + } + else if (Biomes.OLD_GROWTH_PINE_TAIGA.location().equals(b.getRegistryName()) + || Biomes.OLD_GROWTH_SPRUCE_TAIGA.location().equals(b.getRegistryName())) { + getEntityData().set(TYPE, 1); + } + else if (Biomes.FLOWER_FOREST.location().equals(b.getRegistryName())) { + getEntityData().set(TYPE, 2); + } + } + + @Override + protected void defineSynchedData() { + super.defineSynchedData(); + getEntityData().define(TYPE, 0); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new FloatGoal(this)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, + (e) -> ((Player)e).getGameProfile().getId().equals(UUID.fromString("0ca54301-6170-4c44-b3e0-b8afa6b81ed2")))); + this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D)); + this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, TEMPTATION_ITEMS, false)); + this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + } + + public static AttributeSupplier createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 8.0D) + .add(Attributes.MOVEMENT_SPEED, (double)0.1F) + .add(Attributes.ARMOR, 0.0D) + .add(Attributes.ATTACK_DAMAGE, 999.0D) + .build(); + } + + public void tick() { + super.tick(); + yRotTrail = Mth.rotLerp(yRotTrail, getYRot(), 0.2f); + } + + @Override + public boolean hurt(DamageSource source, float amt) { + if (source != null && source.getEntity() instanceof Player p + && p.getGameProfile().getId().equals(UUID.fromString("0ca54301-6170-4c44-b3e0-b8afa6b81ed2"))) { + // SammySemicolon is not allowed to hurt slugs >:/ + p.hurt(source, amt); + return false; + } + return super.hurt(source, amt); + } +} diff --git a/src/main/java/elucent/eidolon/entity/SlimySlugModel.java b/src/main/java/elucent/eidolon/entity/SlimySlugModel.java new file mode 100644 index 0000000..2e699f7 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/SlimySlugModel.java @@ -0,0 +1,54 @@ +package elucent.eidolon.entity; +// Made with Blockbench 4.0.5 +// Exported for Minecraft version 1.17 with Mojang mappings +// Paste this class into your mod and generate all required imports + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class SlimySlugModel extends EntityModel { + private final ModelPart body; + + public SlimySlugModel(ModelPart root) { + this.body = root.getChild("body"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-2.0F, -4.0F, -4.0F, 4.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + + PartDefinition tail = body.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(16, 0).addBox(-1.0F, -2.0F, 0.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 4.0F)); + + PartDefinition left_eye = body.addOrReplaceChild("left_eye", CubeListBuilder.create(), PartPose.offsetAndRotation(1.0F, -4.0F, -3.0F, 0.2618F, 0.0F, 0.2618F)); + + PartDefinition cube_r1 = left_eye.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -3.0F, -1.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F)); + + PartDefinition right_eye = body.addOrReplaceChild("right_eye", CubeListBuilder.create(), PartPose.offsetAndRotation(-1.0F, -4.0F, -3.0F, 0.2618F, 0.0F, -0.2618F)); + + PartDefinition cube_r2 = right_eye.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -3.0F, -1.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 32, 16); + } + + @Override + public void setupAnim(SlimySlugEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + entity.squishAmount = 1 + Mth.cos(limbSwing * 4.0F + (float)Math.PI) * 0.1f; + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + body.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/entity/SlimySlugRenderer.java b/src/main/java/elucent/eidolon/entity/SlimySlugRenderer.java new file mode 100644 index 0000000..607f014 --- /dev/null +++ b/src/main/java/elucent/eidolon/entity/SlimySlugRenderer.java @@ -0,0 +1,34 @@ +package elucent.eidolon.entity; + +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; + +public class SlimySlugRenderer extends MobRenderer { + protected static final ResourceLocation SLIMY_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/entity/slimy_slug.png"); + protected static final ResourceLocation BANANA_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/entity/banana_slug.png"); + protected static final ResourceLocation BROWN_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/entity/brown_slug.png"); + public SlimySlugRenderer(Context erm) { + super(erm, new SlimySlugModel(erm.bakeLayer(ClientRegistry.SLUG_LAYER)), 0.4f); + } + + @Override + public ResourceLocation getTextureLocation(SlimySlugEntity entity) { + return switch (entity.getEntityData().get(SlimySlugEntity.TYPE)) { + case 0 -> SLIMY_TEXTURE; + case 1 -> BANANA_TEXTURE; + case 2 -> BROWN_TEXTURE; + default -> SLIMY_TEXTURE; + }; + } + + @Override + protected void scale(SlimySlugEntity e, PoseStack matrixStackIn, float partialTickTime) { + matrixStackIn.scale(2 / (1 + e.squishAmount), 2 / (1 + e.squishAmount), e.squishAmount); + } +} diff --git a/src/main/java/elucent/eidolon/entity/SoulfireProjectileEntity.java b/src/main/java/elucent/eidolon/entity/SoulfireProjectileEntity.java index 4b2df8f..3f6b99f 100644 --- a/src/main/java/elucent/eidolon/entity/SoulfireProjectileEntity.java +++ b/src/main/java/elucent/eidolon/entity/SoulfireProjectileEntity.java @@ -5,24 +5,17 @@ import elucent.eidolon.network.Networking; import elucent.eidolon.particle.Particles; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.IPacket; -import net.minecraft.util.DamageSource; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkHooks; - -import java.util.List; -import java.util.UUID; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; public class SoulfireProjectileEntity extends SpellProjectileEntity { - public SoulfireProjectileEntity(EntityType entityTypeIn, World worldIn) { + public SoulfireProjectileEntity(EntityType entityTypeIn, Level worldIn) { super(entityTypeIn, worldIn); } @@ -30,41 +23,41 @@ public SoulfireProjectileEntity(EntityType entityTypeIn, World worldIn) { public void tick() { super.tick(); - Vector3d motion = getMotion(); - Vector3d pos = getPositionVec(); - Vector3d norm = motion.normalize().scale(0.025f); + Vec3 motion = getDeltaMovement(); + Vec3 pos = position(); + Vec3 norm = motion.normalize().scale(0.025f); for (int i = 0; i < 8; i ++) { - double lerpX = MathHelper.lerp(i / 8.0f, prevPosX, pos.x); - double lerpY = MathHelper.lerp(i / 8.0f, prevPosY, pos.y); - double lerpZ = MathHelper.lerp(i / 8.0f, prevPosZ, pos.z); + double lerpX = Mth.lerp(i / 8.0f, xo, pos.x); + double lerpY = Mth.lerp(i / 8.0f, yo, pos.y); + double lerpZ = Mth.lerp(i / 8.0f, zo, pos.z); Particles.create(Registry.SPARKLE_PARTICLE) .addVelocity(-norm.x, -norm.y, -norm.z) .setAlpha(0.375f, 0).setScale(0.375f, 0) .setColor(1, 0.875f, 0.5f, 0.5f, 0.25f, 1) .setLifetime(5) - .spawn(world, lerpX, lerpY, lerpZ); + .spawn(level, lerpX, lerpY, lerpZ); Particles.create(Registry.WISP_PARTICLE) .addVelocity(-norm.x, -norm.y, -norm.z) .setAlpha(0.125f, 0).setScale(0.25f, 0.125f) .setColor(1, 0.5f, 0.625f, 0.5f, 0.25f, 1) .setLifetime(20) - .spawn(world, lerpX, lerpY, lerpZ); + .spawn(level, lerpX, lerpY, lerpZ); } } @Override - protected void onImpact(RayTraceResult ray, Entity target) { - target.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, world.getPlayerByUuid(casterId)), 7.0f); + protected void onImpact(HitResult ray, Entity target) { + target.hurt(DamageSource.indirectMagic(this, level.getPlayerByUUID(casterId)), 7.0f); onImpact(ray); } @Override - protected void onImpact(RayTraceResult ray) { - setDead(); - if (!world.isRemote) { - Vector3d pos = ray.getHitVec(); - world.playSound(null, pos.x, pos.y, pos.z, Registry.SPLASH_SOULFIRE_EVENT.get(), SoundCategory.NEUTRAL, 0.6f, rand.nextFloat() * 0.2f + 0.9f); - Networking.sendToTracking(world, getPosition(), new MagicBurstEffectPacket(pos.x, pos.y, pos.z, ColorUtil.packColor(255, 255, 229, 125), ColorUtil.packColor(255, 124, 57, 247))); + protected void onImpact(HitResult ray) { + removeAfterChangingDimensions(); + if (!level.isClientSide) { + Vec3 pos = ray.getLocation(); + level.playSound(null, pos.x, pos.y, pos.z, Registry.SPLASH_SOULFIRE_EVENT.get(), SoundSource.NEUTRAL, 0.6f, random.nextFloat() * 0.2f + 0.9f); + Networking.sendToTracking(level, blockPosition(), new MagicBurstEffectPacket(pos.x, pos.y, pos.z, ColorUtil.packColor(255, 255, 229, 125), ColorUtil.packColor(255, 124, 57, 247))); } } } diff --git a/src/main/java/elucent/eidolon/entity/SpellProjectileEntity.java b/src/main/java/elucent/eidolon/entity/SpellProjectileEntity.java index d39cf4f..110ea7c 100644 --- a/src/main/java/elucent/eidolon/entity/SpellProjectileEntity.java +++ b/src/main/java/elucent/eidolon/entity/SpellProjectileEntity.java @@ -1,93 +1,77 @@ package elucent.eidolon.entity; -import elucent.eidolon.Registry; -import elucent.eidolon.particle.Particles; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.attributes.AttributeModifierMap; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.item.BoatEntity; -import net.minecraft.entity.merchant.villager.AbstractVillagerEntity; -import net.minecraft.entity.monster.MonsterEntity; -import net.minecraft.entity.passive.IronGolemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.ProjectileHelper; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.IPacket; -import net.minecraft.network.play.server.SSpawnObjectPacket; -import net.minecraft.util.DamageSource; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.EntityRayTraceResult; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkHooks; - -import java.util.List; import java.util.UUID; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkHooks; +import net.minecraft.world.level.Level; + public abstract class SpellProjectileEntity extends Entity { UUID casterId = null; - public SpellProjectileEntity(EntityType entityTypeIn, World worldIn) { + public SpellProjectileEntity(EntityType entityTypeIn, Level worldIn) { super(entityTypeIn, worldIn); } public Entity shoot(double x, double y, double z, double vx, double vy, double vz, UUID caster) { - setPosition(x, y, z); - setMotion(vx, vy, vz); + setPos(x, y, z); + setDeltaMovement(vx, vy, vz); casterId = caster; - velocityChanged = true; + hurtMarked = true; return this; } @Override public void tick() { - Vector3d motion = getMotion(); - setMotion(motion.x * 0.96, (motion.y > 0 ? motion.y * 0.96 : motion.y) - 0.03f, motion.z * 0.96); + Vec3 motion = getDeltaMovement(); + setDeltaMovement(motion.x * 0.96, (motion.y > 0 ? motion.y * 0.96 : motion.y) - 0.03f, motion.z * 0.96); super.tick(); - if (!world.isRemote) { - RayTraceResult ray = ProjectileHelper.func_234618_a_(this, (e) -> !e.isSpectator() && e.canBeCollidedWith() && !e.getUniqueID().equals(casterId)); - if (ray.getType() == RayTraceResult.Type.ENTITY) { - onImpact(ray, ((EntityRayTraceResult)ray).getEntity()); + if (!level.isClientSide) { + HitResult ray = ProjectileUtil.getHitResult(this, (e) -> !e.isSpectator() && e.isPickable() && !e.getUUID().equals(casterId)); + if (ray.getType() == HitResult.Type.ENTITY) { + onImpact(ray, ((EntityHitResult)ray).getEntity()); } - else if (ray.getType() == RayTraceResult.Type.BLOCK) { + else if (ray.getType() == HitResult.Type.BLOCK) { onImpact(ray); } } - Vector3d pos = getPositionVec(); - prevPosX = pos.x; - prevPosY = pos.y; - prevPosZ = pos.z; - setPosition(pos.x + motion.x, pos.y + motion.y, pos.z + motion.z); + Vec3 pos = position(); + xo = pos.x; + yo = pos.y; + zo = pos.z; + setPos(pos.x + motion.x, pos.y + motion.y, pos.z + motion.z); } - protected abstract void onImpact(RayTraceResult ray, Entity target); - protected abstract void onImpact(RayTraceResult ray); + protected abstract void onImpact(HitResult ray, Entity target); + protected abstract void onImpact(HitResult ray); @Override - protected void registerData() { + protected void defineSynchedData() { // } @Override - protected void readAdditional(CompoundNBT compound) { - casterId = compound.contains("caster") ? compound.getUniqueId("caster") : null; + protected void readAdditionalSaveData(CompoundTag compound) { + casterId = compound.contains("caster") ? compound.getUUID("caster") : null; } @Override - protected void writeAdditional(CompoundNBT compound) { - if (casterId != null) compound.putUniqueId("caster", casterId); + protected void addAdditionalSaveData(CompoundTag compound) { + if (casterId != null) compound.putUUID("caster", casterId); } @Override - public IPacket createSpawnPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } diff --git a/src/main/java/elucent/eidolon/entity/WraithEntity.java b/src/main/java/elucent/eidolon/entity/WraithEntity.java index 82ad104..9b68a03 100644 --- a/src/main/java/elucent/eidolon/entity/WraithEntity.java +++ b/src/main/java/elucent/eidolon/entity/WraithEntity.java @@ -1,132 +1,126 @@ package elucent.eidolon.entity; import elucent.eidolon.Registry; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.entity.CreatureAttribute; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.AttributeModifierMap; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.item.BoatEntity; -import net.minecraft.entity.merchant.villager.AbstractVillagerEntity; -import net.minecraft.entity.monster.CreeperEntity; -import net.minecraft.entity.monster.MonsterEntity; -import net.minecraft.entity.monster.SpiderEntity; -import net.minecraft.entity.monster.ZombieEntity; -import net.minecraft.entity.passive.ChickenEntity; -import net.minecraft.entity.passive.IronGolemEntity; -import net.minecraft.entity.passive.TurtleEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.pathfinding.PathNavigator; -import net.minecraft.pathfinding.SwimmerPathNavigator; -import net.minecraft.potion.EffectInstance; -import net.minecraft.util.DamageSource; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; - -public class WraithEntity extends MonsterEntity { - public WraithEntity(EntityType type, World worldIn) { +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; + +public class WraithEntity extends Monster { + public WraithEntity(EntityType type, Level worldIn) { super(type, worldIn); registerGoals(); } @Override - public CreatureAttribute getCreatureAttribute() { - return CreatureAttribute.UNDEAD; + public MobType getMobType() { + return MobType.UNDEAD; } @Override - public boolean isEntityUndead() { + public boolean isInvertedHealAndHarm() { return true; } @Override - public boolean attackEntityAsMob(Entity entityIn) { - boolean flag = super.attackEntityAsMob(entityIn); + public boolean doHurtTarget(Entity entityIn) { + boolean flag = super.doHurtTarget(entityIn); if (flag && entityIn instanceof LivingEntity) { - float f = this.world.getDifficultyForLocation(this.getPosition()).getAdditionalDifficulty(); - ((LivingEntity)entityIn).addPotionEffect(new EffectInstance(Registry.CHILLED_EFFECT.get(), 100 + (int)(100 * world.getDifficulty().getId()))); + float f = this.level.getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty(); + ((LivingEntity)entityIn).addEffect(new MobEffectInstance(Registry.CHILLED_EFFECT.get(), 100 + (int)(100 * level.getDifficulty().getId()))); } return flag; } protected void registerGoals() { - this.goalSelector.addGoal(0, new SwimGoal(this)); + this.goalSelector.addGoal(0, new FloatGoal(this)); this.applyEntityAI(); } - public static AttributeModifierMap createAttributes() { - return MonsterEntity.func_234295_eP_() - .createMutableAttribute(Attributes.MAX_HEALTH, 20.0D) - .createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)0.2F) - .createMutableAttribute(Attributes.ATTACK_DAMAGE, 4.0D) - .createMutableAttribute(Attributes.ARMOR, 0.0D) - .create(); + public static AttributeSupplier createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 20.0D) + .add(Attributes.MOVEMENT_SPEED, (double)0.2F) + .add(Attributes.ATTACK_DAMAGE, 4.0D) + .add(Attributes.ARMOR, 0.0D) + .build(); } protected void applyEntityAI() { this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.5D, false)); - this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); + this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); } @Override - public int getExperiencePoints(PlayerEntity player) { + public int getExperienceReward(Player player) { return 5; } @Override - public void livingTick() { - if (this.world.isDaytime() && !this.world.isRemote) { + public void aiStep() { + if (this.level.isDay() && !this.level.isClientSide) { float f = this.getBrightness(); - BlockPos blockpos = this.getRidingEntity() instanceof BoatEntity ? (new BlockPos(this.getPosX(), (double) Math.round(this.getPosY()), this.getPosZ())).up() : new BlockPos(this.getPosX(), (double) Math.round(this.getPosY()), this.getPosZ()); - if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canSeeSky(blockpos)) { - this.setFire(8); + BlockPos blockpos = this.getVehicle() instanceof Boat ? (new BlockPos(this.getX(), (double) Math.round(this.getY()), this.getZ())).above() : new BlockPos(this.getX(), (double) Math.round(this.getY()), this.getZ()); + if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.level.canSeeSky(blockpos)) { + this.setSecondsOnFire(8); } } // hover over water - FluidState below = world.getBlockState(getPositionUnderneath()).getFluidState(); + FluidState below = level.getBlockState(getBlockPosBelowThatAffectsMyMovement()).getFluidState(); if (!below.isEmpty()) { - Vector3d motion = getMotion(); + Vec3 motion = getDeltaMovement(); this.setOnGround(true); - if (getPosY() + motion.y < getPositionUnderneath().getY() + below.getHeight()) { + if (getY() + motion.y < getBlockPosBelowThatAffectsMyMovement().getY() + below.getOwnHeight()) { setNoGravity(true); - if (motion.y < 0) setMotion(motion.mul(1, 0, 1)); - setPosition(getPosX(), getPositionUnderneath().getY() + below.getHeight(), getPosZ()); + if (motion.y < 0) setDeltaMovement(motion.multiply(1, 0, 1)); + setPos(getX(), getBlockPosBelowThatAffectsMyMovement().getY() + below.getOwnHeight(), getZ()); } } else setNoGravity(false); // slow fall this.fallDistance = 0; - Vector3d vector3d = this.getMotion(); + Vec3 vector3d = this.getDeltaMovement(); if (!this.onGround && vector3d.y < 0.0D) { - this.setMotion(vector3d.mul(1.0D, 0.6D, 1.0D)); + this.setDeltaMovement(vector3d.multiply(1.0D, 0.6D, 1.0D)); } - super.livingTick(); + super.aiStep(); } @Override public SoundEvent getDeathSound() { - return SoundEvents.ENTITY_STRAY_DEATH; + return SoundEvents.STRAY_DEATH; } @Override public SoundEvent getAmbientSound() { - return SoundEvents.ENTITY_STRAY_AMBIENT; + return SoundEvents.STRAY_AMBIENT; } @Override public SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.ENTITY_STRAY_HURT; + return SoundEvents.STRAY_HURT; } } diff --git a/src/main/java/elucent/eidolon/entity/WraithModel.java b/src/main/java/elucent/eidolon/entity/WraithModel.java index ad10f57..0ec4830 100644 --- a/src/main/java/elucent/eidolon/entity/WraithModel.java +++ b/src/main/java/elucent/eidolon/entity/WraithModel.java @@ -1,93 +1,62 @@ -package elucent.eidolon.entity; - -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.model.EntityModel; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3d; - -public class WraithModel extends EntityModel { - private final ModelRenderer body; - private final ModelRenderer tail; - private final ModelRenderer right_arm; - private final ModelRenderer lower_right_arm; - private final ModelRenderer right_hand; - private final ModelRenderer left_arm; - private final ModelRenderer lower_left_arm; - private final ModelRenderer left_hand; - - public WraithModel() { - textureWidth = 64; - textureHeight = 64; - - body = new ModelRenderer(this); - body.setRotationPoint(0.0F, 8.0F, 0.0F); - body.setTextureOffset(0, 0).addBox(-4.0F, -16.0F, -4.0F, 8.0F, 16.0F, 8.0F, 0.0F, false); - body.setTextureOffset(32, 2).addBox(-3.0F, -15.0F, -3.0F, 6.0F, 15.0F, 6.0F, 0.0F, false); - - tail = new ModelRenderer(this); - tail.setRotationPoint(0.0F, 0.0F, -4.0F); - body.addChild(tail); - setRotationAngle(tail, 0.2618F, 0.0F, 0.0F); - tail.setTextureOffset(0, 24).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 16.0F, 8.0F, 0.0F, false); - tail.setTextureOffset(32, 26).addBox(-3.0F, 0.2588F, 0.9659F, 6.0F, 15.0F, 6.0F, 0.0F, false); - - right_arm = new ModelRenderer(this); - right_arm.setRotationPoint(-5.5F, -6.5F, 0.0F); - body.addChild(right_arm); - setRotationAngle(right_arm, -1.0472F, 0.0F, -0.1745F); - right_arm.setTextureOffset(0, 48).addBox(-1.5F, -1.5F, -1.0F, 3.0F, 6.0F, 3.0F, 0.0F, false); - - lower_right_arm = new ModelRenderer(this); - lower_right_arm.setRotationPoint(0.0F, 6.0F, 0.0F); - right_arm.addChild(lower_right_arm); - setRotationAngle(lower_right_arm, -0.7854F, 0.0F, 0.0F); - lower_right_arm.setTextureOffset(12, 48).addBox(-1.5F, -2.4749F, -2.6464F, 3.0F, 6.0F, 3.0F, 0.0F, false); - - right_hand = new ModelRenderer(this); - right_hand.setRotationPoint(0.0F, 2.5F, 0.0F); - lower_right_arm.addChild(right_hand); - setRotationAngle(right_hand, 0.3927F, 0.0F, 0.0F); - right_hand.setTextureOffset(25, 48).addBox(-1.5F, -1.0F, -1.5F, 3.0F, 3.0F, 3.0F, 0.0F, false); - - left_arm = new ModelRenderer(this); - left_arm.setRotationPoint(5.5F, -6.5F, 0.0F); - body.addChild(left_arm); - setRotationAngle(left_arm, -1.0472F, 0.0F, 0.1745F); - left_arm.setTextureOffset(0, 48).addBox(-1.5F, -1.5F, -1.0F, 3.0F, 6.0F, 3.0F, 0.0F, true); - - lower_left_arm = new ModelRenderer(this); - lower_left_arm.setRotationPoint(-11.0F, 6.0F, 0.0F); - left_arm.addChild(lower_left_arm); - setRotationAngle(lower_left_arm, -0.7854F, 0.0F, 0.0F); - lower_left_arm.setTextureOffset(12, 48).addBox(9.5F, -2.4749F, -2.6464F, 3.0F, 6.0F, 3.0F, 0.0F, true); - - left_hand = new ModelRenderer(this); - left_hand.setRotationPoint(0.0F, 2.5F, 0.0F); - lower_left_arm.addChild(left_hand); - setRotationAngle(left_hand, 0.3927F, 0.0F, 0.0F); - left_hand.setTextureOffset(25, 48).addBox(9.5F, -1.0F, -1.5F, 3.0F, 3.0F, 3.0F, 0.0F, true); - } - - @Override - public void setRotationAngles(WraithEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ - body.rotationPointY = 8.0f + 1.5f * MathHelper.sin(ageInTicks / 20.0f * (float)Math.PI); - body.rotateAngleX = (float)Math.toRadians(MathHelper.clamp( - 10.0f * (float)entity.getMotion().mul(1, 0, 1).length() / 0.3f, - -10.0f, 10.0f - )); - } - - @Override - public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ - body.render(matrixStack, buffer, packedLight, packedOverlay); - } - - public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +package elucent.eidolon.entity; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class WraithModel extends EntityModel { + private final ModelPart body; + + public WraithModel(ModelPart root) { + this.body = root.getChild("body"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -16.0F, -4.0F, 8.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(32, 2).addBox(-3.0F, -15.0F, -3.0F, 6.0F, 15.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 8.0F, 0.0F)); + + PartDefinition tail = body.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(0, 24).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(32, 26).addBox(-3.0F, 0.2588F, 0.9659F, 6.0F, 15.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -4.0F, 0.2618F, 0.0F, 0.0F)); + + PartDefinition right_arm = body.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(0, 48).addBox(-1.5F, -1.5F, -1.0F, 3.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-5.5F, -6.5F, 0.0F, -1.0472F, 0.0F, -0.1745F)); + + PartDefinition lower_right_arm = right_arm.addOrReplaceChild("lower_right_arm", CubeListBuilder.create().texOffs(12, 48).addBox(-1.5F, -2.4749F, -2.6464F, 3.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 6.0F, 0.0F, -0.7854F, 0.0F, 0.0F)); + + PartDefinition right_hand = lower_right_arm.addOrReplaceChild("right_hand", CubeListBuilder.create().texOffs(25, 48).addBox(-1.5F, -1.0F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 2.5F, 0.0F, 0.3927F, 0.0F, 0.0F)); + + PartDefinition left_arm = body.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(0, 48).mirror().addBox(-1.5F, -1.5F, -1.0F, 3.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(5.5F, -6.5F, 0.0F, -1.0472F, 0.0F, 0.1745F)); + + PartDefinition lower_left_arm = left_arm.addOrReplaceChild("lower_left_arm", CubeListBuilder.create().texOffs(12, 48).mirror().addBox(9.5F, -2.4749F, -2.6464F, 3.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-11.0F, 6.0F, 0.0F, -0.7854F, 0.0F, 0.0F)); + + PartDefinition left_hand = lower_left_arm.addOrReplaceChild("left_hand", CubeListBuilder.create().texOffs(25, 48).mirror().addBox(9.5F, -1.0F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 2.5F, 0.0F, 0.3927F, 0.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 64, 64); + } + + @Override + public void setupAnim(WraithEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + body.y = 8.0f + 1.5f * (float)Mth.sin(ageInTicks / 20.0f * (float)Math.PI); + body.xRot = (float)Math.toRadians(Mth.clamp( + 15.0f * (float)entity.getDeltaMovement().multiply(1, 0, 1).length() / 0.3f, + -15.0f, 15.0f + )); + body.getChild("right_arm").xRot = -1.0472F + Mth.cos(limbSwing * 0.666F + (float)Math.PI) * 0.25F * limbSwingAmount; + body.getChild("left_arm").xRot = -1.0472F + Mth.cos(limbSwing * 0.666F) * 0.25F * limbSwingAmount; + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + body.render(poseStack, buffer, packedLight, packedOverlay); + } } \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/entity/WraithRenderer.java b/src/main/java/elucent/eidolon/entity/WraithRenderer.java index 97600a7..7ef3450 100644 --- a/src/main/java/elucent/eidolon/entity/WraithRenderer.java +++ b/src/main/java/elucent/eidolon/entity/WraithRenderer.java @@ -1,17 +1,19 @@ package elucent.eidolon.entity; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import net.minecraft.client.renderer.entity.EntityRendererManager; +import elucent.eidolon.Registry; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; public class WraithRenderer extends MobRenderer { - public WraithRenderer(EntityRendererManager rendererManager, WraithModel entityModelIn, float shadowSizeIn) { - super(rendererManager, entityModelIn, shadowSizeIn); + public WraithRenderer(Context erm) { + super(erm, new WraithModel(erm.bakeLayer(ClientRegistry.WRAITH_LAYER)), 0.45f); } @Override - public ResourceLocation getEntityTexture(WraithEntity entity) { + public ResourceLocation getTextureLocation(WraithEntity entity) { return new ResourceLocation(Eidolon.MODID, "textures/entity/wraith.png"); } } diff --git a/src/main/java/elucent/eidolon/entity/ZombieBruteEntity.java b/src/main/java/elucent/eidolon/entity/ZombieBruteEntity.java index 0ee3db1..877f186 100644 --- a/src/main/java/elucent/eidolon/entity/ZombieBruteEntity.java +++ b/src/main/java/elucent/eidolon/entity/ZombieBruteEntity.java @@ -1,100 +1,98 @@ package elucent.eidolon.entity; -import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; -import net.minecraft.entity.CreatureAttribute; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.MobEntity; -import net.minecraft.entity.ai.attributes.AttributeModifierMap; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.item.BoatEntity; -import net.minecraft.entity.merchant.villager.AbstractVillagerEntity; -import net.minecraft.entity.monster.MonsterEntity; -import net.minecraft.entity.monster.ZombieEntity; -import net.minecraft.entity.monster.ZombifiedPiglinEntity; -import net.minecraft.entity.passive.IronGolemEntity; -import net.minecraft.entity.passive.TurtleEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.DamageSource; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.npc.AbstractVillager; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.animal.IronGolem; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; -public class ZombieBruteEntity extends MonsterEntity { - public ZombieBruteEntity(EntityType type, World worldIn) { +public class ZombieBruteEntity extends Monster { + public ZombieBruteEntity(EntityType type, Level worldIn) { super(type, worldIn); registerGoals(); } @Override - public CreatureAttribute getCreatureAttribute() { - return CreatureAttribute.UNDEAD; + public MobType getMobType() { + return MobType.UNDEAD; } @Override - public boolean isEntityUndead() { + public boolean isInvertedHealAndHarm() { return true; } protected void registerGoals() { - this.goalSelector.addGoal(0, new SwimGoal(this)); + this.goalSelector.addGoal(0, new FloatGoal(this)); this.applyEntityAI(); } - public static AttributeModifierMap createAttributes() { - return MonsterEntity.func_234295_eP_() - .createMutableAttribute(Attributes.MAX_HEALTH, 40.0D) - .createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)0.28F) - .createMutableAttribute(Attributes.ATTACK_DAMAGE, 5.0D) - .createMutableAttribute(Attributes.ARMOR, 6.0D) - .create(); + public static AttributeSupplier createAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 40.0D) + .add(Attributes.MOVEMENT_SPEED, (double)0.28F) + .add(Attributes.ATTACK_DAMAGE, 5.0D) + .add(Attributes.ARMOR, 6.0D) + .build(); } protected void applyEntityAI() { - this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 8.0F)); - this.goalSelector.addGoal(8, new LookRandomlyGoal(this)); + this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.0D, false)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); - this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); - this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillagerEntity.class, false)); - this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolemEntity.class, true)); + this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); } @Override - public int getExperiencePoints(PlayerEntity player) { + public int getExperienceReward(Player player) { return 8; } @Override - public void livingTick() { - if (this.world.isDaytime() && !this.world.isRemote) { + public void aiStep() { + if (this.level.isDay() && !this.level.isClientSide) { float f = this.getBrightness(); - BlockPos blockpos = this.getRidingEntity() instanceof BoatEntity ? (new BlockPos(this.getPosX(), (double) Math.round(this.getPosY()), this.getPosZ())).up() : new BlockPos(this.getPosX(), (double) Math.round(this.getPosY()), this.getPosZ()); - if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canSeeSky(blockpos)) { - this.setFire(8); + BlockPos blockpos = this.getVehicle() instanceof Boat ? (new BlockPos(this.getX(), (double) Math.round(this.getY()), this.getZ())).above() : new BlockPos(this.getX(), (double) Math.round(this.getY()), this.getZ()); + if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.level.canSeeSky(blockpos)) { + this.setSecondsOnFire(8); } } - super.livingTick(); + super.aiStep(); } @Override public SoundEvent getDeathSound() { - return SoundEvents.ENTITY_ZOMBIE_DEATH; + return SoundEvents.ZOMBIE_DEATH; } @Override public SoundEvent getAmbientSound() { - return SoundEvents.ENTITY_ZOMBIE_AMBIENT; + return SoundEvents.ZOMBIE_AMBIENT; } @Override public SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.ENTITY_ZOMBIE_HURT; + return SoundEvents.ZOMBIE_HURT; } } diff --git a/src/main/java/elucent/eidolon/entity/ZombieBruteModel.java b/src/main/java/elucent/eidolon/entity/ZombieBruteModel.java index d927741..2f8bc80 100644 --- a/src/main/java/elucent/eidolon/entity/ZombieBruteModel.java +++ b/src/main/java/elucent/eidolon/entity/ZombieBruteModel.java @@ -1,76 +1,61 @@ -package elucent.eidolon.entity; - -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.renderer.entity.model.EntityModel; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.util.math.MathHelper; - -public class ZombieBruteModel extends EntityModel { - private final ModelRenderer chest; - private final ModelRenderer right_leg; - private final ModelRenderer head; - private final ModelRenderer left_arm; - private final ModelRenderer right_arm; - private final ModelRenderer left_leg; - - public ZombieBruteModel() { - textureWidth = 96; - textureHeight = 96; - - chest = new ModelRenderer(this); - chest.setRotationPoint(0.0F, 9.0F, 0.0F); - chest.setTextureOffset(20, 16).addBox(-6.0F, -15.0F, -3.0F, 12.0F, 15.0F, 6.0F, 0.0F, false); - - right_leg = new ModelRenderer(this); - right_leg.setRotationPoint(-3.0F, 0.0F, 0.0F); - chest.addChild(right_leg); - right_leg.setTextureOffset(0, 16).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 15.0F, 5.0F, 0.0F, false); - - head = new ModelRenderer(this); - head.setRotationPoint(0.0F, -15.0F, 0.0F); - chest.addChild(head); - head.setTextureOffset(0, 37).addBox(-5.0F, -10.0F, -5.0F, 10.0F, 10.0F, 10.0F, 0.0F, false); - - left_arm = new ModelRenderer(this); - left_arm.setRotationPoint(9.0F, -12.0F, 0.0F); - chest.addChild(left_arm); - left_arm.setTextureOffset(56, 16).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 13.0F, 5.0F, 0.0F, true); - left_arm.setTextureOffset(48, 4).addBox(-3.0F, -3.0F, -3.0F, 6.0F, 6.0F, 6.0F, 0.0F, false); - - right_arm = new ModelRenderer(this); - right_arm.setRotationPoint(-9.0F, -12.0F, 0.0F); - chest.addChild(right_arm); - right_arm.setTextureOffset(48, 4).addBox(-3.0F, -3.0F, -3.0F, 6.0F, 6.0F, 6.0F, 0.0F, false); - right_arm.setTextureOffset(56, 16).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 13.0F, 5.0F, 0.0F, false); - - left_leg = new ModelRenderer(this); - left_leg.setRotationPoint(3.0F, 0.0F, 0.0F); - chest.addChild(left_leg); - left_leg.setTextureOffset(0, 16).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 15.0F, 5.0F, 0.0F, true); - } - - @Override - public void setRotationAngles(ZombieBruteEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ - right_leg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; - left_leg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - right_arm.rotateAngleX = (float)Math.toRadians(-80); - left_arm.rotateAngleX = (float)Math.toRadians(-80); - right_arm.rotateAngleZ = (float)Math.toRadians(5); - left_arm.rotateAngleZ = (float)Math.toRadians(-5); - - head.rotateAngleX = (float)Math.toRadians(headPitch); - head.rotateAngleY = (float)Math.toRadians(netHeadYaw); - } - - @Override - public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ - chest.render(matrixStack, buffer, packedLight, packedOverlay); - } - - public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +package elucent.eidolon.entity; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class ZombieBruteModel extends EntityModel { + private final ModelPart chest; + + public ZombieBruteModel(ModelPart root) { + this.chest = root.getChild("chest"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition chest = partdefinition.addOrReplaceChild("chest", CubeListBuilder.create().texOffs(20, 16).addBox(-6.0F, -15.0F, -3.0F, 12.0F, 15.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 9.0F, 0.0F)); + + PartDefinition right_leg = chest.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 16).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 15.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(-3.0F, 0.0F, 0.0F)); + + PartDefinition head = chest.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 37).addBox(-5.0F, -10.0F, -5.0F, 10.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -15.0F, 0.0F)); + + PartDefinition left_arm = chest.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-2.5F, 0.0F, -2.5F, 5.0F, 13.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(48, 4).addBox(-3.0F, -3.0F, -3.0F, 6.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(9.0F, -12.0F, 0.0F)); + + PartDefinition right_arm = chest.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(48, 4).addBox(-3.0F, -3.0F, -3.0F, 6.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(56, 16).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 13.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(-9.0F, -12.0F, 0.0F)); + + PartDefinition left_leg = chest.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 16).mirror().addBox(-2.5F, 0.0F, -2.5F, 5.0F, 15.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(3.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(meshdefinition, 96, 64); + } + + @Override + public void setupAnim(ZombieBruteEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + chest.getChild("right_leg").xRot = Mth.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; + chest.getChild("left_leg").xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + chest.getChild("right_arm").xRot = (float)Math.toRadians(-80); + chest.getChild("left_arm").xRot = (float)Math.toRadians(-80); + chest.getChild("right_arm").zRot = (float)Math.toRadians(5); + chest.getChild("left_arm").zRot = (float)Math.toRadians(-5); + + chest.getChild("head").xRot = (float)Math.toRadians(headPitch); + chest.getChild("head").yRot = (float)Math.toRadians(netHeadYaw); + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + chest.render(poseStack, buffer, packedLight, packedOverlay); + } } \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/entity/ZombieBruteRenderer.java b/src/main/java/elucent/eidolon/entity/ZombieBruteRenderer.java index 1f22b32..7851d7e 100644 --- a/src/main/java/elucent/eidolon/entity/ZombieBruteRenderer.java +++ b/src/main/java/elucent/eidolon/entity/ZombieBruteRenderer.java @@ -1,20 +1,19 @@ package elucent.eidolon.entity; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import net.minecraft.client.renderer.entity.EntityRendererManager; -import net.minecraft.client.renderer.entity.LivingRenderer; +import elucent.eidolon.Registry; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.client.renderer.entity.model.EntityModel; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; public class ZombieBruteRenderer extends MobRenderer { - public ZombieBruteRenderer(EntityRendererManager rendererManager, ZombieBruteModel entityModelIn, float shadowSizeIn) { - super(rendererManager, entityModelIn, shadowSizeIn); + public ZombieBruteRenderer(Context erm) { + super(erm, new ZombieBruteModel(erm.bakeLayer(ClientRegistry.ZOMBIE_BRUTE_LAYER)), 0.6f); } @Override - public ResourceLocation getEntityTexture(ZombieBruteEntity entity) { + public ResourceLocation getTextureLocation(ZombieBruteEntity entity) { return new ResourceLocation(Eidolon.MODID, "textures/entity/zombie_brute.png"); } } diff --git a/src/main/java/elucent/eidolon/entity/ai/GenericBarterGoal.java b/src/main/java/elucent/eidolon/entity/ai/GenericBarterGoal.java index 3c96345..674fe09 100644 --- a/src/main/java/elucent/eidolon/entity/ai/GenericBarterGoal.java +++ b/src/main/java/elucent/eidolon/entity/ai/GenericBarterGoal.java @@ -1,24 +1,23 @@ package elucent.eidolon.entity.ai; -import net.minecraft.entity.CreatureEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.memory.MemoryModuleStatus; -import net.minecraft.entity.ai.brain.memory.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.Task; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.AxisAlignedBB; - -import java.util.*; +import java.util.Comparator; +import java.util.EnumSet; +import java.util.List; +import java.util.Random; import java.util.function.Function; import java.util.function.Predicate; -public class GenericBarterGoal extends Goal { +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.Entity.RemovalReason; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionHand; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.AABB; + +public class GenericBarterGoal extends Goal { static Random rand = new Random(); Predicate valid; Function result; @@ -30,11 +29,11 @@ public GenericBarterGoal(E entity, Predicate valid, Function 0) return; if (progress > 0 && !backupHack.isEmpty()) - entity.setHeldItem(Hand.MAIN_HAND, backupHack); + entity.setItemInHand(InteractionHand.MAIN_HAND, backupHack); - entity.setAttackTarget(null); + entity.setTarget(null); if (progress > 0) { progress --; - entity.getNavigator().clearPath(); + entity.getNavigation().stop(); if (progress == 0) { - if (!entity.world.isRemote) { - entity.world.addEntity(new ItemEntity(entity.world, entity.getPosX(), entity.getPosY() + 0.1, entity.getPosZ(), result.apply(entity.getHeldItemMainhand().copy()))); + if (!entity.level.isClientSide) { + entity.level.addFreshEntity(new ItemEntity(entity.level, entity.getX(), entity.getY() + 0.1, entity.getZ(), result.apply(entity.getMainHandItem().copy()))); } - entity.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY); + entity.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); cooldown = 600; } } else { - List items = entity.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(entity.getPosition().add(-8, -8, -8), entity.getPosition().add(8, 8, 8)), (item) -> valid.test(item.getItem())); - ItemEntity nearest = items.stream().min(Comparator.comparingDouble(a -> a.getDistanceSq(entity))).get(); - if (nearest.getDistanceSq(entity) < 2.25) { + List items = entity.level.getEntitiesOfClass(ItemEntity.class, new AABB(entity.blockPosition().offset(-8, -8, -8), entity.blockPosition().offset(8, 8, 8)), (item) -> valid.test(item.getItem())); + ItemEntity nearest = items.stream().min(Comparator.comparingDouble(a -> a.distanceToSqr(entity))).get(); + if (nearest.distanceToSqr(entity) < 2.25) { progress = 100; - entity.setHeldItem(Hand.MAIN_HAND, nearest.getItem()); - nearest.remove(); - entity.world.playSound(null, entity.getPosition(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.HOSTILE, 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + entity.setItemInHand(InteractionHand.MAIN_HAND, nearest.getItem()); + nearest.remove(RemovalReason.DISCARDED); + entity.level.playSound(null, entity.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.HOSTILE, 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } - entity.getNavigator().tryMoveToXYZ(nearest.getPosX(), nearest.getPosY(), nearest.getPosZ(), 1.0f); + entity.getNavigation().moveTo(nearest.getX(), nearest.getY(), nearest.getZ(), 1.0f); } - if (!entity.getHeldItemMainhand().isEmpty()) - backupHack = entity.getHeldItemMainhand(); + if (!entity.getMainHandItem().isEmpty()) + backupHack = entity.getMainHandItem(); } @Override - public boolean shouldExecute() { + public boolean canUse() { if (-- cooldown > 0) return false; - if (progress > 0 || entity.ticksExisted < lastTick + 20) return false; - lastTick = entity.ticksExisted; - List items = entity.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(entity.getPosition().add(-8, -8, -8), entity.getPosition().add(8, 8, 8)), (item) -> valid.test(item.getItem())); + if (progress > 0 || entity.tickCount < lastTick + 20) return false; + lastTick = entity.tickCount; + List items = entity.level.getEntitiesOfClass(ItemEntity.class, new AABB(entity.blockPosition().offset(-8, -8, -8), entity.blockPosition().offset(8, 8, 8)), (item) -> valid.test(item.getItem())); return items.size() > 0; } @Override - public boolean shouldContinueExecuting() { + public boolean canContinueToUse() { if (progress > 0) return true; else { // walking towards item - List items = entity.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(entity.getPosition().add(-8, -8, -8), entity.getPosition().add(8, 8, 8)), (item) -> valid.test(item.getItem())); + List items = entity.level.getEntitiesOfClass(ItemEntity.class, new AABB(entity.blockPosition().offset(-8, -8, -8), entity.blockPosition().offset(8, 8, 8)), (item) -> valid.test(item.getItem())); return items.size() > 0; } } diff --git a/src/main/java/elucent/eidolon/entity/ai/GoToPositionGoal.java b/src/main/java/elucent/eidolon/entity/ai/GoToPositionGoal.java index 2b9a910..1ba40c6 100644 --- a/src/main/java/elucent/eidolon/entity/ai/GoToPositionGoal.java +++ b/src/main/java/elucent/eidolon/entity/ai/GoToPositionGoal.java @@ -1,21 +1,18 @@ package elucent.eidolon.entity.ai; -import net.minecraft.entity.CreatureAttribute; -import net.minecraft.entity.CreatureEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.goal.MoveToBlockGoal; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IWorldReader; - import java.util.Random; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.core.BlockPos; + public class GoToPositionGoal extends Goal { Random random = new Random(); BlockPos dest; - CreatureEntity creature; + PathfinderMob creature; double speed; boolean running; - public GoToPositionGoal(CreatureEntity creature, BlockPos pos, double speedIn) { + public GoToPositionGoal(PathfinderMob creature, BlockPos pos, double speedIn) { this.creature = creature; this.dest = pos; this.speed = speedIn; @@ -25,13 +22,13 @@ public GoToPositionGoal(CreatureEntity creature, BlockPos pos, double speedIn) { @Override public void tick() { if (running) { - creature.getNavigator().tryMoveToXYZ(dest.getX(), dest.getY(), dest.getZ(), speed); - if (creature.getDistanceSq(dest.getX(), dest.getY(), dest.getZ()) < 8 * 8) running = false; + creature.getNavigation().moveTo(dest.getX(), dest.getY(), dest.getZ(), speed); + if (creature.distanceToSqr(dest.getX(), dest.getY(), dest.getZ()) < 8 * 8) running = false; } } @Override - public boolean shouldExecute() { + public boolean canUse() { return running; } } diff --git a/src/main/java/elucent/eidolon/entity/ai/PriestBarterGoal.java b/src/main/java/elucent/eidolon/entity/ai/PriestBarterGoal.java index ec32342..ed53358 100644 --- a/src/main/java/elucent/eidolon/entity/ai/PriestBarterGoal.java +++ b/src/main/java/elucent/eidolon/entity/ai/PriestBarterGoal.java @@ -1,25 +1,21 @@ package elucent.eidolon.entity.ai; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.merchant.villager.VillagerEntity; -import net.minecraft.entity.merchant.villager.VillagerProfession; -import net.minecraft.entity.monster.WitchEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.AxisAlignedBB; - -import java.util.List; import java.util.function.Function; import java.util.function.Predicate; -public class PriestBarterGoal extends GenericBarterGoal { - public PriestBarterGoal(VillagerEntity entity, Predicate valid, Function result) { +import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.item.ItemStack; + +public class PriestBarterGoal extends GenericBarterGoal { + public PriestBarterGoal(Villager entity, Predicate valid, Function result) { super(entity, valid, result); } @Override - public boolean shouldExecute() { + public boolean canUse() { if (entity.getVillagerData().getProfession() != VillagerProfession.CLERIC) return false; - return super.shouldExecute(); + return super.canUse(); } @Override diff --git a/src/main/java/elucent/eidolon/entity/ai/WitchBarterGoal.java b/src/main/java/elucent/eidolon/entity/ai/WitchBarterGoal.java index 8ff9bab..adb733a 100644 --- a/src/main/java/elucent/eidolon/entity/ai/WitchBarterGoal.java +++ b/src/main/java/elucent/eidolon/entity/ai/WitchBarterGoal.java @@ -1,24 +1,13 @@ package elucent.eidolon.entity.ai; -import net.minecraft.entity.CreatureEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.monster.WitchEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.AxisAlignedBB; - -import java.util.Comparator; -import java.util.EnumSet; -import java.util.List; -import java.util.Random; import java.util.function.Function; import java.util.function.Predicate; -public class WitchBarterGoal extends GenericBarterGoal { - public WitchBarterGoal(WitchEntity entity, Predicate valid, Function result) { +import net.minecraft.world.entity.monster.Witch; +import net.minecraft.world.item.ItemStack; + +public class WitchBarterGoal extends GenericBarterGoal { + public WitchBarterGoal(Witch entity, Predicate valid, Function result) { super(entity, valid, result); } diff --git a/src/main/java/elucent/eidolon/event/SpeedFactorEvent.java b/src/main/java/elucent/eidolon/event/SpeedFactorEvent.java deleted file mode 100644 index 3083d9c..0000000 --- a/src/main/java/elucent/eidolon/event/SpeedFactorEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package elucent.eidolon.event; - -import net.minecraft.entity.Entity; - -public class SpeedFactorEvent extends net.minecraftforge.eventbus.api.Event { - Entity entity; - float speedFactor; - - public SpeedFactorEvent(Entity entity, float speedFactor) { - this.entity = entity; - this.speedFactor = speedFactor; - } - - public Entity getEntity() { - return entity; - } - - public float getSpeedFactor() { - return speedFactor; - } - - public void setSpeedFactor(float factor) { - speedFactor = factor; - } -} diff --git a/src/main/java/elucent/eidolon/event/StuckInBlockEvent.java b/src/main/java/elucent/eidolon/event/StuckInBlockEvent.java new file mode 100644 index 0000000..df9f1f3 --- /dev/null +++ b/src/main/java/elucent/eidolon/event/StuckInBlockEvent.java @@ -0,0 +1,29 @@ +package elucent.eidolon.event; + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.fml.event.IModBusEvent; + +public class StuckInBlockEvent extends net.minecraftforge.eventbus.api.Event { + Entity entity; + BlockState state; + Vec3 mul; + + public StuckInBlockEvent(Entity entity, BlockState state, Vec3 factor) { + this.entity = entity; + this.mul = factor; + } + + public Entity getEntity() { + return entity; + } + + public Vec3 getStuckMultiplier() { + return mul; + } + + public void setStuckMultiplier(Vec3 factor) { + mul = factor; + } +} diff --git a/src/main/java/elucent/eidolon/gui/ResearchTableContainer.java b/src/main/java/elucent/eidolon/gui/ResearchTableContainer.java new file mode 100644 index 0000000..8700e33 --- /dev/null +++ b/src/main/java/elucent/eidolon/gui/ResearchTableContainer.java @@ -0,0 +1,281 @@ +package elucent.eidolon.gui; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import elucent.eidolon.Registry; +import elucent.eidolon.mixin.AbstractContainerMenuMixin; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.research.ResearchTask; +import elucent.eidolon.tile.ResearchTableTileEntity; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.Mth; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.ContainerListener; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.Tags; +import net.minecraftforge.common.brewing.BrewingRecipeRegistry; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.fml.DistExecutor; + +public class ResearchTableContainer extends AbstractContainerMenu implements ContainerListener { + private final Container tile; + private final ContainerData intArray; + protected final List tasks; + + public ResearchTableContainer(int id, Inventory playerInventory) { + this(id, playerInventory, new SimpleContainer(2), new SimpleContainerData(2)); + } + + public ResearchTableContainer(int id, Inventory playerInventory, Container inventory, ContainerData data) { + super(Registry.RESEARCH_TABLE_CONTAINER.get(), id); + this.tile = inventory; + this.intArray = data; + this.addSlot(new NotesSlot(inventory, 0, 58, 68)); + this.addSlot(new SealSlot(inventory, 1, 58, 32)); + this.addDataSlots(data); + this.tasks = new ArrayList<>(); + + for(int k = 0; k < 3; ++k) { + for(int i1 = 0; i1 < 9; ++i1) { + this.addSlot(new Slot(playerInventory, i1 + k * 9 + 9, 16 + i1 * 18, 142 + k * 18)); + } + } + + for(int l = 0; l < 9; ++l) { + this.addSlot(new Slot(playerInventory, l, 16 + l * 18, 200)); + } + + if (inventory instanceof ResearchTableTileEntity t) { + t.addListener(this); + } + + if (tile instanceof ResearchTableTileEntity) updateSlots(); + } + + protected void popSlot() { + slots.remove(slots.size() - 1); + List lastSlots = ((AbstractContainerMenuMixin)(Object)this).getLastSlots(); + List remoteSlots = ((AbstractContainerMenuMixin)(Object)this).getRemoteSlots(); + lastSlots.remove(lastSlots.size() - 1); + remoteSlots.remove(remoteSlots.size() - 1); + } + + @Override + public void clicked(int p_150400_, int p_150401_, ClickType p_150402_, Player p_150403_) { + if (p_150400_ >= slots.size()) return; + super.clicked(p_150400_, p_150401_, p_150402_, p_150403_); + } + + public void updateSlots() { + if (tile instanceof ResearchTableTileEntity t) { + for (int i = 38; i < slots.size(); i ++) if (!slots.get(i).getItem().isEmpty()) { + double d0 = t.getBlockPos().getY() + 1.3F; + ItemEntity itementity = new ItemEntity(t.getLevel(), t.getBlockPos().getX() + 0.5, d0, t.getBlockPos().getZ() + 0.5, slots.get(i).getItem()); + itementity.setPickUpDelay(40); + t.getLevel().addFreshEntity(itementity); + } + } + while (slots.size() > 38) popSlot(); // Pare down to just the base 2 slots + player inventory. + while (slots.get(0).getItem().is(Registry.RESEARCH_NOTES.get())) { + if (getProgress() > 0) break; // Slots don't appear when research is in progress. + ItemStack stack = slots.get(0).getItem(); + if (!stack.hasTag() || !stack.getTag().contains("research")) break; + Research r = Researches.find(new ResourceLocation(stack.getTag().getString("research"))); + if (r == null) break; + if (stack.getTag().getInt("stepsDone") >= r.getStars()) break; + List tasks = r.getTasks(getSeed(), stack.getTag().getInt("stepsDone")); + for (int i = 0; i < tasks.size(); i ++) { + int x = 189, y = 17 + 36 * i; + tasks.get(i).modifyContainer(this, x, y); + } + break; + } + if (tile instanceof ResearchTableTileEntity) this.broadcastFullState(); + } + + @Override + public void removed(Player player) { + super.removed(player); + if (player instanceof ServerPlayer) { + for (int i = 38; i < slots.size(); i ++) if (!slots.get(i).getItem().isEmpty()) { + player.drop(slots.get(i).getItem(), false); + } + } + if (this.tile instanceof ResearchTableTileEntity t) { + t.removeListener(this); + } + } + + public boolean stillValid(Player playerIn) { + return this.tile.stillValid(playerIn); + } + + public ItemStack quickMoveStack(Player playerIn, int index) { + ItemStack itemstack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack stack = slot.getItem().copy(); + if ((index < 0 || (index > 2 && index < 38))) { + if (this.slots.get(0).mayPlace(stack)) { + if (!this.moveItemStackTo(stack, 0, 1, false)) { + return ItemStack.EMPTY; + } + } else if (this.slots.get(1).mayPlace(stack)) { + if (!this.moveItemStackTo(stack, 1, 2, false)) { + return ItemStack.EMPTY; + } + } else if (index >= 2 && index < 29) { + if (!this.moveItemStackTo(stack, 29, 38, false)) { + return ItemStack.EMPTY; + } + } else if (index >= 29 && index < 38) { + if (!this.moveItemStackTo(stack, 2, 29, false)) { + return ItemStack.EMPTY; + } + } else if (!this.moveItemStackTo(stack, 2, 38, false)) { + return ItemStack.EMPTY; + } + } else { + if (!this.moveItemStackTo(stack, 2, 38, true)) { + return ItemStack.EMPTY; + } + + slot.onQuickCraft(stack, itemstack); + } + + if (stack.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (stack.getCount() == itemstack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(playerIn, stack); + } + + return itemstack; + } + + public int getProgress() { + return this.intArray.get(0); + } + + public int getSeed() { + return this.intArray.get(1); + } + + @Override + public void initializeContents(int id, List items, ItemStack carried) { + this.slots.get(0).set(items.get(0).copy()); + updateSlots(); + + try { + super.initializeContents(id, items, carried); + } catch (IndexOutOfBoundsException e) {} + } + + class NotesSlot extends Slot { + public NotesSlot(Container iInventoryIn, int index, int xPosition, int yPosition) { + super(iInventoryIn, index, xPosition, yPosition); + } + + @Override + public boolean mayPlace(ItemStack stack) { + return stack.is(Registry.RESEARCH_NOTES.get()); + } + + @Override + public void setChanged() { + super.setChanged(); + if (tile instanceof ResearchTableTileEntity) updateSlots(); + } + + @Override + public int getMaxStackSize() { + return 1; + } + } + + class SealSlot extends Slot { + public SealSlot(Container iInventoryIn, int index, int xPosition, int yPosition) { + super(iInventoryIn, index, xPosition, yPosition); + } + + public boolean mayPlace(ItemStack stack) { + return stack.is(Registry.ARCANE_SEAL.get()); + } + + public int getMaxStackSize() { + return 64; + } + } + + public void trySubmitGoal(Player player, int index) { + if (slots.get(0).getItem().is(Registry.RESEARCH_NOTES.get())) { + ItemStack stack = slots.get(0).getItem(); + if (!stack.hasTag() || !stack.getTag().contains("research")) return; + Research r = Researches.find(new ResourceLocation(stack.getTag().getString("research"))); + if (r == null) return; + List tasks = r.getTasks(getSeed(), stack.getTag().getInt("stepsDone")); + if (tasks.size() < index) return; + ResearchTask toComplete = tasks.get(index); + int startingSlot = 38; + for (int i = 0; i < index; i ++) startingSlot += tasks.get(i).getSlotCount(); + if (!toComplete.isComplete(this, player, startingSlot).complete()) return; + toComplete.onComplete(this, player, startingSlot); + this.setData(0, 200); // start progress countdown. + this.broadcastChanges(); + this.updateSlots(); + } + } + + public void tryStamp(Player player) { + if (slots.get(0).getItem().is(Registry.RESEARCH_NOTES.get()) && slots.get(1).getItem().is(Registry.ARCANE_SEAL.get())) { + ItemStack notes = slots.get(0).getItem(); + if (!notes.hasTag() || !notes.getTag().contains("research")) return; + Research r = Researches.find(new ResourceLocation(notes.getTag().getString("research"))); + if (r == null) return; + if (notes.getTag().getInt("stepsDone") < r.getStars()) return; + + slots.get(1).remove(1); + ItemStack completed = new ItemStack(Registry.COMPLETED_RESEARCH.get()); + completed.getOrCreateTag().putString("research", r.getRegistryName().toString()); + slots.get(0).set(completed); + this.updateSlots(); + } + } + + @Override + public void slotChanged(AbstractContainerMenu menu, int slot, ItemStack stack) { + if (slot == 0) updateSlots(); + } + + @Override + public void dataChanged(AbstractContainerMenu menu, int slot, int value) { + if (slot == 0 && (value == 0 || value == 200)) updateSlots(); + } +} diff --git a/src/main/java/elucent/eidolon/gui/ResearchTableScreen.java b/src/main/java/elucent/eidolon/gui/ResearchTableScreen.java new file mode 100644 index 0000000..3577dfe --- /dev/null +++ b/src/main/java/elucent/eidolon/gui/ResearchTableScreen.java @@ -0,0 +1,189 @@ +package elucent.eidolon.gui; + +import com.mojang.blaze3d.vertex.PoseStack; + +import java.util.List; + +import javax.swing.plaf.basic.BasicBorders.MenuBarBorder; + +import com.mojang.blaze3d.systems.RenderSystem; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.ResearchActionPacket; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.research.ResearchTask; +import elucent.eidolon.research.ResearchTask.CompletenessResult; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.network.chat.Component; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class ResearchTableScreen extends AbstractContainerScreen { + private static final ResourceLocation RESEARCH_TABLE_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/gui/research_table.png"); + + public ResearchTableScreen(ResearchTableContainer table, Inventory inv, Component p_i51097_3_) { + super(table, inv, p_i51097_3_); + this.imageHeight = 224; + this.imageWidth = 192; + } + + public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(matrixStack); + super.render(matrixStack, mouseX, mouseY, partialTicks); + this.renderTooltip(matrixStack, mouseX, mouseY); + } + + @Override + protected void renderLabels(PoseStack matrixStack, int x, int y) { + RenderSystem.setShaderTexture(0, RESEARCH_TABLE_TEXTURE); + int i = this.leftPos; + int j = (this.height - this.imageHeight) / 2; + + double mouseX = Minecraft.getInstance().mouseHandler.xpos(); + double mouseY = Minecraft.getInstance().mouseHandler.ypos(); + mouseX = mouseX * (double)Minecraft.getInstance().getWindow().getGuiScaledWidth() / (double)Minecraft.getInstance().getWindow().getScreenWidth(); + mouseY = mouseY * (double)Minecraft.getInstance().getWindow().getGuiScaledHeight() / (double)Minecraft.getInstance().getWindow().getScreenHeight(); + + if (menu.slots.get(0).getItem().getItem() == Registry.RESEARCH_NOTES.get() && menu.getProgress() == 0) { + ItemStack notes = menu.slots.get(0).getItem(); + if (!notes.hasTag() || !notes.getTag().contains("research")) return; + Research r = Researches.find(new ResourceLocation(notes.getTag().getString("research"))); + if (r == null) return; + + int nstars = r.getStars(); + int done = notes.getTag().getInt("stepsDone"); + + if (done < nstars) { + List tasks = r.getTasks(menu.getSeed(), notes.getTag().getInt("stepsDone")); + int slotStart = 38; + for (int k = 0; k < tasks.size(); k ++) { + ResearchTask task = tasks.get(k); + int xx = 164, yy = 16 + 36 * k; + if (isHovering(xx + 10, yy + 6, 20, 20, mouseX, mouseY)) { + task.drawTooltip(matrixStack, this, mouseX - i, mouseY - j); + RenderSystem.setShaderTexture(0, RESEARCH_TABLE_TEXTURE); + } + } + } + } + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (menu.slots.get(0).getItem().getItem() == Registry.RESEARCH_NOTES.get() && menu.getProgress() == 0) { + ItemStack notes = menu.slots.get(0).getItem(); + if (!notes.hasTag() || !notes.getTag().contains("research")) return false; + Research r = Researches.find(new ResourceLocation(notes.getTag().getString("research"))); + if (r == null) return false; + + List tasks = r.getTasks(menu.getSeed(), notes.getTag().getInt("stepsDone")); + int slotStart = 38; + for (int k = 0; k < tasks.size(); k ++) { + ResearchTask task = tasks.get(k); + int xx = 164, yy = 16 + 36 * k; + + CompletenessResult isComplete = task.isComplete(menu, Minecraft.getInstance().player, slotStart); + if (isComplete.complete() && isHovering(xx + task.getWidth() - 30, yy + 9, 20, 13, mouseX, mouseY)) { + Networking.sendToServer(new ResearchActionPacket(ResearchActionPacket.Action.SUBMIT_GOAL, k)); + return true; + } + slotStart = isComplete.nextSlot(); + } + + int nstars = r.getStars(); + int done = notes.getTag().getInt("stepsDone"); + + if (done >= nstars && isHovering(75, 51, 17, 14, mouseX, mouseY) && !menu.getSlot(1).getItem().isEmpty()) { + Networking.sendToServer(new ResearchActionPacket(ResearchActionPacket.Action.STAMP)); + return true; + } + } + return super.mouseClicked(mouseX, mouseY, button); + } + + protected void slotClicked(Slot p_97778_, int p_97779_, int p_97780_, ClickType p_97781_) { + if (p_97779_ >= menu.slots.size()) return; + super.slotClicked(p_97778_, p_97779_, p_97780_, p_97781_); + } + + @Override + protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) { + RenderSystem.setShaderTexture(0, RESEARCH_TABLE_TEXTURE); + int i = this.leftPos; + int j = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); + + double mouseX = Minecraft.getInstance().mouseHandler.xpos(); + double mouseY = Minecraft.getInstance().mouseHandler.ypos(); + mouseX = mouseX * (double)Minecraft.getInstance().getWindow().getGuiScaledWidth() / (double)Minecraft.getInstance().getWindow().getScreenWidth(); + mouseY = mouseY * (double)Minecraft.getInstance().getWindow().getGuiScaledHeight() / (double)Minecraft.getInstance().getWindow().getScreenHeight(); + + if (menu.slots.get(0).getItem().getItem() == Registry.RESEARCH_NOTES.get()) { + ItemStack notes = menu.slots.get(0).getItem(); + if (!notes.hasTag() || !notes.getTag().contains("research")) return; + Research r = Researches.find(new ResourceLocation(notes.getTag().getString("research"))); + if (r == null) return; + + int progress = menu.getProgress(); + int amt = progress * 104 / 200; + if (progress > 0) blit(matrixStack, i + 137, j + 17 + amt, 192, 92 + amt, 9, 104 - amt); + + int nstars = r.getStars(); + int done = notes.getTag().getInt("stepsDone"); + + if (done < nstars && progress == 0) { + List tasks = r.getTasks(menu.getSeed(), notes.getTag().getInt("stepsDone")); + int slotStart = 38; + for (int k = 0; k < tasks.size(); k ++) { + ResearchTask task = tasks.get(k); + int xx = 164, yy = 16 + 36 * k; + RenderSystem.setShaderTexture(0, RESEARCH_TABLE_TEXTURE); + blit(matrixStack, i + xx, j + yy, 80, 224, 8, 32); + blit(matrixStack, i + xx + 8, j + yy, 112, 224, 24, 32); + task.drawIcon(matrixStack, i + xx + 12, j + yy + 8); + RenderSystem.setShaderTexture(0, RESEARCH_TABLE_TEXTURE); + task.drawCustom(matrixStack, i + xx + 32, j + yy); + RenderSystem.setShaderTexture(0, RESEARCH_TABLE_TEXTURE); + + CompletenessResult isComplete = task.isComplete(menu, Minecraft.getInstance().player, slotStart); + if (isComplete.complete()) { + if (isHovering(xx + task.getWidth() - 30, yy + 9, 20, 13, mouseX, mouseY)) { + blit(matrixStack, i + xx + task.getWidth() - 32, j + yy, 184, 224, 24, 32); + } + else blit(matrixStack, i + xx + task.getWidth() - 32, j + yy, 160, 224, 24, 32); + } + else { + blit(matrixStack, i + xx + task.getWidth() - 32, j + yy, 136, 224, 24, 32); + } + blit(matrixStack, i + xx + task.getWidth() - 8, j + yy, 96, 224, 8, 32); + + slotStart = isComplete.nextSlot(); + } + } + + int starsY = 61 + 5 * nstars; + for (int k = 0; k < nstars; k ++) { + if (k < done) blit(matrixStack, i + 152, j + starsY - k * 10, 201, 82, 9, 10); + else blit(matrixStack, i + 152, j + starsY - k * 10, 192, 82, 9, 10); + } + + if (done >= nstars && !menu.getSlot(1).getItem().isEmpty()) { + if (isHovering(75, 51, 17, 14, mouseX, mouseY)) { + blit(matrixStack, i + 73, j + 49, 234, 64, 21, 18); + } + else blit(matrixStack, i + 73, j + 49, 213, 64, 21, 18); + } + } + } +} + diff --git a/src/main/java/elucent/eidolon/gui/SoulEnchanterContainer.java b/src/main/java/elucent/eidolon/gui/SoulEnchanterContainer.java index 1efdab5..759be86 100644 --- a/src/main/java/elucent/eidolon/gui/SoulEnchanterContainer.java +++ b/src/main/java/elucent/eidolon/gui/SoulEnchanterContainer.java @@ -1,68 +1,75 @@ package elucent.eidolon.gui; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + import com.google.common.collect.Lists; + import elucent.eidolon.Registry; import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.block.Blocks; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.inventory.container.EnchantmentContainer; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.EnchantedBookItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.ListNBT; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentInstance; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.EnchantedBookItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; import net.minecraft.stats.Stats; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.inventory.DataSlot; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.registries.ForgeRegistries; -import java.util.*; - -public class SoulEnchanterContainer extends Container { - private final IInventory tableInventory = new Inventory(2) { - public void markDirty() { - super.markDirty(); - SoulEnchanterContainer.this.onCraftMatrixChanged(this); +public class SoulEnchanterContainer extends AbstractContainerMenu { + private final Container tableInventory = new SimpleContainer(2) { + public void setChanged() { + super.setChanged(); + SoulEnchanterContainer.this.slotsChanged(this); } }; - private final IWorldPosCallable worldPosCallable; + private final ContainerLevelAccess worldPosCallable; private final Random rand = new Random(); - private final IntReferenceHolder xpSeed = IntReferenceHolder.single(); + private final DataSlot xpSeed = DataSlot.standalone(); public final int[] enchantClue = new int[]{-1, -1, -1}; public final int[] worldClue = new int[]{-1, -1, -1}; - public SoulEnchanterContainer(int id, PlayerInventory playerInventory) { - this(id, playerInventory, IWorldPosCallable.DUMMY); + public SoulEnchanterContainer(int id, Inventory playerInventory) { + this(id, playerInventory, ContainerLevelAccess.NULL); } - public SoulEnchanterContainer(int id, PlayerInventory playerInventory, IWorldPosCallable worldPosCallable) { + public SoulEnchanterContainer(int id, Inventory playerInventory, ContainerLevelAccess worldPosCallable) { super(Registry.SOUL_ENCHANTER_CONTAINER.get(), id); this.worldPosCallable = worldPosCallable; this.addSlot(new Slot(this.tableInventory, 0, 15, 47) { - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return true; } - public int getSlotStackLimit() { + public int getMaxStackSize() { return 1; } }); this.addSlot(new Slot(this.tableInventory, 1, 35, 47) { - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return stack.getItem() == Registry.SOUL_SHARD.get(); } }); @@ -77,40 +84,40 @@ public boolean isItemValid(ItemStack stack) { this.addSlot(new Slot(playerInventory, k, 8 + k * 18, 142)); } - this.trackInt(this.xpSeed).set(playerInventory.player.getXPSeed()); - this.trackInt(IntReferenceHolder.create(this.enchantClue, 0)); - this.trackInt(IntReferenceHolder.create(this.enchantClue, 1)); - this.trackInt(IntReferenceHolder.create(this.enchantClue, 2)); - this.trackInt(IntReferenceHolder.create(this.worldClue, 0)); - this.trackInt(IntReferenceHolder.create(this.worldClue, 1)); - this.trackInt(IntReferenceHolder.create(this.worldClue, 2)); + this.addDataSlot(this.xpSeed).set(playerInventory.player.getEnchantmentSeed()); + this.addDataSlot(DataSlot.shared(this.enchantClue, 0)); + this.addDataSlot(DataSlot.shared(this.enchantClue, 1)); + this.addDataSlot(DataSlot.shared(this.enchantClue, 2)); + this.addDataSlot(DataSlot.shared(this.worldClue, 0)); + this.addDataSlot(DataSlot.shared(this.worldClue, 1)); + this.addDataSlot(DataSlot.shared(this.worldClue, 2)); } - private float getPower(World world, BlockPos pos) { + private float getPower(Level world, BlockPos pos) { return world.getBlockState(pos).getEnchantPowerBonus(world, pos); } /** * Callback for when the crafting matrix is changed. */ - public void onCraftMatrixChanged(IInventory inventoryIn) { + public void slotsChanged(Container inventoryIn) { if (inventoryIn == this.tableInventory) { - ItemStack itemstack = inventoryIn.getStackInSlot(0); + ItemStack itemstack = inventoryIn.getItem(0); if (!itemstack.isEmpty() && (itemstack.isEnchantable() || itemstack.isEnchanted() || itemstack.getItem() == Items.ENCHANTED_BOOK)) { - this.worldPosCallable.consume((world, pos) -> { + this.worldPosCallable.execute((world, pos) -> { int power = 0; for(int k = -1; k <= 1; ++k) { for(int l = -1; l <= 1; ++l) { - if ((k != 0 || l != 0) && world.isAirBlock(pos.add(l, 0, k)) && world.isAirBlock(pos.add(l, 1, k))) { - power += getPower(world, pos.add(l * 2, 0, k * 2)); - power += getPower(world, pos.add(l * 2, 1, k * 2)); + if ((k != 0 || l != 0) && world.isEmptyBlock(pos.offset(l, 0, k)) && world.isEmptyBlock(pos.offset(l, 1, k))) { + power += getPower(world, pos.offset(l * 2, 0, k * 2)); + power += getPower(world, pos.offset(l * 2, 1, k * 2)); if (l != 0 && k != 0) { - power += getPower(world, pos.add(l * 2, 0, k)); - power += getPower(world, pos.add(l * 2, 1, k)); - power += getPower(world, pos.add(l, 0, k * 2)); - power += getPower(world, pos.add(l, 1, k * 2)); + power += getPower(world, pos.offset(l * 2, 0, k)); + power += getPower(world, pos.offset(l * 2, 1, k)); + power += getPower(world, pos.offset(l, 0, k * 2)); + power += getPower(world, pos.offset(l, 1, k * 2)); } } } @@ -124,15 +131,15 @@ public void onCraftMatrixChanged(IInventory inventoryIn) { } for(int j1 = 0; j1 < 3; ++j1) { - List list = getEnchantmentList(itemstack, j1); + List list = getEnchantmentList(itemstack, j1); if (list != null && !list.isEmpty()) { - EnchantmentData enchantmentdata = list.get(rand.nextInt(list.size())); - enchantClue[j1] = net.minecraft.util.registry.Registry.ENCHANTMENT.getId(enchantmentdata.enchantment); - worldClue[j1] = enchantmentdata.enchantmentLevel; + EnchantmentInstance enchantmentdata = list.get(rand.nextInt(list.size())); + enchantClue[j1] = net.minecraft.core.Registry.ENCHANTMENT.getId(enchantmentdata.enchantment); + worldClue[j1] = enchantmentdata.level; } } - this.detectAndSendChanges(); + this.broadcastChanges(); }); } else { for(int i = 0; i < 3; ++i) { @@ -147,65 +154,65 @@ public void onCraftMatrixChanged(IInventory inventoryIn) { /** * Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy. */ - public boolean enchantItem(PlayerEntity playerIn, int id) { - ItemStack itemstack = this.tableInventory.getStackInSlot(0); - ItemStack itemstack1 = this.tableInventory.getStackInSlot(1); + public boolean clickMenuButton(Player playerIn, int id) { + ItemStack itemstack = this.tableInventory.getItem(0); + ItemStack itemstack1 = this.tableInventory.getItem(1); int i = id + 1; - if ((itemstack1.isEmpty() || itemstack1.getCount() < 1) && !playerIn.abilities.isCreativeMode) { + if ((itemstack1.isEmpty() || itemstack1.getCount() < 1) && !playerIn.getAbilities().instabuild) { return false; - } else if (itemstack.isEmpty() || playerIn.experienceLevel < this.worldClue[id] && !playerIn.abilities.isCreativeMode) { + } else if (itemstack.isEmpty() || playerIn.experienceLevel < this.worldClue[id] && !playerIn.getAbilities().instabuild) { return false; } else { - this.worldPosCallable.consume((p_217003_6_, p_217003_7_) -> { + this.worldPosCallable.execute((p_217003_6_, p_217003_7_) -> { ItemStack itemstack2 = itemstack; - List list = this.getEnchantmentList(itemstack, id); + List list = this.getEnchantmentList(itemstack, id); if (!list.isEmpty()) { - playerIn.onEnchant(itemstack, worldClue[id]); + playerIn.onEnchantmentPerformed(itemstack, worldClue[id]); boolean flag = itemstack.getItem() == Items.BOOK; if (flag) { itemstack2 = new ItemStack(Items.ENCHANTED_BOOK); - CompoundNBT compoundnbt = itemstack.getTag(); + CompoundTag compoundnbt = itemstack.getTag(); if (compoundnbt != null) { itemstack2.setTag(compoundnbt.copy()); } - this.tableInventory.setInventorySlotContents(0, itemstack2); + this.tableInventory.setItem(0, itemstack2); } Map enchants = EnchantmentHelper.getEnchantments(itemstack2); if (enchants.size() > 0) { for (int j = 0; j < list.size(); ++ j) { - EnchantmentData data = list.get(j); - if (enchants.containsKey(data.enchantment)) enchants.replace(data.enchantment, data.enchantmentLevel); - else enchants.put(data.enchantment, data.enchantmentLevel); + EnchantmentInstance data = list.get(j); + if (enchants.containsKey(data.enchantment)) enchants.replace(data.enchantment, data.level); + else enchants.put(data.enchantment, data.level); } EnchantmentHelper.setEnchantments(enchants, itemstack2); } else for(int j = 0; j < list.size(); ++j) { - EnchantmentData data = list.get(j); + EnchantmentInstance data = list.get(j); if (flag) { EnchantedBookItem.addEnchantment(itemstack2, data); } else { - itemstack2.addEnchantment(data.enchantment, data.enchantmentLevel); + itemstack2.enchant(data.enchantment, data.level); } } - if (!playerIn.abilities.isCreativeMode) { + if (!playerIn.getAbilities().instabuild) { itemstack1.shrink(1); if (itemstack1.isEmpty()) { - this.tableInventory.setInventorySlotContents(1, ItemStack.EMPTY); + this.tableInventory.setItem(1, ItemStack.EMPTY); } } - playerIn.addStat(Stats.ENCHANT_ITEM); - if (playerIn instanceof ServerPlayerEntity) { - CriteriaTriggers.ENCHANTED_ITEM.trigger((ServerPlayerEntity)playerIn, itemstack2, i); + playerIn.awardStat(Stats.ENCHANT_ITEM); + if (playerIn instanceof ServerPlayer) { + CriteriaTriggers.ENCHANTED_ITEM.trigger((ServerPlayer)playerIn, itemstack2, i); } - this.tableInventory.markDirty(); - this.xpSeed.set(playerIn.getXPSeed()); - this.onCraftMatrixChanged(this.tableInventory); - p_217003_6_.playSound((PlayerEntity)null, p_217003_7_, SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.BLOCKS, 1.0F, p_217003_6_.rand.nextFloat() * 0.1F + 0.7F); + this.tableInventory.setChanged(); + this.xpSeed.set(playerIn.getEnchantmentSeed()); + this.slotsChanged(this.tableInventory); + p_217003_6_.playSound((Player)null, p_217003_7_, SoundEvents.ENCHANTMENT_TABLE_USE, SoundSource.BLOCKS, 1.0F, p_217003_6_.random.nextFloat() * 0.1F + 0.7F); } }); return true; @@ -216,14 +223,14 @@ public static int getEnchantmentLevel(Enchantment enchID, ItemStack stack) { if (stack.isEmpty()) { return 0; } else { - ResourceLocation resourcelocation = net.minecraft.util.registry.Registry.ENCHANTMENT.getKey(enchID); - ListNBT listnbt = stack.getItem() == Items.ENCHANTED_BOOK ? EnchantedBookItem.getEnchantments(stack) : stack.getEnchantmentTagList(); + ResourceLocation resourcelocation = net.minecraft.core.Registry.ENCHANTMENT.getKey(enchID); + ListTag listnbt = stack.getItem() == Items.ENCHANTED_BOOK ? EnchantedBookItem.getEnchantments(stack) : stack.getEnchantmentTags(); for(int i = 0; i < listnbt.size(); ++i) { - CompoundNBT compoundnbt = listnbt.getCompound(i); - ResourceLocation resourcelocation1 = ResourceLocation.tryCreate(compoundnbt.getString("id")); + CompoundTag compoundnbt = listnbt.getCompound(i); + ResourceLocation resourcelocation1 = ResourceLocation.tryParse(compoundnbt.getString("id")); if (resourcelocation1 != null && resourcelocation1.equals(resourcelocation)) { - return MathHelper.clamp(compoundnbt.getInt("lvl"), 0, 255); + return Mth.clamp(compoundnbt.getInt("lvl"), 0, 255); } } @@ -231,7 +238,7 @@ public static int getEnchantmentLevel(Enchantment enchID, ItemStack stack) { } } - private List getEnchantmentList(ItemStack stack, int enchantSlot) { + private List getEnchantmentList(ItemStack stack, int enchantSlot) { this.rand.setSeed((long)(this.xpSeed.get() + enchantSlot)); ItemStack test = stack.copy(); EnchantmentHelper.setEnchantments(new HashMap<>(), test); @@ -241,9 +248,12 @@ private List getEnchantmentList(ItemStack stack, int enchantSlo Map existing = EnchantmentHelper.getEnchantments(stack); List valid = Lists.newArrayList(ForgeRegistries.ENCHANTMENTS.getValues()); valid.removeIf((ench) -> { - boolean canApply = ench.canApplyAtEnchantingTable(finalTest) || + boolean canApply = ench.canEnchant(finalTest) || finalTest.getItem() == Items.BOOK && ench.isAllowedOnBooks(); - return !canApply || ench.isTreasureEnchantment() || existing.containsKey(ench) && existing.get(ench) >= ench.getMaxLevel(); + return !canApply + || ench.isTreasureOnly() + || existing.containsKey(ench) && existing.get(ench) >= ench.getMaxLevel() + || ench.isCurse(); }); for (Map.Entry e : existing.entrySet()) { @@ -257,21 +267,21 @@ private List getEnchantmentList(ItemStack stack, int enchantSlo } } - List enchants = new ArrayList<>(); + List enchants = new ArrayList<>(); if (valid.isEmpty()) return enchants; // System.out.println("" + enchantSlot + ": " + valid.stream().reduce("", (a, b) -> "" + a + ", " + b, (a, b) -> "" + a + ", " + b)); for (int i = 0; i < enchantSlot; i ++) rand.nextInt(valid.size()); Enchantment enchant = valid.get(this.rand.nextInt(valid.size())); int level = getEnchantmentLevel(enchant, stack); - if (level > 0) enchants.add(new EnchantmentData(enchant, level + 1)); - else enchants.add(new EnchantmentData(enchant, 1)); + if (level > 0) enchants.add(new EnchantmentInstance(enchant, level + 1)); + else enchants.add(new EnchantmentInstance(enchant, 1)); return enchants; } @OnlyIn(Dist.CLIENT) public int getSoulShardAmount() { - ItemStack itemstack = this.tableInventory.getStackInSlot(1); + ItemStack itemstack = this.tableInventory.getItem(1); return itemstack.isEmpty() ? 0 : itemstack.getCount(); } @@ -283,57 +293,57 @@ public int getXPSeed() { /** * Called when the container is closed. */ - public void onContainerClosed(PlayerEntity playerIn) { - super.onContainerClosed(playerIn); - this.worldPosCallable.consume((world, pos) -> { - this.clearContainer(playerIn, playerIn.world, this.tableInventory); + public void removed(Player playerIn) { + super.removed(playerIn); + this.worldPosCallable.execute((world, pos) -> { + this.clearContainer(playerIn, this.tableInventory); }); } /** * Determines whether supplied player can use this container */ - public boolean canInteractWith(PlayerEntity playerIn) { - return isWithinUsableDistance(this.worldPosCallable, playerIn, Registry.SOUL_ENCHANTER.get()); + public boolean stillValid(Player playerIn) { + return stillValid(this.worldPosCallable, playerIn, Registry.SOUL_ENCHANTER.get()); } /** * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player * inventory and the other inventory(s). */ - public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { + public ItemStack quickMoveStack(Player playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; - Slot slot = this.inventorySlots.get(index); - if (slot != null && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); + Slot slot = this.slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.copy(); if (index == 0) { - if (!this.mergeItemStack(itemstack1, 2, 38, true)) { + if (!this.moveItemStackTo(itemstack1, 2, 38, true)) { return ItemStack.EMPTY; } } else if (index == 1) { - if (!this.mergeItemStack(itemstack1, 2, 38, true)) { + if (!this.moveItemStackTo(itemstack1, 2, 38, true)) { return ItemStack.EMPTY; } } else if (itemstack1.getItem() == Registry.SOUL_SHARD.get()) { - if (!this.mergeItemStack(itemstack1, 1, 2, true)) { + if (!this.moveItemStackTo(itemstack1, 1, 2, true)) { return ItemStack.EMPTY; } } else { - if (this.inventorySlots.get(0).getHasStack() || !this.inventorySlots.get(0).isItemValid(itemstack1)) { + if (this.slots.get(0).hasItem() || !this.slots.get(0).mayPlace(itemstack1)) { return ItemStack.EMPTY; } ItemStack itemstack2 = itemstack1.copy(); itemstack2.setCount(1); itemstack1.shrink(1); - this.inventorySlots.get(0).putStack(itemstack2); + this.slots.get(0).set(itemstack2); } if (itemstack1.isEmpty()) { - slot.putStack(ItemStack.EMPTY); + slot.set(ItemStack.EMPTY); } else { - slot.onSlotChanged(); + slot.setChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { diff --git a/src/main/java/elucent/eidolon/gui/SoulEnchanterScreen.java b/src/main/java/elucent/eidolon/gui/SoulEnchanterScreen.java index 8a6becf..62f3c44 100644 --- a/src/main/java/elucent/eidolon/gui/SoulEnchanterScreen.java +++ b/src/main/java/elucent/eidolon/gui/SoulEnchanterScreen.java @@ -1,35 +1,42 @@ package elucent.eidolon.gui; +import java.util.List; +import java.util.Random; + import com.google.common.collect.Lists; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.Eidolon; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.model.BookModel; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import com.mojang.blaze3d.platform.Lighting; +import com.mojang.blaze3d.vertex.Tesselator; +import net.minecraft.client.model.BookModel; +import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.EnchantmentContainer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnchantmentNameParts; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.util.text.*; - -import java.util.List; -import java.util.Random; - -public class SoulEnchanterScreen extends ContainerScreen { +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; +import net.minecraft.client.gui.screens.inventory.EnchantmentNames; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.FormattedText; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.TranslatableComponent; + +public class SoulEnchanterScreen extends AbstractContainerScreen { private static final ResourceLocation ENCHANTMENT_TABLE_GUI_TEXTURE = new ResourceLocation(Eidolon.MODID,"textures/gui/soul_enchanter.png"); private static final ResourceLocation ENCHANTMENT_TABLE_BOOK_TEXTURE = new ResourceLocation(Eidolon.MODID,"textures/entity/enchanter_book.png"); - private static final BookModel MODEL_BOOK = new BookModel(); + private static BookModel MODEL_BOOK = null; private final Random random = new Random(); public int ticks; public float flip; @@ -40,24 +47,25 @@ public class SoulEnchanterScreen extends ContainerScreen public float oOpen; private ItemStack last = ItemStack.EMPTY; - public SoulEnchanterScreen(SoulEnchanterContainer container, PlayerInventory playerInventory, ITextComponent textComponent) { + public SoulEnchanterScreen(SoulEnchanterContainer container, Inventory playerInventory, Component textComponent) { super(container, playerInventory, textComponent); + if (MODEL_BOOK == null) MODEL_BOOK = new BookModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.BOOK)); } - public void tick() { - super.tick(); + public void containerTick() { + super.containerTick(); this.tickBook(); } public boolean mouseClicked(double mouseX, double mouseY, int button) { - int i = (this.width - this.xSize) / 2; - int j = (this.height - this.ySize) / 2; + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; for(int k = 0; k < 3; ++k) { double d0 = mouseX - (double)(i + 60); double d1 = mouseY - (double)(j + 14 + 19 * k); - if (d0 >= 0.0D && d1 >= 0.0D && d0 < 108.0D && d1 < 19.0D && this.container.enchantItem(this.minecraft.player, k)) { - this.minecraft.playerController.sendEnchantPacket((this.container).windowId, k); + if (d0 >= 0.0D && d1 >= 0.0D && d0 < 108.0D && d1 < 19.0D && this.menu.clickMenuButton(this.minecraft.player, k)) { + this.minecraft.gameMode.handleInventoryButtonClick((this.menu).containerId, k); return true; } } @@ -65,88 +73,83 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { return super.mouseClicked(mouseX, mouseY, button); } - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { - RenderHelper.setupGuiFlatDiffuseLighting(); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.minecraft.getTextureManager().bindTexture(ENCHANTMENT_TABLE_GUI_TEXTURE); - int i = (this.width - this.xSize) / 2; - int j = (this.height - this.ySize) / 2; - this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); - RenderSystem.matrixMode(5889); - RenderSystem.pushMatrix(); - RenderSystem.loadIdentity(); - int k = (int)this.minecraft.getMainWindow().getGuiScaleFactor(); - RenderSystem.viewport((this.width - 320) / 2 * k, (this.height - 240) / 2 * k, 320 * k, 240 * k); - RenderSystem.translatef(-0.34F, 0.23F, 0.0F); - RenderSystem.multMatrix(Matrix4f.perspective(90.0D, 1.3333334F, 9.0F, 80.0F)); - RenderSystem.matrixMode(5888); - matrixStack.push(); - MatrixStack.Entry matrixstack$entry = matrixStack.getLast(); - matrixstack$entry.getMatrix().setIdentity(); - matrixstack$entry.getNormal().setIdentity(); - matrixStack.translate(0.0D, (double)3.3F, 1984.0D); - float f = 5.0F; - matrixStack.scale(5.0F, 5.0F, 5.0F); - matrixStack.rotate(Vector3f.ZP.rotationDegrees(180.0F)); - matrixStack.rotate(Vector3f.XP.rotationDegrees(20.0F)); - float f1 = MathHelper.lerp(partialTicks, this.oOpen, this.open); - matrixStack.translate((double)((1.0F - f1) * 0.2F), (double)((1.0F - f1) * 0.1F), (double)((1.0F - f1) * 0.25F)); - float f2 = -(1.0F - f1) * 90.0F - 90.0F; - matrixStack.rotate(Vector3f.YP.rotationDegrees(f2)); - matrixStack.rotate(Vector3f.XP.rotationDegrees(180.0F)); - float f3 = MathHelper.lerp(partialTicks, this.oFlip, this.flip) + 0.25F; - float f4 = MathHelper.lerp(partialTicks, this.oFlip, this.flip) + 0.75F; - f3 = (f3 - (float)MathHelper.fastFloor((double)f3)) * 1.6F - 0.3F; - f4 = (f4 - (float)MathHelper.fastFloor((double)f4)) * 1.6F - 0.3F; - if (f3 < 0.0F) { - f3 = 0.0F; - } - - if (f4 < 0.0F) { - f4 = 0.0F; - } - - if (f3 > 1.0F) { - f3 = 1.0F; - } - - if (f4 > 1.0F) { - f4 = 1.0F; - } - - RenderSystem.enableRescaleNormal(); - MODEL_BOOK.setBookState(0.0F, f3, f4, f1); - IRenderTypeBuffer.Impl irendertypebuffer$impl = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer()); - IVertexBuilder ivertexbuilder = irendertypebuffer$impl.getBuffer(MODEL_BOOK.getRenderType(ENCHANTMENT_TABLE_BOOK_TEXTURE)); - MODEL_BOOK.render(matrixStack, ivertexbuilder, 15728880, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); - irendertypebuffer$impl.finish(); - matrixStack.pop(); - RenderSystem.matrixMode(5889); - RenderSystem.viewport(0, 0, this.minecraft.getMainWindow().getFramebufferWidth(), this.minecraft.getMainWindow().getFramebufferHeight()); - RenderSystem.popMatrix(); - RenderSystem.matrixMode(5888); - RenderHelper.setupGui3DDiffuseLighting(); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - EnchantmentNameParts.getInstance().reseedRandomGenerator((long)this.container.getXPSeed()); - int l = this.container.getSoulShardAmount(); + protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) {Lighting.setupForFlatItems(); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, ENCHANTMENT_TABLE_GUI_TEXTURE); + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); + int k = (int)this.minecraft.getWindow().getGuiScale(); + RenderSystem.viewport((this.width - 320) / 2 * k, (this.height - 240) / 2 * k, 320 * k, 240 * k); + Matrix4f matrix4f = Matrix4f.createTranslateMatrix(-0.34F, 0.23F, 0.0F); + matrix4f.multiply(Matrix4f.perspective(90.0D, 1.3333334F, 9.0F, 80.0F)); + RenderSystem.backupProjectionMatrix(); + RenderSystem.setProjectionMatrix(matrix4f); + matrixStack.pushPose(); + PoseStack.Pose posestack$pose = matrixStack.last(); + posestack$pose.pose().setIdentity(); + posestack$pose.normal().setIdentity(); + matrixStack.translate(0.0D, (double)3.3F, 1984.0D); + float f = 5.0F; + matrixStack.scale(5.0F, 5.0F, 5.0F); + matrixStack.mulPose(Vector3f.ZP.rotationDegrees(180.0F)); + matrixStack.mulPose(Vector3f.XP.rotationDegrees(20.0F)); + float f1 = Mth.lerp(partialTicks, this.oOpen, this.open); + matrixStack.translate((double)((1.0F - f1) * 0.2F), (double)((1.0F - f1) * 0.1F), (double)((1.0F - f1) * 0.25F)); + float f2 = -(1.0F - f1) * 90.0F - 90.0F; + matrixStack.mulPose(Vector3f.YP.rotationDegrees(f2)); + matrixStack.mulPose(Vector3f.XP.rotationDegrees(180.0F)); + float f3 = Mth.lerp(partialTicks, this.oFlip, this.flip) + 0.25F; + float f4 = Mth.lerp(partialTicks, this.oFlip, this.flip) + 0.75F; + f3 = (f3 - (float)Mth.fastFloor((double)f3)) * 1.6F - 0.3F; + f4 = (f4 - (float)Mth.fastFloor((double)f4)) * 1.6F - 0.3F; + if (f3 < 0.0F) { + f3 = 0.0F; + } + + if (f4 < 0.0F) { + f4 = 0.0F; + } + + if (f3 > 1.0F) { + f3 = 1.0F; + } + + if (f4 > 1.0F) { + f4 = 1.0F; + } + + MODEL_BOOK.setupAnim(0.0F, f3, f4, f1); + MultiBufferSource.BufferSource multibuffersource$buffersource = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); + VertexConsumer vertexconsumer = multibuffersource$buffersource.getBuffer(MODEL_BOOK.renderType(ENCHANTMENT_TABLE_BOOK_TEXTURE)); + MODEL_BOOK.renderToBuffer(matrixStack, vertexconsumer, 15728880, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + multibuffersource$buffersource.endBatch(); + matrixStack.popPose(); + RenderSystem.viewport(0, 0, this.minecraft.getWindow().getWidth(), this.minecraft.getWindow().getHeight()); + RenderSystem.restoreProjectionMatrix(); + Lighting.setupFor3DItems(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + EnchantmentNames.getInstance().initSeed((long)this.menu.getXPSeed()); + int l = this.menu.getSoulShardAmount(); for(int i1 = 0; i1 < 3; ++i1) { int j1 = i + 60; int k1 = j1 + 20; this.setBlitOffset(0); - this.minecraft.getTextureManager().bindTexture(ENCHANTMENT_TABLE_GUI_TEXTURE); - int l1 = container.worldClue[i1]; - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, ENCHANTMENT_TABLE_GUI_TEXTURE); + int l1 = menu.worldClue[i1]; + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); int i2 = 86; - ITextProperties itextproperties = EnchantmentNameParts.getInstance().getGalacticEnchantmentName(this.font, i2); + FormattedText itextproperties = EnchantmentNames.getInstance().getRandomName(this.font, i2); int j2 = 6839882; if (l1 < 1) { this.blit(matrixStack, j1, j + 14 + 19 * i1, 0, 185, 108, 19); } else { - if (((l == 0 || this.minecraft.player.experienceLevel < l1) && !this.minecraft.player.abilities.isCreativeMode) || this.container.enchantClue[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels + if (((l == 0 || this.minecraft.player.experienceLevel < l1) && !this.minecraft.player.getAbilities().instabuild) || this.menu.enchantClue[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels this.blit(matrixStack, j1, j + 14 + 19 * i1, 0, 185, 108, 19); - this.blit(matrixStack, j1 + 1, j + 15 + 19 * i1, 16 * (container.worldClue[i1] - 1), 239, 16, 16); - this.font.func_238418_a_(itextproperties, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); + this.blit(matrixStack, j1 + 1, j + 15 + 19 * i1, 16 * (menu.worldClue[i1] - 1), 239, 16, 16); + this.font.drawWordWrap(itextproperties, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); j2 = 4226832; } else { int k2 = x - (i + 60); @@ -158,52 +161,52 @@ protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float pa this.blit(matrixStack, j1, j + 14 + 19 * i1, 0, 166, 108, 19); } - this.blit(matrixStack, j1 + 1, j + 15 + 19 * i1, 16 * (container.worldClue[i1] - 1), 223, 16, 16); - this.font.func_238418_a_(itextproperties, k1, j + 16 + 19 * i1, i2, j2); + this.blit(matrixStack, j1 + 1, j + 15 + 19 * i1, 16 * (menu.worldClue[i1] - 1), 223, 16, 16); + this.font.drawWordWrap(itextproperties, k1, j + 16 + 19 * i1, i2, j2); j2 = 8453920; } } } } - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - partialTicks = this.minecraft.getRenderPartialTicks(); + public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { + partialTicks = this.minecraft.getFrameTime(); this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); - this.renderHoveredTooltip(matrixStack, mouseX, mouseY); - boolean flag = this.minecraft.player.abilities.isCreativeMode; - int i = this.container.getSoulShardAmount(); + this.renderTooltip(matrixStack, mouseX, mouseY); + boolean flag = this.minecraft.player.getAbilities().instabuild; + int i = this.menu.getSoulShardAmount(); for(int j = 0; j < 3; ++j) { - Enchantment enchantment = Enchantment.getEnchantmentByID((this.container).enchantClue[j]); - int l = (this.container).worldClue[j]; + Enchantment enchantment = Enchantment.byId((this.menu).enchantClue[j]); + int l = (this.menu).worldClue[j]; int i1 = j + 1; - if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, (double)mouseX, (double)mouseY) && l > 0) { - List list = Lists.newArrayList(); - list.add(enchantment == null ? new StringTextComponent("") : enchantment.getDisplayName(l)); + if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)mouseX, (double)mouseY) && l > 0) { + List list = Lists.newArrayList(); + list.add(enchantment == null ? new TextComponent("") : enchantment.getFullname(l)); if(enchantment == null) { - list.add(new StringTextComponent("")); - list.add(new TranslationTextComponent("forge.container.enchant.limitedEnchantability").mergeStyle(TextFormatting.RED)); + list.add(new TextComponent("")); + list.add(new TranslatableComponent("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED)); } else if (!flag) { - list.add(StringTextComponent.EMPTY); + list.add(TextComponent.EMPTY); if (this.minecraft.player.experienceLevel < l) { - list.add((new TranslationTextComponent("container.enchant.level.requirement", l)).mergeStyle(TextFormatting.RED)); + list.add((new TranslatableComponent("container.enchant.level.requirement", l)).withStyle(ChatFormatting.RED)); } else { - IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent("container.eidolon.enchant.shard.one", 1); + MutableComponent iformattabletextcomponent = new TranslatableComponent("container.eidolon.enchant.shard.one", 1); - list.add(iformattabletextcomponent.mergeStyle(minecraft.player.experienceLevel >= l ? TextFormatting.GRAY : TextFormatting.RED)); - IFormattableTextComponent iformattabletextcomponent1; + list.add(iformattabletextcomponent.withStyle(minecraft.player.experienceLevel >= l ? ChatFormatting.GRAY : ChatFormatting.RED)); + MutableComponent iformattabletextcomponent1; if (l == 1) { - iformattabletextcomponent1 = new TranslationTextComponent("container.enchant.level.one"); + iformattabletextcomponent1 = new TranslatableComponent("container.enchant.level.one"); } else { - iformattabletextcomponent1 = new TranslationTextComponent("container.enchant.level.many", container.worldClue[i1 - 1]); + iformattabletextcomponent1 = new TranslatableComponent("container.enchant.level.many", menu.worldClue[i1 - 1]); } - list.add(iformattabletextcomponent1.mergeStyle(TextFormatting.GRAY)); + list.add(iformattabletextcomponent1.withStyle(ChatFormatting.GRAY)); } } - this.func_243308_b(matrixStack, list, mouseX, mouseY); + this.renderComponentTooltip(matrixStack, list, mouseX, mouseY); break; } } @@ -211,8 +214,8 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partia } public void tickBook() { - ItemStack itemstack = this.container.getSlot(0).getStack(); - if (!ItemStack.areItemStacksEqual(itemstack, this.last)) { + ItemStack itemstack = this.menu.getSlot(0).getItem(); + if (!ItemStack.matches(itemstack, this.last)) { this.last = itemstack; do { @@ -226,7 +229,7 @@ public void tickBook() { boolean flag = false; for(int i = 0; i < 3; ++i) { - if ((this.container).worldClue[i] != 0) { + if ((this.menu).worldClue[i] != 0) { flag = true; } } @@ -237,10 +240,10 @@ public void tickBook() { this.open -= 0.2F; } - this.open = MathHelper.clamp(this.open, 0.0F, 1.0F); + this.open = Mth.clamp(this.open, 0.0F, 1.0F); float f1 = (this.flipT - this.flip) * 0.4F; float f = 0.2F; - f1 = MathHelper.clamp(f1, -0.2F, 0.2F); + f1 = Mth.clamp(f1, -0.2F, 0.2F); this.flipA += (f1 - this.flipA) * 0.9F; this.flip += this.flipA; } diff --git a/src/main/java/elucent/eidolon/gui/WoodenBrewingStandContainer.java b/src/main/java/elucent/eidolon/gui/WoodenBrewingStandContainer.java index c71d39f..71bac05 100644 --- a/src/main/java/elucent/eidolon/gui/WoodenBrewingStandContainer.java +++ b/src/main/java/elucent/eidolon/gui/WoodenBrewingStandContainer.java @@ -2,47 +2,44 @@ import elucent.eidolon.Registry; import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.container.BrewingStandContainer; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionUtils; -import net.minecraft.util.IIntArray; -import net.minecraft.util.IntArray; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.Tags; import net.minecraftforge.common.brewing.BrewingRecipeRegistry; import net.minecraftforge.event.ForgeEventFactory; -public class WoodenBrewingStandContainer extends Container { - private final IInventory tileBrewingStand; - private final IIntArray intArray; +public class WoodenBrewingStandContainer extends AbstractContainerMenu { + private final Container tileBrewingStand; + private final ContainerData intArray; private final Slot slot; - public WoodenBrewingStandContainer(int id, PlayerInventory playerInventory) { - this(id, playerInventory, new Inventory(4), new IntArray(2)); + public WoodenBrewingStandContainer(int id, Inventory playerInventory) { + this(id, playerInventory, new SimpleContainer(4), new SimpleContainerData(2)); } - public WoodenBrewingStandContainer(int id, PlayerInventory playerInventory, IInventory inventory, IIntArray p_i50096_4_) { + public WoodenBrewingStandContainer(int id, Inventory playerInventory, Container inventory, ContainerData p_i50096_4_) { super(Registry.WOODEN_STAND_CONTAINER.get(), id); - assertInventorySize(inventory, 4); - assertIntArraySize(p_i50096_4_, 2); + checkContainerSize(inventory, 4); + checkContainerDataCount(p_i50096_4_, 2); this.tileBrewingStand = inventory; this.intArray = p_i50096_4_; this.addSlot(new PotionSlot(inventory, 0, 56, 51)); this.addSlot(new PotionSlot(inventory, 1, 79, 58)); this.addSlot(new PotionSlot(inventory, 2, 102, 51)); this.slot = this.addSlot(new IngredientSlot(inventory, 3, 79, 17)); - this.trackIntArray(p_i50096_4_); + this.addDataSlots(p_i50096_4_); for(int i = 0; i < 3; ++i) { for(int j = 0; j < 9; ++j) { @@ -55,48 +52,48 @@ public WoodenBrewingStandContainer(int id, PlayerInventory playerInventory, IInv } } - public boolean canInteractWith(PlayerEntity playerIn) { - return this.tileBrewingStand.isUsableByPlayer(playerIn); + public boolean stillValid(Player playerIn) { + return this.tileBrewingStand.stillValid(playerIn); } - public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { + public ItemStack quickMoveStack(Player playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; - Slot slot = this.inventorySlots.get(index); - if (slot != null && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); + Slot slot = this.slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.copy(); if ((index < 0 || index > 2) && index != 3) { - if (this.slot.isItemValid(itemstack1)) { - if (!this.mergeItemStack(itemstack1, 3, 4, false)) { + if (this.slot.mayPlace(itemstack1)) { + if (!this.moveItemStackTo(itemstack1, 3, 4, false)) { return ItemStack.EMPTY; } } else if (PotionSlot.canHoldPotion(itemstack) && itemstack.getCount() == 1) { - if (!this.mergeItemStack(itemstack1, 0, 3, false)) { + if (!this.moveItemStackTo(itemstack1, 0, 3, false)) { return ItemStack.EMPTY; } } else if (index >= 4 && index < 31) { - if (!this.mergeItemStack(itemstack1, 31, 40, false)) { + if (!this.moveItemStackTo(itemstack1, 31, 40, false)) { return ItemStack.EMPTY; } } else if (index >= 31 && index < 40) { - if (!this.mergeItemStack(itemstack1, 4, 31, false)) { + if (!this.moveItemStackTo(itemstack1, 4, 31, false)) { return ItemStack.EMPTY; } - } else if (!this.mergeItemStack(itemstack1, 4, 40, false)) { + } else if (!this.moveItemStackTo(itemstack1, 4, 40, false)) { return ItemStack.EMPTY; } } else { - if (!this.mergeItemStack(itemstack1, 4, 40, true)) { + if (!this.moveItemStackTo(itemstack1, 4, 40, true)) { return ItemStack.EMPTY; } - slot.onSlotChange(itemstack1, itemstack); + slot.onQuickCraft(itemstack1, itemstack); } if (itemstack1.isEmpty()) { - slot.putStack(ItemStack.EMPTY); + slot.set(ItemStack.EMPTY); } else { - slot.onSlotChanged(); + slot.setChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { @@ -120,43 +117,42 @@ public int getTime() { } static class IngredientSlot extends Slot { - public IngredientSlot(IInventory iInventoryIn, int index, int xPosition, int yPosition) { + public IngredientSlot(Container iInventoryIn, int index, int xPosition, int yPosition) { super(iInventoryIn, index, xPosition, yPosition); } - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return BrewingRecipeRegistry.isValidIngredient(stack) && !Tags.Items.DUSTS_REDSTONE.contains(stack.getItem()) && !Tags.Items.DUSTS_GLOWSTONE.contains(stack.getItem()); } - public int getSlotStackLimit() { + public int getMaxStackSize() { return 64; } } static class PotionSlot extends Slot { - public PotionSlot(IInventory p_i47598_1_, int p_i47598_2_, int p_i47598_3_, int p_i47598_4_) { + public PotionSlot(Container p_i47598_1_, int p_i47598_2_, int p_i47598_3_, int p_i47598_4_) { super(p_i47598_1_, p_i47598_2_, p_i47598_3_, p_i47598_4_); } - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return canHoldPotion(stack); } - public int getSlotStackLimit() { + public int getMaxStackSize() { return 1; } - public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) { - Potion potion = PotionUtils.getPotionFromItem(stack); - if (thePlayer instanceof ServerPlayerEntity) { + public void onTake(Player thePlayer, ItemStack stack) { + Potion potion = PotionUtils.getPotion(stack); + if (thePlayer instanceof ServerPlayer) { ForgeEventFactory.onPlayerBrewedPotion(thePlayer, stack); - CriteriaTriggers.BREWED_POTION.trigger((ServerPlayerEntity)thePlayer, potion); + CriteriaTriggers.BREWED_POTION.trigger((ServerPlayer)thePlayer, potion); } super.onTake(thePlayer, stack); - return stack; } public static boolean canHoldPotion(ItemStack stack) { diff --git a/src/main/java/elucent/eidolon/gui/WoodenBrewingStandScreen.java b/src/main/java/elucent/eidolon/gui/WoodenBrewingStandScreen.java index cce24c9..85d39f0 100644 --- a/src/main/java/elucent/eidolon/gui/WoodenBrewingStandScreen.java +++ b/src/main/java/elucent/eidolon/gui/WoodenBrewingStandScreen.java @@ -1,48 +1,47 @@ package elucent.eidolon.gui; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.Eidolon; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.BrewingStandContainer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.network.chat.Component; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) -public class WoodenBrewingStandScreen extends ContainerScreen { +public class WoodenBrewingStandScreen extends AbstractContainerScreen { private static final ResourceLocation BREWING_STAND_GUI_TEXTURES = new ResourceLocation(Eidolon.MODID, "textures/gui/wooden_brewing_stand.png"); private static final int[] BUBBLELENGTHS = new int[]{29, 24, 20, 16, 11, 6, 0}; - public WoodenBrewingStandScreen(WoodenBrewingStandContainer p_i51097_1_, PlayerInventory p_i51097_2_, ITextComponent p_i51097_3_) { + public WoodenBrewingStandScreen(WoodenBrewingStandContainer p_i51097_1_, Inventory p_i51097_2_, Component p_i51097_3_) { super(p_i51097_1_, p_i51097_2_, p_i51097_3_); } protected void init() { super.init(); - this.titleX = (this.xSize - this.font.getStringPropertyWidth(this.title)) / 2; + this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; } - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); - this.renderHoveredTooltip(matrixStack, mouseX, mouseY); + this.renderTooltip(matrixStack, mouseX, mouseY); } - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.minecraft.getTextureManager().bindTexture(BREWING_STAND_GUI_TEXTURES); - int i = (this.width - this.xSize) / 2; - int j = (this.height - this.ySize) / 2; - this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); - if (container.getHeat() > 0) { + protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) { + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, BREWING_STAND_GUI_TEXTURES); + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); + if (menu.getHeat() > 0) { this.blit(matrixStack, i + 32, j + 52, 197, 0, 14, 14); } - int i1 = this.container.getTime(); + int i1 = this.menu.getTime(); if (i1 > 0) { int j1 = (int)(28.0F * (1.0F - (float)i1 / 800)); if (j1 > 0) { diff --git a/src/main/java/elucent/eidolon/gui/WorktableContainer.java b/src/main/java/elucent/eidolon/gui/WorktableContainer.java index 3ba7963..bcd148a 100644 --- a/src/main/java/elucent/eidolon/gui/WorktableContainer.java +++ b/src/main/java/elucent/eidolon/gui/WorktableContainer.java @@ -1,41 +1,38 @@ package elucent.eidolon.gui; +import java.util.Optional; + import elucent.eidolon.Registry; import elucent.eidolon.recipe.WorktableRecipe; import elucent.eidolon.recipe.WorktableRegistry; -import net.minecraft.block.Blocks; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.inventory.CraftResultInventory; -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.inventory.container.CraftingResultSlot; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ICraftingRecipe; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.network.play.server.SSetSlotPacket; -import net.minecraft.util.IWorldPosCallable; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.inventory.ResultContainer; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.Optional; - -public class WorktableContainer extends Container { - CraftingInventory core = new CraftingInventory(this, 3, 3), extras = new CraftingInventory(this, 2, 2); - CraftResultInventory result = new CraftResultInventory(); - PlayerEntity player; - IWorldPosCallable callable; +public class WorktableContainer extends AbstractContainerMenu { + CraftingContainer core = new CraftingContainer(this, 3, 3), extras = new CraftingContainer(this, 2, 2); + ResultContainer result = new ResultContainer(); + Player player; + ContainerLevelAccess callable; - public WorktableContainer(int id, PlayerInventory inventory) { - this(id, inventory, IWorldPosCallable.DUMMY); + public WorktableContainer(int id, Inventory inventory) { + this(id, inventory, ContainerLevelAccess.NULL); } - public WorktableContainer(int id, PlayerInventory inventory, IWorldPosCallable callable) { + public WorktableContainer(int id, Inventory inventory, ContainerLevelAccess callable) { super(Registry.WORKTABLE_CONTAINER.get(), id); this.player = inventory.player; this.callable = callable; @@ -62,94 +59,91 @@ public WorktableContainer(int id, PlayerInventory inventory, IWorldPosCallable c } } - protected void updateCraftingResult(int id, World world, PlayerEntity player, CraftingInventory inventory, CraftResultInventory inventoryResult) { - if (!world.isRemote) { - ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)player; + protected void updateCraftingResult(int id, Level world, Player player, CraftingContainer inventory, ResultContainer inventoryResult) { + if (!world.isClientSide) { + ServerPlayer serverplayerentity = (ServerPlayer)player; ItemStack itemstack = ItemStack.EMPTY; WorktableRecipe recipe = WorktableRegistry.find(core, extras); if (recipe != null) { itemstack = recipe.getResult(); } else { - Optional optional = world.getServer().getRecipeManager().getRecipe(IRecipeType.CRAFTING, inventory, world); + Optional optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventory, world); if (optional.isPresent()) { - ICraftingRecipe icraftingrecipe = optional.get(); - if (inventoryResult.canUseRecipe(world, serverplayerentity, icraftingrecipe)) { - itemstack = icraftingrecipe.getCraftingResult(inventory); + CraftingRecipe icraftingrecipe = optional.get(); + if (inventoryResult.setRecipeUsed(world, serverplayerentity, icraftingrecipe)) { + itemstack = icraftingrecipe.assemble(inventory); } } } - inventoryResult.setInventorySlotContents(0, itemstack); - serverplayerentity.connection.sendPacket(new SSetSlotPacket(id, 0, itemstack)); + inventoryResult.setItem(0, itemstack); + serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(id, incrementStateId(), 0, itemstack)); } } @Override - public void onCraftMatrixChanged(IInventory inventoryIn) { - callable.consume((p_217069_1_, p_217069_2_) -> { - updateCraftingResult(this.windowId, p_217069_1_, player, core, result); + public void slotsChanged(Container inventoryIn) { + callable.execute((p_217069_1_, p_217069_2_) -> { + updateCraftingResult(this.containerId, p_217069_1_, player, core, result); }); } @Override - public void onContainerClosed(PlayerEntity playerIn) { - super.onContainerClosed(playerIn); - callable.consume((p_217068_2_, p_217068_3_) -> { - this.clearContainer(playerIn, p_217068_2_, this.core); - this.clearContainer(playerIn, p_217068_2_, this.extras); + public void removed(Player playerIn) { + super.removed(playerIn); + callable.execute((p_217068_2_, p_217068_3_) -> { + this.clearContainer(playerIn, this.core); + this.clearContainer(playerIn, this.extras); }); } @Override - public boolean canInteractWith(PlayerEntity playerIn) { - return isWithinUsableDistance(this.callable, playerIn, Registry.WORKTABLE.get()); + public boolean stillValid(Player playerIn) { + return stillValid(this.callable, playerIn, Registry.WORKTABLE.get()); } @Override - public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { + public ItemStack quickMoveStack(Player playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; - Slot slot = this.inventorySlots.get(index); - if (slot != null && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); + Slot slot = this.slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.copy(); if (index == 0) { - callable.consume((p_217067_2_, p_217067_3_) -> { - itemstack1.getItem().onCreated(itemstack1, p_217067_2_, playerIn); + callable.execute((p_217067_2_, p_217067_3_) -> { + itemstack1.getItem().onCraftedBy(itemstack1, p_217067_2_, playerIn); }); - if (!this.mergeItemStack(itemstack1, 14, 50, true)) { + if (!this.moveItemStackTo(itemstack1, 14, 50, true)) { return ItemStack.EMPTY; } - slot.onSlotChange(itemstack1, itemstack); + slot.onQuickCraft(itemstack1, itemstack); } else if (index >= 14 && index < 50) { - if (!this.mergeItemStack(itemstack1, 1, 14, false)) { + if (!this.moveItemStackTo(itemstack1, 1, 14, false)) { if (index < 41) { - if (!this.mergeItemStack(itemstack1, 41, 50, false)) { + if (!this.moveItemStackTo(itemstack1, 41, 50, false)) { return ItemStack.EMPTY; } - } else if (!this.mergeItemStack(itemstack1, 14, 41, false)) { + } else if (!this.moveItemStackTo(itemstack1, 14, 41, false)) { return ItemStack.EMPTY; } } - } else if (!this.mergeItemStack(itemstack1, 14, 50, false)) { + } else if (!this.moveItemStackTo(itemstack1, 14, 50, false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) { - slot.putStack(ItemStack.EMPTY); + slot.set(ItemStack.EMPTY); } else { - slot.onSlotChanged(); + slot.setChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } - ItemStack itemstack2 = slot.onTake(playerIn, itemstack1); - if (index == 0) { - playerIn.dropItem(itemstack2, false); - } + slot.onTake(playerIn, itemstack1); } return itemstack; @@ -161,8 +155,8 @@ public int getSize() { } @Override - public boolean canMergeSlot(ItemStack stack, Slot slotIn) { - return slotIn.inventory != result && super.canMergeSlot(stack, slotIn); + public boolean canTakeItemForPickAll(ItemStack stack, Slot slotIn) { + return slotIn.container != result && super.canTakeItemForPickAll(stack, slotIn); } public int getOutputSlot() { diff --git a/src/main/java/elucent/eidolon/gui/WorktableResultSlot.java b/src/main/java/elucent/eidolon/gui/WorktableResultSlot.java index 40e51fd..399c61b 100644 --- a/src/main/java/elucent/eidolon/gui/WorktableResultSlot.java +++ b/src/main/java/elucent/eidolon/gui/WorktableResultSlot.java @@ -2,25 +2,23 @@ import elucent.eidolon.recipe.WorktableRecipe; import elucent.eidolon.recipe.WorktableRegistry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.IRecipeHolder; -import net.minecraft.inventory.container.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ICraftingRecipe; -import net.minecraft.item.crafting.IRecipeType; -import net.minecraft.util.NonNullList; -import net.minecraft.util.SoundEvents; - -import java.util.Optional; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.RecipeHolder; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraft.core.NonNullList; +import net.minecraft.sounds.SoundEvents; public class WorktableResultSlot extends Slot { - private final CraftingInventory core, extras; - private final PlayerEntity player; + private final CraftingContainer core, extras; + private final Player player; private int amountCrafted; - public WorktableResultSlot(PlayerEntity player, CraftingInventory core, CraftingInventory extras, IInventory inventory, int index, int x, int y) { + public WorktableResultSlot(Player player, CraftingContainer core, CraftingContainer extras, Container inventory, int index, int x, int y) { super(inventory, index, x, y); this.player = player; this.core = core; @@ -28,23 +26,23 @@ public WorktableResultSlot(PlayerEntity player, CraftingInventory core, Crafting } @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return false; } @Override - public ItemStack decrStackSize(int amount) { - if (this.getHasStack()) { - this.amountCrafted += Math.min(amount, this.getStack().getCount()); + public ItemStack remove(int amount) { + if (this.hasItem()) { + this.amountCrafted += Math.min(amount, this.getItem().getCount()); } - return super.decrStackSize(amount); + return super.remove(amount); } @Override - protected void onCrafting(ItemStack stack, int amount) { + protected void onQuickCraft(ItemStack stack, int amount) { this.amountCrafted += amount; - this.onCrafting(stack); + this.checkTakeAchievements(stack); } protected void onSwapCraft(int numItemsCrafted) { @@ -52,24 +50,24 @@ protected void onSwapCraft(int numItemsCrafted) { } @Override - protected void onCrafting(ItemStack stack) { + protected void checkTakeAchievements(ItemStack stack) { if (this.amountCrafted > 0) { - stack.onCrafting(this.player.world, this.player, this.amountCrafted); - net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.player, stack, core); + stack.onCraftedBy(this.player.level, this.player, this.amountCrafted); + ForgeEventFactory.firePlayerCraftingEvent(this.player, stack, core); } - if (this.inventory instanceof IRecipeHolder) { - ((IRecipeHolder)this.inventory).onCrafting(this.player); + if (this.container instanceof RecipeHolder) { + ((RecipeHolder)this.container).awardUsedRecipes(this.player); } - player.playSound(SoundEvents.BLOCK_SMITHING_TABLE_USE, 1.0f, 1.0f); + player.playSound(SoundEvents.SMITHING_TABLE_USE, 1.0f, 1.0f); this.amountCrafted = 0; } @Override - public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) { - this.onCrafting(stack); + public void onTake(Player thePlayer, ItemStack stack) { + this.checkTakeAchievements(stack); net.minecraftforge.common.ForgeHooks.setCraftingPlayer(thePlayer); WorktableRecipe recipe = WorktableRegistry.find(core, extras); NonNullList items = null; @@ -78,34 +76,33 @@ public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack) { } else { items = NonNullList.create(); - items.addAll(thePlayer.world.getRecipeManager().getRecipeNonNull(IRecipeType.CRAFTING, core, thePlayer.world)); - for (int i = 0; i < 4; i ++) items.add(extras.getStackInSlot(i)); + items.addAll(thePlayer.level.getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, core, thePlayer.level)); + for (int i = 0; i < 4; i ++) items.add(extras.getItem(i)); } net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); assert items != null; - for(int i = 0; i < items.size(); ++i) { - IInventory inv = i < 9 ? core : extras; + int n = recipe == null ? Math.min(9, items.size()) : items.size(); + for(int i = 0; i < n; ++i) { + Container inv = i < 9 ? core : extras; int index = i < 9 ? i : i - 9; - ItemStack item = inv.getStackInSlot(index); + ItemStack item = inv.getItem(index); ItemStack remaining = items.get(i); if (!item.isEmpty()) { - inv.decrStackSize(index, 1); - item = inv.getStackInSlot(index); + inv.removeItem(index, 1); + item = inv.getItem(index); } if (!remaining.isEmpty()) { if (item.isEmpty()) { - inv.setInventorySlotContents(index, remaining); - } else if (ItemStack.areItemsEqual(item, remaining) && ItemStack.areItemStackTagsEqual(item, remaining)) { + inv.setItem(index, remaining); + } else if (ItemStack.isSame(item, remaining) && ItemStack.tagMatches(item, remaining)) { remaining.grow(item.getCount()); - inv.setInventorySlotContents(index, remaining); - } else if (!this.player.inventory.addItemStackToInventory(remaining)) { - this.player.dropItem(remaining, false); + inv.setItem(index, remaining); + } else if (!this.player.getInventory().add(remaining)) { + this.player.drop(remaining, false); } } } - - return stack; } } diff --git a/src/main/java/elucent/eidolon/gui/WorktableScreen.java b/src/main/java/elucent/eidolon/gui/WorktableScreen.java index 3521cf0..6fb8bcb 100644 --- a/src/main/java/elucent/eidolon/gui/WorktableScreen.java +++ b/src/main/java/elucent/eidolon/gui/WorktableScreen.java @@ -1,38 +1,40 @@ package elucent.eidolon.gui; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; -import net.minecraft.client.gui.screen.inventory.ContainerScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.network.chat.Component; -public class WorktableScreen extends ContainerScreen { +public class WorktableScreen extends AbstractContainerScreen { private static final ResourceLocation BACKGROUND = new ResourceLocation(Eidolon.MODID,"textures/gui/worktable.png"); - public WorktableScreen(WorktableContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) { + public WorktableScreen(WorktableContainer screenContainer, Inventory inv, Component titleIn) { super(screenContainer, inv, titleIn); - this.ySize = 224; - this.xSize = 192; + this.imageHeight = 224; + this.imageWidth = 192; } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); - this.renderHoveredTooltip(matrixStack, mouseX, mouseY); + this.renderTooltip(matrixStack, mouseX, mouseY); } @Override - protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int x, int y) { + protected void renderLabels(PoseStack matrixStack, int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { - this.minecraft.getTextureManager().bindTexture(BACKGROUND); - int i = this.guiLeft; - int j = (this.height - this.ySize) / 2; - this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); + protected void renderBg(PoseStack matrixStack, float partialTicks, int x, int y) { + RenderSystem.setShaderTexture(0, BACKGROUND); + int i = this.leftPos; + int j = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); } } diff --git a/src/main/java/elucent/eidolon/gui/jei/CrucibleCategory.java b/src/main/java/elucent/eidolon/gui/jei/CrucibleCategory.java index 68d579b..d9595bf 100644 --- a/src/main/java/elucent/eidolon/gui/jei/CrucibleCategory.java +++ b/src/main/java/elucent/eidolon/gui/jei/CrucibleCategory.java @@ -1,12 +1,18 @@ package elucent.eidolon.gui.jei; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.codex.CodexGui; import elucent.eidolon.recipe.CrucibleRecipe; import elucent.eidolon.recipe.CrucibleRegistry; -import elucent.eidolon.util.StackUtil; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.drawable.IDrawable; @@ -14,12 +20,12 @@ import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; - -import java.util.*; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.resources.ResourceLocation; public class CrucibleCategory implements IRecipeCategory { static final ResourceLocation UID = new ResourceLocation(Eidolon.MODID, "crucible"); @@ -36,13 +42,13 @@ public ResourceLocation getUid() { } @Override - public Class getRecipeClass() { + public Class getRecipeClass() { return RecipeWrappers.Crucible.class; } @Override - public String getTitle() { - return I18n.format("jei." + Eidolon.MODID + ".crucible"); + public Component getTitle() { + return new TranslatableComponent(I18n.get("jei." + Eidolon.MODID + ".crucible")); } @Override @@ -70,7 +76,7 @@ public static void condense(List stacks) { StackIngredient last = new StackIngredient(ItemStack.EMPTY, Ingredient.EMPTY); while (iter.hasNext()) { StackIngredient i = iter.next(); - if (!ItemStack.areItemsEqual(i.stack, last.stack) || !ItemStack.areItemStackTagsEqual(i.stack, last.stack) || last.stack.getCount() + i.stack.getCount() > last.stack.getMaxStackSize()) { + if (!ItemStack.isSame(i.stack, last.stack) || !ItemStack.tagMatches(i.stack, last.stack) || last.stack.getCount() + i.stack.getCount() > last.stack.getMaxStackSize()) { last = i; } else { @@ -87,15 +93,15 @@ public void setIngredients(RecipeWrappers.Crucible wrapper, IIngredients ingredi List> inputs = new ArrayList<>(); for (CrucibleRecipe.Step step : wrapper.recipe.getSteps()) { List stepInputs = new ArrayList<>(); - for (Object o : step.matches) { - ItemStack stack = StackUtil.stackFromObject(o); - if (!stack.isEmpty()) stepInputs.add(new StackIngredient(stack, StackUtil.ingredientFromObject(o))); + for (Ingredient o : step.matches) { + ItemStack stack = o.getItems().length > 0 ? o.getItems()[0].copy() : ItemStack.EMPTY.copy(); + if (!stack.isEmpty()) stepInputs.add(new StackIngredient(stack, o)); } condense(stepInputs); for (StackIngredient i : stepInputs) { - ItemStack[] valid = i.ingredient.getMatchingStacks(); + List valid = Arrays.stream(i.ingredient.getItems()).map((s) -> s.copy()).collect(Collectors.toList()); for (ItemStack stack : valid) stack.setCount(i.stack.getCount()); - inputs.add(Arrays.asList(valid)); + inputs.add(valid); } } ingredients.setInputLists(VanillaTypes.ITEM, inputs); @@ -115,8 +121,8 @@ public void setRecipe(IRecipeLayout layout, RecipeWrappers.Crucible recipe, IIng tx += 24; List stepInputs = new ArrayList<>(); - for (Object o : steps.get(i).matches) { - ItemStack stack = StackUtil.stackFromObject(o); + for (Ingredient o : steps.get(i).matches) { + ItemStack stack = o.getItems().length > 0 ? o.getItems()[0].copy() : ItemStack.EMPTY.copy(); if (!stack.isEmpty()) stepInputs.add(new StackIngredient(stack, Ingredient.EMPTY)); } condense(stepInputs); @@ -132,7 +138,7 @@ public void setRecipe(IRecipeLayout layout, RecipeWrappers.Crucible recipe, IIng } @Override - public void draw(RecipeWrappers.Crucible recipe, MatrixStack mStack, double mouseX, double mouseY) { + public void draw(RecipeWrappers.Crucible recipe, PoseStack mStack, double mouseX, double mouseY) { recipe.page.renderBackground(CodexGui.DUMMY, mStack, 5, 4, (int)mouseX, (int)mouseY); recipe.page.render(CodexGui.DUMMY, mStack, 5, 4, (int)mouseX, (int)mouseY); } diff --git a/src/main/java/elucent/eidolon/gui/jei/JEIRegistry.java b/src/main/java/elucent/eidolon/gui/jei/JEIRegistry.java index 6d793e5..e5cbe0a 100644 --- a/src/main/java/elucent/eidolon/gui/jei/JEIRegistry.java +++ b/src/main/java/elucent/eidolon/gui/jei/JEIRegistry.java @@ -9,14 +9,11 @@ import mezz.jei.api.JeiPlugin; import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.recipe.category.IRecipeCategory; -import mezz.jei.api.registration.IAdvancedRegistration; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; @JeiPlugin public class JEIRegistry implements IModPlugin { diff --git a/src/main/java/elucent/eidolon/gui/jei/RecipeWrappers.java b/src/main/java/elucent/eidolon/gui/jei/RecipeWrappers.java index cb254e6..6e01daa 100644 --- a/src/main/java/elucent/eidolon/gui/jei/RecipeWrappers.java +++ b/src/main/java/elucent/eidolon/gui/jei/RecipeWrappers.java @@ -4,9 +4,6 @@ import elucent.eidolon.recipe.CrucibleRecipe; import elucent.eidolon.recipe.WorktableRecipe; import elucent.eidolon.ritual.Ritual; -import net.minecraft.item.ItemStack; - -import java.util.List; public class RecipeWrappers { public static class Crucible { diff --git a/src/main/java/elucent/eidolon/gui/jei/RitualCategory.java b/src/main/java/elucent/eidolon/gui/jei/RitualCategory.java index 73aace5..b2cb723 100644 --- a/src/main/java/elucent/eidolon/gui/jei/RitualCategory.java +++ b/src/main/java/elucent/eidolon/gui/jei/RitualCategory.java @@ -1,6 +1,10 @@ package elucent.eidolon.gui.jei; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.ArrayList; +import java.util.List; + +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.codex.CodexGui; @@ -8,7 +12,7 @@ import elucent.eidolon.ritual.ItemRequirement; import elucent.eidolon.ritual.MultiItemSacrifice; import elucent.eidolon.ritual.RitualRegistry; -import elucent.eidolon.util.StackUtil; +import elucent.eidolon.util.RecipeUtil; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.drawable.IDrawable; @@ -16,13 +20,12 @@ import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; - -import java.util.ArrayList; -import java.util.List; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.resources.ResourceLocation; public class RitualCategory implements IRecipeCategory { static final ResourceLocation UID = new ResourceLocation(Eidolon.MODID, "ritual"); @@ -39,13 +42,13 @@ public ResourceLocation getUid() { } @Override - public Class getRecipeClass() { + public Class getRecipeClass() { return RecipeWrappers.RitualRecipe.class; } @Override - public String getTitle() { - return I18n.format("jei." + Eidolon.MODID + ".ritual"); + public Component getTitle() { + return new TranslatableComponent(I18n.get("jei." + Eidolon.MODID + ".ritual")); } @Override @@ -66,10 +69,10 @@ public void setIngredients(RecipeWrappers.RitualRecipe wrapper, IIngredients ing int slot = 0; for (IRequirement r : wrapper.ritual.getRequirements()) { if (r instanceof ItemRequirement) - inputs.add(StackUtil.ingredientFromObject(((ItemRequirement)r).getMatch())); + inputs.add(RecipeUtil.ingredientFromObject(((ItemRequirement)r).getMatch())); slot ++; } - inputs.add(StackUtil.ingredientFromObject(sacrifice instanceof MultiItemSacrifice ? ((MultiItemSacrifice)sacrifice).main : sacrifice)); + inputs.add(RecipeUtil.ingredientFromObject(sacrifice instanceof MultiItemSacrifice ? ((MultiItemSacrifice)sacrifice).main : sacrifice)); ingredients.setInputIngredients(inputs); } @@ -92,7 +95,7 @@ public void setRecipe(IRecipeLayout layout, RecipeWrappers.RitualRecipe recipe, } @Override - public void draw(RecipeWrappers.RitualRecipe recipe, MatrixStack mStack, double mouseX, double mouseY) { + public void draw(RecipeWrappers.RitualRecipe recipe, PoseStack mStack, double mouseX, double mouseY) { recipe.page.renderBackground(CodexGui.DUMMY, mStack, 5, 4, (int)mouseX, (int)mouseY); recipe.page.render(CodexGui.DUMMY, mStack, 5, 4, (int)mouseX, (int)mouseY); } diff --git a/src/main/java/elucent/eidolon/gui/jei/WorktableCategory.java b/src/main/java/elucent/eidolon/gui/jei/WorktableCategory.java index 024bcde..6732508 100644 --- a/src/main/java/elucent/eidolon/gui/jei/WorktableCategory.java +++ b/src/main/java/elucent/eidolon/gui/jei/WorktableCategory.java @@ -1,13 +1,14 @@ package elucent.eidolon.gui.jei; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.ArrayList; +import java.util.List; + +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.codex.CodexGui; -import elucent.eidolon.recipe.CrucibleRecipe; -import elucent.eidolon.recipe.WorktableRecipe; import elucent.eidolon.recipe.WorktableRegistry; -import elucent.eidolon.util.StackUtil; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.drawable.IDrawable; @@ -15,15 +16,12 @@ import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.resources.ResourceLocation; public class WorktableCategory implements IRecipeCategory { static final ResourceLocation UID = new ResourceLocation(Eidolon.MODID, "worktable"); @@ -40,13 +38,13 @@ public ResourceLocation getUid() { } @Override - public Class getRecipeClass() { + public Class getRecipeClass() { return RecipeWrappers.Worktable.class; } @Override - public String getTitle() { - return I18n.format("jei." + Eidolon.MODID + ".worktable"); + public Component getTitle() { + return new TranslatableComponent(I18n.get("jei." + Eidolon.MODID + ".worktable")); } @Override @@ -64,8 +62,8 @@ public void setIngredients(RecipeWrappers.Worktable wrapper, IIngredients ingred if (wrapper.page == null) wrapper.page = WorktableRegistry.getDefaultPage(wrapper.recipe); List inputs = new ArrayList<>(); - for (Object o : wrapper.recipe.getCore()) inputs.add(StackUtil.ingredientFromObject(o)); - for (Object o : wrapper.recipe.getOuter()) inputs.add(StackUtil.ingredientFromObject(o)); + for (Ingredient i : wrapper.recipe.getCore()) inputs.add(i); + for (Ingredient i : wrapper.recipe.getOuter()) inputs.add(i); ingredients.setInputIngredients(inputs); ingredients.setOutput(VanillaTypes.ITEM, wrapper.recipe.getResult()); } @@ -89,7 +87,7 @@ public void setRecipe(IRecipeLayout layout, RecipeWrappers.Worktable recipe, IIn } @Override - public void draw(RecipeWrappers.Worktable recipe, MatrixStack mStack, double mouseX, double mouseY) { + public void draw(RecipeWrappers.Worktable recipe, PoseStack mStack, double mouseX, double mouseY) { recipe.page.renderBackground(CodexGui.DUMMY, mStack, 5, 4, (int)mouseX, (int)mouseY); recipe.page.render(CodexGui.DUMMY, mStack, 5, 4, (int)mouseX, (int)mouseY); } diff --git a/src/main/java/elucent/eidolon/item/AthameItem.java b/src/main/java/elucent/eidolon/item/AthameItem.java new file mode 100644 index 0000000..7193431 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/AthameItem.java @@ -0,0 +1,127 @@ +package elucent.eidolon.item; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import elucent.eidolon.Registry; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.material.Material; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.EnderMan; +import net.minecraft.world.entity.monster.Endermite; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.SwordItem; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.InteractionResult; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.Vec3; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.living.LootingLevelEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +import java.util.Random; + +public class AthameItem extends SwordItem { + private Random random = new Random(); + + public AthameItem(Properties builderIn) { + super(Tiers.PewterTier.INSTANCE, 1, -1.6f, builderIn); + MinecraftForge.EVENT_BUS.register(this); + } + + @SubscribeEvent + public void onLooting(LootingLevelEvent event) { + if (event.getEntityLiving().getMainHandItem().getItem() instanceof AthameItem) + event.setLootingLevel(event.getLootingLevel() * 2 + 1); + } + + @SubscribeEvent + public void onHurt(LivingHurtEvent event) { + if (event.getSource().getEntity() instanceof LivingEntity + && ((LivingEntity)event.getSource().getEntity()).getMainHandItem().getItem() instanceof AthameItem + && (event.getEntity() instanceof EnderMan || event.getEntity() instanceof Endermite || event.getEntity() instanceof EnderDragon)) { + event.setAmount(event.getAmount() * 4); + } + } + + String loreTag = null; + + public Item setLore(String tag) { + this.loreTag = tag; + return this; + } + + @Override + @OnlyIn(Dist.CLIENT) + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + if (this.loreTag != null) { + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); + } + } + + @Override + public InteractionResult useOn(UseOnContext ctx) { + BlockState state = ctx.getLevel().getBlockState(ctx.getClickedPos()); + float hardness = state.getDestroySpeed(ctx.getLevel(), ctx.getClickedPos()); + if ((state.getMaterial() == Material.PLANT || state.getMaterial() == Material.REPLACEABLE_PLANT || state.getMaterial() == Material.LEAVES || state.getMaterial() == Material.WATER_PLANT || state.getMaterial() == Material.REPLACEABLE_FIREPROOF_PLANT) + && hardness < 5.0f && hardness >= 0) { + if (!ctx.getLevel().isClientSide) { + Vec3 hit = ctx.getClickLocation(); + ((ServerLevel)ctx.getLevel()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, state), hit.x, hit.y, hit.z, 3, ((double)random.nextFloat() - 0.5D) * 0.08D, ((double)random.nextFloat() - 0.5D) * 0.08D, ((double)random.nextFloat() - 0.5D) * 0.08D, (double)0.05F); + ctx.getLevel().playSound(null, ctx.getClickedPos(), SoundEvents.SHEEP_SHEAR, SoundSource.PLAYERS, 0.5f, 0.9f + random.nextFloat() * 0.2f); + if (random.nextInt(5) == 0) { + if (state.getBlock() instanceof DoublePlantBlock && state.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER) + ctx.getLevel().destroyBlock(ctx.getClickedPos().below(), false); + else ctx.getLevel().destroyBlock(ctx.getClickedPos(), false); + if (random.nextInt(10) == 0) { + ItemStack drop = getHarvestable(state); + if (!drop.isEmpty() && !ctx.getLevel().isClientSide) { + ctx.getLevel().playSound(null, ctx.getClickedPos(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.5f, 0.9f + random.nextFloat() * 0.2f); + ctx.getLevel().addFreshEntity(new ItemEntity(ctx.getLevel(), ctx.getClickedPos().getX() + 0.5, ctx.getClickedPos().getY() + 0.5, ctx.getClickedPos().getZ() + 0.5, drop.copy())); + } + if (!ctx.getPlayer().isCreative()) ctx.getItemInHand().hurtAndBreak(1, ctx.getPlayer(), (player) -> { + player.broadcastBreakEvent(ctx.getHand()); + }); + } + } + } + return InteractionResult.SUCCESS; + } + return super.useOn(ctx); + } + + public static Map harvestables = new HashMap<>(); + + public static void initHarvestables() { + harvestables.put(Blocks.JUNGLE_LEAVES.getRegistryName(), new ItemStack(Registry.SILDRIAN_SEED.get())); + harvestables.put(Blocks.LILY_PAD.getRegistryName(), new ItemStack(Registry.OANNA_BLOOM.get())); + harvestables.put(Blocks.OXEYE_DAISY.getRegistryName(), new ItemStack(Registry.MERAMMER_ROOT.get())); + harvestables.put(Blocks.FERN.getRegistryName(), new ItemStack(Registry.AVENNIAN_SPRIG.get())); + } + + public static ItemStack getHarvestable(BlockState state) { + return harvestables.getOrDefault(state.getBlock().getRegistryName(), ItemStack.EMPTY); + } +} diff --git a/src/main/java/elucent/eidolon/item/BonechillWandItem.java b/src/main/java/elucent/eidolon/item/BonechillWandItem.java index 45556f0..fcbf8aa 100644 --- a/src/main/java/elucent/eidolon/item/BonechillWandItem.java +++ b/src/main/java/elucent/eidolon/item/BonechillWandItem.java @@ -1,58 +1,59 @@ package elucent.eidolon.item; +import java.util.List; +import java.util.Random; + import elucent.eidolon.Registry; -import elucent.eidolon.capability.ReputationProvider; import elucent.eidolon.entity.BonechillProjectileEntity; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionHand; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.phys.Vec3; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.List; - public class BonechillWandItem extends WandItem { + private Random random = new Random(); + public BonechillWandItem(Properties builderIn) { super(builderIn); } @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); } } @Override - public ActionResult onItemRightClick(World world, PlayerEntity entity, Hand hand) { - ItemStack stack = entity.getHeldItem(hand); - if (!entity.isSwingInProgress) { - if (!world.isRemote) { - Vector3d pos = entity.getPositionVec().add(entity.getLookVec().scale(0.5)).add(0.5 * Math.sin(Math.toRadians(225 - entity.rotationYawHead)), entity.getHeight() * 2 / 3, 0.5 * Math.cos(Math.toRadians(225 - entity.rotationYawHead))); - Vector3d vel = entity.getEyePosition(0).add(entity.getLookVec().scale(40)).subtract(pos).scale(1.0 / 20); - world.addEntity(new BonechillProjectileEntity(Registry.BONECHILL_PROJECTILE.get(), world).shoot( - pos.x, pos.y, pos.z, vel.x, vel.y, vel.z, entity.getUniqueID() + public InteractionResultHolder use(Level world, Player entity, InteractionHand hand) { + ItemStack stack = entity.getItemInHand(hand); + if (!entity.swinging) { + if (!world.isClientSide) { + Vec3 pos = entity.position().add(entity.getLookAngle().scale(0.5)).add(0.5 * Math.sin(Math.toRadians(225 - entity.yHeadRot)), entity.getBbHeight() * 2 / 3, 0.5 * Math.cos(Math.toRadians(225 - entity.yHeadRot))); + Vec3 vel = entity.getEyePosition(0).add(entity.getLookAngle().scale(40)).subtract(pos).scale(1.0 / 20); + world.addFreshEntity(new BonechillProjectileEntity(Registry.BONECHILL_PROJECTILE.get(), world).shoot( + pos.x, pos.y, pos.z, vel.x, vel.y, vel.z, entity.getUUID() )); - world.playSound(null, pos.x, pos.y, pos.z, Registry.CAST_BONECHILL_EVENT.get(), SoundCategory.NEUTRAL, 0.75f, random.nextFloat() * 0.2f + 0.9f); - stack.damageItem(1, entity, (player) -> { - player.sendBreakAnimation(hand); + world.playSound(null, pos.x, pos.y, pos.z, Registry.CAST_BONECHILL_EVENT.get(), SoundSource.NEUTRAL, 0.75f, random.nextFloat() * 0.2f + 0.9f); + stack.hurtAndBreak(1, entity, (player) -> { + player.broadcastBreakEvent(hand); }); } - entity.swingArm(hand); - return ActionResult.resultSuccess(stack); + entity.swing(hand); + return InteractionResultHolder.success(stack); } - return ActionResult.resultPass(stack); + return InteractionResultHolder.pass(stack); } } diff --git a/src/main/java/elucent/eidolon/item/BonelordArmorItem.java b/src/main/java/elucent/eidolon/item/BonelordArmorItem.java new file mode 100644 index 0000000..ab24755 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/BonelordArmorItem.java @@ -0,0 +1,133 @@ +package elucent.eidolon.item; + +import java.util.UUID; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; + +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.item.model.BonelordArmorModel; +import elucent.eidolon.item.model.WarlockArmorModel; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterials; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.util.Mth; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IItemRenderProperties; +import net.minecraftforge.common.extensions.IForgeItem; + +public class BonelordArmorItem extends ArmorItem implements IForgeItem { + private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; + + public static class Material implements ArmorMaterial { + @Override + public int getDurabilityForSlot(EquipmentSlot slot) { + return MAX_DAMAGE_ARRAY[slot.getIndex()] * 38; + } + + @Override + public int getDefenseForSlot(EquipmentSlot slot) { + switch (slot) { + case CHEST: + return 9; + case HEAD: + return 4; + case LEGS: + return 7; + default: + return 0; + } + } + + @Override + public int getEnchantmentValue() { + return 25; + } + + @Override + public SoundEvent getEquipSound() { + return ArmorMaterials.TURTLE.getEquipSound(); + } + + @Override + public Ingredient getRepairIngredient() { + return Ingredient.of(new ItemStack(Registry.IMBUED_BONES.get())); + } + + @Override + public String getName() { + return Eidolon.MODID + ":bonelord"; + } + + @Override + public float getToughness() { + return 2; + } + + @Override + public float getKnockbackResistance() { + return 0; + } + + public static final Material INSTANCE = new Material(); + } + + Multimap modifiers = null; + + private static final UUID[] ARMOR_MODIFIER_UUID_PER_SLOT = new UUID[]{UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")}; + + public BonelordArmorItem(EquipmentSlot slot, Properties builderIn) { + super(Material.INSTANCE, slot, builderIn); + } + + @Override + public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { + if (modifiers == null) { + UUID uuid = ARMOR_MODIFIER_UUID_PER_SLOT[this.slot.getIndex()]; + modifiers = ImmutableMultimap.builder() + .putAll(getDefaultAttributeModifiers(this.slot)) + .put(Registry.PERSISTENT_SOUL_HEARTS.get(), new AttributeModifier(uuid, "Persistent hearts", this.slot == EquipmentSlot.CHEST ? 20.0 : 10.0, Operation.ADDITION)) + .build(); + } + return slot == this.slot ? modifiers : super.getAttributeModifiers(slot, stack); + } + + @OnlyIn(Dist.CLIENT) + @Override + public void initializeClient(java.util.function.Consumer consumer) { + consumer.accept(new IItemRenderProperties() { + @Override + public BonelordArmorModel getArmorModel(LivingEntity entity, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel _default) { + float pticks = Minecraft.getInstance().getFrameTime(); + float f = Mth.rotLerp(pticks, entity.yBodyRotO, entity.yBodyRot); + float f1 = Mth.rotLerp(pticks, entity.yHeadRotO, entity.yHeadRot); + float netHeadYaw = f1 - f; + float netHeadPitch = Mth.lerp(pticks, entity.xRotO, entity.getXRot()); + ClientRegistry.BONELORD_ARMOR_MODEL.slot = slot; + ClientRegistry.BONELORD_ARMOR_MODEL.copyFromDefault(_default); + ClientRegistry.BONELORD_ARMOR_MODEL.setupAnim(entity, entity.animationPosition, entity.animationSpeed, entity.tickCount + pticks, netHeadYaw, netHeadPitch); + return ClientRegistry.BONELORD_ARMOR_MODEL; + } + }); + } + + @OnlyIn(Dist.CLIENT) + @Override + public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { + return Eidolon.MODID + ":textures/entity/bonelord_armor.png"; + } +} diff --git a/src/main/java/elucent/eidolon/item/CleavingAxeItem.java b/src/main/java/elucent/eidolon/item/CleavingAxeItem.java index de98e4a..86d8718 100644 --- a/src/main/java/elucent/eidolon/item/CleavingAxeItem.java +++ b/src/main/java/elucent/eidolon/item/CleavingAxeItem.java @@ -1,19 +1,19 @@ package elucent.eidolon.item; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.AxeItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import java.util.List; + +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.AxeItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.List; - public class CleavingAxeItem extends AxeItem { public CleavingAxeItem(Properties builderIn) { super(Tiers.PewterTier.INSTANCE, 7, -3.2f, builderIn); @@ -28,10 +28,10 @@ public Item setLore(String tag) { @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); } } } diff --git a/src/main/java/elucent/eidolon/item/CodexItem.java b/src/main/java/elucent/eidolon/item/CodexItem.java index f9163ac..f5f12c9 100644 --- a/src/main/java/elucent/eidolon/item/CodexItem.java +++ b/src/main/java/elucent/eidolon/item/CodexItem.java @@ -2,32 +2,36 @@ import elucent.eidolon.Eidolon; import elucent.eidolon.spell.Sign; -import elucent.eidolon.spell.KnowledgeUtil; import elucent.eidolon.spell.Signs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.*; -import net.minecraft.world.World; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionHand; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; -public class CodexItem extends ItemBase { +public class CodexItem extends ItemBase implements IManaRelatedItem { public CodexItem(Properties properties) { super(properties); } @Override - public ActionResult onItemRightClick(World world, PlayerEntity entity, Hand hand) { - if (world.isRemote) { - entity.playSound(SoundEvents.ITEM_BOOK_PAGE_TURN, SoundCategory.PLAYERS, 1.0f, 1.0f); + public InteractionResultHolder use(Level world, Player entity, InteractionHand hand) { + if (world.isClientSide) { + entity.playNotifySound(SoundEvents.BOOK_PAGE_TURN, SoundSource.PLAYERS, 1.0f, 1.0f); Eidolon.proxy.openCodexGui(); } - return ActionResult.resultPass(entity.getHeldItem(hand)); + return InteractionResultHolder.pass(entity.getItemInHand(hand)); } @Override - public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { super.inventoryTick(stack, world, entity, slot, selected); - if (!world.isRemote && stack.hasTag() && stack.getTag().contains("sign")) { + if (!world.isClientSide && stack.hasTag() && stack.getTag().contains("sign")) { ResourceLocation loc = new ResourceLocation(stack.getTag().getString("sign")); stack.getTag().remove("sign"); Sign sign = Signs.find(loc); diff --git a/src/main/java/elucent/eidolon/item/CompletedResearchItem.java b/src/main/java/elucent/eidolon/item/CompletedResearchItem.java new file mode 100644 index 0000000..12034a8 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/CompletedResearchItem.java @@ -0,0 +1,78 @@ +package elucent.eidolon.item; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import elucent.eidolon.Registry; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.EnderMan; +import net.minecraft.world.entity.monster.Endermite; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.SwordItem; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.Vec3; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.living.LootingLevelEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +import java.util.Random; + +public class CompletedResearchItem extends ItemBase { + public CompletedResearchItem(Properties builderIn) { + super(builderIn); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + if (!stack.hasTag() || !stack.getTag().contains("research")) return; + Research r = Researches.find(new ResourceLocation(stack.getTag().getString("research"))); + if (r == null) return; + tooltip.add(new TextComponent("" + ChatFormatting.ITALIC + ChatFormatting.GOLD + r.getName())); + } + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack stack = player.getItemInHand(hand); + if (stack.hasTag() && stack.getTag().contains("research")) { + Research r = Researches.find(new ResourceLocation(stack.getTag().getString("research"))); + if (r != null && !KnowledgeUtil.knowsResearch(player, r.getRegistryName())) { + KnowledgeUtil.grantResearch(player, r.getRegistryName()); + return InteractionResultHolder.consume(ItemStack.EMPTY); + } + } + return super.use(level, player, hand); + } +} diff --git a/src/main/java/elucent/eidolon/item/DeathbringerScytheItem.java b/src/main/java/elucent/eidolon/item/DeathbringerScytheItem.java new file mode 100644 index 0000000..413360e --- /dev/null +++ b/src/main/java/elucent/eidolon/item/DeathbringerScytheItem.java @@ -0,0 +1,72 @@ +package elucent.eidolon.item; + +import java.util.List; + +import elucent.eidolon.Registry; +import elucent.eidolon.network.DeathbringerSlashEffectPacket; +import elucent.eidolon.network.LifestealEffectPacket; +import elucent.eidolon.network.Networking; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.damagesource.EntityDamageSource; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SwordItem; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.ToolAction; +import net.minecraftforge.common.ToolActions; + +public class DeathbringerScytheItem extends SwordItem { + public DeathbringerScytheItem(Properties builderIn) { + super(Tiers.NecroticTier.INSTANCE, 7, -2.9f, builderIn); + } + + String loreTag = null; + + public Item setLore(String tag) { + this.loreTag = tag; + return this; + } + + @Override + @OnlyIn(Dist.CLIENT) + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + if (this.loreTag != null) { + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); + } + } + + @Override + public boolean canPerformAction(ItemStack stack, ToolAction action) { + if (action == ToolActions.SWORD_SWEEP) return false; + return super.canPerformAction(stack, action); + } + + @Override + public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { + if (target.getMobType() != MobType.UNDEAD) { + target.addEffect(new MobEffectInstance(Registry.UNDEATH_EFFECT.get(), 900)); + } + if (!attacker.level.isClientSide) + Networking.sendToTracking(attacker.level, attacker.blockPosition(), new DeathbringerSlashEffectPacket( + attacker.getX(), attacker.getY() + target.getBbHeight() / 2, attacker.getZ(), + target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ(), + ColorUtil.packColor(255, 33, 26, 23), + ColorUtil.packColor(255, 10, 10, 11), + ColorUtil.packColor(255, 161, 255, 123), + ColorUtil.packColor(255, 194, 171, 70) + )); + return super.hurtEnemy(stack, target, attacker); + } +} diff --git a/src/main/java/elucent/eidolon/item/IManaRelatedItem.java b/src/main/java/elucent/eidolon/item/IManaRelatedItem.java new file mode 100644 index 0000000..c9492a3 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/IManaRelatedItem.java @@ -0,0 +1,5 @@ +package elucent.eidolon.item; + +public interface IManaRelatedItem { + +} diff --git a/src/main/java/elucent/eidolon/item/IRechargeableWand.java b/src/main/java/elucent/eidolon/item/IRechargeableWand.java new file mode 100644 index 0000000..eaa1cac --- /dev/null +++ b/src/main/java/elucent/eidolon/item/IRechargeableWand.java @@ -0,0 +1,7 @@ +package elucent.eidolon.item; + +import net.minecraft.world.item.ItemStack; + +public interface IRechargeableWand { + public ItemStack recharge(ItemStack stack); +} diff --git a/src/main/java/elucent/eidolon/item/IWingsItem.java b/src/main/java/elucent/eidolon/item/IWingsItem.java new file mode 100644 index 0000000..1917295 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/IWingsItem.java @@ -0,0 +1,15 @@ +package elucent.eidolon.item; + +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public interface IWingsItem { + int getMaxCharges(ItemStack stack); + void onFlap(Player player, Level level, ItemStack stack, int nCharges); + int getDashTicks(ItemStack stack); + void onDashStart(Player player, Level level, ItemStack stack); + void onDashTick(Player player, Level level, ItemStack stack, int remainingTicks); + void onDashEnd(Player player, Level level, ItemStack stack); + void onDashFlap(Player player, Level level, ItemStack stack, int dashTicks); +} diff --git a/src/main/java/elucent/eidolon/item/ItemBase.java b/src/main/java/elucent/eidolon/item/ItemBase.java index f441151..130d079 100644 --- a/src/main/java/elucent/eidolon/item/ItemBase.java +++ b/src/main/java/elucent/eidolon/item/ItemBase.java @@ -1,20 +1,20 @@ package elucent.eidolon.item; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import java.util.List; + +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; -import java.util.List; - public class ItemBase extends Item { + String loreFormat = "" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC; String loreTag = null; public ItemBase(Properties properties) { @@ -26,12 +26,23 @@ public ItemBase setLore(String tag) { return this; } + public ItemBase setLore(ChatFormatting format, String tag) { + this.loreFormat = "" + format; + this.loreTag = tag; + return this; + } + + public ItemBase setLore(String format, String tag) { + this.loreFormat = format; + this.loreTag = tag; + return this; + } + @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent(loreFormat + I18n.get(this.loreTag))); } } } diff --git a/src/main/java/elucent/eidolon/item/NotetakingToolsItem.java b/src/main/java/elucent/eidolon/item/NotetakingToolsItem.java new file mode 100644 index 0000000..8240561 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/NotetakingToolsItem.java @@ -0,0 +1,66 @@ +package elucent.eidolon.item; + +import java.util.Collection; +import java.util.stream.Collectors; + +import elucent.eidolon.Registry; +import elucent.eidolon.block.PipeBlock; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; + +public class NotetakingToolsItem extends ItemBase { + public NotetakingToolsItem(Properties properties) { + super(properties); + } + + @Override + public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity entity, InteractionHand hand) { + Collection researches = Researches.getEntityResearches(entity); + if (researches != null && !researches.isEmpty()) { + Research r = researches.iterator().next(); + if (!player.level.isClientSide && r != null) { + ItemStack notes = new ItemStack(Registry.RESEARCH_NOTES.get(), 1); + notes.getOrCreateTag().putString("research", r.getRegistryName().toString()); + notes.getTag().putInt("stepsDone", 0); + stack.shrink(1); + if (stack.getCount() == 0) player.setItemInHand(hand, notes); + else if (!player.getInventory().add(notes)) { + player.drop(notes, false); + } + } + return InteractionResult.PASS; + } + return super.interactLivingEntity(stack, player, entity, hand); + } + + @Override + public InteractionResult useOn(UseOnContext ctx) { + BlockState state = ctx.getLevel().getBlockState(ctx.getClickedPos()); + Collection researches = Researches.getBlockResearches(state.getBlock()); + if (researches != null) { + researches.removeIf((r) -> KnowledgeUtil.knowsResearch(ctx.getPlayer(), r.getRegistryName())); + if (!researches.isEmpty()) { + Research r = researches.iterator().next(); + ItemStack notes = new ItemStack(Registry.RESEARCH_NOTES.get(), 1); + notes.getOrCreateTag().putString("research", r.getRegistryName().toString()); + notes.getTag().putInt("stepsDone", 0); + ctx.getItemInHand().shrink(1); + if (ctx.getItemInHand().getCount() == 0) + ctx.getPlayer().setItemInHand(ctx.getHand(), ItemStack.EMPTY); + if (!ctx.getPlayer().getInventory().add(notes.copy())) { + ctx.getPlayer().drop(notes, false); + } + return InteractionResult.SUCCESS; + } + } + return super.useOn(ctx); + } +} diff --git a/src/main/java/elucent/eidolon/item/ReaperScytheItem.java b/src/main/java/elucent/eidolon/item/ReaperScytheItem.java index 7cf0f89..3f4a6d1 100644 --- a/src/main/java/elucent/eidolon/item/ReaperScytheItem.java +++ b/src/main/java/elucent/eidolon/item/ReaperScytheItem.java @@ -1,18 +1,19 @@ package elucent.eidolon.item; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.*; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import java.util.List; + +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SwordItem; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.List; - public class ReaperScytheItem extends SwordItem { public ReaperScytheItem(Properties builderIn) { super(Tiers.PewterTier.INSTANCE, 5, -2.9f, builderIn); @@ -27,10 +28,10 @@ public Item setLore(String tag) { @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); } } } diff --git a/src/main/java/elucent/eidolon/item/ResearchNotesItem.java b/src/main/java/elucent/eidolon/item/ResearchNotesItem.java new file mode 100644 index 0000000..3722b16 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/ResearchNotesItem.java @@ -0,0 +1,75 @@ +package elucent.eidolon.item; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import elucent.eidolon.Registry; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.EnderMan; +import net.minecraft.world.entity.monster.Endermite; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.SwordItem; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.InteractionResult; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.Vec3; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.living.LootingLevelEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +import java.util.Random; + +public class ResearchNotesItem extends ItemBase { + private Random random = new Random(); + + public ResearchNotesItem(Properties builderIn) { + super(builderIn); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + if (!stack.hasTag() || !stack.getTag().contains("research")) return; + Research r = Researches.find(new ResourceLocation(stack.getTag().getString("research"))); + if (r == null) return; + int done = stack.getTag().getInt("stepsDone"); + StringBuilder stars = new StringBuilder(); + stars.append(ChatFormatting.GOLD); + for (int i = 0; i < r.getStars(); i ++) { + if (i == done) stars.append(ChatFormatting.GRAY); + if (i < done) stars.append("\u2605"); + else stars.append("\u2606"); + } + tooltip.add(new TextComponent(stars.toString())); + boolean known = done >= r.getStars() || KnowledgeUtil.knowsResearch(Minecraft.getInstance().player, r.getRegistryName()); + String name = known ? r.getName() : "???"; + tooltip.add(new TextComponent("" + (known ? ChatFormatting.GRAY : ChatFormatting.DARK_GRAY) + ChatFormatting.ITALIC + name)); + } +} diff --git a/src/main/java/elucent/eidolon/item/ReversalPickItem.java b/src/main/java/elucent/eidolon/item/ReversalPickItem.java index 33ba533..eee8ab1 100644 --- a/src/main/java/elucent/eidolon/item/ReversalPickItem.java +++ b/src/main/java/elucent/eidolon/item/ReversalPickItem.java @@ -1,26 +1,23 @@ package elucent.eidolon.item; -import com.google.common.eventbus.Subscribe; -import net.minecraft.block.Blocks; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.AxeItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.PickaxeItem; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import java.util.List; + +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.PickaxeItem; +import net.minecraft.util.Mth; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import java.util.List; - public class ReversalPickItem extends PickaxeItem { public ReversalPickItem(Properties builderIn) { super(Tiers.MagicToolTier.INSTANCE, 1, -2.8F, builderIn); @@ -36,19 +33,19 @@ public Item setLore(String tag) { @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); } } @SubscribeEvent public static void onStartBreak(PlayerEvent.BreakSpeed event) { - if (event.getPlayer().getHeldItemMainhand().getItem() instanceof ReversalPickItem) { - float hardness = event.getState().getBlockHardness(event.getEntity().world, event.getPos()); - float adjHardness = 1 / (hardness / 1.5f + event.getState().getHarvestLevel()); - float newSpeed = MathHelper.sqrt(event.getOriginalSpeed() * 0.25f) * MathHelper.sqrt(hardness / adjHardness); + if (event.getPlayer().getMainHandItem().getItem() instanceof ReversalPickItem) { + float hardness = event.getState().getDestroySpeed(event.getEntity().level, event.getPos()); + float adjHardness = 1 / (hardness / 2.0f); + float newSpeed = Mth.sqrt(event.getOriginalSpeed() * 0.25f) * Mth.sqrt(hardness / adjHardness); event.setNewSpeed(newSpeed * newSpeed); } } diff --git a/src/main/java/elucent/eidolon/item/SappingSwordItem.java b/src/main/java/elucent/eidolon/item/SappingSwordItem.java index 24c6031..31c4cb5 100644 --- a/src/main/java/elucent/eidolon/item/SappingSwordItem.java +++ b/src/main/java/elucent/eidolon/item/SappingSwordItem.java @@ -1,20 +1,24 @@ package elucent.eidolon.item; +import java.util.List; + import elucent.eidolon.network.LifestealEffectPacket; import elucent.eidolon.network.Networking; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.*; -import net.minecraft.util.EntityDamageSource; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SwordItem; +import net.minecraft.world.damagesource.EntityDamageSource; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; - -import java.util.List; +import net.minecraftforge.common.ToolAction; +import net.minecraftforge.common.ToolActions; public class SappingSwordItem extends SwordItem { public SappingSwordItem(Properties builderIn) { @@ -30,25 +34,31 @@ public Item setLore(String tag) { @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); } } + +// @Override +// public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { +// if (toolAction == ToolActions.SWORD_SWEEP) return false; +// return super.canPerformAction(stack, toolAction); +// } @Override - public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { - if (target.hurtResistantTime > 0) { - target.hurtResistantTime = 0; + public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { + if (target.invulnerableTime > 0) { + target.invulnerableTime = 0; float before = target.getHealth(); - target.attackEntityFrom(new EntityDamageSource("wither", attacker).setDamageBypassesArmor(), 2.0f); + target.hurt(new EntityDamageSource("wither", attacker).bypassArmor(), 2.0f); float healing = before - target.getHealth(); if (healing > 0) { attacker.heal(healing); - if (!attacker.world.isRemote) Networking.sendToTracking(attacker.world, attacker.getPosition(), new LifestealEffectPacket(target.getPosition(), attacker.getPosition(), 1.0f, 0.125f, 0.1875f)); + if (!attacker.level.isClientSide) Networking.sendToTracking(attacker.level, attacker.blockPosition(), new LifestealEffectPacket(target.blockPosition(), attacker.blockPosition(), 1.0f, 0.125f, 0.1875f)); } } - return super.hitEntity(stack, target, attacker); + return super.hurtEnemy(stack, target, attacker); } } diff --git a/src/main/java/elucent/eidolon/item/SilverArmorItem.java b/src/main/java/elucent/eidolon/item/SilverArmorItem.java new file mode 100644 index 0000000..038d979 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/SilverArmorItem.java @@ -0,0 +1,109 @@ +package elucent.eidolon.item; + +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.item.model.SilverArmorModel; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterials; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.util.Mth; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IItemRenderProperties; + +public class SilverArmorItem extends ArmorItem { + private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; + + public static class Material implements ArmorMaterial { + @Override + public int getDurabilityForSlot(EquipmentSlot slot) { + return MAX_DAMAGE_ARRAY[slot.getIndex()] * 17; + } + + @Override + public int getDefenseForSlot(EquipmentSlot slot) { + switch (slot) { + case CHEST: + return 6; + case HEAD: + return 2; + case LEGS: + return 4; + case FEET: + return 2; + default: + return 0; + } + } + + @Override + public int getEnchantmentValue() { + return 20; + } + + @Override + public SoundEvent getEquipSound() { + return ArmorMaterials.GOLD.getEquipSound(); + } + + @Override + public Ingredient getRepairIngredient() { + return Ingredient.of(Registry.INGOTS_SILVER); + } + + @Override + public String getName() { + return Eidolon.MODID + ":silver_armor"; + } + + @Override + public float getToughness() { + return 0; + } + + @Override + public float getKnockbackResistance() { + return 0; + } + + public static final Material INSTANCE = new Material(); + } + + public SilverArmorItem(EquipmentSlot slot, Properties builderIn) { + super(Material.INSTANCE, slot, builderIn); + } + + @OnlyIn(Dist.CLIENT) + @Override + public void initializeClient(java.util.function.Consumer consumer) { + consumer.accept(new IItemRenderProperties() { + @Override + public SilverArmorModel getArmorModel(LivingEntity entity, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel _default) { + float pticks = Minecraft.getInstance().getFrameTime(); + float f = Mth.rotLerp(pticks, entity.yBodyRotO, entity.yBodyRot); + float f1 = Mth.rotLerp(pticks, entity.yHeadRotO, entity.yHeadRot); + float netHeadYaw = f1 - f; + float netHeadPitch = Mth.lerp(pticks, entity.xRotO, entity.getXRot()); + ClientRegistry.SILVER_ARMOR_MODEL.slot = slot; + ClientRegistry.SILVER_ARMOR_MODEL.copyFromDefault(_default); + ClientRegistry.SILVER_ARMOR_MODEL.setupAnim(entity, entity.animationPosition, entity.animationSpeed, entity.tickCount + pticks, netHeadYaw, netHeadPitch); + return ClientRegistry.SILVER_ARMOR_MODEL; + } + }); + } + + @OnlyIn(Dist.CLIENT) + @Override + public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { + return Eidolon.MODID + ":textures/entity/silver_armor.png"; + } +} diff --git a/src/main/java/elucent/eidolon/item/SoulfireWandItem.java b/src/main/java/elucent/eidolon/item/SoulfireWandItem.java index a6816d4..2ae454b 100644 --- a/src/main/java/elucent/eidolon/item/SoulfireWandItem.java +++ b/src/main/java/elucent/eidolon/item/SoulfireWandItem.java @@ -1,68 +1,46 @@ package elucent.eidolon.item; -import elucent.eidolon.Eidolon; +import java.util.Random; + import elucent.eidolon.Registry; -import elucent.eidolon.capability.KnowledgeProvider; -import elucent.eidolon.capability.ReputationProvider; -import elucent.eidolon.deity.Deities; -import elucent.eidolon.deity.DeityLocks; +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.capability.ISoul; import elucent.eidolon.entity.SoulfireProjectileEntity; -import elucent.eidolon.network.KnowledgeUpdatePacket; import elucent.eidolon.network.Networking; -import elucent.eidolon.spell.Sign; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.*; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; -import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import java.util.List; +import elucent.eidolon.network.SoulUpdatePacket; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionHand; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; public class SoulfireWandItem extends WandItem { + static Random random = new Random(); + public SoulfireWandItem(Properties builderIn) { super(builderIn); } @Override - public ActionResult onItemRightClick(World world, PlayerEntity entity, Hand hand) { - ItemStack stack = entity.getHeldItem(hand); - if (!entity.isSwingInProgress) { - if (!world.isRemote) { - Vector3d pos = entity.getPositionVec().add(entity.getLookVec().scale(0.5)).add(0.5 * Math.sin(Math.toRadians(225 - entity.rotationYawHead)), entity.getHeight() * 2 / 3, 0.5 * Math.cos(Math.toRadians(225 - entity.rotationYawHead))); - Vector3d vel = entity.getEyePosition(0).add(entity.getLookVec().scale(40)).subtract(pos).scale(1.0 / 20); - world.addEntity(new SoulfireProjectileEntity(Registry.SOULFIRE_PROJECTILE.get(), world).shoot( - pos.x, pos.y, pos.z, vel.x, vel.y, vel.z, entity.getUniqueID() + public InteractionResultHolder use(Level world, Player entity, InteractionHand hand) { + ItemStack stack = entity.getItemInHand(hand); + if (!entity.swinging) { + if (!world.isClientSide) { + Vec3 pos = entity.position().add(entity.getLookAngle().scale(0.5)).add(0.5 * Math.sin(Math.toRadians(225 - entity.yHeadRot)), entity.getBbHeight() * 2 / 3, 0.5 * Math.cos(Math.toRadians(225 - entity.yHeadRot))); + Vec3 vel = entity.getEyePosition(0).add(entity.getLookAngle().scale(40)).subtract(pos).scale(1.0 / 20); + world.addFreshEntity(new SoulfireProjectileEntity(Registry.SOULFIRE_PROJECTILE.get(), world).shoot( + pos.x, pos.y, pos.z, vel.x, vel.y, vel.z, entity.getUUID() )); - world.playSound(null, pos.x, pos.y, pos.z, Registry.CAST_SOULFIRE_EVENT.get(), SoundCategory.NEUTRAL, 0.75f, random.nextFloat() * 0.2f + 0.9f); - stack.damageItem(1, entity, (player) -> { - player.sendBreakAnimation(hand); + world.playSound(null, pos.x, pos.y, pos.z, Registry.CAST_SOULFIRE_EVENT.get(), SoundSource.NEUTRAL, 0.75f, random.nextFloat() * 0.2f + 0.9f); + stack.hurtAndBreak(1, entity, (player) -> { + player.broadcastBreakEvent(hand); }); - - try { - Template t = ((ServerWorld)world).getStructureTemplateManager().getTemplate(new ResourceLocation("eidolon", "corridor")); - BlockPos d = t.getSize(); - Rotation r = Rotation.values()[entity.getHorizontalFacing().getHorizontalIndex()]; - BlockPos o = new BlockPos(-d.getX() / 2, -d.getY() / 2, -d.getZ() / 2); - BlockPos s = new BlockPos(Math.max(o.getX(), o.getZ()), o.getY(), Math.max(o.getX(), o.getZ())); - t.func_237152_b_((ServerWorld)world, entity.getPosition().down(8).add(o.rotate(r)).subtract(s), new PlacementSettings().setRotation(r), random); - } catch (Exception e) { - // - } } - entity.swingArm(hand); - return ActionResult.resultSuccess(stack); + entity.swing(hand); + return InteractionResultHolder.success(stack); } - return ActionResult.resultPass(stack); + return InteractionResultHolder.pass(stack); } } diff --git a/src/main/java/elucent/eidolon/item/SummoningStaffItem.java b/src/main/java/elucent/eidolon/item/SummoningStaffItem.java new file mode 100644 index 0000000..bff3f2c --- /dev/null +++ b/src/main/java/elucent/eidolon/item/SummoningStaffItem.java @@ -0,0 +1,222 @@ +package elucent.eidolon.item; + +import java.util.List; +import java.util.Optional; +import java.util.Random; + +import elucent.eidolon.Registry; +import elucent.eidolon.capability.IReputation; +import elucent.eidolon.capability.ISoul; +import elucent.eidolon.entity.SoulfireProjectileEntity; +import elucent.eidolon.network.MagicBurstEffectPacket; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.SoulUpdatePacket; +import elucent.eidolon.particle.Particles; +import elucent.eidolon.util.ColorUtil; +import elucent.eidolon.util.EntityUtil; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ArrowItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.InteractionHand; +import net.minecraft.ChatFormatting; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.stats.Stats; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.world.level.Level; + +public class SummoningStaffItem extends ItemBase { + public SummoningStaffItem(Properties builderIn) { + super(builderIn); + } + + @Override + public UseAnim getUseAnimation(ItemStack stack) { + return UseAnim.BOW; + } + + @Override + public int getUseDuration(ItemStack stack) { + return 72000; + } + + Random random = new Random(); + + @Override + public void onUsingTick(ItemStack stack, LivingEntity entity, int time) { + if (entity.level.isClientSide) { + HitResult hit = entity.pick(16, 0, false); + if (hit.getType() != Type.MISS) { + Vec3 pos = hit.getLocation(); + time = 72000 - time; + float alpha = Mth.clamp(time / 40.0f, 0, 1); + float a = Mth.DEG_TO_RAD * (entity.level.getGameTime() % 360 + 12 * time); + float r = 0.3f + 0.3f * alpha; + float sa = r * Mth.sin(a), ca = r * Mth.cos(a); + if (time == 40) { + entity.playSound(SoundEvents.CROSSBOW_QUICK_CHARGE_3, 1, 1); + } + Particles.create(Registry.SMOKE_PARTICLE) + .randomVelocity(0.025f * alpha, 0.0125f * alpha) + .setColor(33.0f/255, 26.0f/255, 23.0f/255, 0.125f, 10.0f/255, 10.0f/255, 12.0f/255, 0) + .setAlpha(0.25f * alpha, 0) + .randomOffset(0.05f + 0.05f * alpha) + .setScale(0.25f + 0.25f * alpha, alpha * 0.125f) + .repeat(entity.level, pos.x + sa, pos.y, pos.z + ca, 2) + .repeat(entity.level, pos.x - sa, pos.y, pos.z - ca, 2); + } + } + } + + @Override + public void releaseUsing(ItemStack stack, Level level, LivingEntity entity, int time) { + if ((72000 - time) >= 20 && hasCharges(stack)) { + ListTag charges = getCharges(stack); + int selected = getSelected(stack); + CompoundTag tag = charges.getCompound(selected); + HitResult hit = entity.pick(16, 0, false); + if (hit.getType() != Type.MISS) { + Vec3 pos = hit.getLocation(); + Optional> etype = EntityType.by(tag); + if (etype.isPresent() && !level.isClientSide) { + tag.remove("UUID"); + Optional e = etype.get().create(tag, level); + if (e.isPresent()) { + e.get().setPos(pos); + EntityUtil.enthrall(entity, (LivingEntity)e.get()); + level.addFreshEntity(e.get()); + Networking.sendToTracking(entity.level, e.get().blockPosition(), new MagicBurstEffectPacket(e.get().getX(), e.get().getY() + e.get().getBbHeight() / 2, e.get().getZ(), + ColorUtil.packColor(255, 61, 70, 35), ColorUtil.packColor(255, 36, 24, 41))); + level.playSound(null, e.get().blockPosition(), SoundEvents.ENCHANTMENT_TABLE_USE, SoundSource.PLAYERS, 0.75f, 0.1f); + } + } + + entity.setItemInHand(entity.getUsedItemHand(), entity instanceof Player && ((Player)entity).getAbilities().instabuild ? stack : consumeCharge(stack, selected)); + entity.swing(entity.getUsedItemHand()); + entity.stopUsingItem(); + } + } + } + + public int getSelected(ItemStack stack) { + CompoundTag tag = stack.getOrCreateTag(); + if (!tag.contains("selected")) tag.putInt("selected", 0); + else if (tag.getInt("selected") >= getCharges(stack).size()) tag.putInt("selected", 0); + return tag.getInt("selected"); + } + + public int changeSelection(ItemStack stack, int diff) { + if (!hasCharges(stack)) return 0; + CompoundTag tag = stack.getOrCreateTag(); + int selected = getSelected(stack) + diff % getCharges(stack).size(); + tag.putInt("selected", selected); + return selected; + } + + public ItemStack addCharges(ItemStack stack, ListTag charges) { + CompoundTag tag = stack.getOrCreateTag(); + if (!tag.contains("charges")) { + while (charges.size() > 100) charges.remove(charges.size() - 1); + tag.put("charges", charges); + } + else { + ListTag existing = tag.getList("charges", Tag.TAG_COMPOUND); + while (existing.size() + charges.size() > 100) charges.remove(charges.size() - 1); + if (charges.size() > 0) for (Tag t : charges) existing.add(t); + tag.put("charges", existing); + } + return stack; + } + + public boolean hasCharges(ItemStack stack) { + CompoundTag tag = stack.getOrCreateTag(); + ListTag list = tag.getList("charges", Tag.TAG_COMPOUND); + return tag.contains("charges") && tag.getList("charges", Tag.TAG_COMPOUND).size() > 0; + } + + public ListTag getCharges(ItemStack stack) { + CompoundTag tag = stack.getOrCreateTag(); + return tag.contains("charges") ? tag.getList("charges", Tag.TAG_COMPOUND) : new ListTag(); + } + + public ItemStack consumeCharge(ItemStack stack, int index) { + ListTag list = getCharges(stack); + if (list.size() > index) list.remove(index); + stack.getOrCreateTag().put("charges", list); + return stack; + } + + public ItemStack addCharge(ItemStack stack, CompoundTag tag) { + ListTag list = getCharges(stack); + if (list.size() < 100) list.add(tag); + stack.getOrCreateTag().put("charges", list); + return stack; + } + + @Override + public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + ItemStack stack = player.getItemInHand(hand); + + if (hasCharges(stack)) { + if (player.isCrouching()) { + changeSelection(stack, 1); + CompoundTag tag = getCharges(stack).getCompound(getSelected(stack)); + ResourceLocation id = new ResourceLocation(tag.getString("id")); + String summonKey = "entity." + id.getNamespace() + "." + id.getPath(); + player.setItemInHand(hand, stack); + if (!world.isClientSide) { + ((ServerPlayer)player).connection.send(new ClientboundSetActionBarTextPacket(new TranslatableComponent("eidolon.tooltip.active_summon").append( + new TranslatableComponent(summonKey).withStyle(ChatFormatting.LIGHT_PURPLE) + ))); + player.playNotifySound(SoundEvents.UI_BUTTON_CLICK, SoundSource.PLAYERS, 0.5f, 1.0f); + } + return InteractionResultHolder.fail(stack); + } + player.startUsingItem(hand); + return InteractionResultHolder.consume(stack); + } + else return InteractionResultHolder.fail(stack); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { + boolean charge = hasCharges(stack); + int selected = getSelected(stack); + String summonKey = "eidolon.tooltip.no_selected_summon"; + if (charge) { + CompoundTag tag = getCharges(stack).getCompound(selected); + String ids = tag.getString("id"); + ResourceLocation id = new ResourceLocation(tag.getString("id")); + summonKey = "entity." + id.getNamespace() + "." + id.getPath(); + } + tooltip.add(new TranslatableComponent("eidolon.tooltip.active_summon").append( + new TranslatableComponent(summonKey).withStyle(charge ? ChatFormatting.LIGHT_PURPLE : ChatFormatting.DARK_PURPLE) + )); + } +} diff --git a/src/main/java/elucent/eidolon/item/Tiers.java b/src/main/java/elucent/eidolon/item/Tiers.java index 309a9d4..aa19cfd 100644 --- a/src/main/java/elucent/eidolon/item/Tiers.java +++ b/src/main/java/elucent/eidolon/item/Tiers.java @@ -1,110 +1,178 @@ package elucent.eidolon.item; import elucent.eidolon.Registry; -import net.minecraft.item.IItemTier; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; +import net.minecraft.world.item.Tier; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; public class Tiers { - public static class PewterTier implements IItemTier { + public static class PewterTier implements Tier { @Override - public int getMaxUses() { + public int getUses() { return 325; } @Override - public float getEfficiency() { + public float getSpeed() { return 6.5f; } @Override - public float getAttackDamage() { + public float getAttackDamageBonus() { return 2; } @Override - public int getHarvestLevel() { + public int getLevel() { return 2; } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return 8; } @Override - public Ingredient getRepairMaterial() { - return Ingredient.fromStacks(new ItemStack(Registry.PEWTER_INGOT.get())); + public Ingredient getRepairIngredient() { + return Ingredient.of(new ItemStack(Registry.PEWTER_INGOT.get())); } public static PewterTier INSTANCE = new PewterTier(); } - public static class MagicToolTier implements IItemTier { + public static class MagicToolTier implements Tier { @Override - public int getMaxUses() { + public int getUses() { return 1170; } @Override - public float getEfficiency() { + public float getSpeed() { return 7.0f; } @Override - public float getAttackDamage() { + public float getAttackDamageBonus() { return 3; } @Override - public int getHarvestLevel() { + public int getLevel() { return 3; } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return 30; } @Override - public Ingredient getRepairMaterial() { + public Ingredient getRepairIngredient() { return Ingredient.EMPTY; } public static MagicToolTier INSTANCE = new MagicToolTier(); } - public static class SanguineTier implements IItemTier { + public static class SilverTier implements Tier { @Override - public int getMaxUses() { + public int getUses() { + return 193; + } + + @Override + public float getSpeed() { + return 7.0f; + } + + @Override + public float getAttackDamageBonus() { + return 2; + } + + @Override + public int getLevel() { + return 2; + } + + @Override + public int getEnchantmentValue() { + return 20; + } + + @Override + public Ingredient getRepairIngredient() { + return Ingredient.of(new ItemStack(Registry.SILVER_INGOT.get())); + } + + public static SilverTier INSTANCE = new SilverTier(); + } + + public static class SanguineTier implements Tier { + @Override + public int getUses() { return 507; } @Override - public float getEfficiency() { + public float getSpeed() { return 8.0f; } @Override - public float getAttackDamage() { + public float getAttackDamageBonus() { return 3; } @Override - public int getHarvestLevel() { + public int getLevel() { return 3; } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return 20; } @Override - public Ingredient getRepairMaterial() { + public Ingredient getRepairIngredient() { return Ingredient.EMPTY; } public static SanguineTier INSTANCE = new SanguineTier(); } + + public static class NecroticTier implements Tier { + @Override + public int getUses() { + return 2161; + } + + @Override + public float getSpeed() { + return 8.0f; + } + + @Override + public float getAttackDamageBonus() { + return 3; + } + + @Override + public int getLevel() { + return 3; + } + + @Override + public int getEnchantmentValue() { + return 30; + } + + @Override + public Ingredient getRepairIngredient() { + return Ingredient.of(Registry.DEATH_ESSENCE.get()); + } + + public static MagicToolTier INSTANCE = new MagicToolTier(); + } } diff --git a/src/main/java/elucent/eidolon/item/TongsItem.java b/src/main/java/elucent/eidolon/item/TongsItem.java new file mode 100644 index 0000000..240aa50 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/TongsItem.java @@ -0,0 +1,29 @@ +package elucent.eidolon.item; + +import elucent.eidolon.block.PipeBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.InteractionResult; + +public class TongsItem extends ItemBase { + public TongsItem(Properties properties) { + super(properties); + } + + @Override + public InteractionResult useOn(UseOnContext ctx) { + BlockState state = ctx.getLevel().getBlockState(ctx.getClickedPos()); + if (state.getBlock() instanceof PipeBlock && ctx.getClickedFace() != state.getValue(PipeBlock.IN)) { + BlockState newState = state.setValue(PipeBlock.OUT, ctx.getClickedFace()); + BlockState off = ctx.getLevel().getBlockState(ctx.getClickedPos().relative(ctx.getClickedFace())); + if (off.getBlock() == state.getBlock() && + off.getValue(PipeBlock.OUT) == ctx.getClickedFace().getOpposite()) + return InteractionResult.FAIL; + if (off.getBlock() != state.getBlock() || off.getValue(PipeBlock.IN) != ctx.getClickedFace()) + newState = newState.setValue(PipeBlock.OUT_ATTACHED, false); + ctx.getLevel().setBlock(ctx.getClickedPos(), newState, 3); + return InteractionResult.SUCCESS; + } + return super.useOn(ctx); + } +} diff --git a/src/main/java/elucent/eidolon/item/TopHatItem.java b/src/main/java/elucent/eidolon/item/TopHatItem.java index c83c570..1ad5f66 100644 --- a/src/main/java/elucent/eidolon/item/TopHatItem.java +++ b/src/main/java/elucent/eidolon/item/TopHatItem.java @@ -1,56 +1,62 @@ package elucent.eidolon.item; +import java.util.List; + +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.item.model.TopHatModel; -import elucent.eidolon.item.model.WarlockArmorModel; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.model.BipedModel; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.*; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterials; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.util.Mth; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.ChatFormatting; +import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; - -import java.util.List; +import net.minecraftforge.client.IItemRenderProperties; public class TopHatItem extends ArmorItem { private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; - public static class Material implements IArmorMaterial { + public static class Material implements ArmorMaterial { @Override - public int getDurability(EquipmentSlotType slot) { + public int getDurabilityForSlot(EquipmentSlot slot) { return MAX_DAMAGE_ARRAY[slot.getIndex()] * 7; } @Override - public int getDamageReductionAmount(EquipmentSlotType slot) { + public int getDefenseForSlot(EquipmentSlot slot) { return 1; } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return 12; } @Override - public SoundEvent getSoundEvent() { - return ArmorMaterial.LEATHER.getSoundEvent(); + public SoundEvent getEquipSound() { + return ArmorMaterials.LEATHER.getEquipSound(); } @Override - public Ingredient getRepairMaterial() { - return Ingredient.fromStacks(new ItemStack(Items.BLACK_WOOL)); + public Ingredient getRepairIngredient() { + return Ingredient.of(new ItemStack(Items.BLACK_WOOL)); } @Override @@ -80,29 +86,39 @@ public Item setLore(String tag) { @Override @OnlyIn(Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (this.loreTag != null) { - tooltip.add(new StringTextComponent("")); - tooltip.add(new StringTextComponent("" + TextFormatting.DARK_PURPLE + TextFormatting.ITALIC + I18n.format(this.loreTag))); + tooltip.add(new TextComponent("")); + tooltip.add(new TextComponent("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + I18n.get(this.loreTag))); } } public TopHatItem(Properties builderIn) { - super(Material.INSTANCE, EquipmentSlotType.HEAD, builderIn); + super(Material.INSTANCE, EquipmentSlot.HEAD, builderIn); } - TopHatModel model = null; - @OnlyIn(Dist.CLIENT) - @Override - public TopHatModel getArmorModel(LivingEntity entity, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) { - if (model == null) model = new TopHatModel(); - return model; + @Override + public void initializeClient(java.util.function.Consumer consumer) { + consumer.accept(new IItemRenderProperties() { + @Override + public TopHatModel getArmorModel(LivingEntity entity, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel _default) { + float pticks = Minecraft.getInstance().getFrameTime(); + float f = Mth.rotLerp(pticks, entity.yBodyRotO, entity.yBodyRot); + float f1 = Mth.rotLerp(pticks, entity.yHeadRotO, entity.yHeadRot); + float netHeadYaw = f1 - f; + float netHeadPitch = Mth.lerp(pticks, entity.xRotO, entity.getXRot()); + ClientRegistry.TOP_HAT_MODEL.slot = slot; + ClientRegistry.TOP_HAT_MODEL.copyFromDefault(_default); + ClientRegistry.TOP_HAT_MODEL.setupAnim(entity, entity.animationPosition, entity.animationSpeed, entity.tickCount + pticks, netHeadYaw, netHeadPitch); + return ClientRegistry.TOP_HAT_MODEL; + } + }); } @OnlyIn(Dist.CLIENT) @Override - public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { + public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return Eidolon.MODID + ":textures/entity/hat.png"; } } diff --git a/src/main/java/elucent/eidolon/item/UnholySymbolItem.java b/src/main/java/elucent/eidolon/item/UnholySymbolItem.java index fdb161c..0c70f0b 100644 --- a/src/main/java/elucent/eidolon/item/UnholySymbolItem.java +++ b/src/main/java/elucent/eidolon/item/UnholySymbolItem.java @@ -1,19 +1,19 @@ package elucent.eidolon.item; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.SwordItem; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.Eidolon; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.List; - public class UnholySymbolItem extends ItemBase { public UnholySymbolItem(Properties builderIn) { super(builderIn); diff --git a/src/main/java/elucent/eidolon/item/WandItem.java b/src/main/java/elucent/eidolon/item/WandItem.java index 0b6d35c..b4049eb 100644 --- a/src/main/java/elucent/eidolon/item/WandItem.java +++ b/src/main/java/elucent/eidolon/item/WandItem.java @@ -1,17 +1,16 @@ package elucent.eidolon.item; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.ItemStack; -public class WandItem extends ItemBase { +public class WandItem extends ItemBase implements IRechargeableWand { public WandItem(Properties properties) { super(properties); } @Override - public int getItemEnchantability() { + public int getEnchantmentValue() { return 20; } @@ -21,4 +20,10 @@ public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchant) { || enchant == Enchantments.UNBREAKING || enchant == Enchantments.MENDING; } + + @Override + public ItemStack recharge(ItemStack stack) { + stack.setDamageValue(0); + return stack; + } } diff --git a/src/main/java/elucent/eidolon/item/WarlockRobesItem.java b/src/main/java/elucent/eidolon/item/WarlockRobesItem.java index 29eb501..6d0c9b7 100644 --- a/src/main/java/elucent/eidolon/item/WarlockRobesItem.java +++ b/src/main/java/elucent/eidolon/item/WarlockRobesItem.java @@ -1,34 +1,37 @@ package elucent.eidolon.item; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.item.model.WarlockArmorModel; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.model.BipedModel; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ArmorMaterial; -import net.minecraft.item.IArmorMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.math.MathHelper; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterials; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.util.Mth; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IItemRenderProperties; +import net.minecraftforge.common.extensions.IForgeItem; -public class WarlockRobesItem extends ArmorItem { +public class WarlockRobesItem extends ArmorItem implements IForgeItem { private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; - public static class Material implements IArmorMaterial { + public static class Material implements ArmorMaterial { @Override - public int getDurability(EquipmentSlotType slot) { + public int getDurabilityForSlot(EquipmentSlot slot) { return MAX_DAMAGE_ARRAY[slot.getIndex()] * 21; } @Override - public int getDamageReductionAmount(EquipmentSlotType slot) { + public int getDefenseForSlot(EquipmentSlot slot) { switch (slot) { case CHEST: return 7; @@ -42,18 +45,18 @@ public int getDamageReductionAmount(EquipmentSlotType slot) { } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return 25; } @Override - public SoundEvent getSoundEvent() { - return ArmorMaterial.LEATHER.getSoundEvent(); + public SoundEvent getEquipSound() { + return ArmorMaterials.LEATHER.getEquipSound(); } @Override - public Ingredient getRepairMaterial() { - return Ingredient.fromStacks(new ItemStack(Registry.WICKED_WEAVE.get())); + public Ingredient getRepairIngredient() { + return Ingredient.of(new ItemStack(Registry.WICKED_WEAVE.get())); } @Override @@ -74,28 +77,32 @@ public float getKnockbackResistance() { public static final Material INSTANCE = new Material(); } - public WarlockRobesItem(EquipmentSlotType slot, Properties builderIn) { + public WarlockRobesItem(EquipmentSlot slot, Properties builderIn) { super(Material.INSTANCE, slot, builderIn); - } - - WarlockArmorModel model = null; + } @OnlyIn(Dist.CLIENT) - @Override - public WarlockArmorModel getArmorModel(LivingEntity entity, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) { - if (model == null) model = new WarlockArmorModel(slot); - float pticks = Minecraft.getInstance().getRenderPartialTicks(); - float f = MathHelper.interpolateAngle(pticks, entity.prevRenderYawOffset, entity.renderYawOffset); - float f1 = MathHelper.interpolateAngle(pticks, entity.prevRotationYawHead, entity.rotationYawHead); - float netHeadYaw = f1 - f; - float netHeadPitch = MathHelper.lerp(pticks, entity.prevRotationPitch, entity.rotationPitch); - model.setRotationAngles(entity, entity.limbSwing, entity.limbSwingAmount, entity.ticksExisted + pticks, netHeadYaw, netHeadPitch); - return model; - } + @Override + public void initializeClient(java.util.function.Consumer consumer) { + consumer.accept(new IItemRenderProperties() { + @Override + public WarlockArmorModel getArmorModel(LivingEntity entity, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel _default) { + float pticks = Minecraft.getInstance().getFrameTime(); + float f = Mth.rotLerp(pticks, entity.yBodyRotO, entity.yBodyRot); + float f1 = Mth.rotLerp(pticks, entity.yHeadRotO, entity.yHeadRot); + float netHeadYaw = f1 - f; + float netHeadPitch = Mth.lerp(pticks, entity.xRotO, entity.getXRot()); + ClientRegistry.WARLOCK_ARMOR_MODEL.slot = slot; + ClientRegistry.WARLOCK_ARMOR_MODEL.copyFromDefault(_default); + ClientRegistry.WARLOCK_ARMOR_MODEL.setupAnim(entity, entity.animationPosition, entity.animationSpeed, entity.tickCount + pticks, netHeadYaw, netHeadPitch); + return ClientRegistry.WARLOCK_ARMOR_MODEL; + } + }); + } @OnlyIn(Dist.CLIENT) @Override - public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { + public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return Eidolon.MODID + ":textures/entity/warlock_robes.png"; } } diff --git a/src/main/java/elucent/eidolon/item/curio/AngelSightItem.java b/src/main/java/elucent/eidolon/item/curio/AngelSightItem.java new file mode 100644 index 0000000..23d2b06 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/curio/AngelSightItem.java @@ -0,0 +1,111 @@ +package elucent.eidolon.item.curio; + +import java.util.Random; + +import elucent.eidolon.Registry; +import elucent.eidolon.entity.AngelArrowEntity; +import elucent.eidolon.item.ItemBase; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ArrowItem; +import net.minecraft.world.item.BowItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.stats.Stats; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import top.theillusivec4.curios.api.CuriosApi; + +public class AngelSightItem extends ItemBase { + static Random random = new Random(); + + public AngelSightItem(Properties properties) { + super(properties); + MinecraftForge.EVENT_BUS.addListener(AngelSightItem::onLoose); + } + + @SubscribeEvent + public static void onLoose(ArrowLooseEvent event) { + Player player = event.getPlayer(); + ItemStack stack = event.getBow(), ammo = player.getProjectile(stack); + Level world = event.getWorld(); + + if (!event.hasAmmo()) return; + + if (ammo.isEmpty()) { + ammo = new ItemStack(Items.ARROW); + } + + if (!CuriosApi.getCuriosHelper().findEquippedCurio(Registry.ANGELS_SIGHT.get(), event.getEntityLiving()).isPresent()) + return; + + float f = BowItem.getPowerForTime(event.getCharge()); + if (!((double)f < 0.1D)) { + boolean flag1 = player.getAbilities().instabuild || (ammo.getItem() instanceof ArrowItem && ((ArrowItem) ammo.getItem()).isInfinite(ammo, stack, player)); + if (!world.isClientSide) { + ArrowItem arrowitem = (ArrowItem) (ammo.getItem() instanceof ArrowItem ? ammo.getItem() : Items.ARROW); + AbstractArrow innerarrow = arrowitem.createArrow(world, ammo, player); + innerarrow = ((BowItem)stack.getItem()).customArrow(innerarrow); + AngelArrowEntity abstractarrowentity = new AngelArrowEntity(world, player); + abstractarrowentity.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, f * 3.0F, 1.0F); + if (f == 1.0F) { + innerarrow.setCritArrow(true); + abstractarrowentity.setCritArrow(true); + } + + int j = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.POWER_ARROWS, stack); + if (j > 0) { + innerarrow.setBaseDamage(innerarrow.getBaseDamage() + (double) j * 0.5D + 0.5D); + } + + int k = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.PUNCH_ARROWS, stack); + if (k > 0) { + innerarrow.setKnockback(k); + } + + if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.FLAMING_ARROWS, stack) > 0) { + innerarrow.setSecondsOnFire(100); + } + abstractarrowentity.setArrow(innerarrow); + + stack.hurtAndBreak(1, player, (p) -> { + p.broadcastBreakEvent(player.getUsedItemHand()); + }); + if (flag1 || player.getAbilities().instabuild && (stack.getItem() == Items.SPECTRAL_ARROW || stack.getItem() == Items.TIPPED_ARROW)) { + abstractarrowentity.pickup = AbstractArrow.Pickup.CREATIVE_ONLY; + } + + world.addFreshEntity(abstractarrowentity); + } + + world.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.ARROW_SHOOT, SoundSource.PLAYERS, 1.0F, 1.0F / (random.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + if (!flag1 && !player.getAbilities().instabuild) { + ammo.shrink(1); + if (ammo.isEmpty()) { + player.getInventory().removeItem(ammo); + } + } + + player.awardStat(Stats.ITEM_USED.get(stack.getItem())); + } + event.setCanceled(true); + } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { + return new EidolonCurio(stack) { + @Override + public boolean canRightClickEquip() { + return true; + } + }; + } +} diff --git a/src/main/java/elucent/eidolon/item/curio/BasicAmuletItem.java b/src/main/java/elucent/eidolon/item/curio/BasicAmuletItem.java index 8c92737..36d3656 100644 --- a/src/main/java/elucent/eidolon/item/curio/BasicAmuletItem.java +++ b/src/main/java/elucent/eidolon/item/curio/BasicAmuletItem.java @@ -1,30 +1,18 @@ package elucent.eidolon.item.curio; +import java.util.UUID; + import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; + import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.*; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraftforge.common.MinecraftForge; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.items.IItemHandlerModifiable; -import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.type.capability.ICurio; - -import java.util.UUID; public class BasicAmuletItem extends Item { UUID ATTR_ID = new UUID(1821688469367197801l, 2986247575840977557l); @@ -33,7 +21,7 @@ public BasicAmuletItem(Properties properties) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public Multimap getAttributeModifiers(String identifier) { diff --git a/src/main/java/elucent/eidolon/item/curio/BasicBeltItem.java b/src/main/java/elucent/eidolon/item/curio/BasicBeltItem.java index 9b7d9d2..b2f4089 100644 --- a/src/main/java/elucent/eidolon/item/curio/BasicBeltItem.java +++ b/src/main/java/elucent/eidolon/item/curio/BasicBeltItem.java @@ -1,19 +1,19 @@ package elucent.eidolon.item.curio; +import java.util.UUID; + import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; + import elucent.eidolon.Eidolon; import elucent.eidolon.item.ItemBase; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import java.util.UUID; - public class BasicBeltItem extends ItemBase { UUID ATTR_ID = new UUID(5892388994722937059l, 8235504439637777033l); public BasicBeltItem(Properties properties) { @@ -21,7 +21,7 @@ public BasicBeltItem(Properties properties) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public Multimap getAttributeModifiers(String identifier) { diff --git a/src/main/java/elucent/eidolon/item/curio/BasicRingItem.java b/src/main/java/elucent/eidolon/item/curio/BasicRingItem.java index c60ed88..b488c4d 100644 --- a/src/main/java/elucent/eidolon/item/curio/BasicRingItem.java +++ b/src/main/java/elucent/eidolon/item/curio/BasicRingItem.java @@ -1,18 +1,18 @@ package elucent.eidolon.item.curio; +import java.util.UUID; + import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; + import elucent.eidolon.Eidolon; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import top.theillusivec4.curios.api.type.capability.ICurio; - -import java.util.UUID; public class BasicRingItem extends Item { UUID ATTR_ID = new UUID(7207179027447911419l, 1628308750126455317l); @@ -21,7 +21,7 @@ public BasicRingItem(Properties properties) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public Multimap getAttributeModifiers(String identifier) { diff --git a/src/main/java/elucent/eidolon/item/curio/EidolonCurio.java b/src/main/java/elucent/eidolon/item/curio/EidolonCurio.java index 89568e8..1fa33f6 100644 --- a/src/main/java/elucent/eidolon/item/curio/EidolonCurio.java +++ b/src/main/java/elucent/eidolon/item/curio/EidolonCurio.java @@ -1,15 +1,13 @@ package elucent.eidolon.item.curio; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; import top.theillusivec4.curios.api.CuriosCapability; import top.theillusivec4.curios.api.type.capability.ICurio; -import javax.annotation.Nonnull; - public class EidolonCurio implements ICurio, ICapabilityProvider { private final ItemStack stack; @@ -26,4 +24,9 @@ public LazyOptional getCapability(Capability cap) { public LazyOptional getCapability(Capability cap, Direction side) { return getCapability(cap); } + + @Override + public ItemStack getStack() { + return stack; + } } diff --git a/src/main/java/elucent/eidolon/item/curio/EnervatingRingItem.java b/src/main/java/elucent/eidolon/item/curio/EnervatingRingItem.java new file mode 100644 index 0000000..0144a16 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/curio/EnervatingRingItem.java @@ -0,0 +1,22 @@ +package elucent.eidolon.item.curio; + +import elucent.eidolon.item.ItemBase; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +public class EnervatingRingItem extends ItemBase { + public EnervatingRingItem(Properties properties) { + super(properties); + } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { + return new EidolonCurio(stack) { + @Override + public boolean canRightClickEquip() { + return true; + } + }; + } +} diff --git a/src/main/java/elucent/eidolon/item/curio/GlassHandItem.java b/src/main/java/elucent/eidolon/item/curio/GlassHandItem.java index 39c749d..ff4fe5a 100644 --- a/src/main/java/elucent/eidolon/item/curio/GlassHandItem.java +++ b/src/main/java/elucent/eidolon/item/curio/GlassHandItem.java @@ -2,22 +2,15 @@ import elucent.eidolon.Registry; import elucent.eidolon.item.ItemBase; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.potion.Effects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; -import net.minecraftforge.event.entity.living.PotionEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; -import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import top.theillusivec4.curios.api.CuriosApi; -import java.util.UUID; - public class GlassHandItem extends ItemBase { public GlassHandItem(Properties properties) { super(properties); @@ -29,14 +22,14 @@ public static void onHurt(LivingHurtEvent event) { if (CuriosApi.getCuriosHelper().findEquippedCurio(Registry.GLASS_HAND.get(), event.getEntityLiving()).isPresent()) { event.setAmount(event.getAmount() * 5); } - if (event.getSource().getTrueSource() instanceof LivingEntity && - CuriosApi.getCuriosHelper().findEquippedCurio(Registry.GLASS_HAND.get(), (LivingEntity)event.getSource().getTrueSource()).isPresent()) { + if (event.getSource().getEntity() instanceof LivingEntity && + CuriosApi.getCuriosHelper().findEquippedCurio(Registry.GLASS_HAND.get(), (LivingEntity)event.getSource().getEntity()).isPresent()) { event.setAmount(event.getAmount() * 2); } } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public boolean canRightClickEquip() { diff --git a/src/main/java/elucent/eidolon/item/curio/GravityBeltItem.java b/src/main/java/elucent/eidolon/item/curio/GravityBeltItem.java index e50c077..2f8e63e 100644 --- a/src/main/java/elucent/eidolon/item/curio/GravityBeltItem.java +++ b/src/main/java/elucent/eidolon/item/curio/GravityBeltItem.java @@ -1,27 +1,24 @@ package elucent.eidolon.item.curio; +import java.util.UUID; + import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.item.ItemBase; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.DamageSource; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import top.theillusivec4.curios.api.CuriosApi; -import java.util.UUID; - public class GravityBeltItem extends ItemBase { UUID ATTR_ID = new UUID(6937061617091731127l, 7120126291930051139l); public GravityBeltItem(Properties properties) { @@ -37,7 +34,7 @@ public static void onFall(LivingFallEvent event) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public Multimap getAttributeModifiers(String identifier) { diff --git a/src/main/java/elucent/eidolon/item/curio/MindShieldingPlateItem.java b/src/main/java/elucent/eidolon/item/curio/MindShieldingPlateItem.java index ab3952e..b306b9d 100644 --- a/src/main/java/elucent/eidolon/item/curio/MindShieldingPlateItem.java +++ b/src/main/java/elucent/eidolon/item/curio/MindShieldingPlateItem.java @@ -1,19 +1,14 @@ package elucent.eidolon.item.curio; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import elucent.eidolon.Registry; import elucent.eidolon.item.ItemBase; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.potion.Effects; -import net.minecraftforge.common.ForgeMod; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.effect.MobEffects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; -import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.PotionEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.Event; @@ -25,25 +20,36 @@ public MindShieldingPlateItem(Properties properties) { super(properties); MinecraftForge.EVENT_BUS.addListener(MindShieldingPlateItem::onPotion); MinecraftForge.EVENT_BUS.addListener(MindShieldingPlateItem::onClone); + MinecraftForge.EVENT_BUS.addListener(MindShieldingPlateItem::onDropXP); } @SubscribeEvent public static void onPotion(PotionEvent.PotionApplicableEvent event) { - if (event.getPotionEffect().getPotion() == Effects.NAUSEA && CuriosApi.getCuriosHelper().findEquippedCurio(Registry.MIND_SHIELDING_PLATE.get(), event.getEntityLiving()).isPresent()) { + if (event.getPotionEffect().getEffect() == MobEffects.CONFUSION && CuriosApi.getCuriosHelper().findEquippedCurio(Registry.MIND_SHIELDING_PLATE.get(), event.getEntityLiving()).isPresent()) { event.setResult(Event.Result.DENY); } } + static final int LEVEL_FLAG = 1 << 30; + @SubscribeEvent public static void onClone(PlayerEvent.Clone event) { - if (event.getOriginal().experienceLevel > 0 && CuriosApi.getCuriosHelper().findEquippedCurio(Registry.MIND_SHIELDING_PLATE.get(), event.getEntityLiving()).isPresent()) { - event.getPlayer().experienceLevel = event.getOriginal().experienceLevel * 3 / 4; - event.getPlayer().experience = event.getOriginal().experience * 3 / 4; + if ((event.getOriginal().experienceLevel & LEVEL_FLAG) != 0) { + event.getPlayer().experienceLevel = event.getOriginal().experienceLevel & ~LEVEL_FLAG; + event.getPlayer().experienceProgress = event.getOriginal().experienceProgress; + } + } + + @SubscribeEvent + public static void onDropXP(LivingExperienceDropEvent event) { + if (event.getEntity() instanceof Player && CuriosApi.getCuriosHelper().findEquippedCurio(Registry.MIND_SHIELDING_PLATE.get(), event.getEntityLiving()).isPresent()) { + ((Player)event.getEntity()).experienceLevel |= LEVEL_FLAG; + event.setCanceled(true); } } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public boolean canRightClickEquip() { diff --git a/src/main/java/elucent/eidolon/item/curio/PrestigiousPalmItem.java b/src/main/java/elucent/eidolon/item/curio/PrestigiousPalmItem.java index 9d676bd..3b2f6b0 100644 --- a/src/main/java/elucent/eidolon/item/curio/PrestigiousPalmItem.java +++ b/src/main/java/elucent/eidolon/item/curio/PrestigiousPalmItem.java @@ -1,20 +1,19 @@ package elucent.eidolon.item.curio; +import java.util.UUID; + import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; + import elucent.eidolon.Eidolon; import elucent.eidolon.item.ItemBase; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import java.util.UUID; - public class PrestigiousPalmItem extends ItemBase { UUID ATTR_ID = new UUID(297661999713141389l, 6434109711109552363l); public PrestigiousPalmItem(Properties properties) { @@ -22,7 +21,7 @@ public PrestigiousPalmItem(Properties properties) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public Multimap getAttributeModifiers(String identifier) { diff --git a/src/main/java/elucent/eidolon/item/curio/RavenCloakItem.java b/src/main/java/elucent/eidolon/item/curio/RavenCloakItem.java new file mode 100644 index 0000000..05768b6 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/curio/RavenCloakItem.java @@ -0,0 +1,89 @@ +package elucent.eidolon.item.curio; + +import java.util.UUID; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.item.IWingsItem; +import elucent.eidolon.item.ItemBase; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraft.nbt.CompoundTag; +import net.minecraftforge.common.ForgeMod; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.event.entity.living.LivingFallEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import top.theillusivec4.curios.api.CuriosApi; + +public class RavenCloakItem extends ItemBase implements IWingsItem { + UUID ATTR_ID = new UUID(261693807752044433L, 1154961640602571210L); + public RavenCloakItem(Properties properties) { + super(properties); + MinecraftForge.EVENT_BUS.addListener(RavenCloakItem::onFall); + } + + @SubscribeEvent + public static void onFall(LivingFallEvent event) { + if (CuriosApi.getCuriosHelper().findEquippedCurio(Registry.GRAVITY_BELT.get(), event.getEntityLiving()).isPresent()) { + event.setDistance(event.getDistance() / 4); + } + } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { + return new EidolonCurio(stack) { + @Override + public boolean canRightClickEquip() { + return true; + } + }; + } + + public static final int MAX_CHARGES = 12; + + @Override + public int getMaxCharges(ItemStack stack) { + return MAX_CHARGES; + } + + @Override + public void onFlap(Player player, Level level, ItemStack stack, int nCharges) { + player.setDeltaMovement(player.getDeltaMovement().add(player.getLookAngle().scale(0.25)).multiply(1, 0, 1).add(0, 0.5, 0)); + } + + @Override + public int getDashTicks(ItemStack stack) { + return 100; + } + + @Override + public void onDashStart(Player player, Level level, ItemStack stack) { + // + } + + @Override + public void onDashTick(Player player, Level level, ItemStack stack, int remainingTicks) { + float coeff = remainingTicks / (float)getDashTicks(stack); + coeff = 1 - (1 - coeff) * (1 - coeff) + 0.25f; + player.setDeltaMovement(player.getDeltaMovement().scale(0.8).add(player.getLookAngle().scale(coeff * 0.2))); + } + + @Override + public void onDashEnd(Player player, Level level, ItemStack stack) { + // + } + + @Override + public void onDashFlap(Player player, Level level, ItemStack stack, int dashTicks) { + player.getCapability(IPlayerData.INSTANCE).ifPresent(d -> d.setDashTicks(getDashTicks(stack))); + } +} diff --git a/src/main/java/elucent/eidolon/item/curio/RavenCloakRenderer.java b/src/main/java/elucent/eidolon/item/curio/RavenCloakRenderer.java new file mode 100644 index 0000000..fd5a9d7 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/curio/RavenCloakRenderer.java @@ -0,0 +1,40 @@ +package elucent.eidolon.item.curio; + +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Eidolon; +import elucent.eidolon.item.model.RavenCloakModel; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import top.theillusivec4.curios.api.SlotContext; +import top.theillusivec4.curios.api.client.ICurioRenderer; + +public class RavenCloakRenderer implements ICurioRenderer { + public static final ResourceLocation TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/entity/raven_cloak.png"); + + RavenCloakModel model = null; + + @Override + public > void render(ItemStack stack, SlotContext slotContext, + PoseStack matrixStack, RenderLayerParent renderLayerParent, MultiBufferSource renderTypeBuffer, + int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, + float headPitch) { + if (model == null) { + model = new RavenCloakModel(Minecraft.getInstance().getEntityModels().bakeLayer(ClientRegistry.RAVEN_CLOAK_LAYER)); + } + LivingEntity entity = slotContext.entity(); + ICurioRenderer.followBodyRotations(entity, model); + ICurioRenderer.followHeadRotations(entity, model.getHead()); + model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + model.renderToBuffer(matrixStack, renderTypeBuffer.getBuffer(RenderType.entityCutoutNoCull(TEXTURE)), light, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1); + } +} diff --git a/src/main/java/elucent/eidolon/item/curio/ResoluteBeltItem.java b/src/main/java/elucent/eidolon/item/curio/ResoluteBeltItem.java index 68cc31d..470d246 100644 --- a/src/main/java/elucent/eidolon/item/curio/ResoluteBeltItem.java +++ b/src/main/java/elucent/eidolon/item/curio/ResoluteBeltItem.java @@ -1,32 +1,29 @@ package elucent.eidolon.item.curio; +import java.util.Random; +import java.util.UUID; + import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.item.ItemBase; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.Attribute; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraftforge.common.ForgeMod; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import top.theillusivec4.curios.api.CuriosApi; -import java.util.Random; -import java.util.UUID; - public class ResoluteBeltItem extends ItemBase { UUID ATTR_ID = new UUID(3701779382882225399l, 5035874982077300549l); @@ -39,16 +36,16 @@ public ResoluteBeltItem(Properties properties) { @SubscribeEvent public static void onHurt(LivingHurtEvent event) { - if (event.getSource().getTrueSource() instanceof LivingEntity && CuriosApi.getCuriosHelper().findEquippedCurio(Registry.RESOLUTE_BELT.get(), event.getEntityLiving()).isPresent()) { - LivingEntity entity = (LivingEntity)event.getSource().getTrueSource(); - Vector3d diff = event.getEntityLiving().getPositionVec().subtract(entity.getPositionVec()).mul(1, 0, 1).normalize(); - entity.applyKnockback(0.8f, diff.x, diff.z); - if (!entity.world.isRemote) entity.world.playSound(null, entity.getPosition(), SoundEvents.ENTITY_IRON_GOLEM_HURT, SoundCategory.PLAYERS, 1.0f, 1.9f + 0.2f * random.nextFloat()); + if (event.getSource().getEntity() instanceof LivingEntity && CuriosApi.getCuriosHelper().findEquippedCurio(Registry.RESOLUTE_BELT.get(), event.getEntityLiving()).isPresent()) { + LivingEntity entity = (LivingEntity)event.getSource().getEntity(); + Vec3 diff = event.getEntityLiving().position().subtract(entity.position()).multiply(1, 0, 1).normalize(); + entity.knockback(0.8f, diff.x, diff.z); + if (!entity.level.isClientSide) entity.level.playSound(null, entity.blockPosition(), SoundEvents.IRON_GOLEM_HURT, SoundSource.PLAYERS, 1.0f, 1.9f + 0.2f * random.nextFloat()); } } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public Multimap getAttributeModifiers(String identifier) { diff --git a/src/main/java/elucent/eidolon/item/curio/SanguineAmuletItem.java b/src/main/java/elucent/eidolon/item/curio/SanguineAmuletItem.java index 834850d..f46f324 100644 --- a/src/main/java/elucent/eidolon/item/curio/SanguineAmuletItem.java +++ b/src/main/java/elucent/eidolon/item/curio/SanguineAmuletItem.java @@ -1,38 +1,39 @@ package elucent.eidolon.item.curio; +import javax.annotation.Nonnull; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.datafixers.util.Either; import elucent.eidolon.Registry; import elucent.eidolon.item.ItemBase; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.EnderPearlEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.StringTextComponent; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.ThrownEnderpearl; +import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; -import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.CuriosCapability; -import top.theillusivec4.curios.api.type.capability.ICurio; - -import javax.annotation.Nonnull; public class SanguineAmuletItem extends ItemBase { public SanguineAmuletItem(Properties properties) { super(properties); DistExecutor.unsafeCallWhenOn(Dist.CLIENT, () -> () -> { - MinecraftForge.EVENT_BUS.addListener(SanguineAmuletItem::addTooltip); + MinecraftForgeClient.registerTooltipComponentFactory(SanguineAmuletTooltipInfo.class, SanguineAmuletTooltipComponent::new); MinecraftForge.EVENT_BUS.addListener(SanguineAmuletItem::renderTooltip); return null; }); @@ -46,33 +47,33 @@ static int getCharge(ItemStack stack) { } static void addCharge(ItemStack stack, int diff) { - int newCharge = MathHelper.clamp(getCharge(stack) + diff, 0, 40); + int newCharge = Mth.clamp(getCharge(stack) + diff, 0, 40); stack.getOrCreateTag().putInt("charge", newCharge); } static void setCharge(ItemStack stack, int charge) { - int newCharge = MathHelper.clamp(charge, 0, 40); + int newCharge = Mth.clamp(charge, 0, 40); stack.getOrCreateTag().putInt("charge", newCharge); } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public void curioTick(String type, int index, LivingEntity entity) { - if (!entity.world.isRemote) { - if (entity.ticksExisted % 80 == 0 && - entity.getHealth() == entity.getMaxHealth() && - entity instanceof PlayerEntity && ((PlayerEntity) entity).getFoodStats().getFoodLevel() >= 18 && + if (!entity.level.isClientSide) { + if (entity.tickCount % 80 == 0 && + entity.getHealth() >= entity.getMaxHealth() - 0.0001 && + entity instanceof Player && ((Player) entity).getFoodData().getFoodLevel() >= 18 && getCharge(stack) < 40) { - PlayerEntity player = (PlayerEntity) entity; - float f = player.getFoodStats().getSaturationLevel() > 0 ? - Math.min(4 * player.getFoodStats().getSaturationLevel(), 16.0F) : 4.0f; - player.addExhaustion(f); + Player player = (Player) entity; + float f = player.getFoodData().getSaturationLevel() > 0 ? + Math.min(4 * player.getFoodData().getSaturationLevel(), 16.0F) : 4.0f; + player.causeFoodExhaustion(f); addCharge(stack, 1); - EnderPearlEntity e; + ThrownEnderpearl e; } - if (entity.ticksExisted % 10 == 0 && + if (entity.tickCount % 10 == 0 && getCharge(stack) > 0 && entity.getHealth() < entity.getMaxHealth()) { int taken = (int) Math.min(1, entity.getMaxHealth() - entity.getHealth()); addCharge(stack, -taken); @@ -87,13 +88,13 @@ public boolean canSync(String identifier, int index, LivingEntity livingEntity) } @Nonnull - public CompoundNBT writeSyncData() { - CompoundNBT nbt = new CompoundNBT(); + public CompoundTag writeSyncData() { + CompoundTag nbt = new CompoundTag(); nbt.putInt("charge", getCharge(stack)); return nbt; } - public void readSyncData(CompoundNBT compound) { + public void readSyncData(CompoundTag compound) { setCharge(stack, compound.getInt("charge")); } @@ -103,36 +104,60 @@ public boolean canRightClickEquip() { } }; } - - @OnlyIn(Dist.CLIENT) - @SubscribeEvent(priority = EventPriority.LOWEST) - public static void addTooltip(ItemTooltipEvent event) { - if (event.getItemStack().getItem() == Registry.SANGUINE_AMULET.get()) { - int charge = getCharge(event.getItemStack()); - if (charge > 0) event.getToolTip().add(new StringTextComponent(" ")); - for (int i = 0; i < charge; i += 20) { - event.getToolTip().add(new StringTextComponent(" ")); - } - } + + public static class SanguineAmuletTooltipInfo implements TooltipComponent { + ItemStack stack; + int maxWidth; + + public SanguineAmuletTooltipInfo(ItemStack stack, int maxWidth) { + this.stack = stack; + this.maxWidth = maxWidth; + } } + + public static class SanguineAmuletTooltipComponent implements ClientTooltipComponent { + ItemStack stack; + int maxWidth; + public SanguineAmuletTooltipComponent(SanguineAmuletTooltipInfo info) { + this.stack = info.stack; + this.maxWidth = info.maxWidth; + } + + @Override + public int getHeight() { + int charge = getCharge(stack); + int rows = (charge + 19) / 20; + return 8 + 12 * rows; + } - @OnlyIn(Dist.CLIENT) - @SubscribeEvent - public static void renderTooltip(RenderTooltipEvent.PostText event) { - ItemStack stack = event.getStack(); - if (stack.getItem() == Registry.SANGUINE_AMULET.get()) { + @Override + public int getWidth(Font font) { + return maxWidth; + } + + @Override + public void renderImage(Font font, int x, int y, PoseStack poseStack, ItemRenderer itemRender, int p_194053_) { Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(new ResourceLocation("minecraft", "textures/gui/icons.png")); - int charge = getCharge(event.getStack()); + RenderSystem.setShaderTexture(0, new ResourceLocation("minecraft", "textures/gui/icons.png")); + int charge = getCharge(stack); int rows = (charge + 19) / 20; for (int i = 0; i < charge; i += 20) { - for (int j = 0; j < MathHelper.clamp(charge - i, 0, 20); j += 2) { + for (int j = 0; j < Mth.clamp(charge - i, 0, 20); j += 2) { if (charge - (i + j) == 1) { - AbstractGui.blit(event.getMatrixStack(), event.getX() - 1 + j / 2 * 8, event.getY() + (event.getLines().size() - rows) * (event.getFontRenderer().FONT_HEIGHT + 1) + (i / 20) * 9 + 2, 61, 0, 9, 9, 256, 256); + GuiComponent.blit(poseStack, x - 1 + j / 2 * 8, y + (i / 20) * 9 + 2, 61, 0, 9, 9, 256, 256); } else - AbstractGui.blit(event.getMatrixStack(), event.getX() - 1 + j / 2 * 8, event.getY() + (event.getLines().size() - rows) * (event.getFontRenderer().FONT_HEIGHT + 1) + (i / 20) * 9 + 2, 52, 0, 9, 9, 256, 256); + GuiComponent.blit(poseStack, x - 1 + j / 2 * 8, y + (i / 20) * 9 + 2, 52, 0, 9, 9, 256, 256); } } + } + } + + @OnlyIn(Dist.CLIENT) + @SubscribeEvent + public static void renderTooltip(RenderTooltipEvent.GatherComponents event) { + ItemStack stack = event.getItemStack(); + if (stack.getItem() == Registry.SANGUINE_AMULET.get()) { + event.getTooltipElements().add(Either.right(new SanguineAmuletTooltipInfo(stack, event.getMaxWidth()))); } } } diff --git a/src/main/java/elucent/eidolon/item/curio/SoulboneAmuletItem.java b/src/main/java/elucent/eidolon/item/curio/SoulboneAmuletItem.java new file mode 100644 index 0000000..8c94314 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/curio/SoulboneAmuletItem.java @@ -0,0 +1,55 @@ +package elucent.eidolon.item.curio; + +import elucent.eidolon.Registry; +import elucent.eidolon.capability.ISoul; +import elucent.eidolon.entity.SpellProjectileEntity; +import elucent.eidolon.item.ItemBase; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.SoulUpdatePacket; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.LargeFireball; +import net.minecraft.world.entity.projectile.LlamaSpit; +import net.minecraft.world.entity.projectile.ThrownPotion; +import net.minecraft.world.entity.projectile.ShulkerBullet; +import net.minecraft.world.entity.projectile.SmallFireball; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import top.theillusivec4.curios.api.CuriosApi; + +public class SoulboneAmuletItem extends ItemBase { + public SoulboneAmuletItem(Properties properties) { + super(properties); + MinecraftForge.EVENT_BUS.addListener(SoulboneAmuletItem::onKill); + } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { + return new EidolonCurio(stack) { + @Override + public boolean canRightClickEquip() { + return true; + } + }; + } + + @SubscribeEvent + public static void onKill(LivingDeathEvent event) { + if (event.getSource().getEntity() instanceof LivingEntity e) { + if (CuriosApi.getCuriosHelper().findEquippedCurio(Registry.SOULBONE_AMULET.get(), e).isPresent()) { + e.getCapability(ISoul.INSTANCE).ifPresent((cap) -> { + cap.setMaxEtherealHealth(Math.max(Math.min(ISoul.getPersistentHealth(e), cap.getMaxEtherealHealth()), 2 * (int)Math.floor((cap.getEtherealHealth() + 3) / 2))); + cap.setEtherealHealth(cap.getEtherealHealth() + 2); + if (!e.level.isClientSide) Networking.sendToTracking(e.level, e.getOnPos(), new SoulUpdatePacket(e)); + }); + } + } + } +} diff --git a/src/main/java/elucent/eidolon/item/curio/TerminusMirrorItem.java b/src/main/java/elucent/eidolon/item/curio/TerminusMirrorItem.java new file mode 100644 index 0000000..0ba8774 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/curio/TerminusMirrorItem.java @@ -0,0 +1,57 @@ +package elucent.eidolon.item.curio; + +import elucent.eidolon.Registry; +import elucent.eidolon.entity.SpellProjectileEntity; +import elucent.eidolon.item.ItemBase; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import top.theillusivec4.curios.api.CuriosApi; + +public class TerminusMirrorItem extends ItemBase { + public TerminusMirrorItem(Properties properties) { + super(properties); + MinecraftForge.EVENT_BUS.addListener(TerminusMirrorItem::onDamage); + } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { + return new EidolonCurio(stack) { + @Override + public boolean canRightClickEquip() { + return true; + } + }; + } + + @SubscribeEvent + public static void onDamage(LivingAttackEvent event) { + if (event.getEntityLiving() instanceof Player) { + CuriosApi.getCuriosHelper().getEquippedCurios(event.getEntityLiving()).resolve().ifPresent((slots) -> { + boolean hasVoid = false; + int i; + for (i = 0; i < slots.getSlots(); i ++) { + if (slots.getStackInSlot(i).getItem() == Registry.TERMINUS_MIRROR.get()) { + hasVoid = true; + break; + } + } + ItemStack stack = slots.getStackInSlot(i); + if (hasVoid && + (event.getSource().getDirectEntity() instanceof Projectile + || event.getSource().getDirectEntity() instanceof SpellProjectileEntity)) { + event.setCanceled(true); + if (!event.getEntity().getCommandSenderWorld().isClientSide) + event.getEntity().getCommandSenderWorld().playSound(null, event.getEntity().blockPosition(), SoundEvents.WITHER_HURT, SoundSource.PLAYERS, 1.0f, 0.75f); + } + }); + } + } +} diff --git a/src/main/java/elucent/eidolon/item/curio/VoidAmuletItem.java b/src/main/java/elucent/eidolon/item/curio/VoidAmuletItem.java index 6faa254..393d165 100644 --- a/src/main/java/elucent/eidolon/item/curio/VoidAmuletItem.java +++ b/src/main/java/elucent/eidolon/item/curio/VoidAmuletItem.java @@ -3,37 +3,22 @@ import elucent.eidolon.Registry; import elucent.eidolon.entity.SpellProjectileEntity; import elucent.eidolon.item.ItemBase; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.EnderPearlEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.*; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.StringTextComponent; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RenderTooltipEvent; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.LargeFireball; +import net.minecraft.world.entity.projectile.LlamaSpit; +import net.minecraft.world.entity.projectile.ThrownPotion; +import net.minecraft.world.entity.projectile.ShulkerBullet; +import net.minecraft.world.entity.projectile.SmallFireball; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.event.entity.living.LivingHurtEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.IItemHandlerModifiable; import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.type.capability.ICurio; -import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; - -import javax.annotation.Nonnull; public class VoidAmuletItem extends ItemBase { public VoidAmuletItem(Properties properties) { @@ -53,11 +38,11 @@ static void setCooldown(ItemStack stack, int cooldown) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public void curioTick(String type, int index, LivingEntity entity) { - if (!entity.world.isRemote) { + if (!entity.level.isClientSide) { if (getCooldown(stack) > 0) setCooldown(stack, getCooldown(stack) - 1); } } @@ -71,7 +56,7 @@ public boolean canRightClickEquip() { @SubscribeEvent public static void onDamage(LivingAttackEvent event) { - if (event.getEntityLiving() instanceof PlayerEntity) { + if (event.getEntityLiving() instanceof Player) { CuriosApi.getCuriosHelper().getEquippedCurios(event.getEntityLiving()).resolve().ifPresent((slots) -> { boolean hasVoid = false; int i; @@ -85,15 +70,15 @@ public static void onDamage(LivingAttackEvent event) { } ItemStack stack = slots.getStackInSlot(i); if (hasVoid && - (event.getSource().getImmediateSource() instanceof FireballEntity - || event.getSource().getImmediateSource() instanceof LlamaSpitEntity - || event.getSource().getImmediateSource() instanceof SmallFireballEntity - || event.getSource().getImmediateSource() instanceof ShulkerBulletEntity - || event.getSource().getImmediateSource() instanceof PotionEntity - || event.getSource().getImmediateSource() instanceof SpellProjectileEntity)) { + (event.getSource().getDirectEntity() instanceof LargeFireball + || event.getSource().getDirectEntity() instanceof LlamaSpit + || event.getSource().getDirectEntity() instanceof SmallFireball + || event.getSource().getDirectEntity() instanceof ShulkerBullet + || event.getSource().getDirectEntity() instanceof ThrownPotion + || event.getSource().getDirectEntity() instanceof SpellProjectileEntity)) { event.setCanceled(true); - if (!event.getEntity().getEntityWorld().isRemote) { - event.getEntity().getEntityWorld().playSound(null, event.getEntity().getPosition(), SoundEvents.ENTITY_WITHER_HURT, SoundCategory.PLAYERS, 1.0f, 0.75f); + if (!event.getEntity().getCommandSenderWorld().isClientSide) { + event.getEntity().getCommandSenderWorld().playSound(null, event.getEntity().blockPosition(), SoundEvents.WITHER_HURT, SoundSource.PLAYERS, 1.0f, 0.75f); setCooldown(stack, 200); } } diff --git a/src/main/java/elucent/eidolon/item/curio/WardedMailItem.java b/src/main/java/elucent/eidolon/item/curio/WardedMailItem.java index 68d491f..0ce1237 100644 --- a/src/main/java/elucent/eidolon/item/curio/WardedMailItem.java +++ b/src/main/java/elucent/eidolon/item/curio/WardedMailItem.java @@ -2,23 +2,14 @@ import elucent.eidolon.Registry; import elucent.eidolon.item.ItemBase; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.*; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.DamageSource; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.api.distmarker.Dist; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.damagesource.DamageSource; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.items.IItemHandlerModifiable; import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.type.capability.ICurio; public class WardedMailItem extends ItemBase { public WardedMailItem(Properties properties) { @@ -27,7 +18,7 @@ public WardedMailItem(Properties properties) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT unused) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag unused) { return new EidolonCurio(stack) { @Override public boolean canRightClickEquip() { @@ -38,13 +29,13 @@ public boolean canRightClickEquip() { @SubscribeEvent public static void onDamage(LivingAttackEvent event) { - if (event.getSource().isMagicDamage()) { + if (event.getSource().isMagic()) { CuriosApi.getCuriosHelper().getEquippedCurios(event.getEntityLiving()).resolve().ifPresent((slots) -> { boolean hasMail = false; for (int i = 0; i < slots.getSlots(); i ++) { if (slots.getStackInSlot(i).getItem() == Registry.WARDED_MAIL.get()) { event.setCanceled(true); - event.getEntityLiving().attackEntityFrom(new DamageSource(event.getSource().getDamageType()), event.getAmount()); + event.getEntityLiving().hurt(new DamageSource(event.getSource().getMsgId()), event.getAmount()); return; } } diff --git a/src/main/java/elucent/eidolon/item/model/ArmorModel.java b/src/main/java/elucent/eidolon/item/model/ArmorModel.java index 5472d4b..78fa189 100644 --- a/src/main/java/elucent/eidolon/item/model/ArmorModel.java +++ b/src/main/java/elucent/eidolon/item/model/ArmorModel.java @@ -1,66 +1,89 @@ -package elucent.eidolon.item.model;// Made with Blockbench 3.7.4 -// Exported for Minecraft version 1.15 -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.renderer.entity.model.BipedModel; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.entity.LivingEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.util.math.MathHelper; - -public abstract class ArmorModel extends BipedModel { - EquipmentSlotType slot; - - public ModelRenderer copyWithoutBoxes(ModelRenderer box) { - ModelRenderer newbox = new ModelRenderer(this); - newbox.setRotationPoint(box.rotationPointX, box.rotationPointY, box.rotationPointZ); - setRotationAngle(newbox, box.rotateAngleX, box.rotateAngleY, box.rotateAngleZ); - newbox.mirror = box.mirror; - newbox.showModel = box.showModel; - return newbox; - } - - public ArmorModel(EquipmentSlotType slot, int texWidth, int texHeight) { - super(0, 0, texWidth, texHeight); - this.slot = slot; - - bipedHead = copyWithoutBoxes(bipedHead); - bipedBody = copyWithoutBoxes(bipedBody); - bipedLeftArm = copyWithoutBoxes(bipedLeftArm); - bipedLeftLeg = copyWithoutBoxes(bipedLeftLeg); - bipedRightArm = copyWithoutBoxes(bipedRightArm); - bipedRightLeg = copyWithoutBoxes(bipedRightLeg); - } - - @Override - public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ - bipedHeadwear.showModel = false; - bipedBody.showModel = bipedLeftArm.showModel = bipedRightArm.showModel = - bipedHead.showModel = bipedLeftLeg.showModel = bipedRightLeg.showModel = false; - - if (slot == EquipmentSlotType.CHEST) { - bipedBody.showModel = true; - bipedLeftArm.showModel = true; - bipedRightArm.showModel = true; - } - - if (slot == EquipmentSlotType.HEAD) { - bipedHead.showModel = true; - } - - if (slot == EquipmentSlotType.FEET) { - bipedLeftLeg.showModel = true; - bipedRightLeg.showModel = true; - } - super.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); - } - - public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +package elucent.eidolon.item.model;// Made with Blockbench 3.7.4 +// Exported for Minecraft version 1.15 +// Paste this class into your mod and generate all required imports + + +import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.EquipmentSlot; + +public abstract class ArmorModel extends HumanoidModel { + public EquipmentSlot slot; + ModelPart root, head, body, leftArm, rightArm, pelvis, leftLegging, rightLegging, leftFoot, rightFoot; + + public ArmorModel(ModelPart root) { + super(root); + this.root = root; + this.head = root.getChild("head"); + this.body = root.getChild("body"); + this.pelvis = root.getChild("pelvis"); + this.leftArm = root.getChild("left_arm"); + this.rightArm = root.getChild("right_arm"); + this.leftLegging = root.getChild("left_legging"); + this.rightLegging = root.getChild("right_legging"); + this.leftFoot = root.getChild("left_foot"); + this.rightFoot = root.getChild("right_foot"); + } + + public static PartDefinition createHumanoidAlias(MeshDefinition mesh) { + PartDefinition root = mesh.getRoot(); + root.addOrReplaceChild("body", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("pelvis", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("head", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("left_legging", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("left_foot", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("right_legging", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("right_foot", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("left_arm", new CubeListBuilder(), PartPose.ZERO); + root.addOrReplaceChild("right_arm", new CubeListBuilder(), PartPose.ZERO); + + return root; + } + + @Override + protected Iterable headParts() { + return slot == EquipmentSlot.HEAD ? ImmutableList.of(head) : ImmutableList.of(); + } + + @Override + protected Iterable bodyParts() { + if (slot == EquipmentSlot.CHEST) { + return ImmutableList.of(body, leftArm, rightArm); + } + else if (slot == EquipmentSlot.LEGS) { + return ImmutableList.of(leftLegging, rightLegging, pelvis); + } + else if (slot == EquipmentSlot.FEET) { + return ImmutableList.of(leftFoot, rightFoot); + } + else return ImmutableList.of(); + } + + @Override + public void renderToBuffer(PoseStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ + super.renderToBuffer(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + } + + public void copyFromDefault(HumanoidModel model) { + body.copyFrom(model.body); + pelvis.copyFrom(body); + leftLegging.copyFrom(leftLeg); + rightLegging.copyFrom(rightLeg); + leftFoot.copyFrom(leftLeg); + rightFoot.copyFrom(rightLeg); + } + + public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) { + modelRenderer.xRot = x; + modelRenderer.yRot = y; + modelRenderer.zRot = z; + } } \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/item/model/BonelordArmorModel.java b/src/main/java/elucent/eidolon/item/model/BonelordArmorModel.java new file mode 100644 index 0000000..22ffb7f --- /dev/null +++ b/src/main/java/elucent/eidolon/item/model/BonelordArmorModel.java @@ -0,0 +1,93 @@ +package elucent.eidolon.item.model; + +import elucent.eidolon.Registry; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; +import top.theillusivec4.curios.api.CuriosApi; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.util.Mth; + +public class BonelordArmorModel extends ArmorModel { + public BonelordArmorModel(ModelPart root) { + super(root); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition mesh = HumanoidModel.createMesh(new CubeDeformation(0), 0); + PartDefinition root = createHumanoidAlias(mesh); + + PartDefinition body = root.getChild("body"); + PartDefinition right_leg = root.getChild("right_legging"); + PartDefinition left_leg = root.getChild("left_legging"); + PartDefinition left_arm = root.getChild("left_arm"); + PartDefinition right_arm = root.getChild("right_arm"); + PartDefinition head = root.getChild("head"); + + PartDefinition chest = body.addOrReplaceChild("chest", CubeListBuilder.create().texOffs(0, 30).addBox(-5.5F, -24.0F, -4.5F, 11.0F, 6.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(38, 30).addBox(-1.5F, -24.5F, 2.0F, 3.0F, 11.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 44).addBox(-5.0F, -18.0F, -3.25F, 10.0F, 4.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition hood = chest.addOrReplaceChild("hood", CubeListBuilder.create().texOffs(38, 44).addBox(-6.5F, 0.0F, 0.0F, 13.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -28.0F, 5.0F, -0.2618F, 0.0F, 0.0F)); + PartDefinition cape = hood.addOrReplaceChild("cape", CubeListBuilder.create().texOffs(68, 9).addBox(-6.0F, 0.0F, 0.0F, 12.0F, 16.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(52, 9).addBox(2.0F, 16.0F, 0.0F, 4.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(52, 9).mirror().addBox(-6.0F, 16.0F, 0.0F, 4.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 4.0F, 0.0F, 0.3927F, 0.0F, 0.0F)); + PartDefinition left_point = cape.addOrReplaceChild("left_point", CubeListBuilder.create().texOffs(50, 29).addBox(0.0F, -1.0F, -1.5F, 8.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, 14.75F, 1.0F, 0.0F, 0.0F, 0.5236F)); + PartDefinition right_point = cape.addOrReplaceChild("right_point", CubeListBuilder.create().texOffs(50, 29).mirror().addBox(-8.0F, -1.0F, -1.51F, 8.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.5F, 14.75F, 1.0F, 0.0F, 0.0F, -0.5236F)); + PartDefinition upper_right_rib = chest.addOrReplaceChild("upper_right_rib", CubeListBuilder.create().texOffs(36, 8).addBox(-5.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(45, 0).addBox(-7.0F, -2.0F, -4.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.5F, -15.0F, 2.0F, 0.0F, 0.2618F, 0.2618F)); + PartDefinition upper_right_rib_tip = upper_right_rib.addOrReplaceChild("upper_right_rib_tip", CubeListBuilder.create().texOffs(36, 8).addBox(-5.0F, -0.99F, -2.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-7.0F, -1.0F, -4.0F, -3.1416F, -0.8727F, 3.1416F)); + PartDefinition mid_right_rib = chest.addOrReplaceChild("mid_right_rib", CubeListBuilder.create().texOffs(36, 8).addBox(-5.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(45, 0).addBox(-7.0F, -2.0F, -4.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.5F, -14.25F, 2.0F, 0.0F, 0.2618F, -0.1309F)); + PartDefinition mid_right_rib_tip = mid_right_rib.addOrReplaceChild("mid_right_rib_tip", CubeListBuilder.create().texOffs(36, 8).addBox(-5.0F, -0.99F, -2.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-7.0F, -1.0F, -4.0F, -3.1416F, -0.8727F, 3.1416F)); + PartDefinition lower_right_rib = chest.addOrReplaceChild("lower_right_rib", CubeListBuilder.create().texOffs(36, 8).addBox(-5.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(45, 0).addBox(-7.0F, -2.0F, -4.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.5F, -13.5F, 2.0F, 0.0F, 0.2618F, -0.5236F)); + PartDefinition lower_right_rib_tip = lower_right_rib.addOrReplaceChild("lower_right_rib_tip", CubeListBuilder.create().texOffs(36, 8).addBox(-5.0F, -0.99F, -2.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-7.0F, -1.0F, -4.0F, -3.1416F, -0.8727F, 3.1416F)); + PartDefinition upper_left_rib = chest.addOrReplaceChild("upper_left_rib", CubeListBuilder.create().texOffs(36, 8).mirror().addBox(0.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(45, 0).mirror().addBox(5.0F, -2.0F, -4.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.5F, -15.0F, 2.0F, 0.0F, -0.2618F, -0.2618F)); + PartDefinition upper_left_rib_tip = upper_left_rib.addOrReplaceChild("upper_left_rib_tip", CubeListBuilder.create().texOffs(36, 8).mirror().addBox(0.0F, -1.99F, -2.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(7.0F, 0.0F, -4.0F, -3.1416F, 0.8727F, -3.1416F)); + PartDefinition mid_left_rib = chest.addOrReplaceChild("mid_left_rib", CubeListBuilder.create().texOffs(36, 8).mirror().addBox(0.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(45, 0).mirror().addBox(5.0F, -2.0F, -4.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.5F, -14.25F, 2.0F, 0.0F, -0.2618F, 0.1309F)); + PartDefinition mid_left_rib_tip = mid_left_rib.addOrReplaceChild("mid_left_rib_tip", CubeListBuilder.create().texOffs(36, 8).mirror().addBox(0.0F, -0.99F, -2.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(7.0F, -1.0F, -4.0F, -3.1416F, 0.8727F, -3.1416F)); + PartDefinition lower_left_rib = chest.addOrReplaceChild("lower_left_rib", CubeListBuilder.create().texOffs(36, 8).mirror().addBox(0.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(45, 0).mirror().addBox(5.0F, -2.0F, -4.0F, 2.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.5F, -13.5F, 2.0F, 0.0F, -0.2618F, 0.5236F)); + PartDefinition lower_left_rib_tip = lower_left_rib.addOrReplaceChild("lower_left_rib_tip", CubeListBuilder.create().texOffs(36, 8).mirror().addBox(0.0F, -0.99F, -2.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(7.0F, -1.0F, -4.0F, -3.1416F, 0.8727F, -3.1416F)); + PartDefinition coccyx = chest.addOrReplaceChild("coccyx", CubeListBuilder.create().texOffs(30, 30).addBox(-1.0F, 0.0F, -2.5F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -13.0F, 5.0F, -0.1745F, 0.0F, 0.0F)); + PartDefinition left_greave = left_leg.addOrReplaceChild("left_greave", CubeListBuilder.create().texOffs(72, 27).addBox(0.0F, -0.5F, 0.0F, 4.0F, 8.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-2.0F, 2.0F, -3.0F, 0.0F, -0.0873F, 0.0F)); + PartDefinition left_knee = left_greave.addOrReplaceChild("left_knee", CubeListBuilder.create().texOffs(84, 27).addBox(-4.5F, -0.5F, 0.0F, 5.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, -2.0F, -0.5F, 0.0F, -0.0873F, 0.0F)); + PartDefinition right_greave = right_leg.addOrReplaceChild("right_greave", CubeListBuilder.create().texOffs(72, 27).mirror().addBox(-4.0F, -0.5F, 0.0F, 4.0F, 8.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(2.0F, 2.0F, -3.0F, 0.0F, 0.0873F, 0.0F)); + PartDefinition right_knee = right_greave.addOrReplaceChild("right_knee", CubeListBuilder.create().texOffs(84, 27).mirror().addBox(-0.5F, -0.5F, 0.0F, 5.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-4.5F, -2.0F, -0.5F, 0.0F, 0.0873F, 0.0F)); + PartDefinition right_shoulder = right_arm.addOrReplaceChild("right_shoulder", CubeListBuilder.create().texOffs(44, 17).mirror().addBox(0.0F, 0.0F, -3.0F, 6.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-4.5F, -2.0F, 0.0F)); + PartDefinition left_shoulder = left_arm.addOrReplaceChild("left_shoulder", CubeListBuilder.create().texOffs(44, 17).addBox(-6.0F, 0.0F, -3.0F, 6.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(4.5F, -2.0F, 0.0F)); + PartDefinition helm = head.addOrReplaceChild("helm", CubeListBuilder.create().texOffs(0, 16).addBox(-5.5F, -3.0F, -5.5F, 11.0F, 3.0F, 11.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-4.5F, -9.0F, -4.5F, 9.0F, 7.0F, 9.0F, new CubeDeformation(0.01F)), PartPose.offset(0.0F, 1.0F, 0.0F)); + PartDefinition cowl = helm.addOrReplaceChild("cowl", CubeListBuilder.create().texOffs(33, 16).addBox(-2.0F, 0.0F, -1.5F, 5.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, -3.5F, -4.5F, -0.2618F, 0.0F, 0.0F)); + PartDefinition right_prong = helm.addOrReplaceChild("right_prong", CubeListBuilder.create().texOffs(27, 0).mirror().addBox(-5.0F, -2.0F, 0.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-4.5F, -3.0F, -4.0F, 0.0F, 0.5236F, 0.5236F)); + PartDefinition back_right_prong = helm.addOrReplaceChild("back_right_prong", CubeListBuilder.create().texOffs(27, 4).mirror().addBox(-7.0F, -2.0F, 0.0F, 7.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-4.5F, -5.0F, 1.0F, 0.0F, 1.0472F, 0.7854F)); + PartDefinition left_prong = helm.addOrReplaceChild("left_prong", CubeListBuilder.create().texOffs(27, 0).addBox(0.0F, -2.0F, 0.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, -3.0F, -4.0F, 0.0F, -0.5236F, -0.5236F)); + PartDefinition back_left_prong = helm.addOrReplaceChild("back_left_prong", CubeListBuilder.create().texOffs(27, 4).addBox(0.0F, -2.0F, 0.0F, 7.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.5F, -5.0F, 1.0F, 0.0F, -1.0472F, -0.7854F)); + + return LayerDefinition.create(mesh, 128, 64); + } + + @Override + public void setupAnim(LivingEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + float f = 1.0F; + if (entity.getFallFlyingTicks() > 4) { + f = (float)entity.getDeltaMovement().lengthSqr(); + f = f / 0.2F; + f = f * f * f; + } + if (f < 1.0F) { + f = 1.0F; + } + if (slot == EquipmentSlot.CHEST) { + body.getChild("chest").getChild("hood").getChild("cape").xRot = 0.3927F + Mth.abs(Mth.cos(limbSwing * 0.6662f) * 0.4f * limbSwingAmount / f); + } + } +} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/item/model/RavenCloakModel.java b/src/main/java/elucent/eidolon/item/model/RavenCloakModel.java new file mode 100644 index 0000000..37546c4 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/model/RavenCloakModel.java @@ -0,0 +1,196 @@ +package elucent.eidolon.item.model; + +import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.item.IWingsItem; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + +public class RavenCloakModel extends HumanoidModel { + ModelPart root, cloak, wings, leftWing, rightWing; + + public RavenCloakModel(ModelPart root) { + super(root); + this.root = root; + this.cloak = root.getChild("body").getChild("cloak"); + this.wings = root.getChild("body").getChild("wings"); + this.leftWing = wings.getChild("left_wing"); + this.rightWing = wings.getChild("right_wing"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition mesh = HumanoidModel.createMesh(new CubeDeformation(0), 0); + PartDefinition root = mesh.getRoot(); + PartDefinition body = root.addOrReplaceChild("body", new CubeListBuilder(), PartPose.ZERO); + PartDefinition head = root.addOrReplaceChild("head", new CubeListBuilder(), PartPose.ZERO); + + PartDefinition hood = head.addOrReplaceChild("hood", CubeListBuilder.create().texOffs(0, 0).addBox(-5.5F, -10.5F, -4.5F, 11.0F, 11.0F, 11.0F, new CubeDeformation(0.5F)), PartPose.offsetAndRotation(0.0F, 0.5F, 0.5F, 0.2618F, 0.0F, 0.0F)); + PartDefinition left_feather1 = hood.addOrReplaceChild("left_feather1", CubeListBuilder.create().texOffs(0, 16).mirror().addBox(0.0F, -1.5F, 0.0F, 0.0F, 3.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(6.0F, -3.0F, -2.0F, 2.0944F, 0.0F, 0.5236F)); + PartDefinition left_feather2 = hood.addOrReplaceChild("left_feather2", CubeListBuilder.create().texOffs(0, 17).mirror().addBox(0.0F, -1.5F, 0.0F, 0.0F, 3.0F, 8.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(6.0F, -3.0F, 1.0F, 1.5708F, 0.0F, 0.7854F)); + PartDefinition left_feather3 = hood.addOrReplaceChild("left_feather3", CubeListBuilder.create().texOffs(0, 16).mirror().addBox(0.0F, -1.5F, 0.0F, 0.0F, 3.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(6.0F, -2.0F, 4.0F, 1.0472F, 0.0F, 0.5236F)); + PartDefinition right_feather1 = hood.addOrReplaceChild("right_feather1", CubeListBuilder.create().texOffs(0, 16).addBox(0.0F, -1.5F, 0.0F, 0.0F, 3.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.0F, -3.0F, -2.0F, 2.0944F, 0.0F, -0.5236F)); + PartDefinition right_feather2 = hood.addOrReplaceChild("right_feather2", CubeListBuilder.create().texOffs(0, 17).addBox(0.0F, -1.5F, 0.0F, 0.0F, 3.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.0F, -3.0F, 1.0F, 1.5708F, 0.0F, -0.7854F)); + PartDefinition right_feather3 = hood.addOrReplaceChild("right_feather3", CubeListBuilder.create().texOffs(0, 16).addBox(0.0F, -1.5F, 0.0F, 0.0F, 3.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.0F, -2.0F, 4.0F, 1.0472F, 0.0F, -0.5236F)); + PartDefinition beak = hood.addOrReplaceChild("beak", CubeListBuilder.create().texOffs(33, 0).addBox(-2.5F, 0.0F, -4.0F, 5.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -11.0F, -5.0F, 0.7854F, 0.0F, 0.0F)); + PartDefinition cloak = body.addOrReplaceChild("cloak", CubeListBuilder.create(), PartPose.offset(0.0F, 1.0F, 0.0F)); + PartDefinition left_cloak = cloak.addOrReplaceChild("left_cloak", CubeListBuilder.create().texOffs(0, 28).mirror().addBox(-0.5F, -4.0F, -4.0F, 12.0F, 20.0F, 12.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.5F, 1, -3.0F, 0.1309F, -0.1309F, -0.1309F)); + PartDefinition right_cloak = cloak.addOrReplaceChild("right_cloak", CubeListBuilder.create().texOffs(0, 28).addBox(-11.5F, -4.0F, -4.0F, 12.0F, 20.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, 1, -3.0F, 0.1309F, 0.1309F, 0.1309F)); + PartDefinition wings = body.addOrReplaceChild("wings", CubeListBuilder.create(), PartPose.offset(0.0F, 1.0F, 0.0F)); + PartDefinition upper_left_cloak = wings.addOrReplaceChild("upper_left_cloak", CubeListBuilder.create().texOffs(0, 28).mirror().addBox(0.5F, -4.0F, -4.0F, 12.0F, 7.0F, 12.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.5F, 4, -3.0F, 0.1309F, -0.1309F, -0.5236F)); + PartDefinition upper_right_cloak = wings.addOrReplaceChild("upper_right_cloak", CubeListBuilder.create().texOffs(0, 28).addBox(-12.5F, -4.0F, -4.0F, 12.0F, 7.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, 4, -3.0F, 0.1309F, 0.1309F, 0.5236F)); + PartDefinition left_wing = wings.addOrReplaceChild("left_wing", CubeListBuilder.create().texOffs(51, 0).addBox(0.0F, 0.0F, -2.0F, 12.0F, 8.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(48, 41).addBox(-4.0F, 8.0F, -1.0F, 14.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2, 5.0F, 0.0F, -0.5236F, -0.3927F)); + PartDefinition left_wing_mid = left_wing.addOrReplaceChild("left_wing_mid", CubeListBuilder.create().texOffs(72, 10).addBox(0.0F, 0.0F, -1.0F, 12.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(44, 27).addBox(-1.0F, 8.0F, -0.5F, 14.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(12.5F, 0.0F, -0.5F, 0.0F, 0.2618F, 0.1309F)); + PartDefinition left_wing_tip = left_wing_mid.addOrReplaceChild("left_wing_tip", CubeListBuilder.create().texOffs(44, 11).addBox(0.0F, 0.0F, -1.0F, 14.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(11.5F, 0.0F, 0.5F, 0.0F, 0.5236F, -0.1309F)); + PartDefinition right_wing = wings.addOrReplaceChild("right_wing", CubeListBuilder.create().texOffs(51, 0).mirror().addBox(-12.0F, 0.0F, -2.0F, 12.0F, 8.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(48, 41).mirror().addBox(-10.0F, 8.0F, -1.0F, 14.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, -2, 5.0F, 0.0F, 0.5236F, 0.3927F)); + PartDefinition right_wing_mid = right_wing.addOrReplaceChild("right_wing_mid", CubeListBuilder.create().texOffs(72, 10).mirror().addBox(-12.0F, 0.0F, -1.0F, 12.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(44, 27).mirror().addBox(-13.0F, 8.0F, -0.5F, 14.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-12.5F, 0.0F, -0.5F, 0.0F, -0.2618F, -0.1309F)); + PartDefinition right_wing_tip = right_wing_mid.addOrReplaceChild("right_wing_tip", CubeListBuilder.create().texOffs(44, 11).mirror().addBox(-14.0F, 0.0F, -1.0F, 14.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-11.5F, 0.0F, 0.5F, 0.0F, -0.5236F, 0.1309F)); + + return LayerDefinition.create(mesh, 128, 64); + } + + @Override + public void setupAnim(LivingEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + if (entity instanceof Player p) { + float pticks = Minecraft.getInstance().getFrameTime(); + IPlayerData data = p.getCapability(IPlayerData.INSTANCE).resolve().get(); + float timeSinceFlying = Mth.clamp(p.level.getGameTime() - data.getFlightStartTime(p) + pticks, 0, 10); + float timeSinceFlapping = Mth.clamp(p.level.getGameTime() - data.getLastFlapTime(p) + pticks, 0.01F, 20); + + ModelPart leftMid = leftWing.getChild("left_wing_mid"); + ModelPart leftTip = leftMid.getChild("left_wing_tip"); + ModelPart rightMid = rightWing.getChild("right_wing_mid"); + ModelPart rightTip = rightMid.getChild("right_wing_tip"); + + float unfurl = 0; + timeSinceFlapping /= 20; + timeSinceFlapping -= 0.166666666666666F; + float flap1 = Mth.sin(Mth.PI * 2.4f * timeSinceFlapping) / (2.4f * Mth.PI * timeSinceFlapping); + timeSinceFlapping += 0.166666666666666F; + float flap2 = -Mth.sin(Mth.TWO_PI * Mth.sqrt(timeSinceFlapping)); + flap2 *= (1.5f - 0.5f * timeSinceFlapping); + if (data.isFlying(p)) { + cloak.visible = false; + wings.visible = true; + unfurl = (10 - timeSinceFlying) / 10.0f; + unfurl *= unfurl; + unfurl = 1 - unfurl; + } + else { + cloak.visible = timeSinceFlying >= 10; + wings.visible = timeSinceFlying < 10; + unfurl = (10 - timeSinceFlying) / 10.0f; + unfurl *= unfurl; + } + + float leftWingX = 0.7854F, leftWingY = -0.5236F, leftWingZ = -0.7854F; + float rightWingX = 0.7854F, rightWingY = 0.5236F, rightWingZ = 0.7854F; + float leftMidX = 0, leftMidY = 0.2618F; + float leftTipY = 0.5236F; + float rightMidX = 0, rightMidY = -0.2618F; + float rightTipY = -0.5236F; + + // dashing + + if (data.isDashing(p)) { + ItemStack wings = data.getWingsItem(p); + int maxDash = wings.getItem() instanceof IWingsItem i ? i.getDashTicks(wings) : 0; + int dashTicks = data.getDashTicks(p); + int sinceDashing = maxDash - dashTicks; + float dashStart = Mth.clamp(sinceDashing / 10.0f, 0.01f, 1); + + leftWingZ = Mth.lerp(dashStart, leftWingZ, 0); + rightWingZ = Mth.lerp(dashStart, rightWingZ, 0); + leftWingY = Mth.lerp(dashStart, leftWingZ, 0); + rightWingY = Mth.lerp(dashStart, rightWingZ, 0); + leftWingX = Mth.lerp(dashStart, leftWingX, 0.2618F); + rightWingX = Mth.lerp(dashStart, rightWingX, 0.2618F); + } + + // flapping + + leftWingX = Mth.lerp(flap1, leftWingX, 1.5708F); + leftWingY = Mth.lerp(flap1, leftWingY, 1.047F); + leftWingZ = Mth.lerp(flap1, leftWingZ, 0.5236F); + leftMidY = Mth.lerp(flap2, leftMidY, 0.7854F); + rightWingX = Mth.lerp(flap1, rightWingX, 1.5708F); + rightWingY = Mth.lerp(flap1, rightWingY, -1.047F); + rightWingZ = Mth.lerp(flap1, rightWingZ, -0.5236F); + rightMidY = Mth.lerp(flap2, rightMidY, -0.7854F); + + // unfurling + + leftWingX = Mth.lerp(unfurl, 0, leftWingX); + leftWingY = Mth.lerp(unfurl, 0.2618F, leftWingY); + leftWingZ = Mth.lerp(unfurl, -0.3927F, leftWingZ); + leftMidY = Mth.lerp(unfurl, 1.4399F, leftMidY); + leftTipY = Mth.lerp(unfurl, 1.5708F, leftTipY); + + rightWingX = Mth.lerp(unfurl, 0, rightWingX); + rightWingY = Mth.lerp(unfurl, -0.2618F, rightWingY); + rightWingZ = Mth.lerp(unfurl, 0.3927F, rightWingZ); + rightMidY = Mth.lerp(unfurl, -1.4399F, rightMidY); + rightTipY = Mth.lerp(unfurl, -1.5708F, rightTipY); + + // crouching + + if (p.isCrouching()) { + leftWingY += 0.3927F; + rightWingY -= 0.3927F; + leftWingZ += 0.3927F; + rightWingZ -= 0.3927F; + } + + // velocity + + float clampedDY = (float) Mth.clamp(p.getDeltaMovement().y, -0.5f, 0.5f); + leftWingZ += clampedDY * 0.5236F; + rightWingZ -= clampedDY * 0.5236F; + + leftWing.xRot = leftWingX; + leftWing.yRot = leftWingY; + leftWing.zRot = leftWingZ; + leftMid.yRot = leftMidY; + leftTip.yRot = leftTipY; + + rightWing.xRot = rightWingX; + rightWing.yRot = rightWingY; + rightWing.zRot = rightWingZ; + rightMid.yRot = rightMidY; + rightTip.yRot = rightTipY; + } + } + + @Override + protected Iterable headParts() { + return ImmutableList.of(root.getChild("head")); + } + + @Override + protected Iterable bodyParts() { + return ImmutableList.of(root.getChild("body")); + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + super.renderToBuffer(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha); + } +} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/item/model/SilverArmorModel.java b/src/main/java/elucent/eidolon/item/model/SilverArmorModel.java new file mode 100644 index 0000000..0422902 --- /dev/null +++ b/src/main/java/elucent/eidolon/item/model/SilverArmorModel.java @@ -0,0 +1,50 @@ +package elucent.eidolon.item.model; + +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; + +public class SilverArmorModel extends ArmorModel { + public SilverArmorModel(ModelPart part) { + super(part); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition mesh = HumanoidModel.createMesh(new CubeDeformation(0), 0); + PartDefinition root = createHumanoidAlias(mesh); + + PartDefinition body = root.getChild("body"); + PartDefinition pelvis = root.getChild("pelvis"); + PartDefinition right_foot = root.getChild("right_foot"); + PartDefinition left_foot = root.getChild("left_foot"); + PartDefinition right_legging = root.getChild("right_legging"); + PartDefinition left_legging = root.getChild("left_legging"); + PartDefinition left_arm = root.getChild("left_arm"); + PartDefinition right_arm = root.getChild("right_arm"); + PartDefinition head = root.getChild("head"); + + PartDefinition chest = body.addOrReplaceChild("chest", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, -12.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.0F)), PartPose.offset(0.0F, 12.0F, 0.0F)); + PartDefinition right_shoulder = right_arm.addOrReplaceChild("right_shoulder", new CubeListBuilder().mirror().texOffs(40, 16).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, new CubeDeformation(1.0f)), PartPose.ZERO); + PartDefinition left_shoulder = left_arm.addOrReplaceChild("left_shoulder", new CubeListBuilder().texOffs(40, 16).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, new CubeDeformation(1.0f)), PartPose.ZERO); + PartDefinition helm = head.addOrReplaceChild("helm", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)), PartPose.ZERO); + PartDefinition guard = helm.addOrReplaceChild("guard", CubeListBuilder.create().texOffs(6, 41).addBox(-5.0F, -6.0F, -5.5F, 10.0F, 10.0F, 10.0F, new CubeDeformation(1.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 0.0F, 0.0F, 0.7854F, 0.0F)); + PartDefinition left_boot = left_foot.addOrReplaceChild("left_boot", new CubeListBuilder().texOffs(0, 22).mirror().addBox(-2.0F, 6.0F, -2.0F, 4.0F, 6.0F, 4.0F, new CubeDeformation(1.0f)), PartPose.ZERO); + PartDefinition right_boot = right_foot.addOrReplaceChild("right_boot", new CubeListBuilder().texOffs(0, 22).addBox(-2.0F, 6.0F, -2.0F, 4.0F, 6.0F, 4.0F, new CubeDeformation(1.0f)), PartPose.ZERO); + PartDefinition left_leg = left_legging.addOrReplaceChild("left_leg", new CubeListBuilder().texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 9.0F, 4.0F, new CubeDeformation(0.5f)), PartPose.ZERO); + PartDefinition right_leg = right_legging.addOrReplaceChild("right_leg", new CubeListBuilder().texOffs(0, 32).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 9.0F, 4.0F, new CubeDeformation(0.5f)), PartPose.ZERO); + PartDefinition codpiece = pelvis.addOrReplaceChild("codpiece", CubeListBuilder.create().texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 5.0F, 4.0F, new CubeDeformation(0.5F)), PartPose.offset(0.0F, 7.0F, 0.0F)); + + return LayerDefinition.create(mesh, 64, 64); + } + + public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) { + modelRenderer.xRot = x; + modelRenderer.yRot = y; + modelRenderer.zRot = z; + } +} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/item/model/TopHatModel.java b/src/main/java/elucent/eidolon/item/model/TopHatModel.java index cfb80c7..cbfac04 100644 --- a/src/main/java/elucent/eidolon/item/model/TopHatModel.java +++ b/src/main/java/elucent/eidolon/item/model/TopHatModel.java @@ -1,33 +1,39 @@ -package elucent.eidolon.item.model;// Made with Blockbench 3.7.4 -// Exported for Minecraft version 1.15 -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.renderer.entity.model.BipedModel; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.inventory.EquipmentSlotType; - -public class TopHatModel extends ArmorModel { - private final ModelRenderer hat; - - public TopHatModel() { - super(EquipmentSlotType.HEAD, 64, 32); - textureWidth = 64; - textureHeight = 32; - - hat = new ModelRenderer(this); - hat.setRotationPoint(0.0F, -7.0F, 0.0F); - bipedHead.addChild(hat); - setRotationAngle(hat, -0.0873F, 0.0F, 0.0F); - hat.setTextureOffset(0, 0).addBox(-5.0F, -2.0F, -5.0F, 10.0F, 2.0F, 10.0F, 0.0F, false); - hat.setTextureOffset(0, 12).addBox(-4.0F, -12.0F, -4.0F, 8.0F, 10.0F, 8.0F, 0.0F, false); - } - - @Override - public void setRotationAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ - // - } +package elucent.eidolon.item.model;// Made with Blockbench 3.7.4 +// Exported for Minecraft version 1.15 +// Paste this class into your mod and generate all required imports + + +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; + +public class TopHatModel extends ArmorModel { + public TopHatModel(ModelPart part) { + super(part); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition mesh = HumanoidModel.createMesh(new CubeDeformation(0), 0); + PartDefinition root = createHumanoidAlias(mesh); + + PartDefinition head = root.getChild("head"); + + PartDefinition hat = head.addOrReplaceChild("hat", CubeListBuilder.create() + .texOffs(0, 0).addBox(-5.0F, -2.0F, -5.0F, 10.0F, 2.0F, 10.0F, new CubeDeformation(0)) + .texOffs(0, 12).addBox(-4.0F, -12.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0)), + PartPose.offsetAndRotation(0.0F, -7.0F, 0.0F, -0.0873F, 0.0F, 0.0F)); + + return LayerDefinition.create(mesh, 64, 32); + } + + @Override + public void setupAnim(LivingEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ + // + } } \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/item/model/WarlockArmorModel.java b/src/main/java/elucent/eidolon/item/model/WarlockArmorModel.java index 8f5c5f2..6df8749 100644 --- a/src/main/java/elucent/eidolon/item/model/WarlockArmorModel.java +++ b/src/main/java/elucent/eidolon/item/model/WarlockArmorModel.java @@ -1,165 +1,71 @@ -package elucent.eidolon.item.model;// Made with Blockbench 3.7.4 -// Exported for Minecraft version 1.15 -// Paste this class into your mod and generate all required imports - - -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.renderer.entity.model.BipedModel; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.util.math.MathHelper; - -public class WarlockArmorModel extends ArmorModel { - private ModelRenderer left_boot = null; - private ModelRenderer left_boot_cuff = null; - private ModelRenderer right_boot = null; - private ModelRenderer right_boot_cuff = null; - private ModelRenderer left_sleeve = null; - private ModelRenderer left_cuff = null; - private ModelRenderer right_sleeve = null; - private ModelRenderer right_cuff = null; - private ModelRenderer hat = null; - private ModelRenderer hatMid = null; - private ModelRenderer hatUpper = null; - private ModelRenderer hatTip = null; - private ModelRenderer cloak = null; - private ModelRenderer left_side = null; - private ModelRenderer right_side = null; - private ModelRenderer back_side = null; - - public WarlockArmorModel(EquipmentSlotType slot) { - super(slot, 64, 128); - - if (slot == EquipmentSlotType.FEET) { - right_boot = new ModelRenderer(this); - right_boot.setRotationPoint(0.0F, 0.0F, 0.0F); - bipedRightLeg.addChild(right_boot); - setRotationAngle(right_boot, 0.0F, 0.0873F, 0.0F); - right_boot.setTextureOffset(0, 84).addBox(-2.5F, 5.5F, -2.5F, 5.0F, 7.0F, 5.0F, 0.0F, false); - right_boot.setTextureOffset(0, 80).addBox(-2.5F, 9.5F, -3.5F, 5.0F, 3.0F, 1.0F, 0.0F, false); - - right_boot_cuff = new ModelRenderer(this); - right_boot_cuff.setRotationPoint(0.0F, 5.0F, 0.0F); - right_boot.addChild(right_boot_cuff); - setRotationAngle(right_boot_cuff, 0.0F, 0.0F, -0.0873F); - right_boot_cuff.setTextureOffset(20, 84).addBox(-3.0F, -1.0F, -3.0F, 6.0F, 2.0F, 6.0F, 0.0F, false); - - left_boot = new ModelRenderer(this); - left_boot.setRotationPoint(0.0F, 0.0F, 0.0F); - bipedLeftLeg.addChild(left_boot); - setRotationAngle(left_boot, 0.0F, -0.0873F, 0.0F); - left_boot.setTextureOffset(0, 84).addBox(-2.5F, 5.5F, -2.5F, 5.0F, 7.0F, 5.0F, 0.0F, false); - left_boot.setTextureOffset(0, 80).addBox(-2.5F, 9.5F, -3.5F, 5.0F, 3.0F, 1.0F, 0.0F, false); - - left_boot_cuff = new ModelRenderer(this); - left_boot_cuff.setRotationPoint(0.0F, 5.0F, 0.0F); - left_boot.addChild(left_boot_cuff); - setRotationAngle(left_boot_cuff, 0.0F, 0.0F, 0.0873F); - left_boot_cuff.setTextureOffset(20, 84).addBox(-3.0F, -1.0F, -3.0F, 6.0F, 2.0F, 6.0F, 0.0F, false); - } - - if (slot == EquipmentSlotType.CHEST) { - right_sleeve = new ModelRenderer(this); - right_sleeve.setRotationPoint(0.0F, 0.0F, 0.0F); - bipedRightArm.addChild(right_sleeve); - setRotationAngle(right_sleeve, 0.0F, 0.0F, 0.1745F); - right_sleeve.setTextureOffset(28, 38).addBox(-4.5F, -2.0F, -2.5F, 5.0F, 5.0F, 5.0F, 0.0F, false); - - right_cuff = new ModelRenderer(this); - right_cuff.setRotationPoint(-1.0F, 3.0F, 0.0F); - right_sleeve.addChild(right_cuff); - setRotationAngle(right_cuff, 0.0F, 0.0873F, 0.0873F); - right_cuff.setTextureOffset(28, 48).addBox(-4.5F, -0.5F, -3.0F, 6.0F, 2.0F, 6.0F, 0.0F, false); - - left_sleeve = new ModelRenderer(this); - left_sleeve.setRotationPoint(0.0F, 0.0F, 0.0F); - bipedLeftArm.addChild(left_sleeve); - setRotationAngle(left_sleeve, 0.0F, 0.0F, -0.1745F); - left_sleeve.setTextureOffset(28, 38).addBox(-0.5F, -2.0F, -2.5F, 5.0F, 5.0F, 5.0F, 0.0F, true); - - left_cuff = new ModelRenderer(this); - left_cuff.setRotationPoint(1.0F, 3.0F, 0.0F); - left_sleeve.addChild(left_cuff); - setRotationAngle(left_cuff, 0.0F, -0.0873F, -0.0873F); - left_cuff.setTextureOffset(28, 48).addBox(-1.5F, -0.5F, -3.0F, 6.0F, 2.0F, 6.0F, 0.0F, true); - - cloak = new ModelRenderer(this); - cloak.setRotationPoint(2.0F, 12.0F, 0.0F); - bipedBody.addChild(cloak); - cloak.setTextureOffset(0, 41).addBox(-6.5F, -12.499F, -2.501F, 9.0F, 15.0F, 5.0F, 0.0F, false); - cloak.setTextureOffset(28, 56).addBox(-7.0F, -12.5F, -3.0F, 10.0F, 8.0F, 6.0F, 0.0F, false); - - left_side = new ModelRenderer(this); - left_side.setRotationPoint(-5.0F, -4.5F, -3.0F); - cloak.addChild(left_side); - setRotationAngle(left_side, 0.0F, 0.0F, 0.1745F); - left_side.setTextureOffset(0, 64).addBox(-2.0F, 0.0F, 0.01F, 2.0F, 10.0F, 6.0F, 0.0F, false); - - right_side = new ModelRenderer(this); - right_side.setRotationPoint(1.0F, -4.5F, -3.0F); - cloak.addChild(right_side); - setRotationAngle(right_side, 0.0F, 0.0F, -0.1745F); - right_side.setTextureOffset(0, 64).addBox(0.0F, 0.0F, 0.01F, 2.0F, 10.0F, 6.0F, 0.0F, false); - - back_side = new ModelRenderer(this); - back_side.setRotationPoint(-2.0F, -4.5F, 1.0F); - cloak.addChild(back_side); - setRotationAngle(back_side, 0.1745F, 0.0F, 0.0F); - back_side.setTextureOffset(17, 70).addBox(-5.01F, 0.0F, 0.0F, 10.0F, 12.0F, 2.0F, 0.0F, false); - } - - if (slot == EquipmentSlotType.HEAD) { - hat = new ModelRenderer(this); - hat.setRotationPoint(0.0F, -7.0F, 0.0F); - bipedHead.addChild(hat); - setRotationAngle(hat, -0.1745F, 0.0F, -0.0873F); - hat.setTextureOffset(0, 0).addBox(-7.0F, -1.0F, -7.0F, 14.0F, 2.0F, 14.0F, 0.0F, false); - - hatMid = new ModelRenderer(this); - hatMid.setRotationPoint(0.0F, 0.0F, 0.0F); - hat.addChild(hatMid); - setRotationAngle(hatMid, -0.0873F, 0.0F, 0.0873F); - hatMid.setTextureOffset(0, 16).addBox(-4.5F, -5.75F, -4.5F, 9.0F, 6.0F, 9.0F, 0.0F, false); - - hatUpper = new ModelRenderer(this); - hatUpper.setRotationPoint(0.0F, -5.0F, 0.0F); - hatMid.addChild(hatUpper); - setRotationAngle(hatUpper, -0.1745F, 0.0F, 0.0436F); - hatUpper.setTextureOffset(0, 31).addBox(-3.0F, -4.0F, -3.0F, 6.0F, 4.0F, 6.0F, 0.0F, false); - - hatTip = new ModelRenderer(this); - hatTip.setRotationPoint(0.0F, -3.0F, 0.0F); - hatUpper.addChild(hatTip); - setRotationAngle(hatTip, -0.2618F, 0.0F, 0.0873F); - hatTip.setTextureOffset(24, 31).addBox(-1.5F, -4.5F, -1.5F, 3.0F, 4.0F, 3.0F, 0.0F, false); - } - } - - @Override - public void setRotationAngles(LivingEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ - super.setRotationAngles(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - float f = 1.0F; - if (entity.getTicksElytraFlying() > 4) { - f = (float)entity.getMotion().lengthSquared(); - f = f / 0.2F; - f = f * f * f; - } - if (f < 1.0F) { - f = 1.0F; - } - if (slot == EquipmentSlotType.CHEST) { - back_side.rotateAngleX = 0.1745f + MathHelper.abs(MathHelper.cos(limbSwing * 0.6662f) * 0.7f * limbSwingAmount / f); - left_side.rotateAngleZ = 0.1745f + MathHelper.cos(limbSwing * 0.6662f + (float)Math.PI) * 0.2f * limbSwingAmount / f + 0.1f * limbSwingAmount / f; - right_side.rotateAngleZ = -0.1745f - MathHelper.cos(limbSwing * 0.6662f) * 0.2f * limbSwingAmount / f - 0.1f * limbSwingAmount / f; - } - } - - public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +package elucent.eidolon.item.model; + +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.util.Mth; + +public class WarlockArmorModel extends ArmorModel { + public WarlockArmorModel(ModelPart root) { + super(root); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition mesh = HumanoidModel.createMesh(new CubeDeformation(0), 0); + PartDefinition root = createHumanoidAlias(mesh); + + PartDefinition body = root.getChild("body"); + PartDefinition right_foot = root.getChild("right_foot"); + PartDefinition left_foot = root.getChild("left_foot"); + PartDefinition left_arm = root.getChild("left_arm"); + PartDefinition right_arm = root.getChild("right_arm"); + PartDefinition head = root.getChild("head"); + + PartDefinition left_boot = left_foot.addOrReplaceChild("left_boot", CubeListBuilder.create().texOffs(0, 84).addBox(-2.5F, 5.5F, -2.5F, 5.0F, 7.0F, 5.0F, new CubeDeformation(0.0F)) + .texOffs(0, 80).addBox(-2.5F, 9.5F, -3.5F, 5.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.25F, 0.0F, 0.0F, 0.0F, -0.0873F, 0.0F)); + PartDefinition left_boot_cuff = left_boot.addOrReplaceChild("left_boot_cuff", CubeListBuilder.create().texOffs(20, 84).addBox(-3.0F, -1.0F, -3.0F, 6.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 5.0F, 0.0F, 0.0F, 0.0F, 0.0873F)); + PartDefinition right_boot = right_foot.addOrReplaceChild("right_boot", CubeListBuilder.create().texOffs(0, 84).addBox(-2.5F, 5.5F, -2.5F, 5.0F, 7.0F, 5.0F, new CubeDeformation(0.0F)) + .texOffs(0, 80).addBox(-2.5F, 9.5F, -3.5F, 5.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.25F, 0.0F, 0.0F, 0.0F, 0.0873F, 0.0F)); + PartDefinition right_boot_cuff = right_boot.addOrReplaceChild("right_boot_cuff", CubeListBuilder.create().texOffs(20, 84).addBox(-3.0F, -1.0F, -3.0F, 6.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 5.0F, 0.0F, 0.0F, 0.0F, -0.0873F)); + PartDefinition right_sleeve = right_arm.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(28, 38).addBox(-4.5F, -2.0F, -2.5F, 5.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, -1.0F, 0.0F, 0.0F, 0.0F, 0.1745F)); + PartDefinition right_cuff = right_sleeve.addOrReplaceChild("right_cuff", CubeListBuilder.create().texOffs(28, 48).addBox(-4.5F, -0.5F, -3.0F, 6.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, 3.0F, 0.0F, 0.0F, 0.0873F, 0.0873F)); + PartDefinition left_sleeve = left_arm.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(28, 38).mirror().addBox(-0.5F, -2.0F, -2.5F, 5.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-1.0F, -1.0F, 0.0F, 0.0F, 0.0F, -0.1745F)); + PartDefinition left_cuff = left_sleeve.addOrReplaceChild("left_cuff", CubeListBuilder.create().texOffs(28, 48).mirror().addBox(-1.5F, -0.5F, -3.0F, 6.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(1.0F, 3.0F, 0.0F, 0.0F, -0.0873F, -0.0873F)); + PartDefinition hat = head.addOrReplaceChild("hat", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -1.0F, -7.0F, 14.0F, 2.0F, 14.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -6.5F, 0.0F, -0.1745F, 0.0F, -0.0873F)); + PartDefinition hatMid = hat.addOrReplaceChild("hatMid", CubeListBuilder.create().texOffs(0, 16).addBox(-4.5F, -5.75F, -4.5F, 9.0F, 6.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.0873F, 0.0F, 0.0873F)); + PartDefinition hatUpper = hatMid.addOrReplaceChild("hatUpper", CubeListBuilder.create().texOffs(0, 31).addBox(-3.0F, -4.0F, -3.0F, 6.0F, 4.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -5.0F, 0.0F, -0.1745F, 0.0F, 0.0436F)); + PartDefinition hatTip = hatUpper.addOrReplaceChild("hatTip", CubeListBuilder.create().texOffs(24, 31).addBox(-1.5F, -4.5F, -1.5F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 0.0F, -0.2618F, 0.0F, 0.0873F)); + PartDefinition cloak = body.addOrReplaceChild("cloak", CubeListBuilder.create().texOffs(0, 41).addBox(-6.5F, -12.4F, -2.5F, 9.0F, 15.0F, 5.0F, new CubeDeformation(0.0F)) + .texOffs(28, 56).addBox(-7.0F, -12.5F, -3.0F, 10.0F, 8.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(2.0F, 12.0F, 0.0F)); + PartDefinition left_side = cloak.addOrReplaceChild("left_side", CubeListBuilder.create().texOffs(0, 64).addBox(-2.0F, 0.0F, 0.01F, 2.0F, 10.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-5.0F, -4.5F, -3.0F, 0.0F, 0.0F, 0.1745F)); + PartDefinition right_side = cloak.addOrReplaceChild("right_side", CubeListBuilder.create().texOffs(0, 64).addBox(0.0F, 0.0F, 0.01F, 2.0F, 10.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, -4.5F, -3.0F, 0.0F, 0.0F, -0.1745F)); + PartDefinition back_side = cloak.addOrReplaceChild("back_side", CubeListBuilder.create().texOffs(17, 70).addBox(-5.01F, 0.0F, 0.0F, 10.0F, 12.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-2.0F, -4.5F, 1.0F, 0.1745F, 0.0F, 0.0F)); + + return LayerDefinition.create(mesh, 64, 128); + } + + @Override + public void setupAnim(LivingEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + float f = 1.0F; + if (entity.getFallFlyingTicks() > 4) { + f = (float)entity.getDeltaMovement().lengthSqr(); + f = f / 0.2F; + f = f * f * f; + } + if (f < 1.0F) { + f = 1.0F; + } + if (slot == EquipmentSlot.CHEST) { + body.getChild("cloak").getChild("back_side").xRot = 0.1745f + Mth.abs(Mth.cos(limbSwing * 0.6662f) * 0.7f * limbSwingAmount / f); + body.getChild("cloak").getChild("left_side").zRot = 0.1745f + Mth.cos(limbSwing * 0.6662f + (float)Math.PI) * 0.2f * limbSwingAmount / f + 0.1f * limbSwingAmount / f; + body.getChild("cloak").getChild("right_side").zRot = -0.1745f - Mth.cos(limbSwing * 0.6662f) * 0.2f * limbSwingAmount / f - 0.1f * limbSwingAmount / f; + } + } } \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/mixin/AbstractArrowMixin.java b/src/main/java/elucent/eidolon/mixin/AbstractArrowMixin.java new file mode 100644 index 0000000..dfb5f2e --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/AbstractArrowMixin.java @@ -0,0 +1,17 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.EntityHitResult; + +@Mixin(AbstractArrow.class) +public interface AbstractArrowMixin { + @Invoker + ItemStack callGetPickupItem(); + + @Invoker + void callOnHitEntity(EntityHitResult result); +} diff --git a/src/main/java/elucent/eidolon/mixin/AbstractContainerMenuMixin.java b/src/main/java/elucent/eidolon/mixin/AbstractContainerMenuMixin.java new file mode 100644 index 0000000..d9467a1 --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/AbstractContainerMenuMixin.java @@ -0,0 +1,33 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMultimap; + +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; +import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.world.phys.EntityHitResult; + +@Mixin(AbstractContainerMenu.class) +public interface AbstractContainerMenuMixin { + @Accessor + public NonNullList getLastSlots(); + + @Accessor + public NonNullList getRemoteSlots(); + + @Invoker + public Slot callAddSlot(Slot slot); +} diff --git a/src/main/java/elucent/eidolon/mixin/LevelRendererMixin.java b/src/main/java/elucent/eidolon/mixin/LevelRendererMixin.java new file mode 100644 index 0000000..f872766 --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/LevelRendererMixin.java @@ -0,0 +1,29 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +import elucent.eidolon.ClientEvents; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource.BufferSource; + +@Mixin(LevelRenderer.class) +public class LevelRendererMixin { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/renderer/LevelRenderer;checkPoseStack(Lcom/mojang/blaze3d/vertex/PoseStack;)V", ordinal = 1)) + private void customRenderLevel(CallbackInfo ci) { + ClientEvents.getDelayedRender().endBatch(RenderUtil.VAPOR_TRANSLUCENT); + ClientEvents.getDelayedRender().endBatch(RenderUtil.GLOWING_BLOCK_PARTICLE); + } + +// @Inject(method = "renderLevel", at = @At(value = "INVOKE", +// target = "Lnet/minecraft/client/renderer/LevelRenderer;renderDebug(net/minecraft/client/Camera;)V", ordinal = 0)) +// private void customRenderLevel2(CallbackInfo ci) { +// ClientEvents.getDelayedRender().endBatch(RenderUtil.VAPOR_TRANSLUCENT); +// ClientEvents.getDelayedRender().endBatch(RenderUtil.GLOWING_BLOCK_PARTICLE); +// } +} diff --git a/src/main/java/elucent/eidolon/mixin/LivingEntityMixin.java b/src/main/java/elucent/eidolon/mixin/LivingEntityMixin.java index 81a298d..40194ef 100644 --- a/src/main/java/elucent/eidolon/mixin/LivingEntityMixin.java +++ b/src/main/java/elucent/eidolon/mixin/LivingEntityMixin.java @@ -1,37 +1,37 @@ package elucent.eidolon.mixin; -import elucent.eidolon.Registry; -import elucent.eidolon.event.SpeedFactorEvent; -import elucent.eidolon.item.ReaperScytheItem; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.IPacket; -import net.minecraft.util.DamageSource; -import net.minecraftforge.common.MinecraftForge; +import java.util.Optional; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.item.IWingsItem; +import net.minecraft.client.renderer.entity.player.PlayerRenderer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + @Mixin(LivingEntity.class) public class LivingEntityMixin { - @Inject(method = "getSpeedFactor()F", at = @At("RETURN"), cancellable = true) - private void customGetSpeedFactor(CallbackInfoReturnable cir) { - float factor = cir.getReturnValue(); - SpeedFactorEvent event = new SpeedFactorEvent((Entity)(Object)this, factor); - MinecraftForge.EVENT_BUS.post(event); - cir.setReturnValue(event.getSpeedFactor()); + @Inject(method = "getMobType", at = @At("HEAD"), cancellable = true) + public void getMobType(CallbackInfoReturnable ci) { + if (((LivingEntity)(Object)this).hasEffect(Registry.UNDEATH_EFFECT.get()) && !Eidolon.trueMobType) { + ci.setReturnValue(MobType.UNDEAD); + } } - @Inject(method = "dropLoot", at = @At("HEAD"), cancellable = true) - protected void customDropLoot(DamageSource source, boolean hitRecently, CallbackInfo ci) { - if (((LivingEntity)(Object)this).isEntityUndead() - && (source.getDamageType() == Registry.RITUAL_DAMAGE.getDamageType() - || source.getTrueSource() instanceof LivingEntity - && ((LivingEntity) source.getTrueSource()).getHeldItemMainhand().getItem() instanceof ReaperScytheItem)) { - ci.cancel(); - } + @Inject(method = "isFallFlying", at = @At("HEAD"), cancellable = true) + public void isFallFlying(CallbackInfoReturnable ci) { + if ((LivingEntity)(Object)this instanceof Player p) { + Optional opt = p.getCapability(IPlayerData.INSTANCE).resolve(); + if (opt.isPresent() && opt.get().isDashing(p)) ci.setReturnValue(true); + } } } diff --git a/src/main/java/elucent/eidolon/mixin/LocalPlayerMixin.java b/src/main/java/elucent/eidolon/mixin/LocalPlayerMixin.java new file mode 100644 index 0000000..ca0e671 --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/LocalPlayerMixin.java @@ -0,0 +1,30 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import elucent.eidolon.ClientEvents; +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.entity.player.PlayerRenderer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobType; + +@Mixin(LocalPlayer.class) +public class LocalPlayerMixin { + @Inject(method = "getJumpRidingScale", at = @At("HEAD"), cancellable = true) + public void getJumpRidingScale(CallbackInfoReturnable ci) { + if (ClientEvents.jumpTicks >= 5) + ci.setReturnValue((ClientEvents.jumpTicks - 5 + Minecraft.getInstance().getFrameTime()) / 15.0f); + } + + @Inject(method = "isRidingJumpable", at = @At("HEAD"), cancellable = true) + public void isRidingJumpable(CallbackInfoReturnable ci) { + if (ClientEvents.jumpTicks >= 5 && ClientEvents.isInGui) ci.setReturnValue(true); + } +} diff --git a/src/main/java/elucent/eidolon/mixin/PlayerRendererMixin.java b/src/main/java/elucent/eidolon/mixin/PlayerRendererMixin.java new file mode 100644 index 0000000..8800d3b --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/PlayerRendererMixin.java @@ -0,0 +1,17 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import elucent.eidolon.entity.RavenVariantLayer; +import net.minecraft.client.renderer.entity.player.PlayerRenderer; + +@Mixin(PlayerRenderer.class) +public class PlayerRendererMixin { + @Inject(method = "", at = @At("RETURN"), cancellable = true) + public void constructor(CallbackInfo ci) { + ((PlayerRenderer)(Object)this).addLayer(new RavenVariantLayer<>(((PlayerRenderer)(Object)this))); + } +} diff --git a/src/main/java/elucent/eidolon/mixin/PotionBrewingMixin.java b/src/main/java/elucent/eidolon/mixin/PotionBrewingMixin.java index 8544f15..4745978 100644 --- a/src/main/java/elucent/eidolon/mixin/PotionBrewingMixin.java +++ b/src/main/java/elucent/eidolon/mixin/PotionBrewingMixin.java @@ -1,13 +1,12 @@ package elucent.eidolon.mixin; -import net.minecraft.item.Item; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionBrewing; -import net.minecraft.world.server.ServerWorld; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.alchemy.Potion; +import net.minecraft.world.item.alchemy.PotionBrewing; + @Mixin(PotionBrewing.class) public interface PotionBrewingMixin { @Invoker diff --git a/src/main/java/elucent/eidolon/mixin/StructureSettingsMixin.java b/src/main/java/elucent/eidolon/mixin/StructureSettingsMixin.java new file mode 100644 index 0000000..4448bce --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/StructureSettingsMixin.java @@ -0,0 +1,21 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMultimap; + +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.StructureSettings; +import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; +import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.resources.ResourceKey; + +@Mixin(StructureSettings.class) +public interface StructureSettingsMixin { + @Accessor + public void setConfiguredStructures(ImmutableMap, ImmutableMultimap, ResourceKey>> configuredStructures); + + @Accessor + public ImmutableMap, ImmutableMultimap, ResourceKey>> getConfiguredStructures(); +} diff --git a/src/main/java/elucent/eidolon/mixin/ZombieVillagerEntityMixin.java b/src/main/java/elucent/eidolon/mixin/ZombieVillagerEntityMixin.java deleted file mode 100644 index df6a605..0000000 --- a/src/main/java/elucent/eidolon/mixin/ZombieVillagerEntityMixin.java +++ /dev/null @@ -1,14 +0,0 @@ -package elucent.eidolon.mixin; - -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.monster.ZombieVillagerEntity; -import net.minecraft.world.server.ServerWorld; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(ZombieVillagerEntity.class) -public interface ZombieVillagerEntityMixin { - @Invoker - void callCureZombie(ServerWorld world); -} diff --git a/src/main/java/elucent/eidolon/mixin/ZombieVillagerMixin.java b/src/main/java/elucent/eidolon/mixin/ZombieVillagerMixin.java new file mode 100644 index 0000000..30124d3 --- /dev/null +++ b/src/main/java/elucent/eidolon/mixin/ZombieVillagerMixin.java @@ -0,0 +1,13 @@ +package elucent.eidolon.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +import net.minecraft.world.entity.monster.ZombieVillager; +import net.minecraft.server.level.ServerLevel; + +@Mixin(ZombieVillager.class) +public interface ZombieVillagerMixin { + @Invoker + void callFinishConversion(ServerLevel world); +} diff --git a/src/main/java/elucent/eidolon/network/AttemptCastPacket.java b/src/main/java/elucent/eidolon/network/AttemptCastPacket.java index 79a4a6d..1fc6dcc 100644 --- a/src/main/java/elucent/eidolon/network/AttemptCastPacket.java +++ b/src/main/java/elucent/eidolon/network/AttemptCastPacket.java @@ -1,71 +1,66 @@ package elucent.eidolon.network; -import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; -import elucent.eidolon.capability.IKnowledge; -import elucent.eidolon.capability.KnowledgeProvider; -import elucent.eidolon.entity.ChantCasterEntity; -import elucent.eidolon.particle.Particles; -import elucent.eidolon.spell.Sign; -import elucent.eidolon.spell.Signs; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.function.Supplier; +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.entity.ChantCasterEntity; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.player.Player; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraft.world.level.Level; + public class AttemptCastPacket { - List signs = new ArrayList<>(); + List runes = new ArrayList<>(); UUID uuid; - public AttemptCastPacket(PlayerEntity player, List signs) { - this.signs.addAll(signs); - this.uuid = player.getUniqueID(); + public AttemptCastPacket(Player player, List runes) { + this.runes.addAll(runes); + this.uuid = player.getUUID(); } - public AttemptCastPacket(UUID uuid, List signs) { - this.signs.addAll(signs); + public AttemptCastPacket(UUID uuid, List runes) { + this.runes.addAll(runes); this.uuid = uuid; } - public static void encode(AttemptCastPacket object, PacketBuffer buffer) { - buffer.writeInt(object.signs.size()); - for (int i = 0; i < object.signs.size(); i ++) buffer.writeString(object.signs.get(i).getRegistryName().toString(), 255); - buffer.writeUniqueId(object.uuid); + public static void encode(AttemptCastPacket object, FriendlyByteBuf buffer) { + buffer.writeInt(object.runes.size()); + for (int i = 0; i < object.runes.size(); i ++) buffer.writeUtf(object.runes.get(i).getRegistryName().toString(), 255); + buffer.writeUUID(object.uuid); } - public static AttemptCastPacket decode(PacketBuffer buffer) { + public static AttemptCastPacket decode(FriendlyByteBuf buffer) { int n = buffer.readInt(); - List signs = new ArrayList<>(); - for (int i = 0; i < n; i ++) signs.add(Signs.find(new ResourceLocation(buffer.readString(255)))); - return new AttemptCastPacket(buffer.readUniqueId(), signs); + List runes = new ArrayList<>(); + for (int i = 0; i < n; i ++) runes.add(Runes.find(new ResourceLocation(buffer.readUtf(255)))); + return new AttemptCastPacket(buffer.readUUID(), runes); } public static void consume(AttemptCastPacket packet, Supplier ctx) { ctx.get().enqueueWork(() -> { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_SERVER; - World world = ctx.get().getSender().world; + Level world = ctx.get().getSender().level; if (world != null) { - PlayerEntity player = world.getPlayerByUuid(packet.uuid); + Player player = world.getPlayerByUUID(packet.uuid); if (player != null) { - List signs = packet.signs; - IKnowledge knowledge = player.getCapability(KnowledgeProvider.CAPABILITY, null).resolve().get(); - for (Sign sign : signs) if (!knowledge.knowsSign(sign)) return; - Vector3d placement = player.getPositionVec().add(0, player.getHeight() * 2 / 3, 0).add(player.getLookVec()); - ChantCasterEntity entity = new ChantCasterEntity(world, player, signs); - entity.setPosition(placement.x, placement.y, placement.z); - world.addEntity(entity); + List runes = packet.runes; + for (Rune rune : runes) if (!KnowledgeUtil.knowsRune(player, rune)) return; + Vec3 placement = player.position().add(0, player.getBbHeight() * 2 / 3, 0).add(player.getLookAngle().scale(0.5f)); + ChantCasterEntity entity = new ChantCasterEntity(world, player, runes, player.getLookAngle()); + entity.setPos(placement.x, placement.y, placement.z); + world.addFreshEntity(entity); } } }); diff --git a/src/main/java/elucent/eidolon/network/ChilledEffectPacket.java b/src/main/java/elucent/eidolon/network/ChilledEffectPacket.java index 6c62727..881085a 100644 --- a/src/main/java/elucent/eidolon/network/ChilledEffectPacket.java +++ b/src/main/java/elucent/eidolon/network/ChilledEffectPacket.java @@ -1,20 +1,19 @@ package elucent.eidolon.network; -import elucent.eidolon.Eidolon; -import net.minecraft.block.Blocks; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.PacketBuffer; -import net.minecraft.particles.BlockParticleData; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - import java.util.function.Supplier; +import elucent.eidolon.Eidolon; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraft.world.entity.player.Player; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; + public class ChilledEffectPacket { double x, y, z; @@ -24,13 +23,13 @@ public ChilledEffectPacket(double x, double y, double z) { this.z = z; } - public static void encode(ChilledEffectPacket object, PacketBuffer buffer) { + public static void encode(ChilledEffectPacket object, FriendlyByteBuf buffer) { buffer.writeDouble(object.x); buffer.writeDouble(object.y); buffer.writeDouble(object.z); } - public static ChilledEffectPacket decode(PacketBuffer buffer) { + public static ChilledEffectPacket decode(FriendlyByteBuf buffer) { return new ChilledEffectPacket(buffer.readDouble(), buffer.readDouble(), buffer.readDouble()); } @@ -38,15 +37,15 @@ public static void consume(ChilledEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - PlayerEntity player = Eidolon.proxy.getPlayer(); + Player player = Eidolon.proxy.getPlayer(); if (player != null) { - World world = player.world; - world.playSound(player, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.PLAYERS, 1.0f, 1.0f); + Level world = player.level; + world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.GLASS_BREAK, SoundSource.PLAYERS, 1.0f, 1.0f); for (int i = 0; i < 5; i ++) { world.addParticle( - new BlockParticleData(ParticleTypes.BLOCK, Blocks.ICE.getDefaultState()), + new BlockParticleOption(ParticleTypes.BLOCK, Blocks.ICE.defaultBlockState()), packet.x, packet.y, packet.z, - 0.05f * world.rand.nextGaussian(), 0.05f * world.rand.nextGaussian(), 0.05f * world.rand.nextGaussian() + 0.05f * world.random.nextGaussian(), 0.05f * world.random.nextGaussian(), 0.05f * world.random.nextGaussian() ); } } diff --git a/src/main/java/elucent/eidolon/network/CrucibleFailPacket.java b/src/main/java/elucent/eidolon/network/CrucibleFailPacket.java index 441c582..55fa66b 100644 --- a/src/main/java/elucent/eidolon/network/CrucibleFailPacket.java +++ b/src/main/java/elucent/eidolon/network/CrucibleFailPacket.java @@ -1,17 +1,19 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + -import java.util.function.Supplier; public class CrucibleFailPacket { BlockPos pos; @@ -20,11 +22,11 @@ public CrucibleFailPacket(BlockPos pos) { this.pos = pos; } - public static void encode(CrucibleFailPacket object, PacketBuffer buffer) { + public static void encode(CrucibleFailPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); } - public static CrucibleFailPacket decode(PacketBuffer buffer) { + public static CrucibleFailPacket decode(FriendlyByteBuf buffer) { return new CrucibleFailPacket(buffer.readBlockPos()); } @@ -32,11 +34,11 @@ public static void consume(CrucibleFailPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 0.625, z = pos.getZ() + 0.5; - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0f, 1.0f); Particles.create(Registry.SMOKE_PARTICLE) .setAlpha(0.125f, 0).setScale(0.3125f, 0.125f).setLifetime(40) diff --git a/src/main/java/elucent/eidolon/network/CrucibleSuccessPacket.java b/src/main/java/elucent/eidolon/network/CrucibleSuccessPacket.java index b7c54a6..5897797 100644 --- a/src/main/java/elucent/eidolon/network/CrucibleSuccessPacket.java +++ b/src/main/java/elucent/eidolon/network/CrucibleSuccessPacket.java @@ -1,17 +1,19 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + -import java.util.function.Supplier; public class CrucibleSuccessPacket { BlockPos pos; @@ -24,12 +26,12 @@ public CrucibleSuccessPacket(BlockPos pos, float r, float g, float b) { this.b = b; } - public static void encode(CrucibleSuccessPacket object, PacketBuffer buffer) { + public static void encode(CrucibleSuccessPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); buffer.writeFloat(object.r).writeFloat(object.g).writeFloat(object.b); } - public static CrucibleSuccessPacket decode(PacketBuffer buffer) { + public static CrucibleSuccessPacket decode(FriendlyByteBuf buffer) { return new CrucibleSuccessPacket(buffer.readBlockPos(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); } @@ -37,12 +39,12 @@ public static void consume(CrucibleSuccessPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 1, z = pos.getZ() + 0.5; - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 0.75f); - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.BLOCKS, 1.0f, 0.75f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0f, 0.75f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.PLAYER_LEVELUP, SoundSource.BLOCKS, 1.0f, 0.75f); Particles.create(Registry.STEAM_PARTICLE) .setAlpha(0.0625f, 0).setScale(0.375f, 0.125f).setLifetime(40) diff --git a/src/main/java/elucent/eidolon/network/CrystallizeEffectPacket.java b/src/main/java/elucent/eidolon/network/CrystallizeEffectPacket.java index 67ace2c..c04b1af 100644 --- a/src/main/java/elucent/eidolon/network/CrystallizeEffectPacket.java +++ b/src/main/java/elucent/eidolon/network/CrystallizeEffectPacket.java @@ -1,17 +1,17 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + -import java.util.function.Supplier; public class CrystallizeEffectPacket { BlockPos pos; @@ -20,11 +20,11 @@ public CrystallizeEffectPacket(BlockPos pos) { this.pos = pos; } - public static void encode(CrystallizeEffectPacket object, PacketBuffer buffer) { + public static void encode(CrystallizeEffectPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); } - public static CrystallizeEffectPacket decode(PacketBuffer buffer) { + public static CrystallizeEffectPacket decode(FriendlyByteBuf buffer) { return new CrystallizeEffectPacket(buffer.readBlockPos()); } @@ -32,7 +32,7 @@ public static void consume(CrystallizeEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 0.1, z = pos.getZ() + 0.5; diff --git a/src/main/java/elucent/eidolon/network/DeathbringerSlashEffectPacket.java b/src/main/java/elucent/eidolon/network/DeathbringerSlashEffectPacket.java new file mode 100644 index 0000000..407f1ce --- /dev/null +++ b/src/main/java/elucent/eidolon/network/DeathbringerSlashEffectPacket.java @@ -0,0 +1,153 @@ +package elucent.eidolon.network; + +import java.util.function.Supplier; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.particle.Particles; +import elucent.eidolon.particle.SlashParticleData; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.Mth; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + +public class DeathbringerSlashEffectPacket { + float x1, y1, z1, x2, y2, z2; + int c1, c2, c3, c4; + + public DeathbringerSlashEffectPacket(double x1, double y1, double z1, double x2, double y2, double z2, int color1, int color2, int color3, int color4) { + this.x1 = (float)x1; + this.y1 = (float)y1; + this.z1 = (float)z1; + this.x2 = (float)x2; + this.y2 = (float)y2; + this.z2 = (float)z2; + this.c1 = color1; + this.c2 = color2; + this.c3 = color3; + this.c4 = color4; + } + + public static void encode(DeathbringerSlashEffectPacket object, FriendlyByteBuf buffer) { + buffer.writeFloat(object.x1).writeFloat(object.y1).writeFloat(object.z1); + buffer.writeFloat(object.x2).writeFloat(object.y2).writeFloat(object.z2); + buffer.writeInt(object.c1).writeInt(object.c2).writeInt(object.c3).writeInt(object.c4); + } + + public static DeathbringerSlashEffectPacket decode(FriendlyByteBuf buffer) { + return new DeathbringerSlashEffectPacket(buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), + buffer.readInt(), buffer.readInt(), buffer.readInt(), buffer.readInt()); + } + + public static void consume(DeathbringerSlashEffectPacket packet, Supplier ctx) { + ctx.get().enqueueWork(() -> { + assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; + + Level world = Eidolon.proxy.getWorld(); + if (world != null) { + double x = packet.x2, y = packet.y2, z = packet.z2; + + float r1 = ColorUtil.getRed(packet.c1) / 255.0f, g1 = ColorUtil.getGreen(packet.c1) / 255.0f, b1 = ColorUtil.getBlue(packet.c1) / 255.0f; + float r2 = ColorUtil.getRed(packet.c2) / 255.0f, g2 = ColorUtil.getGreen(packet.c2) / 255.0f, b2 = ColorUtil.getBlue(packet.c2) / 255.0f; + + float roll = Mth.PI / 6 - world.random.nextFloat() * (Mth.PI * 7 / 6); + float scale = 1.0f + world.random.nextFloat() * 0.2f; + + Vec3 horiz = new Vec3(x - packet.x1, 0, z - packet.z1); + float yaw = (float)Mth.atan2(x - packet.x1, z - packet.z1); + float pitch = (float)Mth.atan2(y - packet.y1, horiz.length()); + float right = yaw + Mth.PI / 2, up = pitch + Mth.PI / 2; + float sy = Mth.sin(yaw), cy = Mth.cos(yaw), sp = Mth.sin(pitch), cp = Mth.cos(pitch); + float sr = Mth.sin(right), cr = Mth.cos(right), su = Mth.sin(up), cu = Mth.cos(up); + float r = 0.5f; + float xax = r * sr * cp, xay = 0, xaz = r * cr * cp; + float yax = r * sy * cu, yay = r * su, yaz = r * cy * cu; + float zax = r * sy * cp, zay = r * sp, zaz = r * cy * cp; + float cro = Mth.cos(roll), sro = Mth.sin(roll); + float nxax = xax * cro - yax * sro; + float nxay = xay * cro - yay * sro; + float nxaz = xaz * cro - yaz * sro; + yax = xax * sro + yax * cro; + yay = xay * sro + yay * cro; + yaz = xaz * sro + yaz * cro; + xax = nxax; + xay = nxay; + xaz = nxaz; + for (float i = 0; i < 6; i ++) { + float c1 = (i + 0.5f) / 6; + float angle = -75 + c1 * 150; + float sa = Mth.sin(Mth.DEG_TO_RAD * angle), ca = Mth.cos(Mth.DEG_TO_RAD * angle); + float dx = sa * xax + ca * zax, dy = sa * xay + ca * zay, dz = sa * xaz + ca * zaz; + Particles.create(Registry.SMOKE_PARTICLE) + .randomVelocity(0.025f) + .addVelocity(dx * 0.25f, dy * 0.25f, dz * 0.25f) + .setColor(33.0f/255, 26.0f/255, 23.0f/255, 0.125f, 10.0f/255, 10.0f/255, 12.0f/255, 0) + .randomOffset(0.1f) + .setScale(0.375f, 0.125f) + .repeat(world, x - sy * cp + dx, y - sp + dy, z - cy * cp + dz, 4); + } + + SlashParticleData.create(Registry.GLOWING_SLASH_PARTICLE.get()) + .lookat(packet.x1, packet.y1, packet.z1, x, y, z) + .color(r1, g1, b1, r2, g2, b2) + .radius(0.9f * scale) + .angle(250) + .width(1f * scale) + .roll(roll) + .lifetime(11) + .spawn(world, x, y, z, 0, 0, 0); + + SlashParticleData.create(Registry.GLOWING_SLASH_PARTICLE.get()) + .lookat(packet.x1, packet.y1, packet.z1, x, y, z) + .color(r1, g1, b1, r2, g2, b2) + .radius(0.8f * scale) + .angle(250) + .width(0.75f * scale) + .roll(roll) + .lifetime(11) + .spawn(world, x, y, z, 0, 0, 0); + + SlashParticleData.create(Registry.GLOWING_SLASH_PARTICLE.get()) + .lookat(packet.x1, packet.y1, packet.z1, x, y, z) + .color(r1, g1, b1, r2, g2, b2) + .radius(0.7f * scale) + .angle(250) + .width(0.5f * scale) + .roll(roll) + .lifetime(13) + .spawn(world, x, y, z, 0, 0, 0); + + r1 = ColorUtil.getRed(packet.c3) / 255.0f; g1 = ColorUtil.getGreen(packet.c3) / 255.0f; b1 = ColorUtil.getBlue(packet.c3) / 255.0f; + r2 = ColorUtil.getRed(packet.c4) / 255.0f; g2 = ColorUtil.getGreen(packet.c4) / 255.0f; b2 = ColorUtil.getBlue(packet.c4) / 255.0f; + + SlashParticleData.create(Registry.GLOWING_SLASH_PARTICLE.get()) + .lookat(packet.x1, packet.y1, packet.z1, x, y, z) + .color(r1, g1, b1, r2, g2, b2) + .radius(0.8f * scale) + .angle(210) + .width(0.625f * scale) + .highlight(0.75f) + .alpha(0.75f, 0) + .roll(roll) + .lifetime(8) + .spawn(world, x, y, z, 0, 0, 0); + + SlashParticleData.create(Registry.GLOWING_SLASH_PARTICLE.get()) + .lookat(packet.x1, packet.y1, packet.z1, x, y, z) + .color(r1, g1, b1, r2, g2, b2) + .radius(0.9f * scale) + .angle(210) + .width(0.25f * scale) + .highlight(0.625f) + .roll(roll) + .lifetime(10) + .spawn(world, x, y, z, 0, 0, 0); + } + }); + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/elucent/eidolon/network/ExtinguishEffectPacket.java b/src/main/java/elucent/eidolon/network/ExtinguishEffectPacket.java index ddcfd70..430967d 100644 --- a/src/main/java/elucent/eidolon/network/ExtinguishEffectPacket.java +++ b/src/main/java/elucent/eidolon/network/ExtinguishEffectPacket.java @@ -1,17 +1,17 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.function.Supplier; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; public class ExtinguishEffectPacket { BlockPos pos; @@ -20,11 +20,11 @@ public ExtinguishEffectPacket(BlockPos pos) { this.pos = pos; } - public static void encode(ExtinguishEffectPacket object, PacketBuffer buffer) { + public static void encode(ExtinguishEffectPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); } - public static ExtinguishEffectPacket decode(PacketBuffer buffer) { + public static ExtinguishEffectPacket decode(FriendlyByteBuf buffer) { return new ExtinguishEffectPacket(buffer.readBlockPos()); } @@ -32,11 +32,11 @@ public static void consume(ExtinguishEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 1, z = pos.getZ() + 0.5; - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0f, 1.0f); Particles.create(Registry.SMOKE_PARTICLE) .setAlpha(0.125f, 0).setScale(0.3125f, 0.125f).setLifetime(80) diff --git a/src/main/java/elucent/eidolon/network/FlameEffectPacket.java b/src/main/java/elucent/eidolon/network/FlameEffectPacket.java index 9595976..14198af 100644 --- a/src/main/java/elucent/eidolon/network/FlameEffectPacket.java +++ b/src/main/java/elucent/eidolon/network/FlameEffectPacket.java @@ -1,17 +1,17 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.function.Supplier; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; public class FlameEffectPacket { BlockPos pos; @@ -24,12 +24,12 @@ public FlameEffectPacket(BlockPos pos, float r, float g, float b) { this.b = b; } - public static void encode(FlameEffectPacket object, PacketBuffer buffer) { + public static void encode(FlameEffectPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); buffer.writeFloat(object.r).writeFloat(object.g).writeFloat(object.b); } - public static FlameEffectPacket decode(PacketBuffer buffer) { + public static FlameEffectPacket decode(FriendlyByteBuf buffer) { return new FlameEffectPacket(buffer.readBlockPos(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); } @@ -37,11 +37,11 @@ public static void consume(FlameEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 1, z = pos.getZ() + 0.5; - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.ENTITY_BLAZE_SHOOT, SoundCategory.BLOCKS, 1.0f, 0.75f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.BLAZE_SHOOT, SoundSource.BLOCKS, 1.0f, 0.75f); Particles.create(Registry.FLAME_PARTICLE) .setAlpha(0.75f, 0).setScale(0.5f, 0.25f).setLifetime(40) @@ -55,7 +55,7 @@ public static void consume(FlameEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 1, z = pos.getZ() + 0.5; - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0f, 1.0f); Particles.create(Registry.FLAME_PARTICLE) .setAlpha(0.75f, 0).setScale(0.5f, 0.25f).setLifetime(20) @@ -55,7 +55,7 @@ public static void consume(IgniteEffectPacket packet, Supplier { - this.tag = (CompoundNBT)KnowledgeProvider.CAPABILITY.getStorage().writeNBT(KnowledgeProvider.CAPABILITY, k, null); + public KnowledgeUpdatePacket(Player entity, boolean playSound) { + this.uuid = entity.getUUID(); + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + this.tag = ((INBTSerializable)k).serializeNBT(); }); this.playSound = playSound; } - public static void encode(KnowledgeUpdatePacket object, PacketBuffer buffer) { - buffer.writeUniqueId(object.uuid); - buffer.writeCompoundTag(object.tag); + public static void encode(KnowledgeUpdatePacket object, FriendlyByteBuf buffer) { + buffer.writeUUID(object.uuid); + buffer.writeNbt(object.tag); buffer.writeBoolean(object.playSound); } - public static KnowledgeUpdatePacket decode(PacketBuffer buffer) { - return new KnowledgeUpdatePacket(buffer.readUniqueId(), buffer.readCompoundTag(), buffer.readBoolean()); + public static KnowledgeUpdatePacket decode(FriendlyByteBuf buffer) { + return new KnowledgeUpdatePacket(buffer.readUUID(), buffer.readNbt(), buffer.readBoolean()); } public static void consume(KnowledgeUpdatePacket packet, Supplier ctx) { ctx.get().enqueueWork(() -> { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); - PlayerEntity player = world.getPlayerByUuid(packet.uuid); + Level world = Eidolon.proxy.getWorld(); + Player player = world.getPlayerByUUID(packet.uuid); if (player != null) { - player.getCapability(KnowledgeProvider.CAPABILITY, null).ifPresent((k) -> { - KnowledgeProvider.CAPABILITY.getStorage().readNBT(KnowledgeProvider.CAPABILITY, k, null, packet.tag); - if (packet.playSound) player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.0f, 0.5f); + player.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + ((INBTSerializable)k).deserializeNBT(packet.tag); + if (packet.playSound) player.playSound(SoundEvents.PLAYER_LEVELUP, 1.0f, 0.5f); }); } }); diff --git a/src/main/java/elucent/eidolon/network/LifestealEffectPacket.java b/src/main/java/elucent/eidolon/network/LifestealEffectPacket.java index 20f976a..dce6447 100644 --- a/src/main/java/elucent/eidolon/network/LifestealEffectPacket.java +++ b/src/main/java/elucent/eidolon/network/LifestealEffectPacket.java @@ -1,17 +1,15 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.function.Supplier; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; public class LifestealEffectPacket { BlockPos src, dst; @@ -25,12 +23,12 @@ public LifestealEffectPacket(BlockPos src, BlockPos dst, float r, float g, float this.b = b; } - public static void encode(LifestealEffectPacket object, PacketBuffer buffer) { + public static void encode(LifestealEffectPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.src).writeBlockPos(object.dst); buffer.writeFloat(object.r).writeFloat(object.g).writeFloat(object.b); } - public static LifestealEffectPacket decode(PacketBuffer buffer) { + public static LifestealEffectPacket decode(FriendlyByteBuf buffer) { return new LifestealEffectPacket(buffer.readBlockPos(), buffer.readBlockPos(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); } @@ -38,12 +36,12 @@ public static void consume(LifestealEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos src = packet.src, dst = packet.dst; for (int i = 0; i < 10; i ++) { Particles.create(Registry.LINE_WISP_PARTICLE) - .setAlpha(0.75f, 0).setScale(0.25f + 0.125f * world.rand.nextFloat(), 0).setLifetime(16 + world.rand.nextInt(4)) + .setAlpha(0.75f, 0).setScale(0.25f + 0.125f * world.random.nextFloat(), 0).setLifetime(16 + world.random.nextInt(4)) .randomOffset(0.375, 0.375).randomVelocity(0.125, 0.125) .addVelocity(dst.getX() + 0.5, dst.getY() + 0.5, dst.getZ() + 0.5) .setColor(packet.r, packet.g, packet.b, packet.r, packet.g * 0.5f, packet.b * 1.5f) diff --git a/src/main/java/elucent/eidolon/network/MagicBurstEffectPacket.java b/src/main/java/elucent/eidolon/network/MagicBurstEffectPacket.java index e677782..ad8a2d4 100644 --- a/src/main/java/elucent/eidolon/network/MagicBurstEffectPacket.java +++ b/src/main/java/elucent/eidolon/network/MagicBurstEffectPacket.java @@ -1,16 +1,16 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; import elucent.eidolon.util.ColorUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.function.Supplier; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; public class MagicBurstEffectPacket { float x, y, z; @@ -28,12 +28,12 @@ public MagicBurstEffectPacket(double x, double y, double z, int color1, int colo this.c2 = color2; } - public static void encode(MagicBurstEffectPacket object, PacketBuffer buffer) { + public static void encode(MagicBurstEffectPacket object, FriendlyByteBuf buffer) { buffer.writeFloat(object.x).writeFloat(object.y).writeFloat(object.z); buffer.writeInt(object.c1).writeInt(object.c2); } - public static MagicBurstEffectPacket decode(PacketBuffer buffer) { + public static MagicBurstEffectPacket decode(FriendlyByteBuf buffer) { return new MagicBurstEffectPacket(buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readInt(), buffer.readInt()); } @@ -41,7 +41,7 @@ public static void consume(MagicBurstEffectPacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { double x = packet.x, y = packet.y, z = packet.z; @@ -58,7 +58,7 @@ public static void consume(MagicBurstEffectPacket packet, Supplier void sendToDimension(World world, MSG msg, RegistryKey dimension) { + public static void sendToDimension(Level world, MSG msg, ResourceKey dimension) { Networking.INSTANCE.send(PacketDistributor.DIMENSION.with(() -> dimension), msg); } - public static void sendToTracking(World world, BlockPos pos, MSG msg) { + public static void sendToTracking(Level world, BlockPos pos, MSG msg) { Networking.INSTANCE.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), msg); } - public static void sendTo(PlayerEntity entity, MSG msg) { - Networking.INSTANCE.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity)entity), msg); + public static void sendTo(Player entity, MSG msg) { + Networking.INSTANCE.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer)entity), msg); } public static void sendToServer(MSG msg) { diff --git a/src/main/java/elucent/eidolon/network/ResearchActionPacket.java b/src/main/java/elucent/eidolon/network/ResearchActionPacket.java new file mode 100644 index 0000000..183ffa3 --- /dev/null +++ b/src/main/java/elucent/eidolon/network/ResearchActionPacket.java @@ -0,0 +1,68 @@ +package elucent.eidolon.network; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Supplier; + +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.entity.ChantCasterEntity; +import elucent.eidolon.gui.ResearchTableContainer; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraft.world.level.Level; + +public class ResearchActionPacket { + public static enum Action { + SUBMIT_GOAL, STAMP + } + Action action; + int index; + + public ResearchActionPacket(Action action, int index) { + this.action = action; + this.index = index; + } + + public ResearchActionPacket(Action action) { + this(action, 0); + } + + public static void encode(ResearchActionPacket object, FriendlyByteBuf buffer) { + buffer.writeInt(object.action.ordinal()); + buffer.writeInt(object.index); + } + + public static ResearchActionPacket decode(FriendlyByteBuf buffer) { + Action action = Action.values()[buffer.readInt()]; + int index = buffer.readInt(); + return new ResearchActionPacket(action, index); + } + + public static void consume(ResearchActionPacket packet, Supplier ctx) { + ctx.get().enqueueWork(() -> { + assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_SERVER; + + ServerPlayer player = ctx.get().getSender(); + AbstractContainerMenu menu = player.containerMenu; + Level world = ctx.get().getSender().level; + if (world != null && menu instanceof ResearchTableContainer rc) { + if (packet.action == Action.SUBMIT_GOAL) { + rc.trySubmitGoal(player, packet.index); + } + else if (packet.action == Action.STAMP) { + rc.tryStamp(player); + } + } + }); + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/elucent/eidolon/network/RitualCompletePacket.java b/src/main/java/elucent/eidolon/network/RitualCompletePacket.java index 2396158..fcdcc28 100644 --- a/src/main/java/elucent/eidolon/network/RitualCompletePacket.java +++ b/src/main/java/elucent/eidolon/network/RitualCompletePacket.java @@ -1,17 +1,19 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.particle.Particles; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + -import java.util.function.Supplier; public class RitualCompletePacket { BlockPos pos; @@ -24,12 +26,12 @@ public RitualCompletePacket(BlockPos pos, float r, float g, float b) { this.b = b; } - public static void encode(RitualCompletePacket object, PacketBuffer buffer) { + public static void encode(RitualCompletePacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); buffer.writeFloat(object.r).writeFloat(object.g).writeFloat(object.b); } - public static RitualCompletePacket decode(PacketBuffer buffer) { + public static RitualCompletePacket decode(FriendlyByteBuf buffer) { return new RitualCompletePacket(buffer.readBlockPos(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); } @@ -37,11 +39,11 @@ public static void consume(RitualCompletePacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos pos = packet.pos; double x = pos.getX() + 0.5, y = pos.getY() + 1, z = pos.getZ() + 0.5; - world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(Eidolon.proxy.getPlayer(), x, y, z, SoundEvents.PLAYER_LEVELUP, SoundSource.BLOCKS, 1.0f, 1.0f); Particles.create(Registry.FLAME_PARTICLE) .setAlpha(0.75f, 0).setScale(0.5f, 0.25f).setLifetime(40) @@ -55,7 +57,7 @@ public static void consume(RitualCompletePacket packet, Supplier { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { BlockPos src = packet.src, dst = packet.dst; - world.playSound(Eidolon.proxy.getPlayer(), src.getX() + 0.5, src.getY() + 0.5, src.getZ() + 0.5, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(Eidolon.proxy.getPlayer(), src.getX() + 0.5, src.getY() + 0.5, src.getZ() + 0.5, SoundEvents.ITEM_PICKUP, SoundSource.BLOCKS, 1.0f, 1.0f); for (int i = 0; i < 10; i ++) { Particles.create(Registry.LINE_WISP_PARTICLE) - .setAlpha(0.75f, 0).setScale(0.25f + 0.125f * world.rand.nextFloat(), 0).setLifetime(16 + world.rand.nextInt(4)) + .setAlpha(0.75f, 0).setScale(0.25f + 0.125f * world.random.nextFloat(), 0).setLifetime(16 + world.random.nextInt(4)) .randomOffset(0.375, 0.375).randomVelocity(0.125, 0.125) .addVelocity(dst.getX() + 0.5, dst.getY() + 1, dst.getZ() + 0.5) .setColor(packet.r, packet.g, packet.b, packet.r, packet.g * 0.5f, packet.b * 1.5f) diff --git a/src/main/java/elucent/eidolon/network/SoulUpdatePacket.java b/src/main/java/elucent/eidolon/network/SoulUpdatePacket.java new file mode 100644 index 0000000..50c9f9a --- /dev/null +++ b/src/main/java/elucent/eidolon/network/SoulUpdatePacket.java @@ -0,0 +1,82 @@ +package elucent.eidolon.network; + +import java.util.UUID; +import java.util.function.Supplier; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.capability.ISoul; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + +public class SoulUpdatePacket { + boolean isPlayer; + UUID uuid; + int id; + CompoundTag tag; + + public SoulUpdatePacket(int id, CompoundTag tag) { + this.isPlayer = false; + this.id = id; + this.tag = tag; + } + + public SoulUpdatePacket(UUID uuid, CompoundTag tag) { + this.isPlayer = true; + this.uuid = uuid; + this.tag = tag; + } + + public SoulUpdatePacket(LivingEntity entity) { + this.isPlayer = entity instanceof Player; + if (isPlayer) this.uuid = entity.getUUID(); + else this.id = entity.getId(); + entity.getCapability(ISoul.INSTANCE, null).ifPresent((k) -> { + this.tag = ((INBTSerializable)k).serializeNBT(); + }); + } + + public SoulUpdatePacket(Player entity) { + this.isPlayer = true; + this.uuid = entity.getUUID(); + entity.getCapability(ISoul.INSTANCE, null).ifPresent((k) -> { + this.tag = ((INBTSerializable)k).serializeNBT(); + }); + } + + public static void encode(SoulUpdatePacket object, FriendlyByteBuf buffer) { + buffer.writeBoolean(object.isPlayer); + if (object.isPlayer) buffer.writeUUID(object.uuid); + else buffer.writeInt(object.id); + buffer.writeNbt(object.tag); + } + + public static SoulUpdatePacket decode(FriendlyByteBuf buffer) { + if (buffer.readBoolean()) { + return new SoulUpdatePacket(buffer.readUUID(), buffer.readNbt()); + } + else return new SoulUpdatePacket(buffer.readInt(), buffer.readNbt()); + } + + public static void consume(SoulUpdatePacket packet, Supplier ctx) { + ctx.get().enqueueWork(() -> { + assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; + + Level world = Eidolon.proxy.getWorld(); + LivingEntity e = packet.isPlayer ? world.getPlayerByUUID(packet.uuid) : (LivingEntity)world.getEntity(packet.id); + if (e != null) { + e.getCapability(ISoul.INSTANCE, null).ifPresent((k) -> { + ((INBTSerializable)k).deserializeNBT(packet.tag); + }); + } + }); + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/elucent/eidolon/network/SpellCastPacket.java b/src/main/java/elucent/eidolon/network/SpellCastPacket.java index 553b25a..2a1d2f0 100644 --- a/src/main/java/elucent/eidolon/network/SpellCastPacket.java +++ b/src/main/java/elucent/eidolon/network/SpellCastPacket.java @@ -1,72 +1,66 @@ package elucent.eidolon.network; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; -import elucent.eidolon.capability.IKnowledge; -import elucent.eidolon.capability.KnowledgeProvider; -import elucent.eidolon.entity.ChantCasterEntity; import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.SignSequence; import elucent.eidolon.spell.Signs; import elucent.eidolon.spell.Spell; import elucent.eidolon.spell.Spells; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.function.Supplier; +import net.minecraft.world.entity.player.Player; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; public class SpellCastPacket { - List signs = new ArrayList<>(); + SignSequence seq; Spell spell; BlockPos pos; UUID uuid; - public SpellCastPacket(PlayerEntity player, BlockPos pos, Spell spell, List signs) { - this.signs.addAll(signs); + public SpellCastPacket(Player player, BlockPos pos, Spell spell, SignSequence seq) { + this.seq = seq; this.pos = pos; this.spell = spell; - this.uuid = player.getUniqueID(); + this.uuid = player.getUUID(); } - public SpellCastPacket(UUID uuid, BlockPos pos, ResourceLocation location, List signs) { - this.signs.addAll(signs); + public SpellCastPacket(UUID uuid, BlockPos pos, ResourceLocation location, SignSequence seq) { + this.seq = seq; this.pos = pos; this.spell = Spells.find(location); this.uuid = uuid; } - public static void encode(SpellCastPacket object, PacketBuffer buffer) { - buffer.writeString(object.spell.getRegistryName().toString()); - buffer.writeInt(object.signs.size()); - for (int i = 0; i < object.signs.size(); i ++) buffer.writeString(object.signs.get(i).getRegistryName().toString()); - buffer.writeUniqueId(object.uuid); + public static void encode(SpellCastPacket object, FriendlyByteBuf buffer) { + buffer.writeUtf(object.spell.getRegistryName().toString()); + buffer.writeNbt(object.seq.serializeNbt()); + buffer.writeUUID(object.uuid); buffer.writeBlockPos(object.pos); } - public static SpellCastPacket decode(PacketBuffer buffer) { - ResourceLocation spell = new ResourceLocation(buffer.readString()); - int n = buffer.readInt(); - List signs = new ArrayList<>(); - for (int i = 0; i < n; i ++) signs.add(Signs.find(new ResourceLocation(buffer.readString()))); - return new SpellCastPacket(buffer.readUniqueId(), buffer.readBlockPos(), spell, signs); + public static SpellCastPacket decode(FriendlyByteBuf buffer) { + ResourceLocation spell = new ResourceLocation(buffer.readUtf()); + SignSequence seq = SignSequence.deserializeNbt(buffer.readNbt()); + return new SpellCastPacket(buffer.readUUID(), buffer.readBlockPos(), spell, seq); } public static void consume(SpellCastPacket packet, Supplier ctx) { ctx.get().enqueueWork(() -> { assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; - World world = Eidolon.proxy.getWorld(); + Level world = Eidolon.proxy.getWorld(); if (world != null) { - PlayerEntity player = world.getPlayerByUuid(packet.uuid); + Player player = world.getPlayerByUUID(packet.uuid); if (player != null) { - List signs = packet.signs; + SignSequence signs = packet.seq; packet.spell.cast(world, packet.pos, player, signs); } } diff --git a/src/main/java/elucent/eidolon/network/TESyncPacket.java b/src/main/java/elucent/eidolon/network/TESyncPacket.java index 2daa579..b191b1c 100644 --- a/src/main/java/elucent/eidolon/network/TESyncPacket.java +++ b/src/main/java/elucent/eidolon/network/TESyncPacket.java @@ -1,53 +1,51 @@ package elucent.eidolon.network; +import java.util.function.Supplier; + import elucent.eidolon.Eidolon; -import net.minecraft.block.Blocks; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.particles.BlockParticleData; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkDirection; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + -import java.util.function.Supplier; public class TESyncPacket { BlockPos pos; - CompoundNBT tag; + CompoundTag tag; - public TESyncPacket(BlockPos pos, CompoundNBT tag) { + public TESyncPacket(BlockPos pos, CompoundTag tag) { this.pos = pos; this.tag = tag; } - public static void encode(TESyncPacket object, PacketBuffer buffer) { + public static void encode(TESyncPacket object, FriendlyByteBuf buffer) { buffer.writeBlockPos(object.pos); - buffer.writeCompoundTag(object.tag); + buffer.writeNbt(object.tag); } - public static TESyncPacket decode(PacketBuffer buffer) { - return new TESyncPacket(buffer.readBlockPos(), buffer.readCompoundTag()); + public static TESyncPacket decode(FriendlyByteBuf buffer) { + return new TESyncPacket(buffer.readBlockPos(), buffer.readNbt()); } public static void consume(TESyncPacket packet, Supplier ctx) { ctx.get().enqueueWork(() -> { - World world; + Level world; if (ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT) world = Eidolon.proxy.getWorld(); else { if (ctx.get().getSender() == null) return; - world = ctx.get().getSender().world; + world = ctx.get().getSender().level; } - world.getTileEntity(packet.pos).read(world.getBlockState(packet.pos), packet.tag); - world.getTileEntity(packet.pos).markDirty(); + BlockEntity t = world.getBlockEntity(packet.pos); + if (t != null) { + world.getBlockEntity(packet.pos).load(packet.tag); + world.getBlockEntity(packet.pos).setChanged(); + } }); ctx.get().setPacketHandled(true); } diff --git a/src/main/java/elucent/eidolon/network/WingsDashPacket.java b/src/main/java/elucent/eidolon/network/WingsDashPacket.java new file mode 100644 index 0000000..351a86e --- /dev/null +++ b/src/main/java/elucent/eidolon/network/WingsDashPacket.java @@ -0,0 +1,61 @@ +package elucent.eidolon.network; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Supplier; + +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.entity.ChantCasterEntity; +import elucent.eidolon.item.IWingsItem; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraft.world.level.Level; + +public class WingsDashPacket { + UUID uuid; + + public WingsDashPacket(Player player) { + this.uuid = player.getUUID(); + } + + public WingsDashPacket(UUID uuid) { + this.uuid = uuid; + } + + public static void encode(WingsDashPacket object, FriendlyByteBuf buffer) { + buffer.writeUUID(object.uuid); + } + + public static WingsDashPacket decode(FriendlyByteBuf buffer) { + return new WingsDashPacket(buffer.readUUID()); + } + + public static void consume(WingsDashPacket packet, Supplier ctx) { + ctx.get().enqueueWork(() -> { + assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_SERVER; + + Level world = ctx.get().getSender().level; + if (world != null) { + Player player = world.getPlayerByUUID(packet.uuid); + if (player != null) { + player.getCapability(IPlayerData.INSTANCE).ifPresent((d) -> { + d.tryDash(player); + }); + } + } + }); + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/elucent/eidolon/network/WingsDataUpdatePacket.java b/src/main/java/elucent/eidolon/network/WingsDataUpdatePacket.java new file mode 100644 index 0000000..ded5db0 --- /dev/null +++ b/src/main/java/elucent/eidolon/network/WingsDataUpdatePacket.java @@ -0,0 +1,71 @@ +package elucent.eidolon.network; + +import java.util.UUID; +import java.util.function.Supplier; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.capability.ISoul; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; + +public class WingsDataUpdatePacket { + UUID uuid; + long lastFlapTime; + int dashTicks; + boolean isFlying; + + public WingsDataUpdatePacket(Player player) { + this.uuid = player.getUUID(); + player.getCapability(IPlayerData.INSTANCE).ifPresent((d) -> { + lastFlapTime = d.getLastFlapTime(player); + dashTicks = d.getDashTicks(player); + isFlying = d.isFlying(player); + }); + } + + public WingsDataUpdatePacket(UUID uuid, long lastFlapTime, int dashTicks, boolean isFlying) { + this.uuid = uuid; + this.lastFlapTime = lastFlapTime; + this.dashTicks = dashTicks; + this.isFlying = isFlying; + } + + public static void encode(WingsDataUpdatePacket object, FriendlyByteBuf buffer) { + buffer.writeUUID(object.uuid); + buffer.writeLong(object.lastFlapTime); + buffer.writeInt(object.dashTicks); + buffer.writeBoolean(object.isFlying); + } + + public static WingsDataUpdatePacket decode(FriendlyByteBuf buffer) { + return new WingsDataUpdatePacket(buffer.readUUID(), buffer.readLong(), buffer.readInt(), buffer.readBoolean()); + } + + public static void consume(WingsDataUpdatePacket packet, Supplier ctx) { + ctx.get().enqueueWork(() -> { + assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT; + + Level world = Eidolon.proxy.getWorld(); + Player p = world.getPlayerByUUID(packet.uuid); + if (p != null && p != Minecraft.getInstance().player) { + p.getCapability(IPlayerData.INSTANCE, null).ifPresent((d) -> { + if (packet.isFlying && !d.isFlying(p)) d.startFlying(p); + else if (!packet.isFlying && d.isFlying(p)) d.stopFlying(p); + d.setLastFlapTime(packet.lastFlapTime); + d.setDashTicks(packet.dashTicks); + }); + } + }); + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/elucent/eidolon/network/WingsFlapPacket.java b/src/main/java/elucent/eidolon/network/WingsFlapPacket.java new file mode 100644 index 0000000..f86941f --- /dev/null +++ b/src/main/java/elucent/eidolon/network/WingsFlapPacket.java @@ -0,0 +1,61 @@ +package elucent.eidolon.network; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Supplier; + +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.capability.IPlayerData; +import elucent.eidolon.entity.ChantCasterEntity; +import elucent.eidolon.item.IWingsItem; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import elucent.eidolon.util.KnowledgeUtil; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraft.world.level.Level; + +public class WingsFlapPacket { + UUID uuid; + + public WingsFlapPacket(Player player) { + this.uuid = player.getUUID(); + } + + public WingsFlapPacket(UUID uuid) { + this.uuid = uuid; + } + + public static void encode(WingsFlapPacket object, FriendlyByteBuf buffer) { + buffer.writeUUID(object.uuid); + } + + public static WingsFlapPacket decode(FriendlyByteBuf buffer) { + return new WingsFlapPacket(buffer.readUUID()); + } + + public static void consume(WingsFlapPacket packet, Supplier ctx) { + ctx.get().enqueueWork(() -> { + assert ctx.get().getDirection() == NetworkDirection.PLAY_TO_SERVER; + + Level world = ctx.get().getSender().level; + if (world != null) { + Player player = world.getPlayerByUUID(packet.uuid); + if (player != null) { + player.getCapability(IPlayerData.INSTANCE).ifPresent((d) -> { + d.tryFlapWings(player); + }); + } + } + }); + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/elucent/eidolon/particle/BubbleParticle.java b/src/main/java/elucent/eidolon/particle/BubbleParticle.java index af9009e..0e70062 100644 --- a/src/main/java/elucent/eidolon/particle/BubbleParticle.java +++ b/src/main/java/elucent/eidolon/particle/BubbleParticle.java @@ -1,34 +1,33 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.tileentity.BedTileEntityRenderer; -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.blockentity.BedRenderer; +import net.minecraft.client.multiplayer.ClientLevel; public class BubbleParticle extends GenericParticle { - IAnimatedSprite animation; + SpriteSet animation; - public BubbleParticle(ClientWorld world, GenericParticleData data, IAnimatedSprite animation, double x, double y, double z, double vx, double vy, double vz) { + public BubbleParticle(ClientLevel world, GenericParticleData data, SpriteSet animation, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); - BedTileEntityRenderer ch; + BedRenderer ch; this.animation = animation; } @Override public void tick() { super.tick(); - this.motionY *= 0.8; - selectSpriteWithAge(this.animation); + this.yd *= 0.8; + setSpriteFromAge(this.animation); } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/BubbleParticleType.java b/src/main/java/elucent/eidolon/particle/BubbleParticleType.java index 3bfa22b..d0b6ef6 100644 --- a/src/main/java/elucent/eidolon/particle/BubbleParticleType.java +++ b/src/main/java/elucent/eidolon/particle/BubbleParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class BubbleParticleType extends ParticleType { public BubbleParticleType() { @@ -13,21 +14,21 @@ public BubbleParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { BubbleParticle ret = new BubbleParticle(world, data, sprite, x, y, z, mx, my, mz); - ret.selectSpriteWithAge(sprite); + ret.setSpriteFromAge(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/particle/FlameParticle.java b/src/main/java/elucent/eidolon/particle/FlameParticle.java index 907e4ec..af26ad1 100644 --- a/src/main/java/elucent/eidolon/particle/FlameParticle.java +++ b/src/main/java/elucent/eidolon/particle/FlameParticle.java @@ -1,26 +1,25 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; public class FlameParticle extends GenericParticle { - public FlameParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public FlameParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); } @Override - protected int getBrightnessForRender(float partialTicks) { + protected int getLightColor(float partialTicks) { return 0xF000F0; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/FlameParticleType.java b/src/main/java/elucent/eidolon/particle/FlameParticleType.java index 08be7fb..bbce9b1 100644 --- a/src/main/java/elucent/eidolon/particle/FlameParticleType.java +++ b/src/main/java/elucent/eidolon/particle/FlameParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class FlameParticleType extends ParticleType { public FlameParticleType() { @@ -13,21 +14,21 @@ public FlameParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { FlameParticle ret = new FlameParticle(world, data, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(sprite); + ret.pickSprite(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/particle/GenericParticle.java b/src/main/java/elucent/eidolon/particle/GenericParticle.java index 035a6a6..42cbf15 100644 --- a/src/main/java/elucent/eidolon/particle/GenericParticle.java +++ b/src/main/java/elucent/eidolon/particle/GenericParticle.java @@ -1,48 +1,48 @@ package elucent.eidolon.particle; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.particle.SpriteTexturedParticle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.ColorHelper; -import net.minecraft.util.math.MathHelper; +import java.awt.Color; -import java.awt.*; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.util.FastColor; +import net.minecraft.util.Mth; -public class GenericParticle extends SpriteTexturedParticle { +public class GenericParticle extends TextureSheetParticle { GenericParticleData data; float[] hsv1 = new float[3], hsv2 = new float[3]; - public GenericParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public GenericParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, x, y, z, vx, vy, vz); - this.setPosition(x, y, z); + this.setPos(x, y, z); this.data = data; - this.motionX = vx; - this.motionY = vy; - this.motionZ = vz; - this.setMaxAge(data.lifetime); - this.particleGravity = data.gravity ? 1 : 0; + this.xd = vx; + this.yd = vy; + this.zd = vz; + this.setLifetime(data.lifetime); + this.gravity = data.gravity ? 1 : 0; Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r1)), (int)(255 * Math.min(1.0f, data.g1)), (int)(255 * Math.min(1.0f, data.b1)), hsv1); Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r2)), (int)(255 * Math.min(1.0f, data.g2)), (int)(255 * Math.min(1.0f, data.b2)), hsv2); updateTraits(); } protected float getCoeff() { - return (float)this.age / this.maxAge; + return (float)this.age / this.lifetime; } protected void updateTraits() { float coeff = getCoeff(); - particleScale = MathHelper.lerp(coeff, data.scale1, data.scale2); - float h = MathHelper.interpolateAngle(coeff, 360 * hsv1[0], 360 * hsv2[0]) / 360; - float s = MathHelper.lerp(coeff, hsv1[1], hsv2[1]); - float v = MathHelper.lerp(coeff, hsv1[2], hsv2[2]); + quadSize = Mth.lerp(coeff, data.scale1, data.scale2); + float h = Mth.rotLerp(coeff, 360 * hsv1[0], 360 * hsv2[0]) / 360; + float s = Mth.lerp(coeff, hsv1[1], hsv2[1]); + float v = Mth.lerp(coeff, hsv1[2], hsv2[2]); int packed = Color.HSBtoRGB(h, s, v); - float r = ColorHelper.PackedColor.getRed(packed) / 255.0f; - float g = ColorHelper.PackedColor.getGreen(packed) / 255.0f; - float b = ColorHelper.PackedColor.getBlue(packed) / 255.0f; + float r = FastColor.ARGB32.red(packed) / 255.0f; + float g = FastColor.ARGB32.green(packed) / 255.0f; + float b = FastColor.ARGB32.blue(packed) / 255.0f; setColor(r, g, b); - setAlphaF(MathHelper.lerp(coeff, data.a1, data.a2)); - prevParticleAngle = particleAngle; - particleAngle += data.spin; + setAlpha(Mth.lerp(coeff, data.a1, data.a2)); + oRoll = roll; + roll += data.spin; } @Override @@ -52,7 +52,7 @@ public void tick() { } @Override - public IParticleRenderType getRenderType() { + public ParticleRenderType getRenderType() { return SpriteParticleRenderType.INSTANCE; } } diff --git a/src/main/java/elucent/eidolon/particle/GenericParticleData.java b/src/main/java/elucent/eidolon/particle/GenericParticleData.java index 343e965..79611b2 100644 --- a/src/main/java/elucent/eidolon/particle/GenericParticleData.java +++ b/src/main/java/elucent/eidolon/particle/GenericParticleData.java @@ -4,14 +4,12 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import elucent.eidolon.Registry; -import net.minecraft.network.PacketBuffer; -import net.minecraft.particles.IParticleData; -import net.minecraft.particles.ParticleType; -import java.util.Locale; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; -public class GenericParticleData implements IParticleData { +public class GenericParticleData implements ParticleOptions { float r1 = 1, g1 = 1, b1 = 1, a1 = 1, r2 = 1, g2 = 1, b2 = 1, a2 = 0; float scale1 = 1, scale2 = 0; int lifetime = 20; @@ -59,7 +57,7 @@ public ParticleType getType() { } @Override - public void write(PacketBuffer buffer) { + public void writeToNetwork(FriendlyByteBuf buffer) { buffer.writeFloat(r1).writeFloat(g1).writeFloat(b1).writeFloat(a1); buffer.writeFloat(r2).writeFloat(g2).writeFloat(b2).writeFloat(a2); buffer.writeFloat(scale1).writeFloat(scale2); @@ -69,13 +67,13 @@ public void write(PacketBuffer buffer) { } @Override - public String getParameters() { + public String writeToString() { return getClass().getSimpleName() + ":internal"; } - public static final IDeserializer DESERIALIZER = new IDeserializer() { + public static final Deserializer DESERIALIZER = new Deserializer() { @Override - public GenericParticleData deserialize(ParticleType type, StringReader reader) throws CommandSyntaxException { + public GenericParticleData fromCommand(ParticleType type, StringReader reader) throws CommandSyntaxException { reader.expect(' '); float r1 = reader.readFloat(); reader.expect(' '); @@ -120,7 +118,7 @@ public GenericParticleData deserialize(ParticleType type, S } @Override - public GenericParticleData read(ParticleType type, PacketBuffer buf) { + public GenericParticleData fromNetwork(ParticleType type, FriendlyByteBuf buf) { float r1 = buf.readFloat(); float g1 = buf.readFloat(); float b1 = buf.readFloat(); diff --git a/src/main/java/elucent/eidolon/particle/GlowParticleRenderType.java b/src/main/java/elucent/eidolon/particle/GlowParticleRenderType.java index 60b0c8b..2168eca 100644 --- a/src/main/java/elucent/eidolon/particle/GlowParticleRenderType.java +++ b/src/main/java/elucent/eidolon/particle/GlowParticleRenderType.java @@ -1,47 +1,50 @@ package elucent.eidolon.particle; +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Registry; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.particle.ParticleRenderType; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; -public class GlowParticleRenderType implements IParticleRenderType { +public class GlowParticleRenderType implements ParticleRenderType { public static final GlowParticleRenderType INSTANCE = new GlowParticleRenderType(); private static void beginRenderCommon(BufferBuilder bufferBuilder, TextureManager textureManager) { RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - RenderSystem.disableAlphaTest(); - RenderSystem.disableLighting(); - - textureManager.bindTexture(AtlasTexture.LOCATION_PARTICLES_TEXTURE); - bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + RenderSystem.setShader(ClientRegistry::getGlowingSpriteShader); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); + ClientEvents.particleMVMatrix = RenderSystem.getModelViewMatrix(); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.PARTICLE); } private static void endRenderCommon() { - Minecraft.getInstance().textureManager.getTexture(AtlasTexture.LOCATION_PARTICLES_TEXTURE).restoreLastBlurMipmap(); - RenderSystem.enableAlphaTest(); + Minecraft.getInstance().textureManager.getTexture(TextureAtlas.LOCATION_PARTICLES).restoreLastBlurMipmap(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); } @Override - public void beginRender(BufferBuilder b, TextureManager tex) { + public void begin(BufferBuilder b, TextureManager tex) { beginRenderCommon(b, tex); } @Override - public void finishRender(Tessellator t) { - t.draw(); + public void end(Tesselator t) { + t.end(); ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE); RenderSystem.enableDepthTest(); endRenderCommon(); diff --git a/src/main/java/elucent/eidolon/particle/GlowingSlashParticle.java b/src/main/java/elucent/eidolon/particle/GlowingSlashParticle.java new file mode 100644 index 0000000..08552eb --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/GlowingSlashParticle.java @@ -0,0 +1,158 @@ +package elucent.eidolon.particle; + +import java.awt.Color; + +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientConfig; +import elucent.eidolon.ClientEvents; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.util.FastColor; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; + +public class GlowingSlashParticle extends TextureSheetParticle { + SlashParticleData data; + float[] hsv1 = new float[3], hsv2 = new float[3]; + public GlowingSlashParticle(ClientLevel world, SlashParticleData data, double x, double y, double z, double vx, double vy, double vz) { + super(world, x, y, z, vx, vy, vz); + this.setPos(x, y, z); + this.data = data; + this.xd = vx; + this.yd = vy; + this.zd = vz; + this.setLifetime(data.lifetime); + Vec3 dir = Vec3.directionFromRotation(Mth.RAD_TO_DEG * -data.pitch, Mth.RAD_TO_DEG * -data.yaw); + xd += dir.x * (0.025f + world.random.nextFloat() * 0.025f); + yd += dir.y * (0.025f + world.random.nextFloat() * 0.025f); + zd += dir.z * (0.025f + world.random.nextFloat() * 0.025f); + Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r1)), (int)(255 * Math.min(1.0f, data.g1)), (int)(255 * Math.min(1.0f, data.b1)), hsv1); + Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r2)), (int)(255 * Math.min(1.0f, data.g2)), (int)(255 * Math.min(1.0f, data.b2)), hsv2); + updateTraits(); + } + + protected float getCoeff() { + return (float)this.age / this.lifetime; + } + + protected float getCoeff(float pticks) { + return ((float)this.age + pticks) / this.lifetime; + } + + protected float getSqInvCoeff(float pticks) { + float inv = (this.lifetime - (float)this.age + pticks) / this.lifetime; + return inv * inv; + } + + protected void updateTraits() { + float coeff = getCoeff(); + float h = Mth.rotLerp(coeff, 360 * hsv1[0], 360 * hsv2[0]) / 360; + float s = Mth.lerp(coeff, hsv1[1], hsv2[1]); + float v = Mth.lerp(coeff, hsv1[2], hsv2[2]); + int packed = Color.HSBtoRGB(h, s, v); + float r = FastColor.ARGB32.red(packed) / 255.0f; + float g = FastColor.ARGB32.green(packed) / 255.0f; + float b = FastColor.ARGB32.blue(packed) / 255.0f; + setColor(r, g, b); + setAlpha(Mth.lerp(coeff, data.a1, data.a2)); + } + + @Override + public void tick() { + updateTraits(); + super.tick(); + } + + @Override + public ParticleRenderType getRenderType() { + return GlowParticleRenderType.INSTANCE; + } + + private void decoVert(VertexConsumer vc, float u, float v, float alpha, int lmap) { + vc.uv(u, v).color(rCol, gCol, bCol, alpha).uv2(lmap).endVertex(); + } + + @Override + public void render(VertexConsumer vc, Camera info, float pticks) { + VertexConsumer b = ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.DELAYED_PARTICLE) : vc; + + float x = (float)(Mth.lerp((double)pticks, this.xo, this.x) - info.getPosition().x()); + float y = (float)(Mth.lerp((double)pticks, this.yo, this.y) - info.getPosition().y()); + float z = (float)(Mth.lerp((double)pticks, this.zo, this.z) - info.getPosition().z()); + float sy = Mth.sin(data.yaw), cy = Mth.cos(data.yaw), sp = Mth.sin(data.pitch), cp = Mth.cos(data.pitch); + float ox = x - sy * cp * data.rad, oy = y - sp * data.rad, oz = z - cy * cp * data.rad; + + float right = data.yaw + Mth.PI / 2, up = data.pitch + Mth.PI / 2; + float sr = Mth.sin(right), cr = Mth.cos(right), su = Mth.sin(up), cu = Mth.cos(up); + float r = data.rad; + float xax = r * sr * cp, xay = 0, xaz = r * cr * cp; + float yax = r * sy * cu, yay = r * su, yaz = r * cy * cu; + float zax = r * sy * cp, zay = r * sp, zaz = r * cy * cp; + float cro = Mth.cos(data.roll), sro = Mth.sin(data.roll); + float nxax = xax * cro - yax * sro; + float nxay = xay * cro - yay * sro; + float nxaz = xaz * cro - yaz * sro; + yax = xax * sro + yax * cro; + yay = xay * sro + yay * cro; + yaz = xaz * sro + yaz * cro; + xax = nxax; + xay = nxay; + xaz = nxaz; + float u0 = this.getU0(); + float u1 = this.getU1(); + float v0 = this.getV0(); + float v1 = this.getV1(); + int lmap = getLightColor(pticks); + float w = data.width / 2; + + float hlangle = -data.angle / 2 + getSqInvCoeff(pticks) * data.angle; + float hlwidth = 4 + 4 * getSqInvCoeff(pticks); + for (float i = 0; i < 18; i ++) { + float c1 = i / 18, c2 = (i + 1) / 18; + float basea = this.alpha - data.highlight; + float angle1 = -data.angle / 2 + c1 * data.angle, angle2 = -data.angle / 2 + c2 * data.angle; + float al1 = Mth.sin(c1 * Mth.PI), al2 = Mth.sin(c2 * Mth.PI); + float dangle1 = Mth.clamp((angle1 - hlangle) / data.angle, -1 / hlwidth, 1 / hlwidth), dangle2 = Mth.clamp((angle2 - hlangle) / data.angle, -1 / hlwidth, 1 / hlwidth); + float hl1 = (Mth.cos(hlwidth * Mth.PI * dangle1) + 1) / 2, hl2 = (Mth.cos(hlwidth * Mth.PI * dangle2) + 1) / 2; + al1 = (1 - data.highlight) * al1 + data.highlight * hl1; + al2 = (1 - data.highlight) * al2 + data.highlight * hl2; + al1 *= alpha; + al2 *= alpha; + float w1 = w * (0.25f + 0.75f * Mth.sin(c1 * Mth.PI)), w2 = w * (0.25f + 0.75f * Mth.sin(c2 * Mth.PI)); + w1 += data.highlight * 0.25f * w * hl1; + w2 += data.highlight * 0.25f * w * hl2; + + float sa1 = Mth.sin(angle1), ca1 = Mth.cos(angle1), sa2 = Mth.sin(angle2), ca2 = Mth.cos(angle2); + float dx1 = sa1 * xax + ca1 * zax, dy1 = sa1 * xay + ca1 * zay, dz1 = sa1 * xaz + ca1 * zaz; + float dx2 = sa2 * xax + ca2 * zax, dy2 = sa2 * xay + ca2 * zay, dz2 = sa2 * xaz + ca2 * zaz; + + // horiz + decoVert(b.vertex(ox + dx2 * r + dx2 * w2, oy + dy2 * r + dy2 * w2, oz + dz2 * r + dz2 * w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + dx2 * -w2, oy + dy2 * r + dy2 * -w2, oz + dz2 * r + dz2 * -w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * -w1, oy + dy1 * r + dy1 * -w1, oz + dz1 * r + dz1 * -w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * w1, oy + dy1 * r + dy1 * w1, oz + dz1 * r + dz1 * w1), u0, v1, al1, lmap); + + // horiz back + decoVert(b.vertex(ox + dx2 * r + dx2 * -w2, oy + dy2 * r + dy2 * -w2, oz + dz2 * r + dz2 * -w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + dx2 * w2, oy + dy2 * r + dy2 * w2, oz + dz2 * r + dz2 * w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * w1, oy + dy1 * r + dy1 * w1, oz + dz1 * r + dz1 * w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * -w1, oy + dy1 * r + dy1 * -w1, oz + dz1 * r + dz1 * -w1), u0, v1, al1, lmap); + + // vert + decoVert(b.vertex(ox + dx2 * r + yax * w2, oy + dy2 * r + yay * w2, oz + dz2 * r + yaz * w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + yax * -w2, oy + dy2 * r + yay * -w2, oz + dz2 * r + yaz * -w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * -w1, oy + dy1 * r + yay * -w1, oz + dz1 * r + yaz * -w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * w1, oy + dy1 * r + yay * w1, oz + dz1 * r + yaz * w1), u0, v1, al1, lmap); + + // vert back + decoVert(b.vertex(ox + dx2 * r + yax * -w2, oy + dy2 * r + yay * -w2, oz + dz2 * r + yaz * -w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + yax * w2, oy + dy2 * r + yay * w2, oz + dz2 * r + yaz * w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * w1, oy + dy1 * r + yay * w1, oz + dz1 * r + yaz * w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * -w1, oy + dy1 * r + yay * -w1, oz + dz1 * r + yaz * -w1), u0, v1, al1, lmap); + } + } +} diff --git a/src/main/java/elucent/eidolon/particle/GlowingSlashParticleType.java b/src/main/java/elucent/eidolon/particle/GlowingSlashParticleType.java new file mode 100644 index 0000000..f4b3459 --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/GlowingSlashParticleType.java @@ -0,0 +1,35 @@ +package elucent.eidolon.particle; + +import com.mojang.serialization.Codec; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; + +public class GlowingSlashParticleType extends ParticleType { + public GlowingSlashParticleType() { + super(false, SlashParticleData.DESERIALIZER); + } + + @Override + public Codec codec() { + return SlashParticleData.codecFor(this); + } + + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; + + public Factory(SpriteSet sprite) { + this.sprite = sprite; + } + + @Override + public Particle createParticle(SlashParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { + GlowingSlashParticle ret = new GlowingSlashParticle(world, data, x, y, z, mx, my, mz); + ret.pickSprite(sprite); + return ret; + } + } +} diff --git a/src/main/java/elucent/eidolon/particle/LineWispParticle.java b/src/main/java/elucent/eidolon/particle/LineWispParticle.java index 419e48a..0ea0053 100644 --- a/src/main/java/elucent/eidolon/particle/LineWispParticle.java +++ b/src/main/java/elucent/eidolon/particle/LineWispParticle.java @@ -1,50 +1,49 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.item.SpawnEggItem; -import net.minecraft.util.math.MathHelper; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.item.SpawnEggItem; +import net.minecraft.util.Mth; public class LineWispParticle extends GenericParticle { double ix, iy, iz, tx, ty, tz; - public LineWispParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public LineWispParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); - this.ix = posX; - this.iy = posY; - this.iz = posZ; - this.tx = motionX; - this.ty = motionY; - this.tz = motionZ; - motionX = motionY = motionZ = 0; + this.ix = x; + this.iy = y; + this.iz = z; + this.tx = xd; + this.ty = yd; + this.tz = zd; + xd = yd = zd = 0; } @Override public void tick() { super.tick(); - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - float coeff = (float)age / maxAge; + xo = x; + yo = y; + zo = z; + float coeff = (float)age / lifetime; coeff *= coeff; - posX = MathHelper.lerp(coeff, ix, tx); - posY = MathHelper.lerp(1 - (1 - coeff) * (1 - coeff), iy, ty); - posZ = MathHelper.lerp(coeff, iz, tz); + x = Mth.lerp(coeff, ix, tx); + y = Mth.lerp(1 - (1 - coeff) * (1 - coeff), iy, ty); + z = Mth.lerp(coeff, iz, tz); SpawnEggItem i; } @Override - protected int getBrightnessForRender(float partialTicks) { + protected int getLightColor(float partialTicks) { return 0xF000F0; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/LineWispParticleType.java b/src/main/java/elucent/eidolon/particle/LineWispParticleType.java index 4e05700..8f73e17 100644 --- a/src/main/java/elucent/eidolon/particle/LineWispParticleType.java +++ b/src/main/java/elucent/eidolon/particle/LineWispParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class LineWispParticleType extends ParticleType { public LineWispParticleType() { @@ -13,21 +14,21 @@ public LineWispParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { LineWispParticle ret = new LineWispParticle(world, data, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(sprite); + ret.pickSprite(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/particle/Particles.java b/src/main/java/elucent/eidolon/particle/Particles.java index aea4759..f15d8c3 100644 --- a/src/main/java/elucent/eidolon/particle/Particles.java +++ b/src/main/java/elucent/eidolon/particle/Particles.java @@ -1,14 +1,10 @@ package elucent.eidolon.particle; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.merchant.villager.VillagerEntity; -import net.minecraft.particles.ParticleType; -import net.minecraft.world.World; -import net.minecraftforge.fml.RegistryObject; - import java.util.Random; -import java.util.function.Function; + +import net.minecraft.core.particles.ParticleType; +import net.minecraft.world.level.Level; +import net.minecraftforge.registries.RegistryObject; public class Particles { public static class ParticleBuilder { @@ -147,7 +143,7 @@ public ParticleBuilder randomOffset(double maxXDist, double maxYDist, double max return this; } - public ParticleBuilder spawn(World world, double x, double y, double z) { + public ParticleBuilder spawn(Level world, double x, double y, double z) { double yaw = random.nextFloat() * Math.PI * 2, pitch = random.nextFloat() * Math.PI - Math.PI / 2, xSpeed = random.nextFloat() * maxXSpeed, ySpeed = random.nextFloat() * maxYSpeed, zSpeed = random.nextFloat() * maxZSpeed; this.vx += Math.sin(yaw) * Math.cos(pitch) * xSpeed; @@ -163,7 +159,7 @@ public ParticleBuilder spawn(World world, double x, double y, double z) { return this; } - public ParticleBuilder repeat(World world, double x, double y, double z, int n) { + public ParticleBuilder repeat(Level world, double x, double y, double z, int n) { for (int i = 0; i < n; i ++) spawn(world, x, y, z); return this; } diff --git a/src/main/java/elucent/eidolon/particle/RuneParticle.java b/src/main/java/elucent/eidolon/particle/RuneParticle.java new file mode 100644 index 0000000..1ee3c08 --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/RuneParticle.java @@ -0,0 +1,150 @@ +package elucent.eidolon.particle; + +import java.awt.Color; + +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Quaternion; +import com.mojang.math.Vector3f; + +import elucent.eidolon.ClientConfig; +import elucent.eidolon.ClientEvents; +import elucent.eidolon.Eidolon; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.util.FastColor; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; + +public class RuneParticle extends TextureSheetParticle { + Rune rune; + float[] hsv1 = new float[3], hsv2 = new float[3]; + public RuneParticle(ClientLevel world, RuneParticleData data, double x, double y, double z, double vx, double vy, double vz) { + super(world, x, y, z, vx, vy, vz); + this.setPos(x, y, z); + this.rune = data.rune; + this.xd = vx; + this.yd = vy; + this.zd = vz; + this.setLifetime(20); + this.gravity = -0.05f; + Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r1)), (int)(255 * Math.min(1.0f, data.g1)), (int)(255 * Math.min(1.0f, data.b1)), hsv1); + Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r2)), (int)(255 * Math.min(1.0f, data.g2)), (int)(255 * Math.min(1.0f, data.b2)), hsv2); + if (hsv1[0] < 0.01) hsv1[0] = hsv2[0]; + if (hsv1[1] < 0.01) hsv1[1] = 0.01f; + updateTraits(); + } + + protected float getCoeff() { + float t = ((float)this.age + Minecraft.getInstance().getDeltaFrameTime()) / this.lifetime; + t = Mth.clamp(t, 0.001f, 0.999f); + float ic = (1 - t) * (1 - t); + return 1 - (Mth.sin(Mth.PI * 4 * t) * ic * 0.5f - 0.7f * t + 0.7f); + } + + protected void updateTraits() { + float coeff = getCoeff(); + float t = ((float)this.age + Minecraft.getInstance().getDeltaFrameTime()) / this.lifetime; + t = Mth.clamp(t, 0.001f, 0.999f); + float ic = (1 - t) * (1 - t); + quadSize = Mth.lerp(coeff, 0.125f, 0.0625f); + this.oRoll = roll; + this.roll = Mth.PI * Mth.sin(Mth.cos(Mth.PI * 4 * t) * ic) / 8; + setAlpha(Mth.lerp(coeff * coeff, 0.5f, 0)); + + float h = Mth.rotLerp(coeff, 360 * hsv1[0], 360 * hsv2[0]) / 360; + float s = Mth.lerp(coeff, hsv1[1], hsv2[1]); + float v = Mth.lerp(coeff, hsv1[2], hsv2[2]); + int packed = Color.HSBtoRGB(h, s, v); + float r = FastColor.ARGB32.red(packed) / 255.0f; + float g = FastColor.ARGB32.green(packed) / 255.0f; + float b = FastColor.ARGB32.blue(packed) / 255.0f; + setColor(r, g, b); + } + + @Override + public void tick() { + updateTraits(); + super.tick(); + xd *= 0.98; + yd *= 0.98; + zd *= 0.98; + } + + @Override + public void render(VertexConsumer b, Camera info, float pticks) { + b = ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_BLOCK_PARTICLE) : b; + Vec3 vec3 = info.getPosition(); + float f = (float)(Mth.lerp((double)pticks, this.xo, this.x) - vec3.x()); + float f1 = (float)(Mth.lerp((double)pticks, this.yo, this.y) - vec3.y()); + float f2 = (float)(Mth.lerp((double)pticks, this.zo, this.z) - vec3.z()); + Quaternion quaternion; + if (this.roll == 0.0F) { + quaternion = info.rotation(); + } else { + quaternion = new Quaternion(info.rotation()); + float f3 = Mth.lerp(pticks, this.oRoll, this.roll); + quaternion.mul(Vector3f.ZP.rotation(f3)); + } + + Vector3f vector3f1 = new Vector3f(-1.0F, -1.0F, 0.0F); + vector3f1.transform(quaternion); + Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)}; + float f4 = this.getQuadSize(pticks); + + for(int i = 0; i < 4; ++i) { + Vector3f vector3f = avector3f[i]; + vector3f.transform(quaternion); + vector3f.mul(f4); + vector3f.add(f, f1, f2); + } + + float f7 = this.getU0(); + float f8 = this.getU1(); + float f5 = this.getV0(); + float f6 = this.getV1(); + int j = this.getLightColor(pticks); + + + Vector3f offX = avector3f[0].copy(), offY = avector3f[1].copy(); + offX.sub(avector3f[2]); + offX.mul(0.5f); + offY.sub(avector3f[3]); + offY.mul(0.5f); + + TextureAtlasSprite aura = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(new ResourceLocation(Eidolon.MODID, "particle/aura")); + + for (int i = 0; i < 1; i ++) { +// float a = Mth.PI * i + Mth.PI * 2 * (age + pticks) / lifetime; +// float s = Mth.sin(a), c = Mth.cos(a); +// float dx = offX.x() * c + offY.x() * s; +// float dy = offX.y() * c + offY.y() * s; +// float dz = offX.z() * c + offY.z() * s; +// dx *= 0.25f; +// dy *= 0.25f; +// dz *= 0.25f; + b.vertex((double)avector3f[0].x() + offX.x(), (double)avector3f[0].y() + offX.y(), (double)avector3f[0].z() + offX.z()).uv(aura.getU1(), aura.getV1()).color(this.rCol, this.gCol, this.bCol, this.alpha * 0.25f).uv2(j).endVertex(); + b.vertex((double)avector3f[1].x() + offY.x(), (double)avector3f[1].y() + offY.y(), (double)avector3f[1].z() + offY.z()).uv(aura.getU1(), aura.getV0()).color(this.rCol, this.gCol, this.bCol, this.alpha * 0.25f).uv2(j).endVertex(); + b.vertex((double)avector3f[2].x() - offX.x(), (double)avector3f[2].y() - offX.y(), (double)avector3f[2].z() - offX.z()).uv(aura.getU0(), aura.getV0()).color(this.rCol, this.gCol, this.bCol, this.alpha * 0.25f).uv2(j).endVertex(); + b.vertex((double)avector3f[3].x() - offY.x(), (double)avector3f[3].y() - offY.y(), (double)avector3f[3].z() - offY.z()).uv(aura.getU0(), aura.getV1()).color(this.rCol, this.gCol, this.bCol, this.alpha * 0.25f).uv2(j).endVertex(); + } + + b.vertex((double)avector3f[0].x(), (double)avector3f[0].y(), (double)avector3f[0].z()).uv(f8, f6).color(this.rCol, this.gCol, this.bCol, this.alpha).uv2(j).endVertex(); + b.vertex((double)avector3f[1].x(), (double)avector3f[1].y(), (double)avector3f[1].z()).uv(f8, f5).color(this.rCol, this.gCol, this.bCol, this.alpha).uv2(j).endVertex(); + b.vertex((double)avector3f[2].x(), (double)avector3f[2].y(), (double)avector3f[2].z()).uv(f7, f5).color(this.rCol, this.gCol, this.bCol, this.alpha).uv2(j).endVertex(); + b.vertex((double)avector3f[3].x(), (double)avector3f[3].y(), (double)avector3f[3].z()).uv(f7, f6).color(this.rCol, this.gCol, this.bCol, this.alpha).uv2(j).endVertex(); + } + + @Override + public ParticleRenderType getRenderType() { + return RuneParticleRenderType.INSTANCE; + } +} diff --git a/src/main/java/elucent/eidolon/particle/RuneParticleData.java b/src/main/java/elucent/eidolon/particle/RuneParticleData.java new file mode 100644 index 0000000..f34ef91 --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/RuneParticleData.java @@ -0,0 +1,102 @@ +package elucent.eidolon.particle; + +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +import elucent.eidolon.Registry; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Runes; +import elucent.eidolon.spell.Sign; +import elucent.eidolon.spell.Signs; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.resources.ResourceLocation; + +public class RuneParticleData implements ParticleOptions { + Rune rune; + float r1, g1, b1, r2, g2, b2; + + public static Codec codecFor(ParticleType type) { + return RecordCodecBuilder.create(instance -> instance.group( + Codec.STRING.fieldOf("rune").forGetter((d) -> d.rune.getRegistryName().toString()), + Codec.FLOAT.fieldOf("r1").forGetter((d) -> d.r1), + Codec.FLOAT.fieldOf("g1").forGetter((d) -> d.g1), + Codec.FLOAT.fieldOf("b1").forGetter((d) -> d.b1), + Codec.FLOAT.fieldOf("r2").forGetter((d) -> d.r2), + Codec.FLOAT.fieldOf("g2").forGetter((d) -> d.g2), + Codec.FLOAT.fieldOf("b2").forGetter((d) -> d.b2) + ).apply(instance, (rune, r1, g1, b1, r2, g2, b2) -> { + RuneParticleData data = new RuneParticleData(Runes.find(new ResourceLocation(rune)), r1, g1, b1, r2, g2, b2); + return data; + })); + } + + public RuneParticleData(Rune rune, float r1, float g1, float b1, float r2, float g2, float b2) { + this.rune = rune; + this.r1 = r1; + this.g1 = g1; + this.b1 = b1; + this.r2 = r2; + this.g2 = g2; + this.b2 = b2; + } + + @Override + public ParticleType getType() { + return Registry.RUNE_PARTICLE.get(); + } + + @Override + public void writeToNetwork(FriendlyByteBuf buffer) { + buffer.writeUtf(rune.toString()); + buffer.writeFloat(r1); + buffer.writeFloat(g1); + buffer.writeFloat(b1); + buffer.writeFloat(r2); + buffer.writeFloat(g2); + buffer.writeFloat(b2); + } + + @Override + public String writeToString() { + return getClass().getSimpleName() + ":internal"; + } + + public static final Deserializer DESERIALIZER = new Deserializer() { + @Override + public RuneParticleData fromCommand(ParticleType type, StringReader reader) throws CommandSyntaxException { + reader.expect(' '); + String loc = reader.readString(); + reader.expect(' '); + float r1 = reader.readFloat(); + reader.expect(' '); + float g1 = reader.readFloat(); + reader.expect(' '); + float b1 = reader.readFloat(); + reader.expect(' '); + float r2 = reader.readFloat(); + reader.expect(' '); + float g2 = reader.readFloat(); + reader.expect(' '); + float b2 = reader.readFloat(); + RuneParticleData data = new RuneParticleData(Runes.find(new ResourceLocation(loc)), r1, g1, b1, r2, g2, b2); + return data; + } + + @Override + public RuneParticleData fromNetwork(ParticleType type, FriendlyByteBuf buf) { + String loc = buf.readUtf(); + float r1 = buf.readFloat(); + float g1 = buf.readFloat(); + float b1 = buf.readFloat(); + float r2 = buf.readFloat(); + float g2 = buf.readFloat(); + float b2 = buf.readFloat(); + RuneParticleData data = new RuneParticleData(Runes.find(new ResourceLocation(loc)), r1, g1, b1, r2, g2, b2); + return data; + } + }; +} diff --git a/src/main/java/elucent/eidolon/particle/RuneParticleRenderType.java b/src/main/java/elucent/eidolon/particle/RuneParticleRenderType.java new file mode 100644 index 0000000..3a005e1 --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/RuneParticleRenderType.java @@ -0,0 +1,45 @@ +package elucent.eidolon.particle; + +import org.lwjgl.opengl.GL11; + +import com.mojang.blaze3d.systems.RenderSystem; + +import net.minecraft.client.Minecraft; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import elucent.eidolon.ClientEvents; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureManager; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; + +public class RuneParticleRenderType extends SpriteParticleRenderType { + public static final RuneParticleRenderType INSTANCE = new RuneParticleRenderType(); + + private static void beginRenderCommon(BufferBuilder bufferBuilder, TextureManager textureManager) { + RenderSystem.depthMask(false); + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); + ClientEvents.particleMVMatrix = RenderSystem.getModelViewMatrix(); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.PARTICLE); + } + + private static void endRenderCommon() { + Minecraft.getInstance().textureManager.getTexture(TextureAtlas.LOCATION_BLOCKS).restoreLastBlurMipmap(); + RenderSystem.depthMask(true); + } + + @Override + public void begin(BufferBuilder b, TextureManager tex) { + beginRenderCommon(b, tex); + } + + @Override + public void end(Tesselator t) { + t.end(); + RenderSystem.enableDepthTest(); + endRenderCommon(); + } +} diff --git a/src/main/java/elucent/eidolon/particle/RuneParticleType.java b/src/main/java/elucent/eidolon/particle/RuneParticleType.java new file mode 100644 index 0000000..4857b7b --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/RuneParticleType.java @@ -0,0 +1,48 @@ +package elucent.eidolon.particle; + +import java.util.Random; + +import com.mojang.serialization.Codec; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; + +public class RuneParticleType extends ParticleType { + public RuneParticleType() { + super(false, RuneParticleData.DESERIALIZER); + } + + @Override + public Codec codec() { + return RuneParticleData.codecFor(this); + } + + public static class Factory implements ParticleProvider { + public Factory() { + // + } + + @Override + public Particle createParticle(RuneParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { + RuneParticle ret = new RuneParticle(world, data, x, y, z, mx, my, mz); + ret.pickSprite(new SpriteSet() { + @Override + public TextureAtlasSprite get(int particleAge, int particleMaxAge) { + return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(ret.rune.getSprite()); + } + + @Override + public TextureAtlasSprite get(Random rand) { + return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(ret.rune.getSprite()); + } + }); + return ret; + } + } +} diff --git a/src/main/java/elucent/eidolon/particle/SignParticle.java b/src/main/java/elucent/eidolon/particle/SignParticle.java index 919b63f..95184f8 100644 --- a/src/main/java/elucent/eidolon/particle/SignParticle.java +++ b/src/main/java/elucent/eidolon/particle/SignParticle.java @@ -1,61 +1,58 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.spell.Sign; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.particle.SpriteTexturedParticle; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.ColorHelper; -import net.minecraft.util.math.MathHelper; - -import java.awt.*; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.util.Mth; -public class SignParticle extends SpriteTexturedParticle { +public class SignParticle extends TextureSheetParticle { Sign sign; - public SignParticle(ClientWorld world, Sign sign, double x, double y, double z, double vx, double vy, double vz) { + public SignParticle(ClientLevel world, Sign sign, double x, double y, double z, double vx, double vy, double vz) { super(world, x, y, z, vx, vy, vz); - this.setPosition(x, y, z); + this.setPos(x, y, z); this.sign = sign; - this.motionX = vx; - this.motionY = vy; - this.motionZ = vz; - this.setMaxAge(20); - this.particleGravity = -0.05f; + this.xd = vx; + this.yd = vy; + this.zd = vz; + this.setLifetime(20); + this.gravity = -0.05f; setColor(sign.getRed(), sign.getGreen(), sign.getBlue()); updateTraits(); } protected float getCoeff() { - return (float)this.age / this.maxAge; + return (float)this.age / this.lifetime; } protected void updateTraits() { float coeff = getCoeff(); - particleScale = MathHelper.lerp(coeff, 0.25f, 0.125f); - setAlphaF(MathHelper.lerp(coeff * coeff, 0.75f, 0)); + quadSize = Mth.lerp(coeff, 0.25f, 0.125f); + setAlpha(Mth.lerp(coeff * coeff, 0.75f, 0)); } @Override public void tick() { updateTraits(); super.tick(); - motionX *= 0.98; - motionY *= 0.98; - motionZ *= 0.98; + xd *= 0.98; + yd *= 0.98; + zd *= 0.98; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_BLOCK_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_BLOCK_PARTICLE) : b, info, pticks); } @Override - public IParticleRenderType getRenderType() { + public ParticleRenderType getRenderType() { return SignParticleRenderType.INSTANCE; } } diff --git a/src/main/java/elucent/eidolon/particle/SignParticleData.java b/src/main/java/elucent/eidolon/particle/SignParticleData.java index af35a5e..8d3cdc0 100644 --- a/src/main/java/elucent/eidolon/particle/SignParticleData.java +++ b/src/main/java/elucent/eidolon/particle/SignParticleData.java @@ -4,15 +4,16 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; + import elucent.eidolon.Registry; import elucent.eidolon.spell.Sign; import elucent.eidolon.spell.Signs; -import net.minecraft.network.PacketBuffer; -import net.minecraft.particles.IParticleData; -import net.minecraft.particles.ParticleType; -import net.minecraft.util.ResourceLocation; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.resources.ResourceLocation; -public class SignParticleData implements IParticleData { +public class SignParticleData implements ParticleOptions { Sign sign; public static Codec codecFor(ParticleType type) { @@ -34,18 +35,18 @@ public ParticleType getType() { } @Override - public void write(PacketBuffer buffer) { - buffer.writeString(sign.toString()); + public void writeToNetwork(FriendlyByteBuf buffer) { + buffer.writeUtf(sign.toString()); } @Override - public String getParameters() { + public String writeToString() { return getClass().getSimpleName() + ":internal"; } - public static final IDeserializer DESERIALIZER = new IDeserializer() { + public static final Deserializer DESERIALIZER = new Deserializer() { @Override - public SignParticleData deserialize(ParticleType type, StringReader reader) throws CommandSyntaxException { + public SignParticleData fromCommand(ParticleType type, StringReader reader) throws CommandSyntaxException { reader.expect(' '); String loc = reader.readString(); SignParticleData data = new SignParticleData(Signs.find(new ResourceLocation(loc))); @@ -53,8 +54,8 @@ public SignParticleData deserialize(ParticleType type, StringR } @Override - public SignParticleData read(ParticleType type, PacketBuffer buf) { - String loc = buf.readString(); + public SignParticleData fromNetwork(ParticleType type, FriendlyByteBuf buf) { + String loc = buf.readUtf(); SignParticleData data = new SignParticleData(Signs.find(new ResourceLocation(loc))); return data; } diff --git a/src/main/java/elucent/eidolon/particle/SignParticleRenderType.java b/src/main/java/elucent/eidolon/particle/SignParticleRenderType.java index 00081f8..6b8afb3 100644 --- a/src/main/java/elucent/eidolon/particle/SignParticleRenderType.java +++ b/src/main/java/elucent/eidolon/particle/SignParticleRenderType.java @@ -1,14 +1,18 @@ package elucent.eidolon.particle; +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.AtlasTexture; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import elucent.eidolon.ClientEvents; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; public class SignParticleRenderType extends SpriteParticleRenderType { public static final SignParticleRenderType INSTANCE = new SignParticleRenderType(); @@ -17,27 +21,24 @@ private static void beginRenderCommon(BufferBuilder bufferBuilder, TextureManage RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 0.00390625f); - - textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); - bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS); + ClientEvents.particleMVMatrix = RenderSystem.getModelViewMatrix(); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.PARTICLE); } private static void endRenderCommon() { - Minecraft.getInstance().textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); - RenderSystem.enableAlphaTest(); - RenderSystem.defaultAlphaFunc(); + Minecraft.getInstance().textureManager.getTexture(TextureAtlas.LOCATION_BLOCKS).restoreLastBlurMipmap(); RenderSystem.depthMask(true); } @Override - public void beginRender(BufferBuilder b, TextureManager tex) { + public void begin(BufferBuilder b, TextureManager tex) { beginRenderCommon(b, tex); } @Override - public void finishRender(Tessellator t) { - t.draw(); + public void end(Tesselator t) { + t.end(); RenderSystem.enableDepthTest(); endRenderCommon(); } diff --git a/src/main/java/elucent/eidolon/particle/SignParticleType.java b/src/main/java/elucent/eidolon/particle/SignParticleType.java index 30380fe..d2acef8 100644 --- a/src/main/java/elucent/eidolon/particle/SignParticleType.java +++ b/src/main/java/elucent/eidolon/particle/SignParticleType.java @@ -1,16 +1,17 @@ package elucent.eidolon.particle; +import java.util.Random; + import com.mojang.serialization.Codec; + import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; - -import java.util.Random; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class SignParticleType extends ParticleType { public SignParticleType() { @@ -18,27 +19,27 @@ public SignParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return SignParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { + public static class Factory implements ParticleProvider { public Factory() { // } @Override - public Particle makeParticle(SignParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(SignParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { SignParticle ret = new SignParticle(world, data.sign, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(new IAnimatedSprite() { + ret.pickSprite(new SpriteSet() { @Override public TextureAtlasSprite get(int particleAge, int particleMaxAge) { - return Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(ret.sign.getSprite()); + return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(ret.sign.getSprite()); } @Override public TextureAtlasSprite get(Random rand) { - return Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(ret.sign.getSprite()); + return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(ret.sign.getSprite()); } }); return ret; diff --git a/src/main/java/elucent/eidolon/particle/SlashParticle.java b/src/main/java/elucent/eidolon/particle/SlashParticle.java new file mode 100644 index 0000000..3657897 --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/SlashParticle.java @@ -0,0 +1,165 @@ +package elucent.eidolon.particle; + +import java.awt.Color; + +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientConfig; +import elucent.eidolon.ClientEvents; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.particle.TextureSheetParticle; +import net.minecraft.util.FastColor; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; + +public class SlashParticle extends TextureSheetParticle { + SlashParticleData data; + float[] hsv1 = new float[3], hsv2 = new float[3]; + public SlashParticle(ClientLevel world, SlashParticleData data, double x, double y, double z, double vx, double vy, double vz) { + super(world, x, y, z, vx, vy, vz); + this.setPos(x, y, z); + this.data = data; + float sy = Mth.sin(data.yaw), cy = Mth.cos(data.yaw), sp = Mth.sin(data.pitch), cp = Mth.cos(data.pitch); + x -= sy * cp * data.width * 0.25f; + y -= sp * data.width * 0.25f; + z -= cy * cp * data.width * 0.25f; + setPos(x, y, z); + this.xd = vx; + this.yd = vy; + this.zd = vz; + Vec3 dir = Vec3.directionFromRotation(Mth.RAD_TO_DEG * data.pitch, Mth.RAD_TO_DEG * data.yaw); + xd += dir.x * (0.025f + world.random.nextFloat() * 0.025f); + yd += dir.y * (0.025f + world.random.nextFloat() * 0.025f); + zd += dir.z * (0.025f + world.random.nextFloat() * 0.025f); + this.setLifetime(data.lifetime); + Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r1)), (int)(255 * Math.min(1.0f, data.g1)), (int)(255 * Math.min(1.0f, data.b1)), hsv1); + Color.RGBtoHSB((int)(255 * Math.min(1.0f, data.r2)), (int)(255 * Math.min(1.0f, data.g2)), (int)(255 * Math.min(1.0f, data.b2)), hsv2); + setSize(data.rad, data.rad); + updateTraits(); + } + + protected float getCoeff() { + return (float)this.age / this.lifetime; + } + + protected float getCoeff(float pticks) { + return ((float)this.age + pticks) / this.lifetime; + } + + protected float getSqInvCoeff(float pticks) { + float inv = (this.lifetime - (float)this.age + pticks) / this.lifetime; + return 1 - inv * inv * inv * inv; + } + + protected void updateTraits() { + float coeff = getCoeff(); + float h = Mth.rotLerp(coeff, 360 * hsv1[0], 360 * hsv2[0]) / 360; + float s = Mth.lerp(coeff, hsv1[1], hsv2[1]); + float v = Mth.lerp(coeff, hsv1[2], hsv2[2]); + int packed = Color.HSBtoRGB(h, s, v); + float r = FastColor.ARGB32.red(packed) / 255.0f; + float g = FastColor.ARGB32.green(packed) / 255.0f; + float b = FastColor.ARGB32.blue(packed) / 255.0f; + setColor(r, g, b); + setAlpha(Mth.lerp(coeff, data.a1, data.a2)); + } + + @Override + public void tick() { + updateTraits(); + super.tick(); + } + + @Override + public ParticleRenderType getRenderType() { + return SpriteParticleRenderType.INSTANCE; + } + + private void decoVert(VertexConsumer vc, float u, float v, float alpha, int lmap) { + vc.uv(u, v).color(rCol, gCol, bCol, alpha).uv2(lmap).endVertex(); + } + + @Override + public void render(VertexConsumer vc, Camera info, float pticks) { + VertexConsumer b = ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.DELAYED_PARTICLE) : vc; + + float x = (float)(Mth.lerp((double)pticks, this.xo, this.x) - info.getPosition().x()); + float y = (float)(Mth.lerp((double)pticks, this.yo, this.y) - info.getPosition().y()); + float z = (float)(Mth.lerp((double)pticks, this.zo, this.z) - info.getPosition().z()); + float sy = Mth.sin(data.yaw), cy = Mth.cos(data.yaw), sp = Mth.sin(data.pitch), cp = Mth.cos(data.pitch); + float ox = x - sy * cp * data.rad, oy = y - sp * data.rad, oz = z - cy * cp * data.rad; + + float right = data.yaw + Mth.PI / 2, up = data.pitch + Mth.PI / 2; + float sr = Mth.sin(right), cr = Mth.cos(right), su = Mth.sin(up), cu = Mth.cos(up); + float r = data.rad; + float xax = r * sr * cp, xay = 0, xaz = r * cr * cp; + float yax = r * sy * cu, yay = r * su, yaz = r * cy * cu; + float zax = r * sy * cp, zay = r * sp, zaz = r * cy * cp; + float cro = Mth.cos(data.roll), sro = Mth.sin(data.roll); + float nxax = xax * cro - yax * sro; + float nxay = xay * cro - yay * sro; + float nxaz = xaz * cro - yaz * sro; + yax = xax * sro + yax * cro; + yay = xay * sro + yay * cro; + yaz = xaz * sro + yaz * cro; + xax = nxax; + xay = nxay; + xaz = nxaz; + float u0 = this.getU0(); + float u1 = this.getU1(); + float v0 = this.getV0(); + float v1 = this.getV1(); + int lmap = getLightColor(pticks); + float w = data.width / 2; + + float hlangle = -data.angle / 2 + getSqInvCoeff(pticks) * data.angle; + float hlwidth = 4 + 4 * getSqInvCoeff(pticks); + + for (float i = 0; i < 18; i ++) { + float c1 = i / 18, c2 = (i + 1) / 18; + float basea = this.alpha - data.highlight; + float angle1 = -data.angle / 2 + c1 * data.angle, angle2 = -data.angle / 2 + c2 * data.angle; + float al1 = Mth.sin(c1 * Mth.PI), al2 = Mth.sin(c2 * Mth.PI); + float dangle1 = Mth.clamp((angle1 - hlangle) / data.angle, -1 / hlwidth, 1 / hlwidth), dangle2 = Mth.clamp((angle2 - hlangle) / data.angle, -1 / hlwidth, 1 / hlwidth); + float hl1 = (Mth.cos(hlwidth * Mth.PI * dangle1) + 1) / 2, hl2 = (Mth.cos(hlwidth * Mth.PI * dangle2) + 1) / 2; + al1 = (1 - data.highlight) * al1 + data.highlight * hl1; + al2 = (1 - data.highlight) * al2 + data.highlight * hl2; + al1 *= alpha; + al2 *= alpha; + float w1 = w * (0.25f + 0.75f * Mth.sin(c1 * Mth.PI)), w2 = w * (0.25f + 0.75f * Mth.sin(c2 * Mth.PI)); + w1 += data.highlight * 0.25f * w * hl1; + w2 += data.highlight * 0.25f * w * hl2; + + float sa1 = Mth.sin(angle1), ca1 = Mth.cos(angle1), sa2 = Mth.sin(angle2), ca2 = Mth.cos(angle2); + float dx1 = sa1 * xax + ca1 * zax, dy1 = sa1 * xay + ca1 * zay, dz1 = sa1 * xaz + ca1 * zaz; + float dx2 = sa2 * xax + ca2 * zax, dy2 = sa2 * xay + ca2 * zay, dz2 = sa2 * xaz + ca2 * zaz; + + // horiz + decoVert(b.vertex(ox + dx2 * r + dx2 * w2, oy + dy2 * r + dy2 * w2, oz + dz2 * r + dz2 * w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + dx2 * -w2, oy + dy2 * r + dy2 * -w2, oz + dz2 * r + dz2 * -w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * -w1, oy + dy1 * r + dy1 * -w1, oz + dz1 * r + dz1 * -w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * w1, oy + dy1 * r + dy1 * w1, oz + dz1 * r + dz1 * w1), u0, v1, al1, lmap); + + // horiz back + decoVert(b.vertex(ox + dx2 * r + dx2 * -w2, oy + dy2 * r + dy2 * -w2, oz + dz2 * r + dz2 * -w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + dx2 * w2, oy + dy2 * r + dy2 * w2, oz + dz2 * r + dz2 * w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * w1, oy + dy1 * r + dy1 * w1, oz + dz1 * r + dz1 * w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + dx1 * -w1, oy + dy1 * r + dy1 * -w1, oz + dz1 * r + dz1 * -w1), u0, v1, al1, lmap); + + // vert + decoVert(b.vertex(ox + dx2 * r + yax * w2 * 0.5f, oy + dy2 * r + yay * w2 * 0.5f, oz + dz2 * r + yaz * w2 * 0.5f), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + yax * -w2 * 0.5f, oy + dy2 * r + yay * -w2 * 0.5f, oz + dz2 * r + yaz * -w2 * 0.5f), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * -w1 * 0.5f, oy + dy1 * r + yay * -w1 * 0.5f, oz + dz1 * r + yaz * -w1 * 0.5f), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * w1 * 0.5f, oy + dy1 * r + yay * w1 * 0.5f, oz + dz1 * r + yaz * w1 * 0.5f), u0, v1, al1, lmap); + + // vert back + decoVert(b.vertex(ox + dx2 * r + yax * -w2, oy + dy2 * r + yay * -w2, oz + dz2 * r + yaz * -w2), u1, v1, al2, lmap); + decoVert(b.vertex(ox + dx2 * r + yax * w2, oy + dy2 * r + yay * w2, oz + dz2 * r + yaz * w2), u1, v0, al2, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * w1, oy + dy1 * r + yay * w1, oz + dz1 * r + yaz * w1), u0, v0, al1, lmap); + decoVert(b.vertex(ox + dx1 * r + yax * -w1, oy + dy1 * r + yay * -w1, oz + dz1 * r + yaz * -w1), u0, v1, al1, lmap); + } + } +} diff --git a/src/main/java/elucent/eidolon/particle/SlashParticleData.java b/src/main/java/elucent/eidolon/particle/SlashParticleData.java new file mode 100644 index 0000000..e2ee13c --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/SlashParticleData.java @@ -0,0 +1,265 @@ +package elucent.eidolon.particle; + +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.Mth; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; + +public class SlashParticleData implements ParticleOptions { + float r1 = 1, g1 = 1, b1 = 1, a1 = 1, r2 = 1, g2 = 1, b2 = 1, a2 = 0; + float width = 0.625f, rad = 1, pitch = 0, yaw = 0, roll = 0, angle = 0; + int lifetime = 10; + float highlight = 0; + + public static Codec codecFor(ParticleType type) { + return RecordCodecBuilder.create(instance -> instance.group( + Codec.FLOAT.fieldOf("r1").forGetter(d -> d.r1), + Codec.FLOAT.fieldOf("g1").forGetter(d -> d.g1), + Codec.FLOAT.fieldOf("b1").forGetter(d -> d.b1), + Codec.FLOAT.fieldOf("a1").forGetter(d -> d.a1), + Codec.FLOAT.fieldOf("r2").forGetter(d -> d.r2), + Codec.FLOAT.fieldOf("g2").forGetter(d -> d.g2), + Codec.FLOAT.fieldOf("b2").forGetter(d -> d.b2), + Codec.FLOAT.fieldOf("a2").forGetter(d -> d.a2), + Codec.FLOAT.fieldOf("width").forGetter(d -> d.width), + Codec.FLOAT.fieldOf("rad").forGetter(d -> d.rad), + Codec.FLOAT.fieldOf("pitch").forGetter(d -> d.pitch), + Codec.FLOAT.fieldOf("yaw").forGetter(d -> d.yaw), + Codec.FLOAT.fieldOf("roll").forGetter(d -> d.roll), + Codec.FLOAT.fieldOf("angle").forGetter(d -> d.angle), + Codec.INT.fieldOf("lifetime").forGetter(d -> d.lifetime), + Codec.FLOAT.fieldOf("highlight").forGetter(d -> d.highlight) + ).apply(instance, (r1, g1, b1, a1, r2, g2, b2, a2, width, rad, + pitch, yaw, roll, angle, lifetime, highlight) -> { + SlashParticleData data = new SlashParticleData(type); + data.r1 = r1; data.g1 = g1; data.b1 = b1; data.a1 = a1; + data.r2 = r2; data.g2 = g2; data.b2 = b2; data.a2 = a2; + data.width = width; + data.rad = rad; + data.pitch = pitch; + data.yaw = yaw; + data.roll = roll; + data.angle = angle; + data.lifetime = lifetime; + data.highlight = highlight; + return data; + })); + } + + ParticleType type; + + public SlashParticleData(ParticleType type) { + this.type = type; + } + + @Override + public ParticleType getType() { + return type; + } + + @Override + public void writeToNetwork(FriendlyByteBuf buffer) { + buffer.writeFloat(r1).writeFloat(g1).writeFloat(b1).writeFloat(a1); + buffer.writeFloat(r2).writeFloat(g2).writeFloat(b2).writeFloat(a2); + buffer.writeFloat(width).writeFloat(rad); + buffer.writeFloat(pitch).writeFloat(yaw).writeFloat(roll).writeFloat(angle); + buffer.writeInt(lifetime); + } + + @Override + public String writeToString() { + return getClass().getSimpleName() + ":internal"; + } + + public static final Deserializer DESERIALIZER = new Deserializer() { + @Override + public SlashParticleData fromCommand(ParticleType type, StringReader reader) throws CommandSyntaxException { + reader.expect(' '); + float r1 = reader.readFloat(); + reader.expect(' '); + float g1 = reader.readFloat(); + reader.expect(' '); + float b1 = reader.readFloat(); + reader.expect(' '); + float a1 = reader.readFloat(); + reader.expect(' '); + float r2 = reader.readFloat(); + reader.expect(' '); + float g2 = reader.readFloat(); + reader.expect(' '); + float b2 = reader.readFloat(); + reader.expect(' '); + float a2 = reader.readFloat(); + reader.expect(' '); + float width = reader.readFloat(); + reader.expect(' '); + float rad = reader.readFloat(); + reader.expect(' '); + float pitch = reader.readFloat(); + reader.expect(' '); + float yaw = reader.readFloat(); + reader.expect(' '); + float roll = reader.readFloat(); + reader.expect(' '); + float angle = reader.readFloat(); + reader.expect(' '); + int lifetime = reader.readInt(); + reader.expect(' '); + float highlight = reader.readFloat(); + SlashParticleData data = new SlashParticleData(type); + data.r1 = r1; + data.g1 = g1; + data.b1 = b1; + data.a1 = a1; + data.r2 = r2; + data.g2 = g2; + data.b2 = b2; + data.a2 = a2; + data.width = width; + data.rad = rad; + data.pitch = pitch; + data.yaw = yaw; + data.roll = roll; + data.angle = angle; + data.lifetime = lifetime; + data.highlight = highlight; + return data; + } + + @Override + public SlashParticleData fromNetwork(ParticleType type, FriendlyByteBuf buf) { + float r1 = buf.readFloat(); + float g1 = buf.readFloat(); + float b1 = buf.readFloat(); + float a1 = buf.readFloat(); + float r2 = buf.readFloat(); + float g2 = buf.readFloat(); + float b2 = buf.readFloat(); + float a2 = buf.readFloat(); + float width = buf.readFloat(); + float rad = buf.readFloat(); + float pitch = buf.readFloat(); + float yaw = buf.readFloat(); + float roll = buf.readFloat(); + float angle = buf.readFloat(); + int lifetime = buf.readInt(); + float highlight = buf.readFloat(); + SlashParticleData data = new SlashParticleData(type); + data.r1 = r1; + data.g1 = g1; + data.b1 = b1; + data.a1 = a1; + data.r2 = r2; + data.g2 = g2; + data.b2 = b2; + data.a2 = a2; + data.width = width; + data.rad = rad; + data.pitch = pitch; + data.roll = roll; + data.yaw = yaw; + data.angle = angle; + data.lifetime = lifetime; + data.highlight = highlight; + return data; + } + }; + + public static SlashParticleData create(ParticleType type) { + SlashParticleData data = new SlashParticleData(type); + return data; + } + + public SlashParticleData color(float r, float g, float b) { + return color(r, g, b, a1, r, g, b, a2); + } + + public SlashParticleData color(float r, float g, float b, float a) { + return color(r, g, b, a, r, g, b, a); + } + + public SlashParticleData color(float r1, float g1, float b1, float r2, float g2, float b2) { + return color(r1, g1, b1, a1, r2, g2, b2, a2); + } + + public SlashParticleData color(float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2) { + this.r1 = r1; + this.g1 = g1; + this.b1 = b1; + this.a1 = a1; + this.r2 = r2; + this.g2 = g2; + this.b2 = b2; + this.a2 = a2; + return this; + } + + public SlashParticleData alpha(float a) { + this.a1 = this.a2 = a; + return this; + } + + public SlashParticleData alpha(float a1, float a2) { + this.a1 = a1; + this.a2 = a2; + return this; + } + + public SlashParticleData width(float w) { + this.width = w; + return this; + } + + public SlashParticleData lookat(double x1, double y1, double z1, double x2, double y2, double z2) { + Vec3 horiz = new Vec3(x2 - x1, 0, z2 - z1); + this.yaw = (float)Mth.atan2(x2 - x1, z2 - z1); + this.pitch = (float)Mth.atan2(y2 - y1, horiz.length()); + return this; + } + + public SlashParticleData pitch(float pitch) { + this.pitch = pitch; + return this; + } + + public SlashParticleData yaw(float yaw) { + this.yaw = yaw; + return this; + } + + public SlashParticleData roll(float roll) { + this.roll = roll; + return this; + } + + public SlashParticleData highlight(float highlight) { + this.highlight = highlight; + return this; + } + + public SlashParticleData angle(float angle) { + this.angle = Mth.DEG_TO_RAD * angle; + return this; + } + + public SlashParticleData radius(float rad) { + this.rad = rad; + return this; + } + + public SlashParticleData lifetime(int ticks) { + this.lifetime = ticks; + return this; + } + + public void spawn(Level level, double x, double y, double z, double vx, double vy, double vz) { + level.addParticle(this, x, y, z, vx, vy, vz); + } +} diff --git a/src/main/java/elucent/eidolon/particle/SlashParticleType.java b/src/main/java/elucent/eidolon/particle/SlashParticleType.java new file mode 100644 index 0000000..5de61b6 --- /dev/null +++ b/src/main/java/elucent/eidolon/particle/SlashParticleType.java @@ -0,0 +1,35 @@ +package elucent.eidolon.particle; + +import com.mojang.serialization.Codec; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; + +public class SlashParticleType extends ParticleType { + public SlashParticleType() { + super(false, SlashParticleData.DESERIALIZER); + } + + @Override + public Codec codec() { + return SlashParticleData.codecFor(this); + } + + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; + + public Factory(SpriteSet sprite) { + this.sprite = sprite; + } + + @Override + public Particle createParticle(SlashParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { + SlashParticle ret = new SlashParticle(world, data, x, y, z, mx, my, mz); + ret.pickSprite(sprite); + return ret; + } + } +} diff --git a/src/main/java/elucent/eidolon/particle/SmokeParticle.java b/src/main/java/elucent/eidolon/particle/SmokeParticle.java index fbe62ed..9160e39 100644 --- a/src/main/java/elucent/eidolon/particle/SmokeParticle.java +++ b/src/main/java/elucent/eidolon/particle/SmokeParticle.java @@ -1,32 +1,32 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.MathHelper; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.util.Mth; public class SmokeParticle extends GenericParticle { - public SmokeParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public SmokeParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); } @Override protected float getCoeff() { - return 1.0f - MathHelper.sin((float)Math.PI * (float)this.age / this.maxAge); + return 1.0f - Mth.sin((float)Math.PI * (float)this.age / this.lifetime); } @Override public void tick() { super.tick(); - motionY *= 0.98; + yd *= 0.98; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.DELAYED_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.DELAYED_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/SmokeParticleType.java b/src/main/java/elucent/eidolon/particle/SmokeParticleType.java index 1dcba24..eac5cb2 100644 --- a/src/main/java/elucent/eidolon/particle/SmokeParticleType.java +++ b/src/main/java/elucent/eidolon/particle/SmokeParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class SmokeParticleType extends ParticleType { public SmokeParticleType() { @@ -13,21 +14,21 @@ public SmokeParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { SmokeParticle ret = new SmokeParticle(world, data, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(sprite); + ret.pickSprite(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/particle/SparkleParticle.java b/src/main/java/elucent/eidolon/particle/SparkleParticle.java index 4a630fd..bcea950 100644 --- a/src/main/java/elucent/eidolon/particle/SparkleParticle.java +++ b/src/main/java/elucent/eidolon/particle/SparkleParticle.java @@ -1,28 +1,27 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.tileentity.BedTileEntityRenderer; -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.blockentity.BedRenderer; +import net.minecraft.client.multiplayer.ClientLevel; public class SparkleParticle extends GenericParticle { - public SparkleParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public SparkleParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); - BedTileEntityRenderer ch; + BedRenderer ch; } @Override - protected int getBrightnessForRender(float partialTicks) { + protected int getLightColor(float partialTicks) { return 0xF000F0; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/SparkleParticleType.java b/src/main/java/elucent/eidolon/particle/SparkleParticleType.java index 1ee7566..08b3a92 100644 --- a/src/main/java/elucent/eidolon/particle/SparkleParticleType.java +++ b/src/main/java/elucent/eidolon/particle/SparkleParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class SparkleParticleType extends ParticleType { public SparkleParticleType() { @@ -13,21 +14,21 @@ public SparkleParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { SparkleParticle ret = new SparkleParticle(world, data, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(sprite); + ret.pickSprite(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/particle/SpriteParticleRenderType.java b/src/main/java/elucent/eidolon/particle/SpriteParticleRenderType.java index a2ba2a1..c80cc40 100644 --- a/src/main/java/elucent/eidolon/particle/SpriteParticleRenderType.java +++ b/src/main/java/elucent/eidolon/particle/SpriteParticleRenderType.java @@ -1,43 +1,48 @@ package elucent.eidolon.particle; +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.particle.ParticleRenderType; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; +import elucent.eidolon.Registry; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; -public class SpriteParticleRenderType implements IParticleRenderType { +public class SpriteParticleRenderType implements ParticleRenderType { public static final SpriteParticleRenderType INSTANCE = new SpriteParticleRenderType(); private static void beginRenderCommon(BufferBuilder bufferBuilder, TextureManager textureManager) { RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderSystem.alphaFunc(GL11.GL_GEQUAL, 0.00390625f); - - textureManager.bindTexture(AtlasTexture.LOCATION_PARTICLES_TEXTURE); - bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + RenderSystem.setShader(ClientRegistry::getSpriteParticleShader); + RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES); + ClientEvents.particleMVMatrix = RenderSystem.getModelViewMatrix(); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.PARTICLE); } private static void endRenderCommon() { - Minecraft.getInstance().textureManager.getTexture(AtlasTexture.LOCATION_PARTICLES_TEXTURE).restoreLastBlurMipmap(); - RenderSystem.enableAlphaTest(); - RenderSystem.defaultAlphaFunc(); + Minecraft.getInstance().textureManager.getTexture(TextureAtlas.LOCATION_PARTICLES).restoreLastBlurMipmap(); RenderSystem.depthMask(true); } @Override - public void beginRender(BufferBuilder b, TextureManager tex) { + public void begin(BufferBuilder b, TextureManager tex) { beginRenderCommon(b, tex); } @Override - public void finishRender(Tessellator t) { - t.draw(); + public void end(Tesselator t) { + t.end(); RenderSystem.enableDepthTest(); endRenderCommon(); } diff --git a/src/main/java/elucent/eidolon/particle/SteamParticle.java b/src/main/java/elucent/eidolon/particle/SteamParticle.java index 592b989..7c9a6b4 100644 --- a/src/main/java/elucent/eidolon/particle/SteamParticle.java +++ b/src/main/java/elucent/eidolon/particle/SteamParticle.java @@ -1,33 +1,32 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.MathHelper; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.util.Mth; public class SteamParticle extends GenericParticle { - public SteamParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public SteamParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); } @Override protected float getCoeff() { - return 1.0f - MathHelper.sin((float)Math.PI * (float)this.age / this.maxAge); + return 1.0f - Mth.sin((float)Math.PI * (float)this.age / this.lifetime); } @Override public void tick() { super.tick(); - motionY *= 0.99; + yd *= 0.99; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/SteamParticleType.java b/src/main/java/elucent/eidolon/particle/SteamParticleType.java index 8779382..10a4641 100644 --- a/src/main/java/elucent/eidolon/particle/SteamParticleType.java +++ b/src/main/java/elucent/eidolon/particle/SteamParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class SteamParticleType extends ParticleType { public SteamParticleType() { @@ -13,21 +14,21 @@ public SteamParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { SteamParticle ret = new SteamParticle(world, data, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(sprite); + ret.pickSprite(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/particle/WispParticle.java b/src/main/java/elucent/eidolon/particle/WispParticle.java index 15c7644..636d2a8 100644 --- a/src/main/java/elucent/eidolon/particle/WispParticle.java +++ b/src/main/java/elucent/eidolon/particle/WispParticle.java @@ -1,26 +1,25 @@ package elucent.eidolon.particle; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientConfig; import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.util.RenderUtil; -import net.minecraft.client.particle.IParticleRenderType; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; public class WispParticle extends GenericParticle { - public WispParticle(ClientWorld world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { + public WispParticle(ClientLevel world, GenericParticleData data, double x, double y, double z, double vx, double vy, double vz) { super(world, data, x, y, z, vx, vy, vz); } @Override - protected int getBrightnessForRender(float partialTicks) { + protected int getLightColor(float partialTicks) { return 0xF000F0; } @Override - public void renderParticle(IVertexBuilder b, ActiveRenderInfo info, float pticks) { - super.renderParticle(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); + public void render(VertexConsumer b, Camera info, float pticks) { + super.render(ClientConfig.BETTER_LAYERING.get() ? ClientEvents.getDelayedRender().getBuffer(RenderUtil.GLOWING_PARTICLE) : b, info, pticks); } } diff --git a/src/main/java/elucent/eidolon/particle/WispParticleType.java b/src/main/java/elucent/eidolon/particle/WispParticleType.java index 6000601..c712684 100644 --- a/src/main/java/elucent/eidolon/particle/WispParticleType.java +++ b/src/main/java/elucent/eidolon/particle/WispParticleType.java @@ -1,11 +1,12 @@ package elucent.eidolon.particle; import com.mojang.serialization.Codec; -import net.minecraft.client.particle.IAnimatedSprite; -import net.minecraft.client.particle.IParticleFactory; + +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.Particle; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.particles.ParticleType; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.particles.ParticleType; public class WispParticleType extends ParticleType { public WispParticleType() { @@ -13,21 +14,21 @@ public WispParticleType() { } @Override - public Codec func_230522_e_() { + public Codec codec() { return GenericParticleData.codecFor(this); } - public static class Factory implements IParticleFactory { - private final IAnimatedSprite sprite; + public static class Factory implements ParticleProvider { + private final SpriteSet sprite; - public Factory(IAnimatedSprite sprite) { + public Factory(SpriteSet sprite) { this.sprite = sprite; } @Override - public Particle makeParticle(GenericParticleData data, ClientWorld world, double x, double y, double z, double mx, double my, double mz) { + public Particle createParticle(GenericParticleData data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { WispParticle ret = new WispParticle(world, data, x, y, z, mx, my, mz); - ret.selectSpriteRandomly(sprite); + ret.pickSprite(sprite); return ret; } } diff --git a/src/main/java/elucent/eidolon/potion/AnchoredEffect.java b/src/main/java/elucent/eidolon/potion/AnchoredEffect.java index c8d6d72..f27f118 100644 --- a/src/main/java/elucent/eidolon/potion/AnchoredEffect.java +++ b/src/main/java/elucent/eidolon/potion/AnchoredEffect.java @@ -1,66 +1,46 @@ package elucent.eidolon.potion; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; import elucent.eidolon.util.ColorUtil; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.player.ClientPlayerEntity; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.client.gui.DisplayEffectsScreen; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; -import net.minecraft.potion.Effect; -import net.minecraft.potion.EffectInstance; -import net.minecraft.potion.EffectType; -import net.minecraft.potion.Effects; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.gui.ForgeIngameGui; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.extensions.IForgeEffect; -import net.minecraftforge.event.entity.living.EnderTeleportEvent; -import net.minecraftforge.event.entity.living.LivingHealEvent; -import net.minecraftforge.eventbus.api.EventPriority; +import net.minecraftforge.common.extensions.IForgeMobEffect; +import net.minecraftforge.event.entity.EntityTeleportEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; -import java.util.Random; - -public class AnchoredEffect extends Effect implements IForgeEffect { +public class AnchoredEffect extends MobEffect implements IForgeMobEffect { public AnchoredEffect() { - super(EffectType.BENEFICIAL, ColorUtil.packColor(255, 154, 58, 232)); + super(MobEffectCategory.BENEFICIAL, ColorUtil.packColor(255, 154, 58, 232)); MinecraftForge.EVENT_BUS.addListener(this::anchor); } @SubscribeEvent - public void anchor(EnderTeleportEvent event) { - LivingEntity e = event.getEntityLiving(); - if (e.isPotionActive(this)) { + public void anchor(EntityTeleportEvent event) { + Entity e = event.getEntity(); + if (e instanceof LivingEntity && ((LivingEntity)e).hasEffect(this)) { event.setCanceled(true); } } protected static final ResourceLocation EFFECT_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/mob_effect/anchored.png"); - @OnlyIn(Dist.CLIENT) - @Override - public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { - Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(EFFECT_TEXTURE); - gui.blit(mStack, x, y, 0, 0, 18, 18); - } - - @OnlyIn(Dist.CLIENT) - @Override - public void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { - Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(EFFECT_TEXTURE); - gui.blit(mStack, x, y, 0, 0, 18, 18); - } +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +// +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } } diff --git a/src/main/java/elucent/eidolon/potion/ChilledEffect.java b/src/main/java/elucent/eidolon/potion/ChilledEffect.java index c17c38a..8d9712d 100644 --- a/src/main/java/elucent/eidolon/potion/ChilledEffect.java +++ b/src/main/java/elucent/eidolon/potion/ChilledEffect.java @@ -1,146 +1,48 @@ package elucent.eidolon.potion; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.Random; + +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; -import elucent.eidolon.network.ChilledEffectPacket; -import elucent.eidolon.network.Networking; -import io.netty.util.NetUtil; -import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.player.ClientPlayerEntity; -import net.minecraft.client.gui.AbstractGui; -import net.minecraft.client.gui.DisplayEffectsScreen; -import net.minecraft.client.gui.IngameGui; -import net.minecraft.data.advancements.AdventureAdvancements; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.attributes.Attributes; -import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.NetworkSystem; -import net.minecraft.network.PacketThreadUtil; -import net.minecraft.particles.BlockParticleData; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.potion.*; -import net.minecraft.util.ColorHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.gen.feature.structure.StrongholdStructure; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.extensions.IForgeEffect; +import net.minecraftforge.common.extensions.IForgeMobEffect; import net.minecraftforge.event.entity.living.LivingHealEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.network.NetworkHooks; -import net.minecraftforge.fml.network.PacketDispatcher; -import net.minecraftforge.fml.network.PacketDistributor; -import org.spongepowered.asm.mixin.MixinEnvironment; -import javax.annotation.Resource; -import java.util.Random; - -public class ChilledEffect extends Effect implements IForgeEffect { +public class ChilledEffect extends MobEffect implements IForgeMobEffect { static int packColor(int alpha, int red, int green, int blue) { return alpha << 24 | red << 16 | green << 8 | blue; } public ChilledEffect() { - super(EffectType.HARMFUL, packColor(255, 147, 189, 245)); + super(MobEffectCategory.HARMFUL, packColor(255, 147, 189, 245)); MinecraftForge.EVENT_BUS.addListener(this::chill); - DistExecutor.unsafeCallWhenOn(Dist.CLIENT, () -> () -> { - MinecraftForge.EVENT_BUS.addListener(ChilledEffect::renderChill); - return null; - }); } @SubscribeEvent public void chill(LivingHealEvent event) { LivingEntity e = event.getEntityLiving(); - if (e.isPotionActive(this)) { + if (e.hasEffect(this)) { event.setCanceled(true); } } - - protected static final ResourceLocation ICONS_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/gui/icons.png"); - protected static final ResourceLocation EFFECT_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/mob_effect/chilled.png"); - - @OnlyIn(Dist.CLIENT) - @Override - public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { - Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(EFFECT_TEXTURE); - gui.blit(mStack, x, y, 0, 0, 18, 18); - } - - @OnlyIn(Dist.CLIENT) - @Override - public void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { - Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(EFFECT_TEXTURE); - gui.blit(mStack, x, y, 0, 0, 18, 18); - } - - @OnlyIn(Dist.CLIENT) - @SubscribeEvent(priority = EventPriority.LOWEST) - public static void renderChill(RenderGameOverlayEvent.Post event) { - Minecraft mc = Minecraft.getInstance(); - ClientPlayerEntity player = mc.player; - if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH - && player.isPotionActive(Registry.CHILLED_EFFECT.get())) { - - MatrixStack mStack = event.getMatrixStack(); - mStack.push(); - mStack.translate(0, 0, 0.01); - - int health = MathHelper.ceil(player.getHealth()); - float absorb = MathHelper.ceil(player.getAbsorptionAmount()); - ModifiableAttributeInstance attrMaxHealth = player.getAttribute(Attributes.MAX_HEALTH); - float healthMax = (float)attrMaxHealth.getValue(); - - int ticks = mc.ingameGUI.getTicks(); - - int regen = -1; - if (player.isPotionActive(Effects.REGENERATION)) regen = ticks % 25; - - Random rand = new Random(); - rand.setSeed((long)(ticks * 312871)); - - int left = event.getWindow().getScaledWidth() / 2 - 91; - int top = event.getWindow().getScaledHeight() - ForgeIngameGui.left_height; - - int healthRows = MathHelper.ceil((healthMax + absorb) / 2.0F / 10.0F); - int rowHeight = Math.max(10 - (healthRows - 2), 3); - - RenderSystem.pushTextureAttributes(); - mc.getTextureManager().bindTexture(ICONS_TEXTURE); - for (int i = MathHelper.ceil((healthMax) / 2.0F) - 1; i >= 0; -- i) { - int row = MathHelper.ceil((float)(i + 1) / 10.0F) - 1; - int x = left + i % 10 * 8; - int y = top + rowHeight - 1; // we don't need to worry about rowHeight, the usual health rendering already added it to top - - if (health <= 4) y += rand.nextInt(2); - if (i == regen) y -= 2; - - RenderSystem.disableAlphaTest(); - RenderSystem.enableBlend(); - if (i * 2 + 1 < health) - mc.ingameGUI.blit(mStack, x, y, 0, 0, 9, 9); - else if (i * 2 + 1 == health) - mc.ingameGUI.blit(mStack, x, y, 9, 0, 9, 9); - RenderSystem.disableBlend(); - RenderSystem.enableAlphaTest(); - } - RenderSystem.popAttributes(); - mStack.pop(); - } - } } diff --git a/src/main/java/elucent/eidolon/potion/ReinforcedEffect.java b/src/main/java/elucent/eidolon/potion/ReinforcedEffect.java new file mode 100644 index 0000000..8df5097 --- /dev/null +++ b/src/main/java/elucent/eidolon/potion/ReinforcedEffect.java @@ -0,0 +1,32 @@ +package elucent.eidolon.potion; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.extensions.IForgeMobEffect; + +public class ReinforcedEffect extends MobEffect implements IForgeMobEffect { + public ReinforcedEffect() { + super(MobEffectCategory.BENEFICIAL, ColorUtil.packColor(255, 250, 214, 74)); + } + + protected static final ResourceLocation EFFECT_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/mob_effect/reinforced.png"); + +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +// +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +} diff --git a/src/main/java/elucent/eidolon/potion/StrictBrewingRecipe.java b/src/main/java/elucent/eidolon/potion/StrictBrewingRecipe.java index aa1a215..4087980 100644 --- a/src/main/java/elucent/eidolon/potion/StrictBrewingRecipe.java +++ b/src/main/java/elucent/eidolon/potion/StrictBrewingRecipe.java @@ -1,21 +1,21 @@ package elucent.eidolon.potion; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraftforge.common.brewing.BrewingRecipe; - import javax.annotation.Nonnull; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.brewing.BrewingRecipe; + public class StrictBrewingRecipe extends BrewingRecipe { ItemStack inputStack; public StrictBrewingRecipe(ItemStack input, Ingredient ingredient, ItemStack output) { - super(Ingredient.fromStacks(input), ingredient, output); + super(Ingredient.of(input), ingredient, output); this.inputStack = input; } @Override public boolean isInput(@Nonnull ItemStack stack) { - return ItemStack.areItemsEqual(inputStack, stack) - && ItemStack.areItemStackTagsEqual(inputStack, stack); + return ItemStack.isSame(inputStack, stack) + && ItemStack.tagMatches(inputStack, stack); } } diff --git a/src/main/java/elucent/eidolon/potion/UndeathEffect.java b/src/main/java/elucent/eidolon/potion/UndeathEffect.java new file mode 100644 index 0000000..86c9e11 --- /dev/null +++ b/src/main/java/elucent/eidolon/potion/UndeathEffect.java @@ -0,0 +1,33 @@ +package elucent.eidolon.potion; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.extensions.IForgeMobEffect; + +public class UndeathEffect extends MobEffect implements IForgeMobEffect { + public UndeathEffect() { + super(MobEffectCategory.HARMFUL, ColorUtil.packColor(255, 51, 39, 42)); + } + + protected static final ResourceLocation EFFECT_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/mob_effect/undeath.png"); + +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +// +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +} diff --git a/src/main/java/elucent/eidolon/potion/VulnerableEffect.java b/src/main/java/elucent/eidolon/potion/VulnerableEffect.java new file mode 100644 index 0000000..fe9c852 --- /dev/null +++ b/src/main/java/elucent/eidolon/potion/VulnerableEffect.java @@ -0,0 +1,32 @@ +package elucent.eidolon.potion; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.extensions.IForgeMobEffect; + +public class VulnerableEffect extends MobEffect implements IForgeMobEffect { + public VulnerableEffect() { + super(MobEffectCategory.HARMFUL, ColorUtil.packColor(255, 90, 102, 161)); + } + + protected static final ResourceLocation EFFECT_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/mob_effect/vulnerable.png"); + +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen gui, MatrixStack mStack, int x, int y, float z) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +// +// @OnlyIn(Dist.CLIENT) +// @Override +// public void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { +// Minecraft mc = Minecraft.getInstance(); +// mc.getTextureManager().bindTexture(EFFECT_TEXTURE); +// AbstractGui.blit(mStack, x, y, 18, 18, 0, 0, 18, 18, 18, 18); +// } +} diff --git a/src/main/java/elucent/eidolon/proxy/ClientProxy.java b/src/main/java/elucent/eidolon/proxy/ClientProxy.java index 8c98c17..79d22ef 100644 --- a/src/main/java/elucent/eidolon/proxy/ClientProxy.java +++ b/src/main/java/elucent/eidolon/proxy/ClientProxy.java @@ -4,19 +4,19 @@ import elucent.eidolon.Registry; import elucent.eidolon.codex.CodexGui; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; public class ClientProxy implements ISidedProxy { @Override - public PlayerEntity getPlayer() { + public Player getPlayer() { return Minecraft.getInstance().player; } @Override - public World getWorld() { - return Minecraft.getInstance().world; + public Level getWorld() { + return Minecraft.getInstance().level; } @Override @@ -27,6 +27,6 @@ public void init() { @Override public void openCodexGui() { - Minecraft.getInstance().displayGuiScreen(CodexGui.getInstance()); + Minecraft.getInstance().setScreen(CodexGui.getInstance()); } } diff --git a/src/main/java/elucent/eidolon/proxy/ISidedProxy.java b/src/main/java/elucent/eidolon/proxy/ISidedProxy.java index 9c25e3b..1d6c9c0 100644 --- a/src/main/java/elucent/eidolon/proxy/ISidedProxy.java +++ b/src/main/java/elucent/eidolon/proxy/ISidedProxy.java @@ -1,11 +1,11 @@ package elucent.eidolon.proxy; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; public interface ISidedProxy { - PlayerEntity getPlayer(); - World getWorld(); + Player getPlayer(); + Level getWorld(); void init(); void openCodexGui(); diff --git a/src/main/java/elucent/eidolon/proxy/ServerProxy.java b/src/main/java/elucent/eidolon/proxy/ServerProxy.java index d4e2cdb..af800f0 100644 --- a/src/main/java/elucent/eidolon/proxy/ServerProxy.java +++ b/src/main/java/elucent/eidolon/proxy/ServerProxy.java @@ -1,18 +1,16 @@ package elucent.eidolon.proxy; -import elucent.eidolon.Registry; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; public class ServerProxy implements ISidedProxy { @Override - public PlayerEntity getPlayer() { + public Player getPlayer() { return null; } @Override - public World getWorld() { + public Level getWorld() { return null; } diff --git a/src/main/java/elucent/eidolon/reagent/CrimsolReagent.java b/src/main/java/elucent/eidolon/reagent/CrimsolReagent.java new file mode 100644 index 0000000..828eacf --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/CrimsolReagent.java @@ -0,0 +1,20 @@ +package elucent.eidolon.reagent; + +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +public class CrimsolReagent extends Reagent { + public CrimsolReagent(ResourceLocation name) { + super(name, new ResourceLocation(Eidolon.MODID, "block/crimsol"), false); + } + + @Override + public void worldEffect(Level world, BlockPos pos, int amount) { + if (!world.isClientSide) + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 1, 1); + } +} diff --git a/src/main/java/elucent/eidolon/reagent/EspritReagent.java b/src/main/java/elucent/eidolon/reagent/EspritReagent.java new file mode 100644 index 0000000..2eb06b5 --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/EspritReagent.java @@ -0,0 +1,20 @@ +package elucent.eidolon.reagent; + +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +public class EspritReagent extends Reagent { + public EspritReagent(ResourceLocation name) { + super(name, new ResourceLocation(Eidolon.MODID, "block/esprit"), false); + } + + @Override + public void worldEffect(Level world, BlockPos pos, int amount) { + if (!world.isClientSide) + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 1, 1); + } +} diff --git a/src/main/java/elucent/eidolon/reagent/IReagentTankProvider.java b/src/main/java/elucent/eidolon/reagent/IReagentTankProvider.java new file mode 100644 index 0000000..bc5491b --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/IReagentTankProvider.java @@ -0,0 +1,10 @@ +package elucent.eidolon.reagent; + +import net.minecraft.core.Direction; + +public interface IReagentTankProvider { + ReagentTank getTank(); + boolean isOutput(Direction direction); + boolean isInput(Direction direction); + void onContentsChanged(); +} diff --git a/src/main/java/elucent/eidolon/reagent/Reagent.java b/src/main/java/elucent/eidolon/reagent/Reagent.java new file mode 100644 index 0000000..b23f9e4 --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/Reagent.java @@ -0,0 +1,40 @@ +package elucent.eidolon.reagent; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public abstract class Reagent { + ResourceLocation name, texture; + boolean gas; + + public Reagent(ResourceLocation name, ResourceLocation texture, boolean isGas) { + this.name = name; + this.texture = texture; + this.gas = isGas; + } + + public ResourceLocation getRegistryName() { + return name; + } + + public ResourceLocation getTexture() { + return texture; + } + + @OnlyIn(Dist.CLIENT) + public TextureAtlasSprite getSprite() { + return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); + } + + public boolean isGas() { + return gas; + } + + public abstract void worldEffect(Level world, BlockPos pos, int amount); +} diff --git a/src/main/java/elucent/eidolon/reagent/ReagentRegistry.java b/src/main/java/elucent/eidolon/reagent/ReagentRegistry.java new file mode 100644 index 0000000..92da958 --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/ReagentRegistry.java @@ -0,0 +1,33 @@ +package elucent.eidolon.reagent; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; + +public class ReagentRegistry { + static Map reagents = new HashMap<>(); + + public static Reagent register(Reagent r) { + reagents.put(r.getRegistryName(), r); + return r; + } + + public static Collection getReagents() { + return reagents.values(); + } + + @Nullable + public static Reagent find(ResourceLocation location) { + return reagents.getOrDefault(location, null); + } + + public static Reagent + STEAM = register(new SteamReagent(new ResourceLocation(Eidolon.MODID, "steam"))), + ESPRIT = register(new EspritReagent(new ResourceLocation(Eidolon.MODID, "esprit"))), + CRIMSOL = register(new CrimsolReagent(new ResourceLocation(Eidolon.MODID, "crimsol"))); +} diff --git a/src/main/java/elucent/eidolon/reagent/ReagentStack.java b/src/main/java/elucent/eidolon/reagent/ReagentStack.java new file mode 100644 index 0000000..eeedebe --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/ReagentStack.java @@ -0,0 +1,30 @@ +package elucent.eidolon.reagent; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; + +public class ReagentStack { + public Reagent reagent; + public int amount; + + public ReagentStack(Reagent reagent, int amount) { + this.reagent = reagent; + this.amount = amount; + } + + public ReagentStack(CompoundTag nbt) { + this.reagent = ReagentRegistry.find(new ResourceLocation(nbt.getString("reagent"))); + this.amount = nbt.getInt("amount"); + } + + public boolean isEmpty() { + return amount == 0; + } + + public CompoundTag write() { + CompoundTag nbt = new CompoundTag(); + nbt.putString("reagent", reagent.getRegistryName().toString()); + nbt.putInt("amount", amount); + return nbt; + } +} diff --git a/src/main/java/elucent/eidolon/reagent/ReagentTank.java b/src/main/java/elucent/eidolon/reagent/ReagentTank.java new file mode 100644 index 0000000..3f957f4 --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/ReagentTank.java @@ -0,0 +1,54 @@ +package elucent.eidolon.reagent; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +public class ReagentTank { + int capacity; + ReagentStack contents; + + public ReagentTank(int capacity) { + this.capacity = capacity; + this.contents = new ReagentStack(ReagentRegistry.STEAM, 0); + } + + public ReagentStack getContents() { + return contents; + } + + public int getCapacity() { + return capacity; + } + + public float getPressure() { + return (float)contents.amount / capacity; + } + + public CompoundTag write() { + CompoundTag nbt = new CompoundTag(); + if (contents != null) nbt.put("contents", contents.write()); + nbt.putInt("capacity", capacity); + return nbt; + } + + public void read(CompoundTag nbt) { + contents = nbt.contains("contents") ? new ReagentStack(nbt.getCompound("contents")) : new ReagentStack(ReagentRegistry.STEAM, 0); + capacity = nbt.getInt("capacity"); + } + + public boolean canFill(ReagentStack stack) { + return contents.isEmpty() || contents.reagent == stack.reagent; + } + + public boolean fill(Level world, BlockPos pos, ReagentStack stack) { + if (!contents.isEmpty() && contents.reagent != stack.reagent) return false; + if (contents.isEmpty()) contents.reagent = stack.reagent; + contents.amount += stack.amount; + if (contents.amount > capacity * 1.25) { + contents.reagent.worldEffect(world, pos, contents.amount); + world.destroyBlock(pos, false); + } + return true; + } +} diff --git a/src/main/java/elucent/eidolon/reagent/RegisterReagentsEvent.java b/src/main/java/elucent/eidolon/reagent/RegisterReagentsEvent.java new file mode 100644 index 0000000..ea238c8 --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/RegisterReagentsEvent.java @@ -0,0 +1,7 @@ +package elucent.eidolon.reagent; + +import net.minecraftforge.eventbus.api.Event; + +public class RegisterReagentsEvent extends Event { + // +} diff --git a/src/main/java/elucent/eidolon/reagent/SteamReagent.java b/src/main/java/elucent/eidolon/reagent/SteamReagent.java new file mode 100644 index 0000000..c6ddbc4 --- /dev/null +++ b/src/main/java/elucent/eidolon/reagent/SteamReagent.java @@ -0,0 +1,20 @@ +package elucent.eidolon.reagent; + +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +public class SteamReagent extends Reagent { + public SteamReagent(ResourceLocation name) { + super(name, new ResourceLocation(Eidolon.MODID, "block/vapor"), true); + } + + @Override + public void worldEffect(Level world, BlockPos pos, int amount) { + if (!world.isClientSide) + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 1, 1); + } +} diff --git a/src/main/java/elucent/eidolon/recipe/CrucibleRecipe.java b/src/main/java/elucent/eidolon/recipe/CrucibleRecipe.java index f29bdf5..56cdf5c 100644 --- a/src/main/java/elucent/eidolon/recipe/CrucibleRecipe.java +++ b/src/main/java/elucent/eidolon/recipe/CrucibleRecipe.java @@ -1,25 +1,29 @@ package elucent.eidolon.recipe; -import elucent.eidolon.ritual.IRitualItemFocus; -import elucent.eidolon.ritual.MultiItemSacrifice; -import elucent.eidolon.ritual.Ritual; -import elucent.eidolon.ritual.RitualRegistry; -import elucent.eidolon.tile.CrucibleTileEntity; -import elucent.eidolon.tile.CrucibleTileEntity.CrucibleStep; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tags.ITag; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.lang.reflect.Array; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -public class CrucibleRecipe { +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.tile.CrucibleTileEntity.CrucibleStep; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.registries.ForgeRegistryEntry; + +public class CrucibleRecipe implements Recipe { List steps = new ArrayList<>(); ResourceLocation registryName; ItemStack result; @@ -29,16 +33,17 @@ public ItemStack getResult() { } public static class Step { - public List matches = new ArrayList<>(); + public List matches = new ArrayList<>(); public int stirs; - public Step(int stirs, List matches) { + public Step(int stirs, List matches) { this.stirs = stirs; this.matches.addAll(matches); } }; - public CrucibleRecipe(ItemStack result) { + public CrucibleRecipe(List steps, ItemStack result) { + this.steps = steps; this.result = result; } @@ -60,41 +65,10 @@ public CrucibleRecipe setRegistryName(ResourceLocation registryName) { return this; } - public CrucibleRecipe addStep(Object... matches) { - addStirringStep(0, matches); - return this; - } - - public CrucibleRecipe addStep(int stirs) { - addStirringStep(stirs, new Object[]{}); - return this; - } - - public CrucibleRecipe addStirringStep(int stirs, Object... matches) { - steps.add(new Step(stirs, Arrays.asList(matches))); - return this; - } - - static boolean matches(Object match, ItemStack sacrifice) { - if (match instanceof ItemStack) { - if (ItemStack.areItemStacksEqual((ItemStack)match, sacrifice)) return true; - } - else if (match instanceof Item) { - if ((Item)match == sacrifice.getItem()) return true; - } - else if (match instanceof Block) { - if (((Block)match).asItem() == sacrifice.getItem()) return true; - } - else if (match instanceof ITag) { - if (((ITag)match).contains(sacrifice.getItem())) return true; - } - return false; - } - public boolean matches(List items) { if (steps.size() != items.size()) return false; - List matchList = new ArrayList<>(); + List matchList = new ArrayList<>(); List itemList = new ArrayList<>(); for (int i = 0; i < steps.size(); i ++) { @@ -109,7 +83,7 @@ public boolean matches(List items) { for (int j = 0; j < matchList.size(); j ++) { for (int k = 0; k < itemList.size(); k ++) { - if (matches(matchList.get(j), itemList.get(k))) { + if (matchList.get(j).test(itemList.get(k))) { matchList.remove(j --); itemList.remove(k --); break; @@ -117,9 +91,105 @@ public boolean matches(List items) { } } - if (matchList.size() != 0) return false; + if (matchList.size() != 0 || itemList.size() != 0) return false; } return true; } + + @Override + public boolean matches(Container inv, Level worldIn) { + return false; // we don't use a single inventory, so we ignore this one + } + + @Override + public ItemStack assemble(Container inv) { + return getResultItem(); + } + + @Override + public boolean canCraftInDimensions(int width, int height) { + return false; // we don't use a single inventory, so we ignore this one + } + + @Override + public ItemStack getResultItem() { + return result; + } + + @Override + public ResourceLocation getId() { + return registryName; + } + + public static class Type implements RecipeType { + @Override + public String toString () { + return Eidolon.MODID + ":crucible"; + } + + public static final CrucibleRecipe.Type INSTANCE = new CrucibleRecipe.Type(); + } + + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { + @Override + public CrucibleRecipe fromJson(ResourceLocation recipeId, JsonObject json) { + List steps = new ArrayList<>(); + JsonArray stepArray = json.getAsJsonArray("steps"); + for (JsonElement elt : stepArray) { + if (!elt.isJsonObject()) throw new JsonSyntaxException("Expected JSON object for crucible step."); + JsonObject step = elt.getAsJsonObject(); + int stirs = step.has("stirs") ? step.get("stirs").getAsInt() : 0; + List matches = new ArrayList<>(); + if (step.has("items")) { + JsonArray items = step.get("items").getAsJsonArray(); + for (JsonElement item : items) matches.add(Ingredient.fromJson(item)); + } + steps.add(new Step(stirs, matches)); + } + ItemStack result = CraftingHelper.getItemStack(json.getAsJsonObject("result"), true); + return CrucibleRegistry.register(new CrucibleRecipe(steps, result).setRegistryName(recipeId)); + } + + @Override + public CrucibleRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { + int count = buffer.readInt(); + List steps = new ArrayList<>(); + for (int i = 0; i < count; i ++) { + int stirs = buffer.readInt(); + int ingredients = buffer.readInt(); + List matches = new ArrayList<>(); + for (int j = 0; j < ingredients; j ++) matches.add(Ingredient.fromNetwork(buffer)); + steps.add(new Step(stirs, matches)); + } + ItemStack result = buffer.readItem(); + return CrucibleRegistry.register(new CrucibleRecipe(steps, result).setRegistryName(recipeId)); + } + + @Override + public void toNetwork(FriendlyByteBuf buffer, CrucibleRecipe recipe) { + buffer.writeInt(recipe.steps.size()); + for (Step step : recipe.steps) { + buffer.writeInt(step.stirs); + buffer.writeInt(step.matches.size()); + for (Ingredient i : step.matches) i.toNetwork(buffer); + } + buffer.writeItem(recipe.result); + } + } + + @Override + public RecipeSerializer getSerializer() { + return Registry.CRUCIBLE_RECIPE.get(); + } + + @Override + public RecipeType getType() { + return CrucibleRecipe.Type.INSTANCE; + } + + @Override + public boolean isSpecial() { + return true; // needed to prevent errors loading modded recipes in the recipe book + } } diff --git a/src/main/java/elucent/eidolon/recipe/CrucibleRegistry.java b/src/main/java/elucent/eidolon/recipe/CrucibleRegistry.java index 6da60a2..7dacaa5 100644 --- a/src/main/java/elucent/eidolon/recipe/CrucibleRegistry.java +++ b/src/main/java/elucent/eidolon/recipe/CrucibleRegistry.java @@ -1,37 +1,28 @@ package elucent.eidolon.recipe; -import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import elucent.eidolon.codex.CruciblePage; import elucent.eidolon.codex.Page; -import elucent.eidolon.gui.jei.CrucibleCategory; import elucent.eidolon.gui.jei.RecipeWrappers; -import elucent.eidolon.ritual.Ritual; -import elucent.eidolon.tile.CrucibleTileEntity; import elucent.eidolon.tile.CrucibleTileEntity.CrucibleStep; -import elucent.eidolon.util.StackUtil; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ItemTags; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.Tags; - -import javax.annotation.Resource; -import java.util.*; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; public class CrucibleRegistry { static Map linkedPages = new HashMap<>(); static Map recipes = new HashMap<>(); - public static void register(CrucibleRecipe recipe) { + public static CrucibleRecipe register(CrucibleRecipe recipe) { ResourceLocation loc = recipe.getRegistryName(); assert loc != null; recipes.put(loc, recipe); + return recipe; } public static void condense(List stacks) { @@ -39,7 +30,7 @@ public static void condense(List stacks) { ItemStack last = ItemStack.EMPTY; while (iter.hasNext()) { ItemStack i = iter.next(); - if (!ItemStack.areItemsEqual(i, last) || !ItemStack.areItemStackTagsEqual(i, last) || last.getCount() + i.getCount() > last.getMaxStackSize()) { + if (!ItemStack.isSame(i, last) || !ItemStack.tagMatches(i, last) || last.getCount() + i.getCount() > last.getMaxStackSize()) { last = i; } else { @@ -52,7 +43,7 @@ public static void condense(List stacks) { public static Page getDefaultPage(CrucibleRecipe recipe) { List steps = new ArrayList<>(); for (CrucibleRecipe.Step step : recipe.getSteps()) { - List stacks = StackUtil.stacksFromObjects(step.matches); + List stacks = step.matches.stream().map((i) -> i.getItems()[0].copy()).collect(Collectors.toList()); condense(stacks); steps.add(new CruciblePage.CrucibleStep(step.stirs, stacks.toArray(new ItemStack[stacks.size()]))); } @@ -65,10 +56,10 @@ public static void linkPage(ResourceLocation recipe, Page page) { public static List getWrappedRecipes() { List wrappers = new ArrayList<>(); - for (Map.Entry entry : recipes.entrySet()) { - Page page = linkedPages.getOrDefault(entry.getKey(), null); + for (CrucibleRecipe recipe : recipes.values()) { + Page page = null; // linkedPages.getOrDefault(entry.getKey(), null); wrappers.add(new RecipeWrappers.Crucible( - entry.getValue(), + recipe, page )); } @@ -85,80 +76,80 @@ public static CrucibleRecipe find(List steps) { } public static void init() { - register(new CrucibleRecipe(new ItemStack(Registry.ARCANE_GOLD_INGOT.get(), 2)).setRegistryName(Eidolon.MODID, "arcane_gold") - .addStep(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Registry.SOUL_SHARD.get()) - .addStep(Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD)); - register(new CrucibleRecipe(new ItemStack(Registry.LESSER_SOUL_GEM.get())).setRegistryName(Eidolon.MODID, "lesser_soul_gem") - .addStep(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.GEMS_LAPIS, Tags.Items.GEMS_LAPIS) - .addStirringStep(2, Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get()) - .addStep(Tags.Items.GEMS_QUARTZ)); - register(new CrucibleRecipe(new ItemStack(Registry.SHADOW_GEM.get())).setRegistryName(Eidolon.MODID, "shadow_gem") - .addStep(Items.COAL) - .addStirringStep(1, Items.GHAST_TEAR, Registry.DEATH_ESSENCE.get()) - .addStirringStep(1, Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get(), Registry.DEATH_ESSENCE.get()) - .addStep(Tags.Items.GEMS_DIAMOND)); - register(new CrucibleRecipe(new ItemStack(Registry.SULFUR.get(), 2)).setRegistryName(Eidolon.MODID, "sulfur") - .addStep(Items.COAL, Registry.ENCHANTED_ASH.get())); - register(new CrucibleRecipe(new ItemStack(Registry.ENDER_CALX.get(), 2)).setRegistryName(Eidolon.MODID, "ender_calx") - .addStep(Tags.Items.ENDER_PEARLS, Registry.ENCHANTED_ASH.get())); - register(new CrucibleRecipe(new ItemStack(Items.LEATHER, 1)).setRegistryName(Eidolon.MODID, "leather_from_flesh") - .addStep(Registry.ENCHANTED_ASH.get(), Registry.ENCHANTED_ASH.get()) - .addStirringStep(2, Items.ROTTEN_FLESH)); - register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_beef") - .addStep(Items.BEEF, Tags.Items.MUSHROOMS)); - register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_pork") - .addStep(Items.PORKCHOP, Tags.Items.MUSHROOMS)); - register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_mutton") - .addStep(Items.MUTTON, Tags.Items.MUSHROOMS)); - register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_chicken") - .addStep(Items.CHICKEN, Tags.Items.MUSHROOMS)); - register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_rabbit") - .addStep(Items.RABBIT, Tags.Items.MUSHROOMS)); - register(new CrucibleRecipe(new ItemStack(Items.GUNPOWDER, 4)).setRegistryName(Eidolon.MODID, "gunpowder") - .addStep(Registry.SULFUR.get(), Items.BONE_MEAL) - .addStirringStep(1, Items.CHARCOAL)); - register(new CrucibleRecipe(new ItemStack(Items.GOLDEN_APPLE, 1)).setRegistryName(Eidolon.MODID, "gilded_apple") - .addStep(Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD) - .addStirringStep(2, Registry.ENCHANTED_ASH.get()) - .addStep(Items.APPLE)); - register(new CrucibleRecipe(new ItemStack(Items.GOLDEN_CARROT, 1)).setRegistryName(Eidolon.MODID, "gilded_carrot") - .addStep(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_GOLD) - .addStirringStep(2, Registry.ENCHANTED_ASH.get()) - .addStep(Items.CARROT)); - register(new CrucibleRecipe(new ItemStack(Items.GLISTERING_MELON_SLICE, 1)).setRegistryName(Eidolon.MODID, "gilded_melon") - .addStep(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_GOLD) - .addStirringStep(2, Registry.ENCHANTED_ASH.get()) - .addStep(Items.MELON_SLICE)); - register(new CrucibleRecipe(new ItemStack(Registry.DEATH_ESSENCE.get(), 4)).setRegistryName(Eidolon.MODID, "death_essence") - .addStep(Registry.ZOMBIE_HEART.get(), Items.ROTTEN_FLESH) - .addStirringStep(2, Items.BONE_MEAL, Items.BONE_MEAL) - .addStep(Items.CHARCOAL)); - register(new CrucibleRecipe(new ItemStack(Registry.CRIMSON_ESSENCE.get(), 4)).setRegistryName(Eidolon.MODID, "crimson_essence_fungus") - .addStep(Items.CRIMSON_FUNGUS, Items.NETHER_WART) - .addStirringStep(1, Registry.SULFUR.get())); - register(new CrucibleRecipe(new ItemStack(Registry.CRIMSON_ESSENCE.get(), 2)).setRegistryName(Eidolon.MODID, "crimson_essence_roots") - .addStep(Items.CRIMSON_ROOTS, Items.NETHER_WART) - .addStirringStep(1, Registry.SULFUR.get())); - register(new CrucibleRecipe(new ItemStack(Registry.CRIMSON_ESSENCE.get(), 2)).setRegistryName(Eidolon.MODID, "crimson_essence_vines") - .addStep(Items.WEEPING_VINES, Items.NETHER_WART) - .addStirringStep(1, Registry.SULFUR.get())); - register(new CrucibleRecipe(new ItemStack(Registry.FUNGUS_SPROUTS.get(), 2)).setRegistryName(Eidolon.MODID, "fungus_sprouts") - .addStep(Tags.Items.MUSHROOMS) - .addStirringStep(2, Items.BONE_MEAL) - .addStep(Items.WHEAT_SEEDS)); - register(new CrucibleRecipe(new ItemStack(Registry.WARPED_SPROUTS.get(), 2)).setRegistryName(Eidolon.MODID, "warped_sprouts") - .addStep(Blocks.WARPED_FUNGUS) - .addStirringStep(2, Registry.ENDER_CALX.get()) - .addStep(Items.NETHER_WART)); - register(new CrucibleRecipe(new ItemStack(Registry.POLISHED_PLANKS.getBlock(), 32)).setRegistryName(Eidolon.MODID, "polished_planks") - .addStep(ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, - ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS) - .addStirringStep(1, Registry.SOUL_SHARD.get(), Registry.ENCHANTED_ASH.get())); +// register(new CrucibleRecipe(new ItemStack(Registry.ARCANE_GOLD_INGOT.get(), 2)).setRegistryName(Eidolon.MODID, "arcane_gold") +// .addStep(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Registry.SOUL_SHARD.get()) +// .addStep(Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD)); +// register(new CrucibleRecipe(new ItemStack(Registry.LESSER_SOUL_GEM.get())).setRegistryName(Eidolon.MODID, "lesser_soul_gem") +// .addStep(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.GEMS_LAPIS, Tags.Items.GEMS_LAPIS) +// .addStirringStep(2, Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get()) +// .addStep(Tags.Items.GEMS_QUARTZ)); +// register(new CrucibleRecipe(new ItemStack(Registry.SHADOW_GEM.get())).setRegistryName(Eidolon.MODID, "shadow_gem") +// .addStep(Items.COAL) +// .addStirringStep(1, Items.GHAST_TEAR, Registry.DEATH_ESSENCE.get()) +// .addStirringStep(1, Registry.SOUL_SHARD.get(), Registry.SOUL_SHARD.get(), Registry.DEATH_ESSENCE.get()) +// .addStep(Tags.Items.GEMS_DIAMOND)); +// register(new CrucibleRecipe(new ItemStack(Registry.SULFUR.get(), 2)).setRegistryName(Eidolon.MODID, "sulfur") +// .addStep(Items.COAL, Registry.ENCHANTED_ASH.get())); +// register(new CrucibleRecipe(new ItemStack(Registry.ENDER_CALX.get(), 2)).setRegistryName(Eidolon.MODID, "ender_calx") +// .addStep(Tags.Items.ENDER_PEARLS, Registry.ENCHANTED_ASH.get())); +// register(new CrucibleRecipe(new ItemStack(Items.LEATHER, 1)).setRegistryName(Eidolon.MODID, "leather_from_flesh") +// .addStep(Registry.ENCHANTED_ASH.get(), Registry.ENCHANTED_ASH.get()) +// .addStirringStep(2, Items.ROTTEN_FLESH)); +// register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_beef") +// .addStep(Items.BEEF, Tags.Items.MUSHROOMS)); +// register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_pork") +// .addStep(Items.PORKCHOP, Tags.Items.MUSHROOMS)); +// register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_mutton") +// .addStep(Items.MUTTON, Tags.Items.MUSHROOMS)); +// register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_chicken") +// .addStep(Items.CHICKEN, Tags.Items.MUSHROOMS)); +// register(new CrucibleRecipe(new ItemStack(Items.ROTTEN_FLESH, 1)).setRegistryName(Eidolon.MODID, "rotten_rabbit") +// .addStep(Items.RABBIT, Tags.Items.MUSHROOMS)); +// register(new CrucibleRecipe(new ItemStack(Items.GUNPOWDER, 4)).setRegistryName(Eidolon.MODID, "gunpowder") +// .addStep(Registry.SULFUR.get(), Items.BONE_MEAL) +// .addStirringStep(1, Items.CHARCOAL)); +// register(new CrucibleRecipe(new ItemStack(Items.GOLDEN_APPLE, 1)).setRegistryName(Eidolon.MODID, "gilded_apple") +// .addStep(Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD) +// .addStirringStep(2, Registry.ENCHANTED_ASH.get()) +// .addStep(Items.APPLE)); +// register(new CrucibleRecipe(new ItemStack(Items.GOLDEN_CARROT, 1)).setRegistryName(Eidolon.MODID, "gilded_carrot") +// .addStep(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_GOLD) +// .addStirringStep(2, Registry.ENCHANTED_ASH.get()) +// .addStep(Items.CARROT)); +// register(new CrucibleRecipe(new ItemStack(Items.GLISTERING_MELON_SLICE, 1)).setRegistryName(Eidolon.MODID, "gilded_melon") +// .addStep(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_GOLD) +// .addStirringStep(2, Registry.ENCHANTED_ASH.get()) +// .addStep(Items.MELON_SLICE)); +// register(new CrucibleRecipe(new ItemStack(Registry.DEATH_ESSENCE.get(), 4)).setRegistryName(Eidolon.MODID, "death_essence") +// .addStep(Registry.ZOMBIE_HEART.get(), Items.ROTTEN_FLESH) +// .addStirringStep(2, Items.BONE_MEAL, Items.BONE_MEAL) +// .addStep(Items.CHARCOAL)); +// register(new CrucibleRecipe(new ItemStack(Registry.CRIMSON_ESSENCE.get(), 4)).setRegistryName(Eidolon.MODID, "crimson_essence_fungus") +// .addStep(Items.CRIMSON_FUNGUS, Items.NETHER_WART) +// .addStirringStep(1, Registry.SULFUR.get())); +// register(new CrucibleRecipe(new ItemStack(Registry.CRIMSON_ESSENCE.get(), 2)).setRegistryName(Eidolon.MODID, "crimson_essence_roots") +// .addStep(Items.CRIMSON_ROOTS, Items.NETHER_WART) +// .addStirringStep(1, Registry.SULFUR.get())); +// register(new CrucibleRecipe(new ItemStack(Registry.CRIMSON_ESSENCE.get(), 2)).setRegistryName(Eidolon.MODID, "crimson_essence_vines") +// .addStep(Items.WEEPING_VINES, Items.NETHER_WART) +// .addStirringStep(1, Registry.SULFUR.get())); +// register(new CrucibleRecipe(new ItemStack(Registry.FUNGUS_SPROUTS.get(), 2)).setRegistryName(Eidolon.MODID, "fungus_sprouts") +// .addStep(Tags.Items.MUSHROOMS) +// .addStirringStep(2, Items.BONE_MEAL) +// .addStep(Items.WHEAT_SEEDS)); +// register(new CrucibleRecipe(new ItemStack(Registry.WARPED_SPROUTS.get(), 2)).setRegistryName(Eidolon.MODID, "warped_sprouts") +// .addStep(Blocks.WARPED_FUNGUS) +// .addStirringStep(2, Registry.ENDER_CALX.get()) +// .addStep(Items.NETHER_WART)); +// register(new CrucibleRecipe(new ItemStack(Registry.POLISHED_PLANKS.getBlock(), 32)).setRegistryName(Eidolon.MODID, "polished_planks") +// .addStep(ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, +// ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS, ItemTags.PLANKS) +// .addStirringStep(1, Registry.SOUL_SHARD.get(), Registry.ENCHANTED_ASH.get())); } } diff --git a/src/main/java/elucent/eidolon/recipe/WorktableRecipe.java b/src/main/java/elucent/eidolon/recipe/WorktableRecipe.java index fc9dc2b..2ba0887 100644 --- a/src/main/java/elucent/eidolon/recipe/WorktableRecipe.java +++ b/src/main/java/elucent/eidolon/recipe/WorktableRecipe.java @@ -1,20 +1,34 @@ package elucent.eidolon.recipe; -import net.minecraft.block.Block; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; - -public class WorktableRecipe { - Object[] core, extras; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.registries.ForgeRegistryEntry; + +public class WorktableRecipe implements Recipe { + Ingredient[] core, extras; ItemStack result; ResourceLocation registryName; - public WorktableRecipe(Object[] core, Object[] extras, ItemStack result) { + public WorktableRecipe(Ingredient[] core, Ingredient[] extras, ItemStack result) { this.core = core; this.extras = extras; this.result = result; @@ -34,47 +48,31 @@ public WorktableRecipe setRegistryName(ResourceLocation registryName) { return this; } - public Object[] getCore() { + public Ingredient[] getCore() { return core; } - public Object[] getOuter() { + public Ingredient[] getOuter() { return extras; } - static boolean matches(Object match, ItemStack sacrifice) { - if (match instanceof ItemStack) { - if (ItemStack.areItemStacksEqual((ItemStack)match, sacrifice)) return true; - } - else if (match instanceof Item) { - if ((Item)match == sacrifice.getItem()) return true; - } - else if (match instanceof Block) { - if (((Block)match).asItem() == sacrifice.getItem()) return true; - } - else if (match instanceof ITag) { - if (((ITag)match).contains(sacrifice.getItem())) return true; - } - return false; - } - - public boolean matches(IInventory coreInv, IInventory extraInv) { - if (coreInv.getSizeInventory() < 9 || extraInv.getSizeInventory() < 4) return false; + public boolean matches(Container coreInv, Container extraInv) { + if (coreInv.getContainerSize() < 9 || extraInv.getContainerSize() < 4) return false; for (int i = 0; i < core.length; i ++) { - if (!matches(core[i], coreInv.getStackInSlot(i))) return false; + if (!core[i].test(coreInv.getItem(i))) return false; } for (int i = 0; i < extras.length; i ++) { - if (!matches(extras[i], extraInv.getStackInSlot(i))) return false; + if (!extras[i].test(extraInv.getItem(i))) return false; } return true; } - public NonNullList getRemainingItems(IInventory coreInv, IInventory extraInv) { + public NonNullList getRemainingItems(Container coreInv, Container extraInv) { NonNullList items = NonNullList.withSize(13, ItemStack.EMPTY); for(int i = 0; i < items.size(); ++i) { - IInventory inv = i < 9 ? coreInv : extraInv; - ItemStack item = inv.getStackInSlot(i < 9 ? i : i - 9); + Container inv = i < 9 ? coreInv : extraInv; + ItemStack item = inv.getItem(i < 9 ? i : i - 9); if (item.hasContainerItem()) { items.set(i, item.getContainerItem()); } @@ -86,4 +84,100 @@ public NonNullList getRemainingItems(IInventory coreInv, IInventory e public ItemStack getResult() { return result.copy(); } + + @Override + public boolean matches(Container inv, Level worldIn) { + return false; // we don't use a single inventory, so we ignore this one + } + + @Override + public ItemStack assemble(Container inv) { + return getResultItem(); + } + + @Override + public boolean canCraftInDimensions(int width, int height) { + return false; // we don't use a single inventory, so we ignore this one + } + + @Override + public ItemStack getResultItem() { + return result; + } + + @Override + public ResourceLocation getId() { + return registryName; + } + + public static class Type implements RecipeType { + @Override + public String toString () { + return Eidolon.MODID + ":worktable"; + } + + public static final Type INSTANCE = new Type(); + } + + public static class Serializer extends ForgeRegistryEntry> implements RecipeSerializer { + @Override + public WorktableRecipe fromJson(ResourceLocation recipeId, JsonObject json) { + Map ingredientMap = new HashMap<>(); + JsonObject keys = json.getAsJsonObject("key"); + for (Map.Entry e : keys.entrySet()) { + if (e.getKey().length() != 1) throw new RuntimeException("Recipe ingredient key must be a single character"); + ingredientMap.put(e.getKey(), Ingredient.fromJson(e.getValue().getAsJsonObject())); + } + Ingredient[] core = new Ingredient[9], extras = new Ingredient[4]; + JsonArray pattern = json.getAsJsonArray("pattern"); + if (pattern.size() != 3) throw new JsonSyntaxException("All worktable recipes must have three rows."); + for (int i = 0; i < 3; i ++) { + if (pattern.get(i).getAsString().length() != 3) throw new JsonSyntaxException("All worktable recipe rows must have three columns."); + for (int j = 0; j < 3; j ++) { + String key = pattern.get(i).getAsString().substring(j, j + 1); + Ingredient item = key.equals(" ") ? Ingredient.EMPTY : ingredientMap.get(key); + core[i * 3 + j] = item; + } + } + String reagents = json.get("reagents").getAsString(); + if (reagents.length() != 4) throw new JsonSyntaxException("All worktable recipes must have reagent strings of length 4."); + for (int i = 0; i < 4; i ++) { + String key = reagents.substring(i, i + 1); + extras[i] = key.equals(" ") ? Ingredient.EMPTY : ingredientMap.get(key); + } + ItemStack result = CraftingHelper.getItemStack(json.getAsJsonObject("result"), true); + return WorktableRegistry.register(new WorktableRecipe(core, extras, result).setRegistryName(recipeId)); + } + + @Override + public WorktableRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { + Ingredient[] core = new Ingredient[9], extras = new Ingredient[4]; + for (int i = 0; i < 9; i ++) core[i] = Ingredient.fromNetwork(buffer); + for (int i = 0; i < 4; i ++) extras[i] = Ingredient.fromNetwork(buffer); + ItemStack result = buffer.readItem(); + return WorktableRegistry.register(new WorktableRecipe(core, extras, result).setRegistryName(recipeId)); + } + + @Override + public void toNetwork(FriendlyByteBuf buffer, WorktableRecipe recipe) { + for (int i = 0; i < 9; i ++) recipe.core[i].toNetwork(buffer); + for (int i = 0; i < 4; i ++) recipe.extras[i].toNetwork(buffer); + buffer.writeItem(recipe.result); + } + } + + @Override + public RecipeSerializer getSerializer() { + return Registry.WORKTABLE_RECIPE.get(); + } + + @Override + public RecipeType getType() { + return Type.INSTANCE; + } + + @Override + public boolean isSpecial() { + return true; // needed to prevent errors loading modded recipes in the recipe book + } } diff --git a/src/main/java/elucent/eidolon/recipe/WorktableRegistry.java b/src/main/java/elucent/eidolon/recipe/WorktableRegistry.java index 9759c8c..8aca6ae 100644 --- a/src/main/java/elucent/eidolon/recipe/WorktableRegistry.java +++ b/src/main/java/elucent/eidolon/recipe/WorktableRegistry.java @@ -1,54 +1,41 @@ package elucent.eidolon.recipe; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; -import elucent.eidolon.codex.CruciblePage; -import elucent.eidolon.codex.Page; -import elucent.eidolon.codex.WorktablePage; -import elucent.eidolon.gui.jei.RecipeWrappers; -import elucent.eidolon.tile.CrucibleTileEntity; -import elucent.eidolon.util.StackUtil; -import net.minecraft.block.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.ForgeTagHandler; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.data.ForgeBlockTagsProvider; -import net.minecraftforge.common.data.ForgeItemTagsProvider; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import elucent.eidolon.codex.Page; +import elucent.eidolon.codex.WorktablePage; +import elucent.eidolon.gui.jei.RecipeWrappers; +import elucent.eidolon.util.RecipeUtil; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; + public class WorktableRegistry { static Map recipes = new HashMap<>(); - public static void register(WorktableRecipe recipe) { + public static WorktableRecipe register(WorktableRecipe recipe) { ResourceLocation loc = recipe.getRegistryName(); assert loc != null; recipes.put(loc, recipe); + return recipe; } public static Page getDefaultPage(WorktableRecipe recipe) { List stacks = new ArrayList<>(); - for (Object o : recipe.core) stacks.add(StackUtil.stackFromObject(o)); - for (Object o : recipe.extras) stacks.add(StackUtil.stackFromObject(o)); + for (Object o : recipe.core) stacks.add(RecipeUtil.stackFromObject(o)); + for (Object o : recipe.extras) stacks.add(RecipeUtil.stackFromObject(o)); return new WorktablePage(recipe.result.copy(), stacks.toArray(new ItemStack[stacks.size()])); } public static List getWrappedRecipes() { List wrappers = new ArrayList<>(); - for (Map.Entry entry : recipes.entrySet()) { + for (WorktableRecipe recipe : recipes.values()) { Page page = null; // linkedPages.getOrDefault(entry.getKey(), null); wrappers.add(new RecipeWrappers.Worktable( - entry.getValue(), + recipe, page )); } @@ -59,201 +46,8 @@ public static WorktableRecipe find(ResourceLocation loc) { return recipes.get(loc); } - public static WorktableRecipe find(IInventory core, IInventory outer) { + public static WorktableRecipe find(Container core, Container outer) { for (WorktableRecipe recipe : recipes.values()) if (recipe.matches(core, outer)) return recipe; return null; } - - public static void init() { - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.PEWTER_INGOT.get(), ItemStack.EMPTY, - Registry.PEWTER_INLAY.get(), Registry.BASIC_AMULET.get(), Registry.PEWTER_INLAY.get(), - ItemStack.EMPTY, Blocks.OBSIDIAN, ItemStack.EMPTY - }, new Object[]{ - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY, - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY - }, new ItemStack(Registry.VOID_AMULET.get())).setRegistryName(Eidolon.MODID, "void_amulet")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.LESSER_SOUL_GEM.get(), ItemStack.EMPTY, - Registry.ENCHANTED_ASH.get(), Items.IRON_CHESTPLATE, Registry.ENCHANTED_ASH.get(), - ItemStack.EMPTY, Registry.ENCHANTED_ASH.get(), ItemStack.EMPTY - }, new Object[]{ - Registry.PEWTER_INLAY.get(), - Registry.PEWTER_INLAY.get(), - Registry.PEWTER_INLAY.get(), - Registry.PEWTER_INLAY.get() - }, new ItemStack(Registry.WARDED_MAIL.get())).setRegistryName(Eidolon.MODID, "warded_mail")); - register(new WorktableRecipe(new Object[]{ - Registry.PEWTER_INGOT.get(), Registry.PEWTER_INGOT.get(), ItemStack.EMPTY, - ItemStack.EMPTY, Items.STICK, Registry.PEWTER_INGOT.get(), - Items.STICK, ItemStack.EMPTY, ItemStack.EMPTY - }, new Object[]{ - Registry.UNHOLY_SYMBOL.get(), - Registry.SOUL_SHARD.get(), - Registry.TATTERED_CLOTH.get(), - Registry.SOUL_SHARD.get() - }, new ItemStack(Registry.REAPER_SCYTHE.get())).setRegistryName(Eidolon.MODID, "reaper_scythe")); - register(new WorktableRecipe(new Object[]{ - Registry.PEWTER_INGOT.get(), Registry.PEWTER_INGOT.get(), ItemStack.EMPTY, - Registry.PEWTER_INGOT.get(), Items.STICK, ItemStack.EMPTY, - ItemStack.EMPTY, Items.STICK, ItemStack.EMPTY - }, new Object[]{ - Registry.UNHOLY_SYMBOL.get(), - ItemStack.EMPTY, - Registry.PEWTER_INLAY.get(), - ItemStack.EMPTY - }, new ItemStack(Registry.CLEAVING_AXE.get())).setRegistryName(Eidolon.MODID, "cleaving_axe")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Items.BOOK, ItemStack.EMPTY, - Registry.ARCANE_GOLD_INGOT.get(), Blocks.OBSIDIAN, Registry.ARCANE_GOLD_INGOT.get(), - Blocks.OBSIDIAN, Blocks.OBSIDIAN, Blocks.OBSIDIAN - }, new Object[]{ - Tags.Items.GEMS_DIAMOND, - Registry.GOLD_INLAY.get(), - Tags.Items.GEMS_DIAMOND, - Registry.GOLD_INLAY.get() - }, new ItemStack(Registry.SOUL_ENCHANTER.get())).setRegistryName(Eidolon.MODID, "soul_enchanter")); - register(new WorktableRecipe(new Object[]{ - Blocks.OBSIDIAN, Blocks.CRYING_OBSIDIAN, Blocks.OBSIDIAN, - ItemStack.EMPTY, Registry.PEWTER_INGOT.get(), ItemStack.EMPTY, - ItemStack.EMPTY, Registry.PEWTER_INLAY.get(), ItemStack.EMPTY - }, new Object[]{ - Items.ENDER_PEARL, - Registry.SOUL_SHARD.get(), - Registry.LESSER_SOUL_GEM.get(), - Registry.SOUL_SHARD.get() - }, new ItemStack(Registry.REVERSAL_PICK.get())).setRegistryName(Eidolon.MODID, "reversal_pick")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.ARCANE_GOLD_INGOT.get(), Registry.SHADOW_GEM.get(), - ItemStack.EMPTY, Items.STICK, Registry.ARCANE_GOLD_INGOT.get(), - Registry.GOLD_INLAY.get(), ItemStack.EMPTY, ItemStack.EMPTY - }, new Object[]{ - Registry.LESSER_SOUL_GEM.get(), - Items.BLAZE_POWDER, - Items.BLAZE_POWDER, - Items.BLAZE_POWDER - }, new ItemStack(Registry.SOULFIRE_WAND.get())).setRegistryName(Eidolon.MODID, "soulfire_wand")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.PEWTER_INGOT.get(), Registry.WRAITH_HEART.get(), - ItemStack.EMPTY, Items.STICK, Registry.PEWTER_INGOT.get(), - Registry.PEWTER_INLAY.get(), ItemStack.EMPTY, ItemStack.EMPTY - }, new Object[]{ - Registry.LESSER_SOUL_GEM.get(), - Items.BONE_MEAL, - Items.BONE_MEAL, - Items.BONE_MEAL - }, new ItemStack(Registry.BONECHILL_WAND.get())).setRegistryName(Eidolon.MODID, "bonechill_wand")); - register(new WorktableRecipe(new Object[]{ - Blocks.SMOOTH_STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, - Tags.Items.STONE, Tags.Items.STONE, Tags.Items.STONE, - Tags.Items.STONE, Registry.PEWTER_INLAY.get(), Tags.Items.STONE - }, new Object[]{ - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY, - ItemStack.EMPTY, - ItemStack.EMPTY - }, new ItemStack(Registry.STONE_ALTAR.get(), 3)).setRegistryName(Eidolon.MODID, "stone_altar")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Blocks.SMOOTH_STONE, ItemStack.EMPTY, - Tags.Items.STONE, Tags.Items.STONE, Tags.Items.STONE, - ItemStack.EMPTY, Tags.Items.STONE, ItemStack.EMPTY - }, new Object[]{ - Registry.UNHOLY_SYMBOL.get(), - ItemStack.EMPTY, - Registry.GOLD_INLAY.get(), - ItemStack.EMPTY - }, new ItemStack(Registry.UNHOLY_EFFIGY.get())).setRegistryName(Eidolon.MODID, "unholy_effigy")); - register(new WorktableRecipe(new Object[]{ - Blocks.WHITE_WOOL, Blocks.WHITE_WOOL, Blocks.WHITE_WOOL, - Blocks.WHITE_WOOL, Registry.SHADOW_GEM.get(), Blocks.WHITE_WOOL, - Blocks.WHITE_WOOL, Blocks.WHITE_WOOL, Blocks.WHITE_WOOL - }, new Object[]{ - Registry.UNHOLY_SYMBOL.get(), - ItemStack.EMPTY, - Tags.Items.DYES_BLUE, - ItemStack.EMPTY - }, new ItemStack(Registry.WICKED_WEAVE.get(), 8)).setRegistryName(Eidolon.MODID, "wicked_weave")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, - ItemStack.EMPTY, Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, - Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, Registry.WICKED_WEAVE.get() - }, new Object[]{ - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY, - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY - }, new ItemStack(Registry.WARLOCK_HAT.get())).setRegistryName(Eidolon.MODID, "warlock_hat")); - register(new WorktableRecipe(new Object[]{ - Registry.WICKED_WEAVE.get(), Registry.WICKED_WEAVE.get(), Registry.WICKED_WEAVE.get(), - Registry.WICKED_WEAVE.get(), Registry.WICKED_WEAVE.get(), Registry.WICKED_WEAVE.get(), - Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, Registry.WICKED_WEAVE.get() - }, new Object[]{ - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY, - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY - }, new ItemStack(Registry.WARLOCK_CLOAK.get())).setRegistryName(Eidolon.MODID, "warlock_cloak")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, - Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, Registry.WICKED_WEAVE.get(), - Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, Registry.WICKED_WEAVE.get() - }, new Object[]{ - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY, - Registry.SOUL_SHARD.get(), - ItemStack.EMPTY - }, new ItemStack(Registry.WARLOCK_BOOTS.get())).setRegistryName(Eidolon.MODID, "warlock_boots")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Tags.Items.ENDER_PEARLS, ItemStack.EMPTY, - Tags.Items.FEATHERS, Registry.BASIC_BELT.get(), Tags.Items.FEATHERS, - ItemStack.EMPTY, Registry.LESSER_SOUL_GEM.get(), ItemStack.EMPTY - }, new Object[]{ - Registry.ENDER_CALX.get(), - Registry.PEWTER_INLAY.get(), - Registry.ENDER_CALX.get(), - Registry.PEWTER_INLAY.get() - }, new ItemStack(Registry.GRAVITY_BELT.get())).setRegistryName(Eidolon.MODID, "gravity_belt")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.GOLD_INLAY.get(), ItemStack.EMPTY, - Registry.ARCANE_GOLD_INGOT.get(), Registry.BASIC_BELT.get(), Registry.ARCANE_GOLD_INGOT.get(), - ItemStack.EMPTY, Tags.Items.GEMS_DIAMOND, ItemStack.EMPTY - }, new Object[]{ - Items.LEATHER, - Registry.SOUL_SHARD.get(), - Registry.ENCHANTED_ASH.get(), - Registry.SOUL_SHARD.get() - }, new ItemStack(Registry.RESOLUTE_BELT.get())).setRegistryName(Eidolon.MODID, "resolute_belt")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Registry.WICKED_WEAVE.get(), ItemStack.EMPTY, - Registry.WICKED_WEAVE.get(), Registry.WICKED_WEAVE.get(), Registry.WICKED_WEAVE.get(), - ItemStack.EMPTY, Registry.LESSER_SOUL_GEM.get(), ItemStack.EMPTY - }, new Object[]{ - Registry.WARPED_SPROUTS.get(), - Registry.ENDER_CALX.get(), - Registry.SOUL_SHARD.get(), - Registry.ENDER_CALX.get() - }, new ItemStack(Registry.PRESTIGIOUS_PALM.get())).setRegistryName(Eidolon.MODID, "prestigious_palm")); - register(new WorktableRecipe(new Object[]{ - Registry.LEAD_INGOT.get(), Registry.LEAD_INGOT.get(), Registry.LEAD_INGOT.get(), - Registry.LEAD_INGOT.get(), Registry.LEAD_INGOT.get(), Registry.LEAD_INGOT.get(), - Items.LEATHER, Registry.SOUL_SHARD.get(), Items.LEATHER - }, new Object[]{ - Tags.Items.STORAGE_BLOCKS_LAPIS, - ItemStack.EMPTY, - Tags.Items.GEMS_QUARTZ, - ItemStack.EMPTY - }, new ItemStack(Registry.MIND_SHIELDING_PLATE.get())).setRegistryName(Eidolon.MODID, "mind_shielding_plate")); - register(new WorktableRecipe(new Object[]{ - ItemStack.EMPTY, Tags.Items.STORAGE_BLOCKS_DIAMOND, ItemStack.EMPTY, - ItemStack.EMPTY, Registry.BASIC_AMULET.get(), ItemStack.EMPTY, - ItemStack.EMPTY, Blocks.GLASS, ItemStack.EMPTY - }, new Object[]{ - Registry.ZOMBIE_HEART.get(), - Registry.LESSER_SOUL_GEM.get(), - Registry.WRAITH_HEART.get(), - Registry.LESSER_SOUL_GEM.get() - }, new ItemStack(Registry.GLASS_HAND.get())).setRegistryName(Eidolon.MODID, "glass_hand")); - } } diff --git a/src/main/java/elucent/eidolon/research/Research.java b/src/main/java/elucent/eidolon/research/Research.java new file mode 100644 index 0000000..0357d0c --- /dev/null +++ b/src/main/java/elucent/eidolon/research/Research.java @@ -0,0 +1,58 @@ +package elucent.eidolon.research; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import net.minecraft.client.resources.language.I18n; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; + +public class Research { + ResourceLocation rl; + int stars; + Map> specialTasks = new HashMap<>(); + + public Research(ResourceLocation rl, int stars) { + this.rl = rl; + this.stars = stars; + if (stars <= 0) throw new IllegalArgumentException("Research difficulty must be at least one star!"); + if (stars > 10) throw new IllegalArgumentException("Research difficulty cannot exceed ten stars!"); + } + + public Research addSpecialTasks(int step, ResearchTask... tasks) { + specialTasks.put(step, List.of(tasks)); + return this; + } + + public ResourceLocation getRegistryName() { + return rl; + } + + public int getStars() { + return stars; + } + + public String getName() { + return I18n.get("research." + rl.getNamespace() + "." + rl.getPath()); + } + + public List getTasks(int rootSeed, int done) { + if (specialTasks.containsKey(done)) return specialTasks.get(done); + List tasks = new ArrayList<>(); + Random random = new Random(); + int seed = getSeed(rootSeed, done); + random.setSeed(seed); + for (int i = 0; i < 3; i ++) { + tasks.add(Researches.getRandomTask(random)); + } + return tasks; + } + + public int getSeed(int rootSeed, int done) { + return rl.hashCode() * 384780223 ^ done * 844955129 ^ rootSeed * 112041199 + 6; + } +} diff --git a/src/main/java/elucent/eidolon/research/ResearchReward.java b/src/main/java/elucent/eidolon/research/ResearchReward.java new file mode 100644 index 0000000..5ed6ff4 --- /dev/null +++ b/src/main/java/elucent/eidolon/research/ResearchReward.java @@ -0,0 +1,5 @@ +package elucent.eidolon.research; + +public class ResearchReward { + +} diff --git a/src/main/java/elucent/eidolon/research/ResearchTask.java b/src/main/java/elucent/eidolon/research/ResearchTask.java new file mode 100644 index 0000000..e4c4b5e --- /dev/null +++ b/src/main/java/elucent/eidolon/research/ResearchTask.java @@ -0,0 +1,312 @@ +package elucent.eidolon.research; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.Function; +import java.util.function.Supplier; + +import com.mojang.blaze3d.vertex.PoseStack; + +import elucent.eidolon.Registry; +import elucent.eidolon.mixin.AbstractContainerMenuMixin; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public abstract class ResearchTask { + public abstract CompoundTag write(); + public abstract void read(CompoundTag tag); + public abstract CompletenessResult isComplete(AbstractContainerMenu menu, Player player, int slotStart); + public abstract void onComplete(AbstractContainerMenu menu, Player player, int slotStart); + + @OnlyIn(Dist.CLIENT) + public abstract int getWidth(); + + @OnlyIn(Dist.CLIENT) + public abstract void drawIcon(PoseStack stack, int x, int y); + + @OnlyIn(Dist.CLIENT) + public int drawCustom(PoseStack stack, int x, int y) { return 0; } + + @OnlyIn(Dist.CLIENT) + public int getDefaultWidth() { + return 64; + } + + @OnlyIn(Dist.CLIENT) + public void drawTooltip(PoseStack stack, AbstractContainerScreen gui, double mouseX, double mouseY) {} + + public static record CompletenessResult(int nextSlot, boolean complete) {}; + + public int getSlotCount() { + return 0; + } + + public void modifyContainer(AbstractContainerMenu menu, int x, int y) {} + + public static class Items extends ResearchTask { + List items; + InternalContainer container; + + class InternalContainer implements Container { + List items = new ArrayList<>(); + + protected void updateItems() { + while (items.size() < Items.this.items.size()) items.add(ItemStack.EMPTY); + } + + @Override + public void clearContent() { + items.clear(); + } + + @Override + public int getContainerSize() { + return Items.this.items.size(); + } + + @Override + public boolean isEmpty() { + for (ItemStack s : items) if (!s.isEmpty()) return false; + return true; + } + + @Override + public ItemStack getItem(int slot) { + updateItems(); + return items.get(slot); + } + + @Override + public ItemStack removeItem(int slot, int amount) { + updateItems(); + ItemStack stack = ContainerHelper.removeItem(this.items, slot, amount); + if (!stack.isEmpty()) { + this.setChanged(); + } + return stack; + } + + @Override + public ItemStack removeItemNoUpdate(int slot) { + updateItems(); + ItemStack itemstack = this.items.get(slot); + if (itemstack.isEmpty()) { + return ItemStack.EMPTY; + } else { + this.items.set(slot, ItemStack.EMPTY); + return itemstack; + } + } + + @Override + public void setItem(int slot, ItemStack stack) { + updateItems(); + items.set(slot, stack); + } + + @Override + public void setChanged() { + // stub. should this be implemented? + } + + @Override + public boolean stillValid(Player p_18946_) { + return true; + } + } + + public Items() { + this.items = new ArrayList(); + this.container = new InternalContainer(); + } + + public Items(ItemStack... stacks) { + this.items = List.of(stacks); + this.container = new InternalContainer(); + } + + @Override + public CompoundTag write() { + CompoundTag tag = new CompoundTag(); + tag.put("stacks", new ListTag()); + return items.stream().map(s -> s.save(new CompoundTag())).reduce(tag, (t, s) -> { + t.getList("stacks", Tag.TAG_COMPOUND).add(s); + return t; + }); + } + + @Override + public void read(CompoundTag tag) { + ListTag list = tag.getList("stacks", Tag.TAG_COMPOUND); + for (Tag t : list) { + items.add(ItemStack.of((CompoundTag)t)); + } + } + + @Override + public int getWidth() { + return getDefaultWidth() + 8 + 17 * items.size(); + } + + @Override + public void drawIcon(PoseStack stack, int x, int y) { + int offset = (items.size() - 1) * -4; + ItemRenderer ir = Minecraft.getInstance().getItemRenderer(); + for (int i = 0; i < items.size(); i ++) { + ir.renderAndDecorateItem(items.get(i), x + i * 8 + offset, y); + ir.renderGuiItemDecorations(Minecraft.getInstance().font, items.get(i), x + i * 8 + offset, y, null); + } + } + + @Override + public int drawCustom(PoseStack stack, int x, int y) { + Gui.blit(stack, x, y, 0, 88, 224, 1, 32, 256, 256); + x += 1; + for (int i = 0; i < items.size(); i ++) { + if (items.size() == 1) { + Gui.blit(stack, x, y, 0, 192, 0, 22, 32, 256, 256); + x += 22; + } + else if (i == 0) { + Gui.blit(stack, x, y, 0, 192, 32, 20, 32, 256, 256); + x += 19; + } + else if (i == items.size() - 1) { + Gui.blit(stack, x, y, 0, 228, 32, 20, 32, 256, 256); + x += 20; + } + else { + Gui.blit(stack, x, y, 0, 211, 32, 18, 32, 256, 256); + x += 17; + } + } + Gui.blit(stack, x, y, 0, 88, 224, 2, 32, 256, 256); + x += 2; + return 8 + 17 * items.size(); + } + + @Override + public void drawTooltip(PoseStack stack, AbstractContainerScreen gui, double mouseX, double mouseY) { + List tooltip = gui.getTooltipFromItem(items.get(0)); + gui.renderComponentTooltip(stack, tooltip, (int)mouseX, (int)mouseY); + } + + @Override + public int getSlotCount() { + return items.size(); + } + + @Override + public void modifyContainer(AbstractContainerMenu menu, int x, int y) { + for (int i = 0; i < items.size(); i ++) ((AbstractContainerMenuMixin)(Object)menu).callAddSlot(new Slot(container, i, x + 11 + 17 * i, y + 7)); + } + + @Override + public CompletenessResult isComplete(AbstractContainerMenu menu, Player player, int slotStart) { + boolean isMatching = true; + for (int i = 0; i < items.size() && isMatching; i ++) { + if (menu.getItems().size() <= slotStart + i) { + isMatching = false; + continue; + } + ItemStack slot = menu.getSlot(slotStart + i).getItem(); + if (!ItemStack.isSameItemSameTags(items.get(i), slot)) isMatching = false; + if (slot.getCount() < items.get(i).getCount()) isMatching = false; + } + return new CompletenessResult(slotStart + items.size(), isMatching); + } + + @Override + public void onComplete(AbstractContainerMenu menu, Player player, int slotStart) { + for (int i = 0; i < items.size(); i ++) { + menu.getSlot(slotStart + i).remove(items.get(i).getCount()); + } + } + }; + + public static class ScrivenerItems extends Items { + static List> ITEM_POOL = List.of( + (random) -> new ItemStack(Registry.MAGIC_INK.get(), random.nextInt(1, 3)), + (random) -> new ItemStack(net.minecraft.world.item.Items.FEATHER), + (random) -> new ItemStack(Registry.PARCHMENT.get(), random.nextInt(1, 3)), + (random) -> new ItemStack(Registry.CANDLE.get()), + (random) -> new ItemStack(net.minecraft.world.item.Items.CHARCOAL, random.nextInt(1, 3)), + (random) -> new ItemStack(net.minecraft.world.item.Items.BOOK) + ); + + public ScrivenerItems(Random random) { + items = List.of(ITEM_POOL.get(random.nextInt(ITEM_POOL.size())).apply(random)); + } + } + + public static class XP extends ResearchTask { + int levels; + + public XP(Random random) { + levels = random.nextInt(1, 6); // 1-5 XP levels as cost + } + + @Override + public CompoundTag write() { + CompoundTag tag = new CompoundTag(); + tag.putInt("levels", levels); + return tag; + } + + @Override + public void read(CompoundTag tag) { + this.levels = tag.getInt("levels"); + } + + @Override + public int getWidth() { + return getDefaultWidth(); + } + + @Override + public void drawIcon(PoseStack stack, int x, int y) { + int offY = Minecraft.getInstance().player.experienceLevel < levels ? 16 : 0; + Gui.blit(stack, x, y, 0, (levels - 1) * 16, 224 + offY, 16, 16, 256, 256); + } + + @Override + public CompletenessResult isComplete(AbstractContainerMenu menu, Player player, int slotStart) { + return new CompletenessResult(slotStart, player.experienceLevel >= levels); + } + + @Override + public void drawTooltip(PoseStack stack, AbstractContainerScreen gui, double mouseX, double mouseY) { + MutableComponent tooltip; + if (levels == 1) { + tooltip = new TranslatableComponent("container.enchant.level.one"); + } else { + tooltip = new TranslatableComponent("container.enchant.level.many", levels); + } + + gui.renderTooltip(stack, tooltip, (int)mouseX, (int)mouseY); + } + + @Override + public void onComplete(AbstractContainerMenu menu, Player player, int slotStart) { + player.giveExperienceLevels(-levels); + } + } +} diff --git a/src/main/java/elucent/eidolon/research/Researches.java b/src/main/java/elucent/eidolon/research/Researches.java new file mode 100644 index 0000000..2f18e8c --- /dev/null +++ b/src/main/java/elucent/eidolon/research/Researches.java @@ -0,0 +1,78 @@ +package elucent.eidolon.research; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.function.Function; +import java.util.function.Supplier; + +import javax.annotation.Nullable; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.block.Block; + +public class Researches { + static Map researches = new HashMap<>(); + static Multimap blockResearches = HashMultimap.create(); + static Multimap entityResearches = HashMultimap.create(); + static List> taskPool = new ArrayList<>(); + + public static Research register(Research r, Object... sources) { + researches.put(r.getRegistryName(), r); + for (Object o : sources) { + if (o instanceof Block b) { + blockResearches.put(b.getRegistryName(), r); + } + else if (o instanceof EntityType e) { + entityResearches.put(e.getRegistryName(), r); + } + } + return r; + } + + public static void addTask(Function task) { + taskPool.add(task); + } + + @Nullable + public static Collection getBlockResearches(Block b) { + return blockResearches.get(b.getRegistryName()); + } + + @Nullable + public static Collection getEntityResearches(Entity e) { + return entityResearches.get(e.getType().getRegistryName()); + } + + public static Collection getResearches() { + return researches.values(); + } + + @Nullable + public static Research find(ResourceLocation location) { + return researches.getOrDefault(location, null); + } + + public static ResearchTask getRandomTask(Random random) { + return taskPool.get(random.nextInt(taskPool.size())).apply(random); + } + + public static void init() { + addTask(ResearchTask.ScrivenerItems::new); + addTask(ResearchTask.ScrivenerItems::new); + addTask(ResearchTask.ScrivenerItems::new); + addTask(ResearchTask.ScrivenerItems::new); + addTask(ResearchTask.XP::new); + addTask(ResearchTask.XP::new); + register(new Research(new ResourceLocation(Eidolon.MODID, "gluttony"), 5), EntityType.PIG); + } +} diff --git a/src/main/java/elucent/eidolon/ritual/AbsorptionRitual.java b/src/main/java/elucent/eidolon/ritual/AbsorptionRitual.java new file mode 100644 index 0000000..18edc96 --- /dev/null +++ b/src/main/java/elucent/eidolon/ritual/AbsorptionRitual.java @@ -0,0 +1,74 @@ +package elucent.eidolon.ritual; + +import java.util.List; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.item.IRechargeableWand; +import elucent.eidolon.item.SummoningStaffItem; +import elucent.eidolon.network.CrystallizeEffectPacket; +import elucent.eidolon.network.MagicBurstEffectPacket; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.RitualConsumePacket; +import elucent.eidolon.util.ColorUtil; +import elucent.eidolon.util.EntityUtil; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.Entity.RemovalReason; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; + +public class AbsorptionRitual extends Ritual { + public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/absorption_ritual"); + + public AbsorptionRitual() { + super(SYMBOL, ColorUtil.packColor(255, 123, 140, 70)); + } + + @Override + public RitualResult start(Level world, BlockPos pos) { + List tiles = Ritual.getTilesWithinAABB(IRitualItemFocus.class, world, getSearchBounds(pos)); + BlockPos toRecharge = null; + if (!tiles.isEmpty()) for (int i = 0; i < tiles.size(); i ++) { + ItemStack stack = tiles.get(i).provide(); + if (stack.getItem() instanceof SummoningStaffItem s) { + toRecharge = ((BlockEntity)tiles.get(i)).getBlockPos(); + break; + } + } + + List entities = world.getEntitiesOfClass(LivingEntity.class, getSearchBounds(pos), (e) -> Eidolon.getTrueMobType(e) == MobType.UNDEAD && !EntityUtil.isEnthralled(e) && e.getHealth() <= e.getMaxHealth() / 5); + ListTag entityTags = new ListTag(); + for (LivingEntity e : entities) { + e.setHealth(e.getMaxHealth()); + if (!world.isClientSide) { + Networking.sendToTracking(world, e.blockPosition(), new MagicBurstEffectPacket(e.getX(), e.getY() + 0.1, e.getZ(), + ColorUtil.packColor(255, 61, 70, 35), ColorUtil.packColor(255, 36, 24, 41))); + if (toRecharge != null) { + Networking.sendToTracking(world, toRecharge, new RitualConsumePacket(e.blockPosition().above(), toRecharge, getRed(), getGreen(), getBlue())); + } + } + CompoundTag eTag = e.serializeNBT(); + entityTags.add(eTag); + entityTags.add(eTag); + entityTags.add(eTag); + entityTags.add(eTag); + entityTags.add(eTag); + e.remove(RemovalReason.KILLED); + } + if (!tiles.isEmpty()) for (int i = 0; i < tiles.size(); i ++) { + ItemStack stack = tiles.get(i).provide(); + if (stack.getItem() instanceof SummoningStaffItem s) { + tiles.get(i).replace(s.addCharges(stack, entityTags)); + break; + } + } + return RitualResult.TERMINATE; + } +} diff --git a/src/main/java/elucent/eidolon/ritual/AllureRitual.java b/src/main/java/elucent/eidolon/ritual/AllureRitual.java index 898dded..15051be 100644 --- a/src/main/java/elucent/eidolon/ritual/AllureRitual.java +++ b/src/main/java/elucent/eidolon/ritual/AllureRitual.java @@ -1,19 +1,17 @@ package elucent.eidolon.ritual; +import java.util.List; +import java.util.stream.Collectors; + import elucent.eidolon.Eidolon; import elucent.eidolon.entity.ai.GoToPositionGoal; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.ai.brain.BrainUtil; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.merchant.villager.VillagerEntity; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.List; -import java.util.stream.Collectors; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class AllureRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/allure_ritual"); @@ -23,17 +21,17 @@ public AllureRitual() { } @Override - public RitualResult tick(World world, BlockPos pos) { + public RitualResult tick(Level world, BlockPos pos) { if (world.getGameTime() % 200 == 0) { - List animals = world.getEntitiesWithinAABB(AnimalEntity.class, new AxisAlignedBB(pos).grow(96, 16, 96)); - for (AnimalEntity a : animals) { + List animals = world.getEntitiesOfClass(Animal.class, new AABB(pos).inflate(96, 16, 96)); + for (Animal a : animals) { boolean hasGoal = a.goalSelector.getRunningGoals() .filter((goal) -> goal.getGoal() instanceof GoToPositionGoal) .count() > 0; - if (!hasGoal && a.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) >= 12 * 12 && world.rand.nextInt(40) == 0) { - BlockPos target = pos.down().add(world.rand.nextInt(9) - 4, 0, world.rand.nextInt(9) - 4); + if (!hasGoal && a.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) >= 12 * 12 && world.random.nextInt(40) == 0) { + BlockPos target = pos.below().offset(world.random.nextInt(9) - 4, 0, world.random.nextInt(9) - 4); a.goalSelector.addGoal(1, new GoToPositionGoal(a, target, 1.0)); - } else if (hasGoal && a.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) < 8 * 8) { + } else if (hasGoal && a.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) < 8 * 8) { List goals = a.goalSelector.getRunningGoals().filter((goal) -> goal.getGoal() instanceof GoToPositionGoal) .collect(Collectors.toList()); for (Goal g : goals) a.goalSelector.removeGoal(g); diff --git a/src/main/java/elucent/eidolon/ritual/CrystalRitual.java b/src/main/java/elucent/eidolon/ritual/CrystalRitual.java index 48681bc..ba8404b 100644 --- a/src/main/java/elucent/eidolon/ritual/CrystalRitual.java +++ b/src/main/java/elucent/eidolon/ritual/CrystalRitual.java @@ -1,21 +1,18 @@ package elucent.eidolon.ritual; +import java.util.List; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.network.CrystallizeEffectPacket; import elucent.eidolon.network.Networking; -import elucent.eidolon.particle.GenericParticle; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.particles.ParticleType; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import javax.annotation.Resource; -import java.util.List; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class CrystalRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/crystal_ritual"); @@ -25,13 +22,13 @@ public CrystalRitual() { } @Override - public RitualResult start(World world, BlockPos pos) { - List entities = world.getEntitiesWithinAABB(LivingEntity.class, getSearchBounds(pos), (e) -> e.isEntityUndead()); + public RitualResult start(Level world, BlockPos pos) { + List entities = world.getEntitiesOfClass(LivingEntity.class, getSearchBounds(pos), (e) -> e.isInvertedHealAndHarm()); for (LivingEntity e : entities) { - e.attackEntityFrom(Registry.RITUAL_DAMAGE, e.getMaxHealth() * 1000); - if (!world.isRemote) { - Networking.sendToTracking(world, e.getPosition(), new CrystallizeEffectPacket(e.getPosition())); - world.addEntity(new ItemEntity(world, e.getPosX(), e.getPosY(), e.getPosZ(), new ItemStack(Registry.SOUL_SHARD.get(), 1 + world.rand.nextInt(3)))); + e.hurt(Registry.RITUAL_DAMAGE, e.getMaxHealth() * 1000); + if (!world.isClientSide) { + Networking.sendToTracking(world, e.blockPosition(), new CrystallizeEffectPacket(e.blockPosition())); + world.addFreshEntity(new ItemEntity(world, e.getX(), e.getY(), e.getZ(), new ItemStack(Registry.SOUL_SHARD.get(), 1 + world.random.nextInt(3)))); } } return RitualResult.TERMINATE; diff --git a/src/main/java/elucent/eidolon/ritual/DaylightRitual.java b/src/main/java/elucent/eidolon/ritual/DaylightRitual.java index d12b0f6..45118d1 100644 --- a/src/main/java/elucent/eidolon/ritual/DaylightRitual.java +++ b/src/main/java/elucent/eidolon/ritual/DaylightRitual.java @@ -1,24 +1,15 @@ package elucent.eidolon.ritual; import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; -import elucent.eidolon.network.CrystallizeEffectPacket; -import elucent.eidolon.network.Networking; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.network.play.server.SUpdateTimePacket; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.GameRules; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.storage.ServerWorldInfo; -import org.apache.logging.log4j.core.jmx.Server; - -import java.util.List; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.network.protocol.game.ClientboundSetTimePacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.storage.PrimaryLevelData; public class DaylightRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/daylight_ritual"); @@ -28,12 +19,12 @@ public DaylightRitual() { } @Override - public RitualResult tick(World world, BlockPos pos) { + public RitualResult tick(Level world, BlockPos pos) { if (world.getDayTime() % 24000 < 1000 || world.getDayTime() % 24000 >= 12000) { - if (!world.isRemote) { - ((ServerWorldInfo) world.getWorldInfo()).setDayTime(world.getDayTime() + 100); - for (ServerPlayerEntity player : ((ServerWorld) world).getPlayers()) { - player.connection.sendPacket(new SUpdateTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); + if (!world.isClientSide) { + ((PrimaryLevelData) world.getLevelData()).setDayTime(world.getDayTime() + 100); + for (ServerPlayer player : ((ServerLevel) world).players()) { + player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); } } return RitualResult.PASS; diff --git a/src/main/java/elucent/eidolon/ritual/DeceitRitual.java b/src/main/java/elucent/eidolon/ritual/DeceitRitual.java index a7cfafc..798e175 100644 --- a/src/main/java/elucent/eidolon/ritual/DeceitRitual.java +++ b/src/main/java/elucent/eidolon/ritual/DeceitRitual.java @@ -1,22 +1,14 @@ package elucent.eidolon.ritual; +import java.util.List; + import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; -import elucent.eidolon.network.CrystallizeEffectPacket; -import elucent.eidolon.network.Networking; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.ReturnToVillageGoal; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.merchant.villager.VillagerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.village.GossipManager; -import net.minecraft.world.World; - -import java.util.List; +import net.minecraft.world.entity.npc.Villager; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class DeceitRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/deceit_ritual"); @@ -26,11 +18,11 @@ public DeceitRitual() { } @Override - public RitualResult tick(World world, BlockPos pos) { + public RitualResult tick(Level world, BlockPos pos) { if (world.getGameTime() % 20 == 0) { - List villagers = world.getEntitiesWithinAABB(VillagerEntity.class, new AxisAlignedBB(pos).grow(48, 16, 48)); - for (VillagerEntity v : villagers) { - if (world.rand.nextInt(120) == 0) v.getGossip().tick(); + List villagers = world.getEntitiesOfClass(Villager.class, new AABB(pos).inflate(48, 16, 48)); + for (Villager v : villagers) { + if (world.random.nextInt(120) == 0) v.getGossips().decay(); } } return RitualResult.PASS; diff --git a/src/main/java/elucent/eidolon/ritual/FocusItemPresentRequirement.java b/src/main/java/elucent/eidolon/ritual/FocusItemPresentRequirement.java new file mode 100644 index 0000000..61c129b --- /dev/null +++ b/src/main/java/elucent/eidolon/ritual/FocusItemPresentRequirement.java @@ -0,0 +1,41 @@ +package elucent.eidolon.ritual; + +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; + +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.RitualConsumePacket; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.tags.Tag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +public class FocusItemPresentRequirement extends FocusItemRequirement { + public FocusItemPresentRequirement(ItemStack item) { + super(item); + } + + public FocusItemPresentRequirement(Item item) { + super(item); + } + + public FocusItemPresentRequirement(Block block) { + super(block); + } + + public FocusItemPresentRequirement(Tag item) { + super(item); + } + + public FocusItemPresentRequirement(Function item) { + super(item); + } + + public void whenMet(Ritual ritual, Level world, BlockPos pos, RequirementInfo info) { + // + } +} diff --git a/src/main/java/elucent/eidolon/ritual/FocusItemRequirement.java b/src/main/java/elucent/eidolon/ritual/FocusItemRequirement.java index f5d50e4..f378c49 100644 --- a/src/main/java/elucent/eidolon/ritual/FocusItemRequirement.java +++ b/src/main/java/elucent/eidolon/ritual/FocusItemRequirement.java @@ -1,16 +1,18 @@ package elucent.eidolon.ritual; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; + import elucent.eidolon.network.Networking; import elucent.eidolon.network.RitualConsumePacket; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tags.ITag; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.List; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.tags.Tag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class FocusItemRequirement implements IRequirement { Object match; @@ -24,39 +26,45 @@ public FocusItemRequirement(Item item) { } public FocusItemRequirement(Block block) { - this.match = Item.getItemFromBlock(block); + this.match = Item.byBlock(block); } - public FocusItemRequirement(ITag item) { + public FocusItemRequirement(Tag item) { + this.match = item; + } + + public FocusItemRequirement(Function item) { this.match = item; } @Override - public RequirementInfo isMet(Ritual ritual, World world, BlockPos pos) { - List tiles = Ritual.getTilesWithinAABB(IRitualItemProvider.class, world, ritual.getSearchBounds(pos)); - System.out.println(tiles.size()); + public RequirementInfo isMet(Ritual ritual, Level world, BlockPos pos) { + List tiles = Ritual.getTilesWithinAABB(IRitualItemFocus.class, world, ritual.getSearchBounds(pos)); if (tiles.isEmpty()) return RequirementInfo.FALSE; for (int i = 0; i < tiles.size(); i ++) { ItemStack stack = tiles.get(i).provide(); - if (match instanceof ItemStack && ItemStack.areItemStacksEqual((ItemStack)match, stack)) { - return new RequirementInfo(true, ((TileEntity)tiles.get(i)).getPos()); + if (match instanceof ItemStack && ItemStack.matches((ItemStack)match, stack)) { + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); } else if (match instanceof Item && stack.getItem() == (Item)match) { - return new RequirementInfo(true, ((TileEntity)tiles.get(i)).getPos()); + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); + } + else if (match instanceof Tag && ((Tag)match).contains(stack.getItem())) { + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); } - else if (match instanceof ITag && ((ITag)match).contains(stack.getItem())) { - return new RequirementInfo(true, ((TileEntity)tiles.get(i)).getPos()); + else if (match instanceof Function && ((Function)match).apply(stack)) { + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); } } return RequirementInfo.FALSE; } - public void whenMet(Ritual ritual, World world, BlockPos pos, RequirementInfo info) { - ((IRitualItemProvider)world.getTileEntity(info.getPos())).take(); - if (!world.isRemote) { - Networking.sendToTracking(world, pos.up(2), new RitualConsumePacket(info.getPos(), pos.up(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); + public void whenMet(Ritual ritual, Level world, BlockPos pos, RequirementInfo info) { + ((IRitualItemProvider)world.getBlockEntity(info.getPos())).take(); + if (!world.isClientSide) { + Networking.sendToTracking(world, pos.above(2), new RitualConsumePacket(info.getPos(), pos.above(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); } } } diff --git a/src/main/java/elucent/eidolon/ritual/HealthRequirement.java b/src/main/java/elucent/eidolon/ritual/HealthRequirement.java index 8f34fa6..07bf6dc 100644 --- a/src/main/java/elucent/eidolon/ritual/HealthRequirement.java +++ b/src/main/java/elucent/eidolon/ritual/HealthRequirement.java @@ -1,21 +1,16 @@ package elucent.eidolon.ritual; +import java.util.ArrayList; +import java.util.List; + import elucent.eidolon.Registry; import elucent.eidolon.network.Networking; import elucent.eidolon.network.RitualConsumePacket; -import net.minecraft.block.Block; -import net.minecraft.entity.CreatureEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tags.ITag; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.ArrayList; -import java.util.List; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class HealthRequirement implements IRequirement { float health; @@ -25,9 +20,9 @@ public HealthRequirement(float health) { } @Override - public RequirementInfo isMet(Ritual ritual, World world, BlockPos pos) { - List entities = world.getEntitiesWithinAABB(CreatureEntity.class, Ritual.getDefaultBounds(pos), (entity) -> !entity.isEntityUndead()); - List players = world.getEntitiesWithinAABB(PlayerEntity.class, Ritual.getDefaultBounds(pos)); + public RequirementInfo isMet(Ritual ritual, Level world, BlockPos pos) { + List entities = world.getEntitiesOfClass(PathfinderMob.class, Ritual.getDefaultBounds(pos), (entity) -> !entity.isInvertedHealAndHarm()); + List players = world.getEntitiesOfClass(Player.class, Ritual.getDefaultBounds(pos)); List targets = new ArrayList<>(); targets.addAll(entities); targets.addAll(players); @@ -39,9 +34,9 @@ public RequirementInfo isMet(Ritual ritual, World world, BlockPos pos) { return RequirementInfo.FALSE; } - public void whenMet(Ritual ritual, World world, BlockPos pos, RequirementInfo info) { - List entities = world.getEntitiesWithinAABB(CreatureEntity.class, Ritual.getDefaultBounds(pos), (entity) -> !entity.isEntityUndead()); - List players = world.getEntitiesWithinAABB(PlayerEntity.class, Ritual.getDefaultBounds(pos)); + public void whenMet(Ritual ritual, Level world, BlockPos pos, RequirementInfo info) { + List entities = world.getEntitiesOfClass(PathfinderMob.class, Ritual.getDefaultBounds(pos), (entity) -> !entity.isInvertedHealAndHarm()); + List players = world.getEntitiesOfClass(Player.class, Ritual.getDefaultBounds(pos)); List targets = new ArrayList<>(); targets.addAll(entities); targets.addAll(players); @@ -49,11 +44,11 @@ public void whenMet(Ritual ritual, World world, BlockPos pos, RequirementInfo in for (int i = 0; i < targets.size(); i ++) { float targetHealth = targets.get(i).getHealth(); if (this.health - acc < targetHealth) - targets.get(i).attackEntityFrom(Registry.RITUAL_DAMAGE, this.health - acc); - else targets.get(i).attackEntityFrom(Registry.RITUAL_DAMAGE, targetHealth); + targets.get(i).hurt(Registry.RITUAL_DAMAGE, this.health - acc); + else targets.get(i).hurt(Registry.RITUAL_DAMAGE, targetHealth); acc += targetHealth; - if (!world.isRemote) Networking.sendToTracking(world, pos, new RitualConsumePacket(targets.get(i).getPosition(), pos, ritual.getRed(), ritual.getGreen(), ritual.getBlue())); + if (!world.isClientSide) Networking.sendToTracking(world, pos, new RitualConsumePacket(targets.get(i).blockPosition(), pos, ritual.getRed(), ritual.getGreen(), ritual.getBlue())); if (acc >= this.health) return; } } diff --git a/src/main/java/elucent/eidolon/ritual/IRequirement.java b/src/main/java/elucent/eidolon/ritual/IRequirement.java index 30b55b0..8ba927c 100644 --- a/src/main/java/elucent/eidolon/ritual/IRequirement.java +++ b/src/main/java/elucent/eidolon/ritual/IRequirement.java @@ -1,11 +1,11 @@ package elucent.eidolon.ritual; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public interface IRequirement { - RequirementInfo isMet(Ritual ritual, World world, BlockPos pos); - default void whenMet(Ritual ritual, World world, BlockPos pos, RequirementInfo info) { + RequirementInfo isMet(Ritual ritual, Level world, BlockPos pos); + default void whenMet(Ritual ritual, Level world, BlockPos pos, RequirementInfo info) { // } } diff --git a/src/main/java/elucent/eidolon/ritual/IRitualItemFocus.java b/src/main/java/elucent/eidolon/ritual/IRitualItemFocus.java index 2b02dd0..f466be6 100644 --- a/src/main/java/elucent/eidolon/ritual/IRitualItemFocus.java +++ b/src/main/java/elucent/eidolon/ritual/IRitualItemFocus.java @@ -1,5 +1,7 @@ package elucent.eidolon.ritual; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; -public interface IRitualItemFocus extends IRitualItemProvider {} +public interface IRitualItemFocus extends IRitualItemProvider { + void replace(ItemStack stack); +} diff --git a/src/main/java/elucent/eidolon/ritual/IRitualItemProvider.java b/src/main/java/elucent/eidolon/ritual/IRitualItemProvider.java index 65f41b5..511794d 100644 --- a/src/main/java/elucent/eidolon/ritual/IRitualItemProvider.java +++ b/src/main/java/elucent/eidolon/ritual/IRitualItemProvider.java @@ -1,6 +1,6 @@ package elucent.eidolon.ritual; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public interface IRitualItemProvider { ItemStack provide(); diff --git a/src/main/java/elucent/eidolon/ritual/ItemRequirement.java b/src/main/java/elucent/eidolon/ritual/ItemRequirement.java index 810dd8a..6962812 100644 --- a/src/main/java/elucent/eidolon/ritual/ItemRequirement.java +++ b/src/main/java/elucent/eidolon/ritual/ItemRequirement.java @@ -1,19 +1,16 @@ package elucent.eidolon.ritual; +import java.util.List; + import elucent.eidolon.network.Networking; import elucent.eidolon.network.RitualConsumePacket; -import elucent.eidolon.ritual.Ritual.SetupResult; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tags.ITag; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.tags.Tag; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.Tags; - -import java.util.List; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class ItemRequirement implements IRequirement { Object match; @@ -27,38 +24,38 @@ public ItemRequirement(Item item) { } public ItemRequirement(Block block) { - this.match = Item.getItemFromBlock(block); + this.match = Item.byBlock(block); } - public ItemRequirement(ITag item) { + public ItemRequirement(Tag item) { this.match = item; } @Override - public RequirementInfo isMet(Ritual ritual, World world, BlockPos pos) { + public RequirementInfo isMet(Ritual ritual, Level world, BlockPos pos) { List tiles = Ritual.getTilesWithinAABB(IRitualItemProvider.class, world, ritual.getSearchBounds(pos)); if (tiles.isEmpty()) return RequirementInfo.FALSE; for (int i = 0; i < tiles.size(); i ++) { ItemStack stack = tiles.get(i).provide(); - if (match instanceof ItemStack && ItemStack.areItemStacksEqual((ItemStack)match, stack)) { - return new RequirementInfo(true, ((TileEntity)tiles.get(i)).getPos()); + if (match instanceof ItemStack && ItemStack.matches((ItemStack)match, stack)) { + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); } else if (match instanceof Item && stack.getItem() == (Item)match) { - return new RequirementInfo(true, ((TileEntity)tiles.get(i)).getPos()); + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); } - else if (match instanceof ITag && ((ITag)match).contains(stack.getItem())) { - return new RequirementInfo(true, ((TileEntity)tiles.get(i)).getPos()); + else if (match instanceof Tag && ((Tag)match).contains(stack.getItem())) { + return new RequirementInfo(true, ((BlockEntity)tiles.get(i)).getBlockPos()); } } return RequirementInfo.FALSE; } - public void whenMet(Ritual ritual, World world, BlockPos pos, RequirementInfo info) { - ((IRitualItemProvider)world.getTileEntity(info.getPos())).take(); - if (!world.isRemote) { - Networking.sendToTracking(world, pos.up(2), new RitualConsumePacket(info.getPos(), pos.up(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); + public void whenMet(Ritual ritual, Level world, BlockPos pos, RequirementInfo info) { + ((IRitualItemProvider)world.getBlockEntity(info.getPos())).take(); + if (!world.isClientSide) { + Networking.sendToTracking(world, pos.above(2), new RitualConsumePacket(info.getPos(), pos.above(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); } } diff --git a/src/main/java/elucent/eidolon/ritual/MoonlightRitual.java b/src/main/java/elucent/eidolon/ritual/MoonlightRitual.java index cef7dc8..b02b633 100644 --- a/src/main/java/elucent/eidolon/ritual/MoonlightRitual.java +++ b/src/main/java/elucent/eidolon/ritual/MoonlightRitual.java @@ -1,18 +1,15 @@ package elucent.eidolon.ritual; import elucent.eidolon.Eidolon; -import elucent.eidolon.network.Networking; import elucent.eidolon.util.ColorUtil; -import net.minecraft.block.BedBlock; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.network.play.server.SUpdateTimePacket; -import net.minecraft.tileentity.BedTileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.GameRules; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.storage.ServerWorldInfo; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.network.protocol.game.ClientboundSetTimePacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.storage.PrimaryLevelData; public class MoonlightRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/moonlight_ritual"); @@ -22,12 +19,12 @@ public MoonlightRitual() { } @Override - public RitualResult tick(World world, BlockPos pos) { + public RitualResult tick(Level world, BlockPos pos) { if (world.getDayTime() % 24000 < 13000 && world.getDayTime() % 24000 >= 0) { - if (!world.isRemote) { - ((ServerWorldInfo) world.getWorldInfo()).setDayTime(world.getDayTime() + 100); - for (ServerPlayerEntity player : ((ServerWorld) world).getPlayers()) { - player.connection.sendPacket(new SUpdateTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); + if (!world.isClientSide) { + ((PrimaryLevelData) world.getLevelData()).setDayTime(world.getDayTime() + 100); + for (ServerPlayer player : ((ServerLevel) world).players()) { + player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); } } return RitualResult.PASS; diff --git a/src/main/java/elucent/eidolon/ritual/PurifyRitual.java b/src/main/java/elucent/eidolon/ritual/PurifyRitual.java index 4136869..86c9f33 100644 --- a/src/main/java/elucent/eidolon/ritual/PurifyRitual.java +++ b/src/main/java/elucent/eidolon/ritual/PurifyRitual.java @@ -1,32 +1,25 @@ package elucent.eidolon.ritual; +import java.util.List; + import elucent.eidolon.Eidolon; -import elucent.eidolon.entity.ai.GoToPositionGoal; -import elucent.eidolon.mixin.ZombieVillagerEntityMixin; +import elucent.eidolon.mixin.ZombieVillagerMixin; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.CreatureEntity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnReason; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.monster.HoglinEntity; -import net.minecraft.entity.monster.ZoglinEntity; -import net.minecraft.entity.monster.ZombieVillagerEntity; -import net.minecraft.entity.monster.ZombifiedPiglinEntity; -import net.minecraft.entity.monster.piglin.PiglinEntity; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; -import java.util.stream.Collectors; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.Entity.RemovalReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.monster.hoglin.Hoglin; +import net.minecraft.world.entity.monster.Zoglin; +import net.minecraft.world.entity.monster.ZombieVillager; +import net.minecraft.world.entity.monster.ZombifiedPiglin; +import net.minecraft.world.entity.monster.piglin.Piglin; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; public class PurifyRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/purify_ritual"); @@ -36,27 +29,27 @@ public PurifyRitual() { } @Override - public RitualResult start(World world, BlockPos pos) { - List purifiable = world.getEntitiesWithinAABB(CreatureEntity.class, Ritual.getDefaultBounds(pos), (entity) -> entity instanceof ZombieVillagerEntity || entity instanceof ZombifiedPiglinEntity || entity instanceof ZoglinEntity); + public RitualResult start(Level world, BlockPos pos) { + List purifiable = world.getEntitiesOfClass(PathfinderMob.class, Ritual.getDefaultBounds(pos), (entity) -> entity instanceof ZombieVillager || entity instanceof ZombifiedPiglin || entity instanceof Zoglin); - if (purifiable.size() > 0 && !world.isRemote) world.playSound(null, pos, SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE, SoundCategory.PLAYERS, 1.0f, 1.0f); - if (!world.isRemote) for (CreatureEntity entity : purifiable) { - if (entity instanceof ZombieVillagerEntity) { - ((ZombieVillagerEntityMixin)entity).callCureZombie((ServerWorld)world); + if (purifiable.size() > 0 && !world.isClientSide) world.playSound(null, pos, SoundEvents.ZOMBIE_VILLAGER_CURE, SoundSource.PLAYERS, 1.0f, 1.0f); + if (!world.isClientSide) for (PathfinderMob entity : purifiable) { + if (entity instanceof ZombieVillager) { + ((ZombieVillagerMixin)entity).callFinishConversion((ServerLevel)world); } - if (entity instanceof ZombifiedPiglinEntity) { - entity.remove(); - PiglinEntity piglin = new PiglinEntity(EntityType.PIGLIN, world); - piglin.copyLocationAndAnglesFrom(entity); - piglin.onInitialSpawn((ServerWorld)world, world.getDifficultyForLocation(pos), SpawnReason.MOB_SUMMONED, null, null); - world.addEntity(piglin); + if (entity instanceof ZombifiedPiglin) { + entity.remove(RemovalReason.KILLED); + Piglin piglin = new Piglin(EntityType.PIGLIN, world); + piglin.copyPosition(entity); + piglin.finalizeSpawn((ServerLevel)world, world.getCurrentDifficultyAt(pos), MobSpawnType.MOB_SUMMONED, null, null); + world.addFreshEntity(piglin); } - if (entity instanceof ZoglinEntity) { - entity.remove(); - HoglinEntity hoglin = new HoglinEntity(EntityType.HOGLIN, world); - hoglin.copyLocationAndAnglesFrom(entity); - hoglin.onInitialSpawn((ServerWorld)world, world.getDifficultyForLocation(pos), SpawnReason.MOB_SUMMONED, null, null); - world.addEntity(hoglin); + if (entity instanceof Zoglin) { + entity.remove(RemovalReason.KILLED); + Hoglin hoglin = new Hoglin(EntityType.HOGLIN, world); + hoglin.copyPosition(entity); + hoglin.finalizeSpawn((ServerLevel)world, world.getCurrentDifficultyAt(pos), MobSpawnType.MOB_SUMMONED, null, null); + world.addFreshEntity(hoglin); } } return RitualResult.TERMINATE; diff --git a/src/main/java/elucent/eidolon/ritual/RechargingRitual.java b/src/main/java/elucent/eidolon/ritual/RechargingRitual.java new file mode 100644 index 0000000..7860a48 --- /dev/null +++ b/src/main/java/elucent/eidolon/ritual/RechargingRitual.java @@ -0,0 +1,42 @@ +package elucent.eidolon.ritual; + +import java.util.List; +import java.util.function.Predicate; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.item.IRechargeableWand; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.RitualConsumePacket; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.Tag; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; + +public class RechargingRitual extends Ritual { + public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/recharge_ritual"); + + public RechargingRitual() { + super(SYMBOL, ColorUtil.packColor(255, 220, 180, 701)); + } + + @Override + public RitualResult start(Level world, BlockPos pos) { + List tiles = Ritual.getTilesWithinAABB(IRitualItemFocus.class, world, getSearchBounds(pos)); + if (!tiles.isEmpty()) for (int i = 0; i < tiles.size(); i ++) { + ItemStack stack = tiles.get(i).provide(); + if (stack.getItem() instanceof IRechargeableWand) { + tiles.get(i).replace(((IRechargeableWand)stack.getItem()).recharge(stack)); + if (!world.isClientSide && tiles.get(i) instanceof BlockEntity b) { + Networking.sendToTracking(world, b.getBlockPos(), new RitualConsumePacket(pos.above(2), b.getBlockPos(), getRed(), getGreen(), getBlue())); + } + break; + } + } + return RitualResult.TERMINATE; + } +} diff --git a/src/main/java/elucent/eidolon/ritual/RepellingRitual.java b/src/main/java/elucent/eidolon/ritual/RepellingRitual.java index 66b9f88..0cd4a42 100644 --- a/src/main/java/elucent/eidolon/ritual/RepellingRitual.java +++ b/src/main/java/elucent/eidolon/ritual/RepellingRitual.java @@ -1,27 +1,20 @@ package elucent.eidolon.ritual; +import java.util.List; +import java.util.stream.Collectors; + import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; import elucent.eidolon.entity.ai.GoToPositionGoal; -import elucent.eidolon.network.CrystallizeEffectPacket; -import elucent.eidolon.network.Networking; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.monster.MonsterEntity; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3i; -import net.minecraft.world.World; -import net.minecraft.world.gen.Heightmap; - -import java.util.List; -import java.util.stream.Collectors; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.Vec3; +import net.minecraft.core.Vec3i; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.levelgen.Heightmap; public class RepellingRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/repelling_ritual"); @@ -31,21 +24,21 @@ public RepellingRitual() { } @Override - public RitualResult tick(World world, BlockPos pos) { + public RitualResult tick(Level world, BlockPos pos) { if (world.getGameTime() % 200 == 0) { - List monsters = world.getEntitiesWithinAABB(MonsterEntity.class, new AxisAlignedBB(pos).grow(96, 16, 96)); - for (MonsterEntity a : monsters) { + List monsters = world.getEntitiesOfClass(Monster.class, new AABB(pos).inflate(96, 16, 96)); + for (Monster a : monsters) { boolean hasGoal = a.goalSelector.getRunningGoals() .filter((goal) -> goal.getGoal() instanceof GoToPositionGoal) .count() > 0; - if (!hasGoal && a.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) <= 80 * 80) { - Vector3i diff = a.getPosition().subtract(pos); - Vector3d diffv = new Vector3d(diff.getX(), 0, diff.getZ()); + if (!hasGoal && a.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) <= 80 * 80) { + Vec3i diff = a.blockPosition().subtract(pos); + Vec3 diffv = new Vec3(diff.getX(), 0, diff.getZ()); diffv = diffv.scale(90 / diffv.length()); int i = pos.getX() + (int)diffv.x, j = pos.getZ() + (int)diffv.z; - BlockPos target = world.getHeight(Heightmap.Type.WORLD_SURFACE, new BlockPos(i, 0, j)); + BlockPos target = world.getHeightmapPos(Heightmap.Types.WORLD_SURFACE, new BlockPos(i, 0, j)); a.goalSelector.addGoal(1, new GoToPositionGoal(a, target, 1.0)); - } else if (hasGoal && a.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > 88 * 88) { + } else if (hasGoal && a.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) > 88 * 88) { List goals = a.goalSelector.getRunningGoals().filter((goal) -> goal.getGoal() instanceof GoToPositionGoal) .collect(Collectors.toList()); for (Goal g : goals) a.goalSelector.removeGoal(g); diff --git a/src/main/java/elucent/eidolon/ritual/RequirementInfo.java b/src/main/java/elucent/eidolon/ritual/RequirementInfo.java index 5a9aee5..e9db673 100644 --- a/src/main/java/elucent/eidolon/ritual/RequirementInfo.java +++ b/src/main/java/elucent/eidolon/ritual/RequirementInfo.java @@ -1,6 +1,6 @@ package elucent.eidolon.ritual; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; public class RequirementInfo { public static final RequirementInfo diff --git a/src/main/java/elucent/eidolon/ritual/Ritual.java b/src/main/java/elucent/eidolon/ritual/Ritual.java index ef43eaf..19191cb 100644 --- a/src/main/java/elucent/eidolon/ritual/Ritual.java +++ b/src/main/java/elucent/eidolon/ritual/Ritual.java @@ -1,33 +1,17 @@ package elucent.eidolon.ritual; -import com.google.common.eventbus.Subscribe; -import elucent.eidolon.particle.GenericParticle; -import elucent.eidolon.particle.GenericParticleData; -import elucent.eidolon.particle.Particles; -import elucent.eidolon.potion.ChilledEffect; -import elucent.eidolon.util.ColorUtil; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.texture.AtlasTexture.SheetData; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.particles.ParticleType; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ColorHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunk; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; - import java.util.ArrayList; import java.util.List; import java.util.Set; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.chunk.ChunkAccess; + public abstract class Ritual { ResourceLocation name = null; int color; @@ -103,7 +87,7 @@ public enum RitualResult { TERMINATE } - public SetupResult setup(World world, BlockPos pos, int step) { + public SetupResult setup(Level world, BlockPos pos, int step) { if (step >= stepRequirements.size()) return SetupResult.SUCCEED; for (IRequirement req : continuousRequirements) { RequirementInfo info = req.isMet(this, world, pos); @@ -117,30 +101,30 @@ public SetupResult setup(World world, BlockPos pos, int step) { return SetupResult.PASS; } - public AxisAlignedBB getSearchBounds(BlockPos pos) { + public AABB getSearchBounds(BlockPos pos) { return getDefaultBounds(pos); } - public static AxisAlignedBB getDefaultBounds(BlockPos pos) { - return new AxisAlignedBB(pos.getX() - 8, pos.getY() - 6, pos.getZ() - 8, pos.getX() + 9, pos.getY() + 11, pos.getZ() + 9); + public static AABB getDefaultBounds(BlockPos pos) { + return new AABB(pos.getX() - 8, pos.getY() - 6, pos.getZ() - 8, pos.getX() + 9, pos.getY() + 11, pos.getZ() + 9); } - public RitualResult tick(World world, BlockPos pos) { + public RitualResult tick(Level world, BlockPos pos) { return RitualResult.PASS; } - public RitualResult start(World world, BlockPos pos) { + public RitualResult start(Level world, BlockPos pos) { return RitualResult.PASS; } - public static List getTilesWithinAABB(Class type, World world, AxisAlignedBB bb) { + public static List getTilesWithinAABB(Class type, Level world, AABB bb) { List tileList = new ArrayList<>(); for (int i = (int)Math.floor(bb.minX); i < (int)Math.ceil(bb.maxX) + 16; i += 16) { for (int j = (int)Math.floor(bb.minZ); j < (int)Math.ceil(bb.maxZ) + 16; j += 16) { - IChunk c = world.getChunk(new BlockPos(i, 0, j)); - Set tiles = c.getTileEntitiesPos(); + ChunkAccess c = world.getChunk(new BlockPos(i, 0, j)); + Set tiles = c.getBlockEntitiesPos(); for (BlockPos p : tiles) if (bb.contains(p.getX() + 0.5, p.getY() + 0.5, p.getZ() + 0.5)) { - TileEntity t = world.getTileEntity(p); + BlockEntity t = world.getBlockEntity(p); if (type.isInstance(t)) tileList.add((T)t); } } diff --git a/src/main/java/elucent/eidolon/ritual/RitualRegistry.java b/src/main/java/elucent/eidolon/ritual/RitualRegistry.java index 74d1a1b..4c1808e 100644 --- a/src/main/java/elucent/eidolon/ritual/RitualRegistry.java +++ b/src/main/java/elucent/eidolon/ritual/RitualRegistry.java @@ -1,37 +1,36 @@ package elucent.eidolon.ritual; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.codex.Page; import elucent.eidolon.codex.RitualPage; -import elucent.eidolon.codex.WorktablePage; import elucent.eidolon.gui.jei.RecipeWrappers; -import elucent.eidolon.recipe.WorktableRecipe; -import elucent.eidolon.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.entity.EntityType; -import net.minecraft.inventory.ItemStackHelper; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.potion.PotionUtils; -import net.minecraft.potion.Potions; -import net.minecraft.tags.ITag; +import elucent.eidolon.item.IRechargeableWand; +import elucent.eidolon.util.RecipeUtil; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.Potions; import net.minecraft.tags.Tag; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.minecraftforge.common.Tags; -import java.util.*; -import java.util.Map.Entry; - public class RitualRegistry { static Map rituals = new HashMap<>(); static BiMap matches = HashBiMap.create(); @@ -55,11 +54,11 @@ public static Ritual register(Block sacrifice, Ritual ritual) { ResourceLocation name = ritual.getRegistryName(); assert name != null; rituals.put(name, ritual); - matches.put(Item.getItemFromBlock(sacrifice), ritual); + matches.put(Item.byBlock(sacrifice), ritual); return ritual; } - public static Ritual register(ITag sacrifice, Ritual ritual) { + public static Ritual register(Tag sacrifice, Ritual ritual) { ResourceLocation name = ritual.getRegistryName(); assert name != null; rituals.put(name, ritual); @@ -79,19 +78,19 @@ public static Page getDefaultPage(Ritual ritual, Object sacrifice) { List inputs = new ArrayList<>(); List foci = new ArrayList<>(); if (sacrifice instanceof MultiItemSacrifice) for (Object o : ((MultiItemSacrifice)sacrifice).items) { - foci.add(StackUtil.stackFromObject(o)); + foci.add(RecipeUtil.stackFromObject(o)); } int slot = 0; for (IRequirement r : ritual.getRequirements()) { if (r instanceof ItemRequirement) - inputs.add(new RitualPage.RitualIngredient(StackUtil.stackFromObject(((ItemRequirement)r).getMatch()), false)); + inputs.add(new RitualPage.RitualIngredient(RecipeUtil.stackFromObject(((ItemRequirement)r).getMatch()), false)); slot ++; } Iterator iter = foci.iterator(); while (iter.hasNext()) { ItemStack focus = iter.next(); for (RitualPage.RitualIngredient input : inputs) { - if (ItemStack.areItemsEqual(focus, input.stack) && ItemStack.areItemStackTagsEqual(focus, input.stack) + if (ItemStack.isSame(focus, input.stack) && ItemStack.tagMatches(focus, input.stack) && !input.isFocus) { input.isFocus = true; iter.remove(); @@ -99,7 +98,7 @@ public static Page getDefaultPage(Ritual ritual, Object sacrifice) { } } } - ItemStack center = StackUtil.stackFromObject(sacrifice instanceof MultiItemSacrifice ? ((MultiItemSacrifice)sacrifice).main : sacrifice); + ItemStack center = RecipeUtil.stackFromObject(sacrifice instanceof MultiItemSacrifice ? ((MultiItemSacrifice)sacrifice).main : sacrifice); return new RitualPage(ritual, center, inputs.toArray(new RitualPage.RitualIngredient[inputs.size()])); } @@ -122,18 +121,18 @@ public static Ritual find(ResourceLocation name) { return rituals.get(name); } - static boolean matches(World world, BlockPos pos, Object match, ItemStack sacrifice) { + static boolean matches(Level world, BlockPos pos, Object match, ItemStack sacrifice) { if (match instanceof ItemStack) { - if (ItemStack.areItemStacksEqual((ItemStack)match, sacrifice)) return true; + if (ItemStack.matches((ItemStack)match, sacrifice)) return true; } else if (match instanceof Block) { - if (Item.getItemFromBlock((Block)match) == sacrifice.getItem()) return true; + if (Item.byBlock((Block)match) == sacrifice.getItem()) return true; } else if (match instanceof Item) { if ((Item)match == sacrifice.getItem()) return true; } - else if (match instanceof ITag) { - if (((ITag)match).contains(sacrifice.getItem())) return true; + else if (match instanceof Tag) { + if (((Tag)match).contains(sacrifice.getItem())) return true; } else if (match instanceof MultiItemSacrifice) { // check main item first, avoid complicated work @@ -163,7 +162,7 @@ else if (match instanceof MultiItemSacrifice) { return false; } - public static Ritual find(World world, BlockPos pos, ItemStack sacrifice) { + public static Ritual find(Level world, BlockPos pos, ItemStack sacrifice) { for (Entry entry : matches.entrySet()) { if (matches(world, pos, entry.getKey(), sacrifice)) return entry.getValue(); } @@ -174,8 +173,9 @@ public static Ritual find(World world, BlockPos pos, ItemStack sacrifice) { SUMMON_ZOMBIE, SUMMON_SKELETON, SUMMON_PHANTOM, SUMMON_HUSK, SUMMON_DROWNED, SUMMON_STRAY, SUMMON_WITHER_SKELETON, SUMMON_WRAITH, ALLURE_RITUAL, REPELLING_RITUAL, DECEIT_RITUAL, DAYLIGHT_RITUAL, MOONLIGHT_RITUAL, - PURIFY_RITUAL, - SANGUINE_SWORD, SANGUINE_AMULET; + PURIFY_RITUAL, RECHARGE_SOULFIRE_RITUAL, RECHARGE_BONECHILL_RITUAL, + SANGUINE_SWORD, SANGUINE_AMULET, + ABSORB_RITUAL; public static void init() { CRYSTAL_RITUAL = register(Items.BONE_MEAL, new CrystalRitual().setRegistryName(Eidolon.MODID, "crystal") @@ -252,11 +252,11 @@ public static void init() { PURIFY_RITUAL = register(Items.GLISTERING_MELON_SLICE, new PurifyRitual().setRegistryName(Eidolon.MODID, "purify") .addRequirement(new ItemRequirement(Registry.ENCHANTED_ASH.get())) .addRequirement(new ItemRequirement(Registry.ENCHANTED_ASH.get())) - .addRequirement(new ItemRequirement(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HEALING))) + .addRequirement(new ItemRequirement(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.HEALING))) .addRequirement(new ItemRequirement(Registry.SOUL_SHARD.get())) .addRequirement(new ItemRequirement(Registry.SOUL_SHARD.get()))); - SANGUINE_SWORD = register(new MultiItemSacrifice(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HARMING), Items.IRON_SWORD), new SanguineRitual(new ItemStack(Registry.SAPPING_SWORD.get())).setRegistryName(Eidolon.MODID, "sanguine_sapping_sword") + SANGUINE_SWORD = register(new MultiItemSacrifice(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.HARMING), Items.IRON_SWORD), new SanguineRitual(new ItemStack(Registry.SAPPING_SWORD.get())).setRegistryName(Eidolon.MODID, "sanguine_sapping_sword") .addRequirement(new ItemRequirement(Registry.SHADOW_GEM.get())) .addRequirement(new ItemRequirement(Registry.SOUL_SHARD.get())) .addRequirement(new ItemRequirement(Registry.SOUL_SHARD.get())) @@ -266,7 +266,7 @@ public static void init() { .addRequirement(new ItemRequirement(Items.GHAST_TEAR)) .addRequirement(new HealthRequirement(20))); - SANGUINE_AMULET = register(new MultiItemSacrifice(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HARMING), Registry.BASIC_AMULET.get()), new SanguineRitual(new ItemStack(Registry.SANGUINE_AMULET.get())).setRegistryName(Eidolon.MODID, "sanguine_sanguine_amulet") + SANGUINE_AMULET = register(new MultiItemSacrifice(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.HARMING), Registry.BASIC_AMULET.get()), new SanguineRitual(new ItemStack(Registry.SANGUINE_AMULET.get())).setRegistryName(Eidolon.MODID, "sanguine_sanguine_amulet") .addRequirement(new ItemRequirement(Tags.Items.GEMS_DIAMOND)) .addRequirement(new ItemRequirement(Tags.Items.DUSTS_REDSTONE)) .addRequirement(new ItemRequirement(Tags.Items.DUSTS_REDSTONE)) @@ -275,5 +275,24 @@ public static void init() { .addRequirement(new ItemRequirement(Tags.Items.DUSTS_REDSTONE)) .addRequirement(new ItemRequirement(Registry.LESSER_SOUL_GEM.get())) .addRequirement(new HealthRequirement(40))); + + RECHARGE_SOULFIRE_RITUAL = register(Registry.LESSER_SOUL_GEM.get(), new RechargingRitual().setRegistryName(Eidolon.MODID, "recharging") + .addRequirement(new ItemRequirement(Items.BLAZE_POWDER)) + .addRequirement(new ItemRequirement(Items.BLAZE_POWDER)) + .addRequirement(new ItemRequirement(Tags.Items.DUSTS_REDSTONE)) + .addInvariant(new FocusItemPresentRequirement(Registry.SOULFIRE_WAND.get()))); + + RECHARGE_BONECHILL_RITUAL = register(Registry.LESSER_SOUL_GEM.get(), new RechargingRitual().setRegistryName(Eidolon.MODID, "recharging") + .addRequirement(new ItemRequirement(Items.SNOWBALL)) + .addRequirement(new ItemRequirement(Items.SNOWBALL)) + .addRequirement(new ItemRequirement(Tags.Items.DUSTS_REDSTONE)) + .addInvariant(new FocusItemPresentRequirement(Registry.BONECHILL_WAND.get()))); + + ABSORB_RITUAL = register(Registry.DEATH_ESSENCE.get(), new AbsorptionRitual().setRegistryName(Eidolon.MODID, "absorption") + .addRequirement(new ItemRequirement(Registry.TATTERED_CLOTH.get())) + .addRequirement(new ItemRequirement(Registry.TATTERED_CLOTH.get())) + .addRequirement(new ItemRequirement(Items.BONE)) + .addRequirement(new ItemRequirement(Registry.SOUL_SHARD.get())) + .addRequirement(new ItemRequirement(Registry.SOUL_SHARD.get()))); } } diff --git a/src/main/java/elucent/eidolon/ritual/SanguineRitual.java b/src/main/java/elucent/eidolon/ritual/SanguineRitual.java index 19fd7b6..23dc51c 100644 --- a/src/main/java/elucent/eidolon/ritual/SanguineRitual.java +++ b/src/main/java/elucent/eidolon/ritual/SanguineRitual.java @@ -2,11 +2,11 @@ import elucent.eidolon.Eidolon; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class SanguineRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/sanguine_ritual"); @@ -18,9 +18,9 @@ public SanguineRitual(ItemStack result) { } @Override - public RitualResult start(World world, BlockPos pos) { - if (!world.isRemote) { - world.addEntity(new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 2.5, pos.getZ() + 0.5, result.copy())); + public RitualResult start(Level world, BlockPos pos) { + if (!world.isClientSide) { + world.addFreshEntity(new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 2.5, pos.getZ() + 0.5, result.copy())); } return RitualResult.TERMINATE; } diff --git a/src/main/java/elucent/eidolon/ritual/SummonRitual.java b/src/main/java/elucent/eidolon/ritual/SummonRitual.java index 3dd397e..91f3124 100644 --- a/src/main/java/elucent/eidolon/ritual/SummonRitual.java +++ b/src/main/java/elucent/eidolon/ritual/SummonRitual.java @@ -1,20 +1,14 @@ package elucent.eidolon.ritual; import elucent.eidolon.Eidolon; -import elucent.eidolon.Registry; import elucent.eidolon.network.CrystallizeEffectPacket; import elucent.eidolon.network.Networking; import elucent.eidolon.util.ColorUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.List; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class SummonRitual extends Ritual { public static final ResourceLocation SYMBOL = new ResourceLocation(Eidolon.MODID, "particle/summon_ritual"); @@ -26,12 +20,12 @@ public SummonRitual(EntityType entity) { } @Override - public RitualResult start(World world, BlockPos pos) { - if (!world.isRemote) { + public RitualResult start(Level world, BlockPos pos) { + if (!world.isClientSide) { Networking.sendToTracking(world, pos, new CrystallizeEffectPacket(pos)); Entity e = entity.create(world); - e.setPosition(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5); - world.addEntity(e); + e.setPos(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5); + world.addFreshEntity(e); } return RitualResult.TERMINATE; } diff --git a/src/main/java/elucent/eidolon/spell/AltarEntries.java b/src/main/java/elucent/eidolon/spell/AltarEntries.java index b6c0e01..2031ae6 100644 --- a/src/main/java/elucent/eidolon/spell/AltarEntries.java +++ b/src/main/java/elucent/eidolon/spell/AltarEntries.java @@ -1,14 +1,14 @@ package elucent.eidolon.spell; -import elucent.eidolon.Registry; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.SkullBlock; -import net.minecraft.state.properties.BlockStateProperties; - import java.util.HashMap; import java.util.Map; +import elucent.eidolon.Registry; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SkullBlock; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; + public class AltarEntries { static Map entries = new HashMap<>(); @@ -17,22 +17,22 @@ public static AltarEntry find(BlockState state) { } public static void init() { - entries.put(Blocks.TORCH.getDefaultState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(1)); - entries.put(Blocks.LANTERN.getDefaultState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(1).setCapacity(1)); - entries.put(Registry.CANDLE.get().getDefaultState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(2)); - entries.put(Registry.CANDLESTICK.get().getDefaultState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(2)); + entries.put(Blocks.TORCH.defaultBlockState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(1)); + entries.put(Blocks.LANTERN.defaultBlockState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(1).setCapacity(1)); + entries.put(Registry.CANDLE.get().defaultBlockState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(2)); + entries.put(Registry.CANDLESTICK.get().defaultBlockState(), new AltarEntry(AltarKeys.LIGHT_KEY).setPower(2)); - for (int i : BlockStateProperties.ROTATION_0_15.getAllowedValues()) { - entries.put(Blocks.SKELETON_SKULL.getDefaultState().with(SkullBlock.ROTATION, i), new AltarEntry(AltarKeys.SKULL_KEY).setCapacity(2)); - entries.put(Blocks.ZOMBIE_HEAD.getDefaultState().with(SkullBlock.ROTATION, i), new AltarEntry(AltarKeys.SKULL_KEY).setCapacity(1).setPower(1)); - entries.put(Blocks.WITHER_SKELETON_SKULL.getDefaultState().with(SkullBlock.ROTATION, i), new AltarEntry(AltarKeys.SKULL_KEY).setCapacity(3).setPower(1)); + for (int i : BlockStateProperties.ROTATION_16.getPossibleValues()) { + entries.put(Blocks.SKELETON_SKULL.defaultBlockState().setValue(SkullBlock.ROTATION, i), new AltarEntry(AltarKeys.SKULL_KEY).setCapacity(2)); + entries.put(Blocks.ZOMBIE_HEAD.defaultBlockState().setValue(SkullBlock.ROTATION, i), new AltarEntry(AltarKeys.SKULL_KEY).setCapacity(1).setPower(1)); + entries.put(Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(SkullBlock.ROTATION, i), new AltarEntry(AltarKeys.SKULL_KEY).setCapacity(3).setPower(1)); } - entries.put(Blocks.POTTED_WARPED_ROOTS.getDefaultState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(1)); - entries.put(Blocks.POTTED_CRIMSON_ROOTS.getDefaultState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(1)); - entries.put(Blocks.POTTED_WARPED_FUNGUS.getDefaultState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(2)); - entries.put(Blocks.POTTED_CRIMSON_FUNGUS.getDefaultState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(2)); - entries.put(Blocks.POTTED_WITHER_ROSE.getDefaultState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(3)); - entries.put(Registry.GOBLET.get().getDefaultState(), new AltarEntry(AltarKeys.GOBLET_KEY).setCapacity(2)); + entries.put(Blocks.POTTED_WARPED_ROOTS.defaultBlockState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(1)); + entries.put(Blocks.POTTED_CRIMSON_ROOTS.defaultBlockState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(1)); + entries.put(Blocks.POTTED_WARPED_FUNGUS.defaultBlockState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(2)); + entries.put(Blocks.POTTED_CRIMSON_FUNGUS.defaultBlockState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(2)); + entries.put(Blocks.POTTED_WITHER_ROSE.defaultBlockState(), new AltarEntry(AltarKeys.PLANT_KEY).setPower(3)); + entries.put(Registry.GOBLET.get().defaultBlockState(), new AltarEntry(AltarKeys.GOBLET_KEY).setCapacity(2)); } } diff --git a/src/main/java/elucent/eidolon/spell/AltarEntry.java b/src/main/java/elucent/eidolon/spell/AltarEntry.java index 8ff4c76..b5a4623 100644 --- a/src/main/java/elucent/eidolon/spell/AltarEntry.java +++ b/src/main/java/elucent/eidolon/spell/AltarEntry.java @@ -1,9 +1,9 @@ package elucent.eidolon.spell; -import net.minecraft.util.ResourceLocation; - import java.util.function.Consumer; +import net.minecraft.resources.ResourceLocation; + public class AltarEntry { double capacity = 0, power = 0; ResourceLocation key = null; diff --git a/src/main/java/elucent/eidolon/spell/AltarInfo.java b/src/main/java/elucent/eidolon/spell/AltarInfo.java index 00562c1..c911fea 100644 --- a/src/main/java/elucent/eidolon/spell/AltarInfo.java +++ b/src/main/java/elucent/eidolon/spell/AltarInfo.java @@ -1,15 +1,20 @@ package elucent.eidolon.spell; -import elucent.eidolon.block.TableBlockBase; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import java.util.ArrayDeque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Queue; +import java.util.Set; -import java.util.*; +import elucent.eidolon.block.TableBlockBase; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class AltarInfo { static class AltarAttributes { @@ -22,31 +27,31 @@ public AltarAttributes() {} Map attributes = new HashMap<>(); - public static Set getAltarPositions(World world, BlockPos pos) { + public static Set getAltarPositions(Level world, BlockPos pos) { Set result = new HashSet<>(); Queue visit = new ArrayDeque(); - BlockState below = world.getBlockState(pos.down()); + BlockState below = world.getBlockState(pos.below()); Block b = below.getBlock(); - if (below.getBlock() instanceof TableBlockBase) visit.add(pos.down()); + if (below.getBlock() instanceof TableBlockBase) visit.add(pos.below()); while (!visit.isEmpty()) { BlockPos visited = visit.remove(); if (result.contains(visited)) continue; result.add(visited); - for (Direction d : BlockStateProperties.HORIZONTAL_FACING.getAllowedValues()) - if (world.getBlockState(visited.offset(d)).getBlock() == b - && !result.contains(visited.offset(d))) - visit.add(visited.offset(d)); + for (Direction d : BlockStateProperties.HORIZONTAL_FACING.getPossibleValues()) + if (world.getBlockState(visited.relative(d)).getBlock() == b + && !result.contains(visited.relative(d))) + visit.add(visited.relative(d)); } return result; } - public static AltarInfo getAltarInfo(World world, BlockPos pos) { + public static AltarInfo getAltarInfo(Level world, BlockPos pos) { AltarInfo info = new AltarInfo(); info.icon = world.getBlockState(pos).getBlock(); Set altarPositions = getAltarPositions(world, pos); for (BlockPos p : altarPositions) { if (info.altar == null) info.altar = world.getBlockState(p).getBlock(); - BlockState state = world.getBlockState(p.up()); + BlockState state = world.getBlockState(p.above()); AltarEntry entry = AltarEntries.find(state); if (entry != null) { entry.apply(info); diff --git a/src/main/java/elucent/eidolon/spell/AltarKeys.java b/src/main/java/elucent/eidolon/spell/AltarKeys.java index 771450f..1d8127a 100644 --- a/src/main/java/elucent/eidolon/spell/AltarKeys.java +++ b/src/main/java/elucent/eidolon/spell/AltarKeys.java @@ -1,11 +1,11 @@ package elucent.eidolon.spell; -import elucent.eidolon.Eidolon; -import net.minecraft.util.ResourceLocation; - import java.util.HashSet; import java.util.Set; +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; + public class AltarKeys { Set keys = new HashSet<>(); diff --git a/src/main/java/elucent/eidolon/spell/AnimalSacrificeSpell.java b/src/main/java/elucent/eidolon/spell/AnimalSacrificeSpell.java index 1ac2ad3..8705bff 100644 --- a/src/main/java/elucent/eidolon/spell/AnimalSacrificeSpell.java +++ b/src/main/java/elucent/eidolon/spell/AnimalSacrificeSpell.java @@ -1,28 +1,28 @@ package elucent.eidolon.spell; +import java.util.Comparator; +import java.util.List; + import elucent.eidolon.Registry; import elucent.eidolon.block.HorizontalBlockBase; -import elucent.eidolon.capability.ReputationProvider; +import elucent.eidolon.capability.IReputation; import elucent.eidolon.deity.Deity; import elucent.eidolon.deity.DeityLocks; import elucent.eidolon.particle.Particles; import elucent.eidolon.ritual.Ritual; import elucent.eidolon.tile.EffigyTileEntity; import elucent.eidolon.tile.GobletTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.Comparator; -import java.util.List; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class AnimalSacrificeSpell extends StaticSpell { Deity deity; @@ -33,63 +33,61 @@ public AnimalSacrificeSpell(ResourceLocation name, Deity deity, Sign... signs) { } @Override - public boolean canCast(World world, BlockPos pos, PlayerEntity player) { - if (!world.getCapability(ReputationProvider.CAPABILITY).isPresent()) return false; - if (!world.getCapability(ReputationProvider.CAPABILITY).resolve().get().canPray(player, world.getGameTime())) return false; - if (world.getCapability(ReputationProvider.CAPABILITY).resolve().get().getReputation(player.getUniqueID(), deity.getId()) < 3.0) return false; - List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); - List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); + public boolean canCast(Level world, BlockPos pos, Player player) { + if (!world.getCapability(IReputation.INSTANCE).isPresent()) return false; + if (!world.getCapability(IReputation.INSTANCE).resolve().get().canPray(player, getRegistryName(), world.getGameTime())) return false; + if (world.getCapability(IReputation.INSTANCE).resolve().get().getReputation(player.getUUID(), deity.getId()) < 3.0) return false; + List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); + List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); if (effigies.size() == 0 || goblets.size() == 0) return false; - EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); + EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); if (goblet.getEntityType() == null) return false; Entity test = goblet.getEntityType().create(world); - return test instanceof AnimalEntity && effigy.ready(); + return test instanceof Animal && effigy.ready(); } @Override - public void cast(World world, BlockPos pos, PlayerEntity player) { - List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); - List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); + public void cast(Level world, BlockPos pos, Player player) { + List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); + List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); if (effigies.size() == 0 || goblets.size() == 0) return; - EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - if (!world.isRemote) { + EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + if (!world.isClientSide) { effigy.pray(); goblet.setEntityType(null); - AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getPos()); - world.getCapability(ReputationProvider.CAPABILITY, null).ifPresent((rep) -> { - rep.pray(player, world.getGameTime()); + AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getBlockPos()); + world.getCapability(IReputation.INSTANCE, null).ifPresent((rep) -> { + rep.pray(player, getRegistryName(), world.getGameTime()); double prev = rep.getReputation(player, deity.getId()); - if (rep.unlock(player, deity.getId(), DeityLocks.SACRIFICE_MOB)) - deity.onReputationUnlock(player, rep, DeityLocks.SACRIFICE_MOB); + rep.unlock(player, deity.getId(), DeityLocks.SACRIFICE_MOB); rep.addReputation(player, deity.getId(), 3.0 + 0.5 * info.getPower()); - deity.onReputationChange(player, rep, prev, rep.getReputation(player, deity.getId())); }); } else { - world.playSound(player, effigy.getPos(), SoundEvents.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.NEUTRAL, 10000.0F, 0.6F + world.rand.nextFloat() * 0.2F); - world.playSound(player, effigy.getPos(), SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.NEUTRAL, 2.0F, 0.5F + world.rand.nextFloat() * 0.2F); - BlockState state = world.getBlockState(effigy.getPos()); - Direction dir = state.get(HorizontalBlockBase.HORIZONTAL_FACING); - Direction tangent = dir.rotateY(); - float x = effigy.getPos().getX() + 0.5f + dir.getXOffset() * 0.21875f; - float y = effigy.getPos().getY() + 0.8125f; - float z = effigy.getPos().getZ() + 0.5f + dir.getZOffset() * 0.21875f; + world.playSound(player, effigy.getBlockPos(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.NEUTRAL, 10000.0F, 0.6F + world.random.nextFloat() * 0.2F); + world.playSound(player, effigy.getBlockPos(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.NEUTRAL, 2.0F, 0.5F + world.random.nextFloat() * 0.2F); + BlockState state = world.getBlockState(effigy.getBlockPos()); + Direction dir = state.getValue(HorizontalBlockBase.HORIZONTAL_FACING); + Direction tangent = dir.getClockWise(); + float x = effigy.getBlockPos().getX() + 0.5f + dir.getStepX() * 0.21875f; + float y = effigy.getBlockPos().getY() + 0.8125f; + float z = effigy.getBlockPos().getZ() + 0.5f + dir.getStepZ() * 0.21875f; Particles.create(Registry.FLAME_PARTICLE) .setColor(Signs.BLOOD_SIGN.getRed(), Signs.BLOOD_SIGN.getGreen(), Signs.BLOOD_SIGN.getBlue()) .setAlpha(0.5f, 0) .setScale(0.125f, 0.0625f) .randomOffset(0.01f) .randomVelocity(0.0025f).addVelocity(0, 0.005f, 0) - .repeat(world, x + 0.09375f * tangent.getXOffset(), y, z + 0.09375f * tangent.getZOffset(), 8); + .repeat(world, x + 0.09375f * tangent.getStepX(), y, z + 0.09375f * tangent.getStepZ(), 8); Particles.create(Registry.FLAME_PARTICLE) .setColor(Signs.BLOOD_SIGN.getRed(), Signs.BLOOD_SIGN.getGreen(), Signs.BLOOD_SIGN.getBlue()) .setAlpha(0.5f, 0) .setScale(0.1875f, 0.125f) .randomOffset(0.01f) .randomVelocity(0.0025f).addVelocity(0, 0.005f, 0) - .repeat(world, x - 0.09375f * tangent.getXOffset(), y, z - 0.09375f * tangent.getZOffset(), 8); + .repeat(world, x - 0.09375f * tangent.getStepX(), y, z - 0.09375f * tangent.getStepZ(), 8); } } } diff --git a/src/main/java/elucent/eidolon/spell/DarkTouchSpell.java b/src/main/java/elucent/eidolon/spell/DarkTouchSpell.java index 48870a5..8b406bb 100644 --- a/src/main/java/elucent/eidolon/spell/DarkTouchSpell.java +++ b/src/main/java/elucent/eidolon/spell/DarkTouchSpell.java @@ -1,44 +1,27 @@ package elucent.eidolon.spell; -import com.google.common.eventbus.Subscribe; +import java.util.List; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; -import elucent.eidolon.block.HorizontalBlockBase; -import elucent.eidolon.capability.ReputationProvider; +import elucent.eidolon.capability.IReputation; import elucent.eidolon.deity.Deities; -import elucent.eidolon.deity.Deity; import elucent.eidolon.network.MagicBurstEffectPacket; import elucent.eidolon.network.Networking; -import elucent.eidolon.particle.Particles; -import elucent.eidolon.ritual.Ritual; -import elucent.eidolon.tile.EffigyTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.MusicDiscItem; -import net.minecraft.util.*; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceContext; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.living.LivingHurtEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.DistExecutor; - -import java.util.Comparator; -import java.util.List; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.RecordItem; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; public class DarkTouchSpell extends StaticSpell { public static final String NECROTIC_KEY = new ResourceLocation(Eidolon.MODID, "necrotic").toString(); @@ -79,13 +62,13 @@ public DarkTouchSpell(ResourceLocation name, Sign... signs) { // } @Override - public boolean canCast(World world, BlockPos pos, PlayerEntity player) { - if (!world.getCapability(ReputationProvider.CAPABILITY).isPresent()) return false; - if (world.getCapability(ReputationProvider.CAPABILITY).resolve().get().getReputation(player, Deities.DARK_DEITY.getId()) < 4.0) return false; + public boolean canCast(Level world, BlockPos pos, Player player) { + if (!world.getCapability(IReputation.INSTANCE).isPresent()) return false; + if (world.getCapability(IReputation.INSTANCE).resolve().get().getReputation(player, Deities.DARK_DEITY.getId()) < 4.0) return false; - RayTraceResult ray = world.rayTraceBlocks(new RayTraceContext(player.getEyePosition(0), player.getEyePosition(0).add(player.getLookVec().scale(4)), RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player)); - Vector3d v = ray.getType() == RayTraceResult.Type.BLOCK ? ray.getHitVec() : player.getEyePosition(0).add(player.getLookVec().scale(4)); - List items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(v.x - 1.5, v.y - 1.5, v.z - 1.5, v.x + 1.5, v.y + 1.5, v.z + 1.5)); + HitResult ray = world.clip(new ClipContext(player.getEyePosition(0), player.getEyePosition(0).add(player.getLookAngle().scale(4)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)); + Vec3 v = ray.getType() == HitResult.Type.BLOCK ? ray.getLocation() : player.getEyePosition(0).add(player.getLookAngle().scale(4)); + List items = world.getEntitiesOfClass(ItemEntity.class, new AABB(v.x - 1.5, v.y - 1.5, v.z - 1.5, v.x + 1.5, v.y + 1.5, v.z + 1.5)); if (items.size() != 1) return false; ItemStack stack = items.get(0).getItem(); return stack.getCount() == 1 && canTouch(stack); @@ -94,7 +77,7 @@ public boolean canCast(World world, BlockPos pos, PlayerEntity player) { boolean canTouch(ItemStack stack) { return stack.getItem() == Registry.PEWTER_INLAY.get() // is pewter || stack.getItem() == Items.BLACK_WOOL - || (stack.getItem() instanceof MusicDiscItem && stack.getItem() != Registry.PAROUSIA_DISC.get()); + || (stack.getItem() instanceof RecordItem && stack.getItem() != Registry.PAROUSIA_DISC.get()); // || (stack.isDamageable() && stack.getMaxStackSize() == 1); // is tool } @@ -103,7 +86,7 @@ ItemStack touchResult(ItemStack stack) { // assumes canTouch is true return new ItemStack(Registry.UNHOLY_SYMBOL.get()); else if (stack.getItem() == Items.BLACK_WOOL) return new ItemStack(Registry.TOP_HAT.get()); - else if (stack.getItem() instanceof MusicDiscItem && stack.getItem() != Registry.PAROUSIA_DISC.get()) + else if (stack.getItem() instanceof RecordItem && stack.getItem() != Registry.PAROUSIA_DISC.get()) return new ItemStack(Registry.PAROUSIA_DISC.get()); // else { // stack.getOrCreateTag().putBoolean(NECROTIC_KEY, true); @@ -113,21 +96,21 @@ else if (stack.getItem() instanceof MusicDiscItem && stack.getItem() != Registry } @Override - public void cast(World world, BlockPos pos, PlayerEntity player) { - RayTraceResult ray = world.rayTraceBlocks(new RayTraceContext(player.getEyePosition(0), player.getEyePosition(0).add(player.getLookVec().scale(4)), RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player)); - Vector3d v = ray.getType() == RayTraceResult.Type.BLOCK ? ray.getHitVec() : player.getEyePosition(0).add(player.getLookVec().scale(4)); - List items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(v.x - 1.5, v.y - 1.5, v.z - 1.5, v.x + 1.5, v.y + 1.5, v.z + 1.5)); + public void cast(Level world, BlockPos pos, Player player) { + HitResult ray = world.clip(new ClipContext(player.getEyePosition(0), player.getEyePosition(0).add(player.getLookAngle().scale(4)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)); + Vec3 v = ray.getType() == HitResult.Type.BLOCK ? ray.getLocation() : player.getEyePosition(0).add(player.getLookAngle().scale(4)); + List items = world.getEntitiesOfClass(ItemEntity.class, new AABB(v.x - 1.5, v.y - 1.5, v.z - 1.5, v.x + 1.5, v.y + 1.5, v.z + 1.5)); if (items.size() == 1) { - if (!world.isRemote) { + if (!world.isClientSide) { ItemStack stack = items.get(0).getItem(); if (canTouch(stack)) { items.get(0).setItem(touchResult(stack)); - Vector3d p = items.get(0).getPositionVec(); - items.get(0).setDefaultPickupDelay(); - Networking.sendToTracking(world, items.get(0).getPosition(), new MagicBurstEffectPacket(p.x, p.y, p.z, Signs.WICKED_SIGN.getColor(), Signs.BLOOD_SIGN.getColor())); + Vec3 p = items.get(0).position(); + items.get(0).setDefaultPickUpDelay(); + Networking.sendToTracking(world, items.get(0).blockPosition(), new MagicBurstEffectPacket(p.x, p.y, p.z, Signs.WICKED_SIGN.getColor(), Signs.BLOOD_SIGN.getColor())); } } else { - world.playSound(player, player.getPosition(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.NEUTRAL, 1.0F, 0.6F + world.rand.nextFloat() * 0.2F); + world.playSound(player, player.blockPosition(), SoundEvents.ENCHANTMENT_TABLE_USE, SoundSource.NEUTRAL, 1.0F, 0.6F + world.random.nextFloat() * 0.2F); } } } diff --git a/src/main/java/elucent/eidolon/spell/KnowledgeUtil.java b/src/main/java/elucent/eidolon/spell/KnowledgeUtil.java deleted file mode 100644 index c52b372..0000000 --- a/src/main/java/elucent/eidolon/spell/KnowledgeUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -package elucent.eidolon.spell; - -import elucent.eidolon.capability.KnowledgeProvider; -import elucent.eidolon.network.KnowledgeUpdatePacket; -import elucent.eidolon.network.Networking; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.network.play.server.STitlePacket; -import net.minecraft.network.play.server.SUpdateTimePacket; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.GameRules; - -public class KnowledgeUtil { - public static void grantSign(Entity entity, Sign sign) { - if (!(entity instanceof PlayerEntity)) return; - entity.getCapability(KnowledgeProvider.CAPABILITY, null).ifPresent((k) -> { - if (k.knowsSign(sign)) return; - k.addSign(sign); - - ((ServerPlayerEntity)entity).connection.sendPacket(new STitlePacket(STitlePacket.Type.ACTIONBAR, new TranslationTextComponent("eidolon.title.new_sign", new TranslationTextComponent(sign.key.getNamespace() + ".sign." + sign.key.getPath())))); - Networking.sendTo((PlayerEntity)entity, new KnowledgeUpdatePacket((PlayerEntity)entity, true)); - }); - } - - public static void grantFact(Entity entity, ResourceLocation fact) { - if (!(entity instanceof PlayerEntity)) return; - entity.getCapability(KnowledgeProvider.CAPABILITY, null).ifPresent((k) -> { - if (k.knowsFact(fact)) return; - k.addFact(fact); - - ((ServerPlayerEntity)entity).connection.sendPacket(new STitlePacket(STitlePacket.Type.ACTIONBAR, new TranslationTextComponent("eidolon.title.new_fact"))); - Networking.sendTo((PlayerEntity)entity, new KnowledgeUpdatePacket((PlayerEntity)entity, true)); - }); - } - - public static boolean knowsSign(PlayerEntity player, Sign sign) { - if (player.getCapability(KnowledgeProvider.CAPABILITY).isPresent()) { - return player.getCapability(KnowledgeProvider.CAPABILITY).resolve().get().knowsSign(sign); - } - return false; - } - - public static boolean knowsFact(PlayerEntity player, ResourceLocation fact) { - if (player.getCapability(KnowledgeProvider.CAPABILITY).isPresent()) { - return player.getCapability(KnowledgeProvider.CAPABILITY).resolve().get().knowsFact(fact); - } - return false; - } -} diff --git a/src/main/java/elucent/eidolon/spell/PrayerSpell.java b/src/main/java/elucent/eidolon/spell/PrayerSpell.java index f72c9e4..0d69b49 100644 --- a/src/main/java/elucent/eidolon/spell/PrayerSpell.java +++ b/src/main/java/elucent/eidolon/spell/PrayerSpell.java @@ -1,25 +1,24 @@ package elucent.eidolon.spell; +import java.util.Comparator; +import java.util.List; + import elucent.eidolon.Registry; import elucent.eidolon.block.HorizontalBlockBase; -import elucent.eidolon.capability.KnowledgeProvider; -import elucent.eidolon.capability.ReputationProvider; +import elucent.eidolon.capability.IReputation; import elucent.eidolon.deity.Deity; import elucent.eidolon.particle.Particles; import elucent.eidolon.ritual.Ritual; import elucent.eidolon.tile.EffigyTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.Comparator; -import java.util.List; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class PrayerSpell extends StaticSpell { Deity deity; @@ -30,53 +29,52 @@ public PrayerSpell(ResourceLocation name, Deity deity, Sign... signs) { } @Override - public boolean canCast(World world, BlockPos pos, PlayerEntity player) { - if (!world.getCapability(ReputationProvider.CAPABILITY).isPresent()) return false; - if (!world.getCapability(ReputationProvider.CAPABILITY).resolve().get().canPray(player, world.getGameTime())) return false; - List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); + public boolean canCast(Level world, BlockPos pos, Player player) { + if (!world.getCapability(IReputation.INSTANCE).isPresent()) return false; + if (!world.getCapability(IReputation.INSTANCE).resolve().get().canPray(player, getRegistryName(), world.getGameTime())) return false; + List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); if (effigies.size() == 0) return false; - EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); + EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); return effigy.ready(); } @Override - public void cast(World world, BlockPos pos, PlayerEntity player) { - List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); + public void cast(Level world, BlockPos pos, Player player) { + List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); if (effigies.size() == 0) return; - EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - if (!world.isRemote) { + EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + if (!world.isClientSide) { effigy.pray(); - AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getPos()); - world.getCapability(ReputationProvider.CAPABILITY, null).ifPresent((rep) -> { - rep.pray(player, world.getGameTime()); + AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getBlockPos()); + world.getCapability(IReputation.INSTANCE, null).ifPresent((rep) -> { + rep.pray(player, getRegistryName(), world.getGameTime()); double prev = rep.getReputation(player, deity.getId()); rep.addReputation(player, deity.getId(), 1.0 + 0.25 * info.getPower()); - deity.onReputationChange(player, rep, prev, rep.getReputation(player, deity.getId())); }); } else { - world.playSound(player, effigy.getPos(), SoundEvents.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.NEUTRAL, 10000.0F, 0.6F + world.rand.nextFloat() * 0.2F); - world.playSound(player, effigy.getPos(), SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.NEUTRAL, 2.0F, 0.5F + world.rand.nextFloat() * 0.2F); - BlockState state = world.getBlockState(effigy.getPos()); - Direction dir = state.get(HorizontalBlockBase.HORIZONTAL_FACING); - Direction tangent = dir.rotateY(); - float x = effigy.getPos().getX() + 0.5f + dir.getXOffset() * 0.21875f; - float y = effigy.getPos().getY() + 0.8125f; - float z = effigy.getPos().getZ() + 0.5f + dir.getZOffset() * 0.21875f; + world.playSound(player, effigy.getBlockPos(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.NEUTRAL, 10000.0F, 0.6F + world.random.nextFloat() * 0.2F); + world.playSound(player, effigy.getBlockPos(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.NEUTRAL, 2.0F, 0.5F + world.random.nextFloat() * 0.2F); + BlockState state = world.getBlockState(effigy.getBlockPos()); + Direction dir = state.getValue(HorizontalBlockBase.HORIZONTAL_FACING); + Direction tangent = dir.getClockWise(); + float x = effigy.getBlockPos().getX() + 0.5f + dir.getStepX() * 0.21875f; + float y = effigy.getBlockPos().getY() + 0.8125f; + float z = effigy.getBlockPos().getZ() + 0.5f + dir.getStepZ() * 0.21875f; Particles.create(Registry.FLAME_PARTICLE) .setColor(deity.getRed(), deity.getGreen(), deity.getBlue()) .setAlpha(0.5f, 0) .setScale(0.125f, 0.0625f) .randomOffset(0.01f) .randomVelocity(0.0025f).addVelocity(0, 0.005f, 0) - .repeat(world, x + 0.09375f * tangent.getXOffset(), y, z + 0.09375f * tangent.getZOffset(), 8); + .repeat(world, x + 0.09375f * tangent.getStepX(), y, z + 0.09375f * tangent.getStepZ(), 8); Particles.create(Registry.FLAME_PARTICLE) .setColor(deity.getRed(), deity.getGreen(), deity.getBlue()) .setAlpha(0.5f, 0) .setScale(0.1875f, 0.125f) .randomOffset(0.01f) .randomVelocity(0.0025f).addVelocity(0, 0.005f, 0) - .repeat(world, x - 0.09375f * tangent.getXOffset(), y, z - 0.09375f * tangent.getZOffset(), 8); + .repeat(world, x - 0.09375f * tangent.getStepX(), y, z - 0.09375f * tangent.getStepZ(), 8); } } } diff --git a/src/main/java/elucent/eidolon/spell/Rune.java b/src/main/java/elucent/eidolon/spell/Rune.java new file mode 100644 index 0000000..42b7f58 --- /dev/null +++ b/src/main/java/elucent/eidolon/spell/Rune.java @@ -0,0 +1,42 @@ +package elucent.eidolon.spell; + +import net.minecraft.resources.ResourceLocation; + +public abstract class Rune { + ResourceLocation key, sprite; + ResourceLocation registryName; + + public Rune(ResourceLocation registryName) { + this.key = registryName; + this.sprite = new ResourceLocation(key.getNamespace(), "rune/" + key.getPath()); + } + + public Rune(ResourceLocation registryName, ResourceLocation sprite) { + this.key = registryName; + this.sprite = sprite; + } + + public ResourceLocation getRegistryName() { + return key; + } + + public ResourceLocation getSprite() { + return sprite; + } + + public enum RuneResult { + PASS, FAIL + } + + public abstract RuneResult doEffect(SignSequence seq); + + @Override + public boolean equals(Object other) { + return other instanceof Sign && ((Sign)other).key.equals(key); + } + + @Override + public int hashCode() { + return key.hashCode(); + } +} diff --git a/src/main/java/elucent/eidolon/spell/Runes.java b/src/main/java/elucent/eidolon/spell/Runes.java new file mode 100644 index 0000000..ac7171b --- /dev/null +++ b/src/main/java/elucent/eidolon/spell/Runes.java @@ -0,0 +1,44 @@ +package elucent.eidolon.spell; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import elucent.eidolon.Eidolon; +import net.minecraft.resources.ResourceLocation; + +public class Runes { + static Map runes = new HashMap<>(); + + public static void register(Rune rune) { + runes.put(rune.getRegistryName(), rune); + } + + public static Rune find(ResourceLocation rl) { + return runes.getOrDefault(rl, null); + } + + public static Collection getRunes() { + return runes.values(); + } + + public static void init() { + register(new Rune(new ResourceLocation(Eidolon.MODID, "sin")) { + @Override + public RuneResult doEffect(SignSequence seq) { + seq.addRight(Signs.WICKED_SIGN); + return RuneResult.PASS; + } + }); + register(new Rune(new ResourceLocation(Eidolon.MODID, "crimson_rose")) { + @Override + public RuneResult doEffect(SignSequence seq) { + if (seq.removeRightmostN(Signs.WICKED_SIGN, 2)) { + seq.addRight(Signs.BLOOD_SIGN); + return RuneResult.PASS; + } + return RuneResult.FAIL; + } + }); + } +} diff --git a/src/main/java/elucent/eidolon/spell/Sign.java b/src/main/java/elucent/eidolon/spell/Sign.java index 12128c2..4a02e45 100644 --- a/src/main/java/elucent/eidolon/spell/Sign.java +++ b/src/main/java/elucent/eidolon/spell/Sign.java @@ -1,9 +1,7 @@ package elucent.eidolon.spell; import elucent.eidolon.util.ColorUtil; -import net.minecraft.util.ResourceLocation; - -import javax.annotation.Resource; +import net.minecraft.resources.ResourceLocation; public class Sign { ResourceLocation key, sprite; diff --git a/src/main/java/elucent/eidolon/spell/SignSequence.java b/src/main/java/elucent/eidolon/spell/SignSequence.java new file mode 100644 index 0000000..b1cd5a9 --- /dev/null +++ b/src/main/java/elucent/eidolon/spell/SignSequence.java @@ -0,0 +1,175 @@ +package elucent.eidolon.spell; + +import java.util.ArrayDeque; +import java.util.Collection; +import java.util.Deque; +import java.util.Iterator; +import java.util.function.Function; + +import javax.annotation.Nullable; + +import org.abego.treelayout.internal.util.java.lang.IterableUtil; + +import com.mojang.math.Vector3f; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; + +public class SignSequence { + public Deque seq = new ArrayDeque<>(); + public Sign last = null; + + public SignSequence() {} + + public SignSequence(Collection signs) { + seq.addAll(signs); + } + + public SignSequence(Sign... signs) { + for (Sign s : signs) seq.addLast(s); + } + + public void addLeft(Sign s) { + seq.addFirst(s); + } + + public void addRight(Sign s) { + seq.addLast(s); + } + + public void removeLeft() { + last = seq.getFirst(); + seq.removeFirst(); + } + + public void removeRight() { + last = seq.getLast(); + seq.removeLast(); + } + + private int count(Sign s) { + int count = 0; + Iterator iterator = seq.iterator(); + while (iterator.hasNext()) { + if (s.equals(iterator.next())) count ++; + } + return count; + } + + private boolean contains(Sign s) { + Iterator iterator = seq.iterator(); + while (iterator.hasNext()) { + if (s.equals(iterator.next())) return true; + } + return false; + } + + private boolean containsN(Sign s, int n) { + Iterator iterator = seq.iterator(); + int count = 0; + while (iterator.hasNext()) { + if (s.equals(iterator.next())) count ++; + if (count >= n) return true; + } + return false; + } + + public boolean removeLeftmost(Sign s) { + if (!seq.contains(s)) return false; + last = s; + seq.removeFirstOccurrence(s); + return true; + } + + public boolean removeRightmost(Sign s) { + if (!seq.contains(s)) return false; + last = s; + seq.removeLastOccurrence(s); + return true; + } + + public int removeAll(Sign s) { + int count = count(s); + if (seq.contains(s)) last = s; + seq.removeIf((i) -> i.equals(s)); + return count; + } + + public boolean removeLeftmostN(Sign s, int n) { + if (n == 0) return true; + if (!containsN(s, n)) return false; + last = s; + for (int i = 0; i < n; i ++) seq.removeFirstOccurrence(s); + return true; + } + + public boolean removeRightmostN(Sign s, int n) { + if (n == 0) return true; + if (!containsN(s, n)) return false; + last = s; + for (int i = 0; i < n; i ++) seq.removeLastOccurrence(s); + return true; + } + + public void map(Function tf) { + int n = seq.size(); + for (int i = 0; i < n; i ++) { + seq.addLast(tf.apply(seq.getFirst())); + } + } + + @Nullable + public Sign getLast() { + return last; + } + + public CompoundTag serializeNbt() { + CompoundTag tag = new CompoundTag(); + ListTag list = new ListTag(); + for (Sign s : seq) list.add(StringTag.valueOf(s.key.toString())); + tag.put("seq", list); + if (last != null) tag.putString("last", last.getRegistryName().toString()); + return tag; + } + + public static SignSequence deserializeNbt(CompoundTag tag) { + SignSequence s = new SignSequence(); + ListTag list = tag.getList("seq", Tag.TAG_STRING); + for (int i = 0; i < list.size(); i ++) { + Sign t = Signs.find(new ResourceLocation(list.getString(i))); + if (t != null) s.seq.addLast(t); + } + s.last = tag.contains("last") ? Signs.find(new ResourceLocation(tag.getString("last"))) : null; + return s; + } + + public Vector3f getAverageColor() { + float r = 1, g = 1, b = 1; + for (Sign s : seq) { + r += s.getRed(); + g += s.getGreen(); + b += s.getBlue(); + } + r /= seq.size() + 1; + g /= seq.size() + 1; + b /= seq.size() + 1; + return new Vector3f(r, g, b); + } + + @Override + public boolean equals(Object other) { + if (other instanceof SignSequence s) { + if (s.seq.size() != seq.size()) return false; + Iterator a = seq.iterator(), b = s.seq.iterator(); + while (a.hasNext() && b.hasNext()) { + Sign sa = a.next(), sb = b.next(); + if (!sa.equals(sb)) return false; + } + return true; + } + return false; + } +} diff --git a/src/main/java/elucent/eidolon/spell/Signs.java b/src/main/java/elucent/eidolon/spell/Signs.java index f6fe331..51a6ba9 100644 --- a/src/main/java/elucent/eidolon/spell/Signs.java +++ b/src/main/java/elucent/eidolon/spell/Signs.java @@ -1,14 +1,14 @@ package elucent.eidolon.spell; -import elucent.eidolon.Eidolon; -import elucent.eidolon.util.ColorUtil; -import net.minecraft.util.ResourceLocation; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import elucent.eidolon.Eidolon; +import elucent.eidolon.util.ColorUtil; +import net.minecraft.resources.ResourceLocation; + public class Signs { static List signs = new ArrayList<>(); static Map signMap = new HashMap<>(); @@ -53,14 +53,34 @@ public static List getSigns() { new ResourceLocation(Eidolon.MODID, "particle/mind_sign"), ColorUtil.packColor(255, 90, 121, 255) )), + FLAME_SIGN = register(new Sign( + new ResourceLocation(Eidolon.MODID, "flame"), + new ResourceLocation(Eidolon.MODID, "particle/flame_sign"), + ColorUtil.packColor(255, 255, 128, 64) + )), + WINTER_SIGN = register(new Sign( + new ResourceLocation(Eidolon.MODID, "winter"), + new ResourceLocation(Eidolon.MODID, "particle/winter_sign"), + ColorUtil.packColor(255, 112, 149, 210) + )), + HARMONY_SIGN = register(new Sign( + new ResourceLocation(Eidolon.MODID, "harmony"), + new ResourceLocation(Eidolon.MODID, "particle/harmony_sign"), + ColorUtil.packColor(255, 141, 141, 195) + )), + DEATH_SIGN = register(new Sign( + new ResourceLocation(Eidolon.MODID, "death"), + new ResourceLocation(Eidolon.MODID, "particle/death_sign"), + ColorUtil.packColor(255, 123, 140, 70) + )), WARDING_SIGN = register(new Sign( new ResourceLocation(Eidolon.MODID, "warding"), new ResourceLocation(Eidolon.MODID, "particle/warding_sign"), - ColorUtil.packColor(255, 190, 212, 184) + ColorUtil.packColor(255, 118, 204, 175) )), - ENERGY_SIGN = register(new Sign( - new ResourceLocation(Eidolon.MODID, "energy"), - new ResourceLocation(Eidolon.MODID, "particle/energy_sign"), - ColorUtil.packColor(255, 145, 250, 100) + MAGIC_SIGN = register(new Sign( + new ResourceLocation(Eidolon.MODID, "magic"), + new ResourceLocation(Eidolon.MODID, "particle/magic_sign"), + ColorUtil.packColor(255, 167, 85, 192) )); } diff --git a/src/main/java/elucent/eidolon/spell/Spell.java b/src/main/java/elucent/eidolon/spell/Spell.java index 86f6839..9b8857a 100644 --- a/src/main/java/elucent/eidolon/spell/Spell.java +++ b/src/main/java/elucent/eidolon/spell/Spell.java @@ -1,12 +1,12 @@ package elucent.eidolon.spell; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - import java.util.List; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + public abstract class Spell { ResourceLocation registryName; public Spell(ResourceLocation registryName) { @@ -17,7 +17,7 @@ public ResourceLocation getRegistryName() { return registryName; } - public abstract boolean matches(List signs); - public abstract boolean canCast(World world, BlockPos pos, PlayerEntity player, List signs); - public abstract void cast(World world, BlockPos pos, PlayerEntity player, List signs); + public abstract boolean matches(SignSequence signs); + public abstract boolean canCast(Level world, BlockPos pos, Player player, SignSequence signs); + public abstract void cast(Level world, BlockPos pos, Player player, SignSequence signs); } diff --git a/src/main/java/elucent/eidolon/spell/Spells.java b/src/main/java/elucent/eidolon/spell/Spells.java index 460923e..1a74964 100644 --- a/src/main/java/elucent/eidolon/spell/Spells.java +++ b/src/main/java/elucent/eidolon/spell/Spells.java @@ -1,14 +1,14 @@ package elucent.eidolon.spell; -import elucent.eidolon.Eidolon; -import elucent.eidolon.deity.Deities; -import net.minecraft.util.ResourceLocation; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import elucent.eidolon.Eidolon; +import elucent.eidolon.deity.Deities; +import net.minecraft.resources.ResourceLocation; + public class Spells { static List spells = new ArrayList<>(); static Map spellMap = new HashMap<>(); @@ -17,7 +17,7 @@ public static Spell find(ResourceLocation loc) { return spellMap.getOrDefault(loc, null); } - public static Spell find(List signs) { + public static Spell find(SignSequence signs) { for (Spell spell : spells) if (spell.matches(signs)) return spell; return null; } @@ -51,5 +51,10 @@ public static List getSpells() { new ResourceLocation(Eidolon.MODID, "dark_villager_sacrifice"), Deities.DARK_DEITY, Signs.BLOOD_SIGN, Signs.WICKED_SIGN, Signs.BLOOD_SIGN, Signs.SOUL_SIGN + )), + LIGHT_PRAYER = register(new PrayerSpell( + new ResourceLocation(Eidolon.MODID, "light_prayer"), + Deities.LIGHT_DEITY, + Signs.SACRED_SIGN, Signs.SACRED_SIGN, Signs.SACRED_SIGN )); } diff --git a/src/main/java/elucent/eidolon/spell/StaticSpell.java b/src/main/java/elucent/eidolon/spell/StaticSpell.java index 6efc0aa..a9d7623 100644 --- a/src/main/java/elucent/eidolon/spell/StaticSpell.java +++ b/src/main/java/elucent/eidolon/spell/StaticSpell.java @@ -1,40 +1,37 @@ package elucent.eidolon.spell; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import net.minecraft.world.entity.player.Player; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + public abstract class StaticSpell extends Spell { - List signs; + SignSequence signs; public StaticSpell(ResourceLocation name, Sign... signs) { super(name); - this.signs = Arrays.asList(signs); + this.signs = new SignSequence(signs); } @Override - public boolean matches(List signs) { - if (this.signs.size() != signs.size()) return false; - for (int i = 0; i < signs.size(); i ++) if (this.signs.get(i) != signs.get(i)) return false; - return true; + public boolean matches(SignSequence signs) { + return this.signs.equals(signs); } - public abstract boolean canCast(World world, BlockPos pos, PlayerEntity player); + public abstract boolean canCast(Level world, BlockPos pos, Player player); @Override - public boolean canCast(World world, BlockPos pos, PlayerEntity player, List signs) { + public boolean canCast(Level world, BlockPos pos, Player player, SignSequence signs) { return canCast(world, pos, player); } - public abstract void cast(World world, BlockPos pos, PlayerEntity player); + public abstract void cast(Level world, BlockPos pos, Player player); @Override - public void cast(World world, BlockPos pos, PlayerEntity player, List signs) { + public void cast(Level world, BlockPos pos, Player player, SignSequence signs) { cast(world, pos, player); } } diff --git a/src/main/java/elucent/eidolon/spell/VillagerSacrificeSpell.java b/src/main/java/elucent/eidolon/spell/VillagerSacrificeSpell.java index 31d3f8f..aaec91e 100644 --- a/src/main/java/elucent/eidolon/spell/VillagerSacrificeSpell.java +++ b/src/main/java/elucent/eidolon/spell/VillagerSacrificeSpell.java @@ -1,29 +1,28 @@ package elucent.eidolon.spell; +import java.util.Comparator; +import java.util.List; + import elucent.eidolon.Registry; import elucent.eidolon.block.HorizontalBlockBase; -import elucent.eidolon.capability.ReputationProvider; +import elucent.eidolon.capability.IReputation; import elucent.eidolon.deity.Deity; import elucent.eidolon.deity.DeityLocks; import elucent.eidolon.particle.Particles; import elucent.eidolon.ritual.Ritual; import elucent.eidolon.tile.EffigyTileEntity; import elucent.eidolon.tile.GobletTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.merchant.villager.AbstractVillagerEntity; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.Comparator; -import java.util.List; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.npc.AbstractVillager; +import net.minecraft.world.entity.player.Player; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class VillagerSacrificeSpell extends StaticSpell { Deity deity; @@ -34,65 +33,63 @@ public VillagerSacrificeSpell(ResourceLocation name, Deity deity, Sign... signs) } @Override - public boolean canCast(World world, BlockPos pos, PlayerEntity player) { - if (!world.getCapability(ReputationProvider.CAPABILITY).isPresent()) return false; - if (!world.getCapability(ReputationProvider.CAPABILITY).resolve().get().canPray(player, world.getGameTime())) return false; - if (world.getCapability(ReputationProvider.CAPABILITY).resolve().get().getReputation(player.getUniqueID(), deity.getId()) < 15.0) return false; - List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); - List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); + public boolean canCast(Level world, BlockPos pos, Player player) { + if (!world.getCapability(IReputation.INSTANCE).isPresent()) return false; + if (!world.getCapability(IReputation.INSTANCE).resolve().get().canPray(player, getRegistryName(), world.getGameTime())) return false; + if (world.getCapability(IReputation.INSTANCE).resolve().get().getReputation(player.getUUID(), deity.getId()) < 15.0) return false; + List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); + List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); if (effigies.size() == 0 || goblets.size() == 0) return false; - EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); + EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); if (goblet.getEntityType() == null) return false; - AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getPos()); + AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getBlockPos()); if (info.getAltar() != Registry.STONE_ALTAR.get() || info.getIcon() != Registry.UNHOLY_EFFIGY.get()) return false; Entity test = goblet.getEntityType().create(world); - return (test instanceof AbstractVillagerEntity || test instanceof PlayerEntity) && effigy.ready(); + return (test instanceof AbstractVillager || test instanceof Player) && effigy.ready(); } @Override - public void cast(World world, BlockPos pos, PlayerEntity player) { - List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); - List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AxisAlignedBB(pos.add(-4, -4, -4), pos.add(5, 5, 5))); + public void cast(Level world, BlockPos pos, Player player) { + List goblets = Ritual.getTilesWithinAABB(GobletTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); + List effigies = Ritual.getTilesWithinAABB(EffigyTileEntity.class, world, new AABB(pos.offset(-4, -4, -4), pos.offset(5, 5, 5))); if (effigies.size() == 0 || goblets.size() == 0) return; - EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getPos().distanceSq(pos))).get(); - if (!world.isRemote) { + EffigyTileEntity effigy = effigies.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + GobletTileEntity goblet = goblets.stream().min(Comparator.comparingDouble((e) -> e.getBlockPos().distSqr(pos))).get(); + if (!world.isClientSide) { effigy.pray(); goblet.setEntityType(null); - AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getPos()); - world.getCapability(ReputationProvider.CAPABILITY, null).ifPresent((rep) -> { - rep.pray(player, world.getGameTime()); + AltarInfo info = AltarInfo.getAltarInfo(world, effigy.getBlockPos()); + world.getCapability(IReputation.INSTANCE, null).ifPresent((rep) -> { + rep.pray(player, getRegistryName(), world.getGameTime()); double prev = rep.getReputation(player, deity.getId()); - if (rep.unlock(player, deity.getId(), DeityLocks.SACRIFICE_VILLAGER)) - deity.onReputationUnlock(player, rep, DeityLocks.SACRIFICE_VILLAGER); + rep.unlock(player, deity.getId(), DeityLocks.SACRIFICE_VILLAGER); rep.addReputation(player, deity.getId(), 6.0 + 1.0 * info.getPower()); - deity.onReputationChange(player, rep, prev, rep.getReputation(player, deity.getId())); }); } else { - world.playSound(player, effigy.getPos(), SoundEvents.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.NEUTRAL, 10000.0F, 0.6F + world.rand.nextFloat() * 0.2F); - world.playSound(player, effigy.getPos(), SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.NEUTRAL, 2.0F, 0.5F + world.rand.nextFloat() * 0.2F); - BlockState state = world.getBlockState(effigy.getPos()); - Direction dir = state.get(HorizontalBlockBase.HORIZONTAL_FACING); - Direction tangent = dir.rotateY(); - float x = effigy.getPos().getX() + 0.5f + dir.getXOffset() * 0.21875f; - float y = effigy.getPos().getY() + 0.8125f; - float z = effigy.getPos().getZ() + 0.5f + dir.getZOffset() * 0.21875f; + world.playSound(player, effigy.getBlockPos(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.NEUTRAL, 10000.0F, 0.6F + world.random.nextFloat() * 0.2F); + world.playSound(player, effigy.getBlockPos(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.NEUTRAL, 2.0F, 0.5F + world.random.nextFloat() * 0.2F); + BlockState state = world.getBlockState(effigy.getBlockPos()); + Direction dir = state.getValue(HorizontalBlockBase.HORIZONTAL_FACING); + Direction tangent = dir.getClockWise(); + float x = effigy.getBlockPos().getX() + 0.5f + dir.getStepX() * 0.21875f; + float y = effigy.getBlockPos().getY() + 0.8125f; + float z = effigy.getBlockPos().getZ() + 0.5f + dir.getStepZ() * 0.21875f; Particles.create(Registry.FLAME_PARTICLE) .setColor(Signs.SOUL_SIGN.getRed(), Signs.SOUL_SIGN.getGreen(), Signs.SOUL_SIGN.getBlue()) .setAlpha(0.5f, 0) .setScale(0.125f, 0.0625f) .randomOffset(0.01f) .randomVelocity(0.0025f).addVelocity(0, 0.005f, 0) - .repeat(world, x + 0.09375f * tangent.getXOffset(), y, z + 0.09375f * tangent.getZOffset(), 8); + .repeat(world, x + 0.09375f * tangent.getStepX(), y, z + 0.09375f * tangent.getStepZ(), 8); Particles.create(Registry.FLAME_PARTICLE) .setColor(Signs.SOUL_SIGN.getRed(), Signs.SOUL_SIGN.getGreen(), Signs.SOUL_SIGN.getBlue()) .setAlpha(0.5f, 0) .setScale(0.1875f, 0.125f) .randomOffset(0.01f) .randomVelocity(0.0025f).addVelocity(0, 0.005f, 0) - .repeat(world, x - 0.09375f * tangent.getXOffset(), y, z - 0.09375f * tangent.getZOffset(), 8); + .repeat(world, x - 0.09375f * tangent.getStepX(), y, z - 0.09375f * tangent.getStepZ(), 8); } } } diff --git a/src/main/java/elucent/eidolon/tile/BrazierTileEntity.java b/src/main/java/elucent/eidolon/tile/BrazierTileEntity.java index a730ef1..18ff8a3 100644 --- a/src/main/java/elucent/eidolon/tile/BrazierTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/BrazierTileEntity.java @@ -1,31 +1,31 @@ package elucent.eidolon.tile; import elucent.eidolon.Registry; -import elucent.eidolon.network.*; -import elucent.eidolon.particle.GenericParticleData; +import elucent.eidolon.network.ExtinguishEffectPacket; +import elucent.eidolon.network.FlameEffectPacket; +import elucent.eidolon.network.IgniteEffectPacket; +import elucent.eidolon.network.Networking; +import elucent.eidolon.network.RitualCompletePacket; import elucent.eidolon.particle.Particles; import elucent.eidolon.ritual.Ritual; import elucent.eidolon.ritual.Ritual.RitualResult; import elucent.eidolon.ritual.Ritual.SetupResult; import elucent.eidolon.ritual.RitualRegistry; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.fml.network.PacketDispatcher; -import net.minecraftforge.fml.network.PacketDistributor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.Containers; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; -public class BrazierTileEntity extends TileEntityBase implements ITickableTileEntity { +public class BrazierTileEntity extends TileEntityBase { ItemStack stack = ItemStack.EMPTY; boolean burning = false; int findingCounter = 0; @@ -34,57 +34,57 @@ public class BrazierTileEntity extends TileEntityBase implements ITickableTileEn int step = 0; boolean ritualDone = false; - public BrazierTileEntity() { - this(Registry.BRAZIER_TILE_ENTITY); + public BrazierTileEntity(BlockPos pos, BlockState state) { + this(Registry.BRAZIER_TILE_ENTITY, pos, state); } - public BrazierTileEntity(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public BrazierTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); } @Override public void onDestroyed(BlockState state, BlockPos pos) { super.onDestroyed(state, pos); - if (!stack.isEmpty()) InventoryHelper.spawnItemStack(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); + if (!stack.isEmpty()) Containers.dropItemStack(level, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); } @Override - public ActionResultType onActivated(BlockState state, BlockPos pos, PlayerEntity player, Hand hand) { - if (hand == Hand.MAIN_HAND) { - if (burning && player.isSneaking() && player.getHeldItem(hand).isEmpty()) { + public InteractionResult onActivated(BlockState state, BlockPos pos, Player player, InteractionHand hand) { + if (hand == InteractionHand.MAIN_HAND) { + if (burning && player.isShiftKeyDown() && player.getItemInHand(hand).isEmpty()) { extinguish(); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - else if (!burning && player.getHeldItem(hand).isEmpty() && !stack.isEmpty()) { - player.addItemStackToInventory(stack); + else if (!burning && player.getItemInHand(hand).isEmpty() && !stack.isEmpty()) { + player.addItem(stack); stack = ItemStack.EMPTY; - if (!world.isRemote) sync(); - return ActionResultType.SUCCESS; + if (!level.isClientSide) sync(); + return InteractionResult.SUCCESS; } else if (!burning && !stack.isEmpty() - && player.getHeldItem(hand).getItem() == Items.FLINT_AND_STEEL) { - player.getHeldItem(hand).damageItem(1, player, (p) -> { - p.sendBreakAnimation(hand); + && player.getItemInHand(hand).getItem() == Items.FLINT_AND_STEEL) { + player.getItemInHand(hand).hurtAndBreak(1, player, (p) -> { + p.broadcastBreakEvent(hand); }); startBurning(); - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - else if (!player.getHeldItem(hand).isEmpty() && stack.isEmpty()) { - stack = player.getHeldItem(hand).copy(); + else if (!player.getItemInHand(hand).isEmpty() && stack.isEmpty()) { + stack = player.getItemInHand(hand).copy(); stack.setCount(1); - player.getHeldItem(hand).shrink(1); - if (player.getHeldItem(hand).isEmpty()) player.setHeldItem(hand, ItemStack.EMPTY); - if (!world.isRemote) sync(); - return ActionResultType.SUCCESS; + player.getItemInHand(hand).shrink(1); + if (player.getItemInHand(hand).isEmpty()) player.setItemInHand(hand, ItemStack.EMPTY); + if (!level.isClientSide) sync(); + return InteractionResult.SUCCESS; } } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public void read(BlockState state, CompoundNBT tag) { - super.read(state, tag); - stack = ItemStack.read(tag.getCompound("stack")); + public void load(CompoundTag tag) { + super.load(tag); + stack = ItemStack.of(tag.getCompound("stack")); burning = tag.getBoolean("burning"); ritual = tag.contains("ritual") ? RitualRegistry.find(new ResourceLocation(tag.getString("ritual"))) : null; step = tag.getInt("step"); @@ -92,25 +92,23 @@ public void read(BlockState state, CompoundNBT tag) { } @Override - public CompoundNBT write(CompoundNBT tag) { - tag = super.write(tag); - tag.put("stack", stack.write(new CompoundNBT())); + public void saveAdditional(CompoundTag tag) { + tag.put("stack", stack.save(new CompoundTag())); tag.putBoolean("burning", burning); if (ritual != null) tag.putString("ritual", ritual.getRegistryName().toString()); tag.putInt("step", step); tag.putBoolean("ritualDone", ritualDone); - return tag; } protected void complete() { burning = false; stepCounter = 0; findingCounter = 0; - if (!world.isRemote) { + if (!level.isClientSide) { if (ritual != null) - Networking.sendToTracking(world, pos.up(2), new RitualCompletePacket(pos.up(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); + Networking.sendToTracking(level, worldPosition.above(2), new RitualCompletePacket(worldPosition.above(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); ritual = null; - Networking.sendToTracking(world, pos, new ExtinguishEffectPacket(pos)); + Networking.sendToTracking(level, worldPosition, new ExtinguishEffectPacket(worldPosition)); sync(); } ritual = null; @@ -120,11 +118,11 @@ protected void extinguish() { burning = false; stepCounter = 0; findingCounter = 0; - if (!world.isRemote) { + if (!level.isClientSide) { if (ritual != null) - Networking.sendToTracking(world, pos.up(2), new FlameEffectPacket(pos.up(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); + Networking.sendToTracking(level, worldPosition.above(2), new FlameEffectPacket(worldPosition.above(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); ritual = null; - Networking.sendToTracking(world, pos, new ExtinguishEffectPacket(pos)); + Networking.sendToTracking(level, worldPosition, new ExtinguishEffectPacket(worldPosition)); sync(); } ritual = null; @@ -133,8 +131,8 @@ protected void extinguish() { protected void startBurning() { burning = true; findingCounter = 0; - if (!world.isRemote) { - Networking.sendToTracking(world, pos, new IgniteEffectPacket(pos, 1.0f, 0.5f, 0.25f)); + if (!level.isClientSide) { + Networking.sendToTracking(level, worldPosition, new IgniteEffectPacket(worldPosition, 1.0f, 0.5f, 0.25f)); sync(); } } @@ -146,32 +144,31 @@ protected void setRitual(Ritual ritual) { stepCounter = 0; step = 0; ritualDone = false; - if (!world.isRemote) { - Networking.sendToTracking(world, pos.up(2), new FlameEffectPacket(pos.up(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); + if (!level.isClientSide) { + Networking.sendToTracking(level, worldPosition.above(2), new FlameEffectPacket(worldPosition.above(2), ritual.getRed(), ritual.getGreen(), ritual.getBlue())); sync(); } } } - @Override public void tick() { if (burning && findingCounter < 80 && ritual == null) { float progress = (findingCounter - 40) / 40.0f; if (progress >= 0) for (int i = 0; i < 8; i ++) { float angle = progress * (float)Math.PI / 4 + i * (float)Math.PI / 4; - float radius = 0.625f * MathHelper.sin(4 * angle); + float radius = 0.625f * Mth.sin(4 * angle); angle += (float)Math.PI / 4; - float x = getPos().getX() + 0.5f + MathHelper.sin(angle) * radius; - float y = getPos().getY() + 0.875f; - float z = getPos().getZ() + 0.5f + MathHelper.cos(angle) * radius; + float x = getBlockPos().getX() + 0.5f + Mth.sin(angle) * radius; + float y = getBlockPos().getY() + 0.875f; + float z = getBlockPos().getZ() + 0.5f + Mth.cos(angle) * radius; Particles.create(Registry.WISP_PARTICLE) .setAlpha(0.25f * progress, 0).setScale(0.125f, 0.0625f).setLifetime(20) .setColor(1.0f, 0.5f, 0.25f, 1.0f, 0.25f, 0.375f) - .spawn(world, x, y, z); + .spawn(level, x, y, z); } findingCounter ++; if (findingCounter == 80) { - Ritual r = RitualRegistry.find(world, pos, stack); + Ritual r = RitualRegistry.find(level, worldPosition, stack); stack = ItemStack.EMPTY; findingCounter = 81; setRitual(r); @@ -180,14 +177,14 @@ public void tick() { if (burning && ritual != null && !ritualDone) { stepCounter ++; if (stepCounter == 40) { - SetupResult result = ritual.setup(world, pos, step); + SetupResult result = ritual.setup(level, worldPosition, step); if (result == SetupResult.SUCCEED) { ritualDone = true; - if (!world.isRemote) sync(); - if (ritual.start(world, pos) == RitualResult.TERMINATE) complete(); + if (!level.isClientSide) sync(); + if (ritual.start(level, worldPosition) == RitualResult.TERMINATE) complete(); } - else if (result == SetupResult.FAIL && !world.isRemote) extinguish(); - else if (!world.isRemote) { + else if (result == SetupResult.FAIL && !level.isClientSide) extinguish(); + else if (!level.isClientSide) { stepCounter = 0; step ++; sync(); @@ -195,10 +192,10 @@ else if (!world.isRemote) { } } if (burning && ritual != null && ritualDone) { - if (ritual.tick(world, pos) == RitualResult.TERMINATE) complete(); + if (ritual.tick(level, worldPosition) == RitualResult.TERMINATE) complete(); } - if (world.isRemote && burning) { - float x = getPos().getX() + 0.5f, y = getPos().getY() + 1, z = getPos().getZ() + 0.5f; + if (level.isClientSide && burning) { + float x = getBlockPos().getX() + 0.5f, y = getBlockPos().getY() + 1, z = getBlockPos().getZ() + 0.5f; float r = ritual == null ? 1.0f : ritual.getRed(); float g = ritual == null ? 0.5f : ritual.getGreen(); float b = ritual == null ? 0.25f : ritual.getBlue(); @@ -207,25 +204,25 @@ else if (!world.isRemote) { .randomOffset(0.25, 0.125).randomVelocity(0.00625f, 0.01875f) .addVelocity(0, 0.00625f, 0) .setColor(r, g, b, r, g * 0.5f, b * 1.5f) - .spawn(world, x, y, z); - if (world.rand.nextInt(5) == 0) Particles.create(Registry.SMOKE_PARTICLE) + .spawn(level, x, y, z); + if (level.random.nextInt(5) == 0) Particles.create(Registry.SMOKE_PARTICLE) .setAlpha(0.125f, 0).setScale(0.375f, 0.125f).setLifetime(80) .randomOffset(0.25, 0.125).randomVelocity(0.025f, 0.025f) .addVelocity(0, 0.1f, 0) .setColor(0.5f, 0.5f, 0.5f, 0.25f, 0.25f, 0.25f) - .spawn(world, x, y + 0.125, z); - if (world.rand.nextInt(40) == 0) Particles.create(Registry.SPARKLE_PARTICLE) + .spawn(level, x, y + 0.125, z); + if (level.random.nextInt(40) == 0) Particles.create(Registry.SPARKLE_PARTICLE) .setAlpha(1, 0).setScale(0.0625f, 0).setLifetime(40) .randomOffset(0.0625, 0).randomVelocity(0.125f, 0) .addVelocity(0, 0.125f, 0) .setColor(r, g * 1.5f, b * 2, r, g, b) .enableGravity().setSpin(0.4f) - .spawn(world, x, y, z); + .spawn(level, x, y, z); } } @Override - public AxisAlignedBB getRenderBoundingBox() { - return new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 4, pos.getZ() + 1); + public AABB getRenderBoundingBox() { + return new AABB(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), worldPosition.getX() + 1, worldPosition.getY() + 4, worldPosition.getZ() + 1); } } diff --git a/src/main/java/elucent/eidolon/tile/BrazierTileRenderer.java b/src/main/java/elucent/eidolon/tile/BrazierTileRenderer.java index 635f744..e01b959 100644 --- a/src/main/java/elucent/eidolon/tile/BrazierTileRenderer.java +++ b/src/main/java/elucent/eidolon/tile/BrazierTileRenderer.java @@ -1,47 +1,44 @@ package elucent.eidolon.tile; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.ClientEvents; -import elucent.eidolon.Events; import elucent.eidolon.ritual.Ritual; import elucent.eidolon.util.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.core.BlockPos; +import com.mojang.math.Vector3f; -public class BrazierTileRenderer extends TileEntityRenderer { - public BrazierTileRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); - } +public class BrazierTileRenderer implements BlockEntityRenderer { + public BrazierTileRenderer() {} @Override - public void render(BrazierTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + public void render(BrazierTileEntity tileEntityIn, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Minecraft mc = Minecraft.getInstance(); ItemRenderer ir = mc.getItemRenderer(); if (!tileEntityIn.stack.isEmpty()) { - matrixStackIn.push(); + matrixStackIn.pushPose(); matrixStackIn.translate(0.5,0.9375, 0.5); - matrixStackIn.rotate(Vector3f.YP.rotationDegrees(3 * (mc.world.getGameTime() % 360 + partialTicks))); - ir.renderItem(tileEntityIn.stack, TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn); - matrixStackIn.pop(); + matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(3 * (mc.level.getGameTime() % 360 + partialTicks))); + ir.renderStatic(tileEntityIn.stack, TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, 0); + matrixStackIn.popPose(); } if (tileEntityIn.ritual != null) { - IRenderTypeBuffer buffer = ClientEvents.getDelayedRender(); + MultiBufferSource buffer = ClientEvents.getDelayedRender(); Ritual ritual = tileEntityIn.ritual; float r = ritual.getRed(), g = ritual.getGreen(), b = ritual.getBlue(); RenderUtil.dragon(matrixStackIn, buffer, 0.5, 3.0, 0.5, 1, r, g, b); - TextureAtlasSprite sprite = mc.getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(ritual.getSymbol()); + TextureAtlasSprite sprite = mc.getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(ritual.getSymbol()); - BlockPos pos = tileEntityIn.getPos(); + BlockPos pos = tileEntityIn.getBlockPos(); RenderUtil.litBillboard(matrixStackIn, buffer, 0.5, 3.0, 0.5, r, g, b, sprite); RenderUtil.litBillboard(matrixStackIn, buffer, 0.5, 3.0, 0.5, r, g, b, sprite); } diff --git a/src/main/java/elucent/eidolon/tile/CabinetModel.java b/src/main/java/elucent/eidolon/tile/CabinetModel.java new file mode 100644 index 0000000..f575e88 --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/CabinetModel.java @@ -0,0 +1,54 @@ +package elucent.eidolon.tile; +// Made with Blockbench 4.1.3 +// Exported for Minecraft version 1.17 with Mojang mappings +// Paste this class into your mod and generate all required imports + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.Eidolon; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; + +public class CabinetModel extends EntityModel { + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(Eidolon.MODID, "cabinet"), "main"); + private final ModelPart left_door; + private final ModelPart right_door; + + public CabinetModel(ModelPart root) { + this.left_door = root.getChild("left_door"); + this.right_door = root.getChild("right_door"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + + PartDefinition left_door = partdefinition.addOrReplaceChild("left_door", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -12.0F, -2.0F, 5.0F, 22.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, 8.0F, -5.0F)); + + PartDefinition right_door = partdefinition.addOrReplaceChild("right_door", CubeListBuilder.create().texOffs(14, 0).addBox(-5.0F, -12.0F, -2.0F, 5.0F, 22.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(5.0F, 8.0F, -5.0F)); + + return LayerDefinition.create(meshdefinition, 32, 32); + } + + @Override + public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + left_door.render(poseStack, buffer, packedLight, packedOverlay); + right_door.render(poseStack, buffer, packedLight, packedOverlay); + } +} \ No newline at end of file diff --git a/src/main/java/elucent/eidolon/tile/CrucibleTileEntity.java b/src/main/java/elucent/eidolon/tile/CrucibleTileEntity.java index e88d302..a0b74a8 100644 --- a/src/main/java/elucent/eidolon/tile/CrucibleTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/CrucibleTileEntity.java @@ -1,5 +1,11 @@ package elucent.eidolon.tile; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.Predicate; + +import elucent.eidolon.Config; import elucent.eidolon.Registry; import elucent.eidolon.network.CrucibleFailPacket; import elucent.eidolon.network.CrucibleSuccessPacket; @@ -7,33 +13,26 @@ import elucent.eidolon.particle.Particles; import elucent.eidolon.recipe.CrucibleRecipe; import elucent.eidolon.recipe.CrucibleRegistry; -import elucent.eidolon.ritual.IRitualItemProvider; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.CampfireBlock; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.INBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.*; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.common.util.Constants; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CampfireBlock; +import net.minecraft.world.entity.Entity.RemovalReason; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.nbt.ListTag; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.phys.AABB; +import net.minecraft.core.BlockPos; -import javax.swing.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.function.Predicate; - -public class CrucibleTileEntity extends TileEntityBase implements ITickableTileEntity { +public class CrucibleTileEntity extends TileEntityBase { boolean boiling = false; boolean hasWater = false; int stirTicks = 0; @@ -75,17 +74,17 @@ public List getContents() { return contents; } - public CrucibleStep(CompoundNBT nbt) { + public CrucibleStep(CompoundTag nbt) { stirs = nbt.getInt("stirs"); - ListNBT list = nbt.getList("contents", Constants.NBT.TAG_COMPOUND); - for (INBT item : list) contents.add(ItemStack.read((CompoundNBT)item)); + ListTag list = nbt.getList("contents", Tag.TAG_COMPOUND); + for (Tag item : list) contents.add(ItemStack.of((CompoundTag)item)); } - public CompoundNBT write() { - CompoundNBT nbt = new CompoundNBT(); + public CompoundTag write() { + CompoundTag nbt = new CompoundTag(); nbt.putInt("stirs", stirs); - ListNBT list = new ListNBT(); - for (ItemStack stack : contents) list.add(stack.write(new CompoundNBT())); + ListTag list = new ListTag(); + for (ItemStack stack : contents) list.add(stack.save(new CompoundTag())); nbt.put("contents", list); return nbt; } @@ -96,60 +95,60 @@ public CompoundNBT write() { (BlockState b) -> b.getBlock() == Blocks.FIRE, (BlockState b) -> b.getBlock() == Blocks.SOUL_FIRE, (BlockState b) -> b.getBlock() == Blocks.LAVA, - (BlockState b) -> b.getBlock() == Blocks.CAMPFIRE && b.get(CampfireBlock.LIT), - (BlockState b) -> b.getBlock() == Blocks.SOUL_CAMPFIRE && b.get(CampfireBlock.LIT) + (BlockState b) -> b.getBlock() == Blocks.CAMPFIRE && b.getValue(CampfireBlock.LIT), + (BlockState b) -> b.getBlock() == Blocks.SOUL_CAMPFIRE && b.getValue(CampfireBlock.LIT) }; - public CrucibleTileEntity() { - this(Registry.CRUCIBLE_TILE_ENTITY); + public CrucibleTileEntity(BlockPos pos, BlockState state) { + this(Registry.CRUCIBLE_TILE_ENTITY, pos, state); } - public CrucibleTileEntity(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public CrucibleTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { + super(tileEntityTypeIn, pos, state); } @Override - public ActionResultType onActivated(BlockState state, BlockPos pos, PlayerEntity player, Hand hand) { - if (hand == Hand.MAIN_HAND) { - if (player.isSneaking() && player.getHeldItem(hand).isEmpty() && hasWater) { + public InteractionResult onActivated(BlockState state, BlockPos pos, Player player, InteractionHand hand) { + if (hand == InteractionHand.MAIN_HAND) { + if (player.isShiftKeyDown() && player.getItemInHand(hand).isEmpty() && hasWater) { boiling = false; hasWater = false; stirs = 0; steps.clear(); - if (!world.isRemote) { + if (!level.isClientSide) { sync(); - world.playSound(null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0f, 1.0f); + level.playSound(null, pos, SoundEvents.BUCKET_EMPTY, SoundSource.BLOCKS, 1.0f, 1.0f); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - else if (player.getHeldItem(hand).isEmpty() && stirTicks == 0 && this.steps.size() > 0) { + else if (player.getItemInHand(hand).isEmpty() && stirTicks == 0 && this.steps.size() > 0) { stirs ++; stirTicks = 20; - if (!world.isRemote) { - world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_SPLASH, SoundCategory.BLOCKS, 1.0f, 1.0f); + if (!level.isClientSide) { + level.playSound(null, pos, SoundEvents.GENERIC_SPLASH, SoundSource.BLOCKS, 1.0f, 1.0f); sync(); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } - if (player.getHeldItem(hand).getItem() == Items.WATER_BUCKET) { - player.setHeldItem(hand, new ItemStack(Items.BUCKET)); - hasWater = true; - if (!world.isRemote) { + if (player.getItemInHand(hand).getItem() == Items.WATER_BUCKET) { + player.setItemInHand(hand, new ItemStack(Items.BUCKET)); + if (!level.isClientSide) { + hasWater = true; sync(); - world.playSound(null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0f, 1.0f); + level.playSound(null, pos, SoundEvents.BUCKET_EMPTY, SoundSource.BLOCKS, 1.0f, 1.0f); } - return ActionResultType.SUCCESS; + return InteractionResult.SUCCESS; } } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public void read(BlockState state, CompoundNBT tag) { - super.read(state, tag); + public void load(CompoundTag tag) { + super.load(tag); this.steps.clear(); - ListNBT steps = tag.getList("steps", Constants.NBT.TAG_COMPOUND); - for (INBT step : steps) this.steps.add(new CrucibleStep((CompoundNBT)step)); + ListTag steps = tag.getList("steps", Tag.TAG_COMPOUND); + for (Tag step : steps) this.steps.add(new CrucibleStep((CompoundTag)step)); boiling = tag.getBoolean("boiling"); hasWater = tag.getBoolean("hasWater"); stirs = tag.getInt("stirs"); @@ -158,33 +157,30 @@ public void read(BlockState state, CompoundNBT tag) { } @Override - public CompoundNBT write(CompoundNBT tag) { - tag = super.write(tag); - ListNBT steps = new ListNBT(); + public void saveAdditional(CompoundTag tag) { + ListTag steps = new ListTag(); for (CrucibleStep step : this.steps) steps.add(step.write()); tag.put("steps", steps); tag.putBoolean("boiling", boiling); tag.putBoolean("hasWater", hasWater); tag.putInt("stirs", stirs); tag.putInt("stirTicks", stirTicks); - return tag; } - @Override public void tick() { if (stirTicks > 0) stirTicks --; - if (hasWater && world.getGameTime() % 200 == 0) { - BlockState state = world.getBlockState(pos.down()); + if (hasWater && level.getGameTime() % 200 == 0) { + BlockState state = level.getBlockState(worldPosition.below()); boolean isHeated = false; for (Predicate pred : HOT_BLOCKS) if (pred.test(state)) isHeated = true; if (boiling && !isHeated) { boiling = false; - if (!world.isRemote) sync(); + if (!level.isClientSide) sync(); } else if (!boiling && isHeated) { boiling = true; - if (!world.isRemote) sync(); + if (!level.isClientSide) sync(); } } @@ -195,31 +191,31 @@ else if (!boiling && isHeated) { float steamG = steps.size() > 0 ? Math.min(1.0f, 1 - (float)Math.pow(1 - getGreen(), 2)) : 1.0f; float steamB = steps.size() > 0 ? Math.min(1.0f, 1 - (float)Math.pow(1 - getBlue(), 2)) : 1.0f; - if (world.isRemote && hasWater && boiling) for (int i = 0; i < 2; i ++){ + if (level.isClientSide && hasWater && boiling) for (int i = 0; i < 2; i ++){ Particles.create(Registry.BUBBLE_PARTICLE) .setScale(0.05f) .setLifetime(10) .addVelocity(0, 0.015625, 0) .setColor(bubbleR, bubbleG, bubbleB) .setAlpha(1.0f, 0.75f) - .spawn(world, pos.getX() + 0.125 + 0.75 * world.rand.nextFloat(), pos.getY() + 0.6875, pos.getZ() + 0.125 + 0.75 * world.rand.nextFloat()); - if (world.rand.nextInt(8) == 0) Particles.create(Registry.STEAM_PARTICLE) + .spawn(level, worldPosition.getX() + 0.125 + 0.75 * level.random.nextFloat(), worldPosition.getY() + 0.6875, worldPosition.getZ() + 0.125 + 0.75 * level.random.nextFloat()); + if (level.random.nextInt(8) == 0) Particles.create(Registry.STEAM_PARTICLE) .setAlpha(0.0625f, 0).setScale(0.375f, 0.125f).setLifetime(80) .randomOffset(0.375, 0.125).randomVelocity(0.0125f, 0.025f) .addVelocity(0, 0.05f, 0) .setColor(steamR, steamG, steamB) - .spawn(world, pos.getX() + 0.5, pos.getY() + 0.625, pos.getZ() + 0.5); + .spawn(level, worldPosition.getX() + 0.5, worldPosition.getY() + 0.625, worldPosition.getZ() + 0.5); } - if (!world.isRemote && boiling && hasWater && world.getGameTime() % 8 == 0) { - List items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(pos).shrink(0.125)); - for (ItemEntity item : items) item.setPickupDelay(20); + if (!level.isClientSide && boiling && hasWater && level.getGameTime() % 8 == 0) { + List items = level.getEntitiesOfClass(ItemEntity.class, new AABB(worldPosition).deflate(0.125)); + for (ItemEntity item : items) item.setPickUpDelay(20); } - if (!world.isRemote && stepCounter > 0) { + if (!level.isClientSide && stepCounter > 0) { -- stepCounter; if (stepCounter == 0) { - List items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(pos).shrink(0.125)); + List items = level.getEntitiesOfClass(ItemEntity.class, new AABB(worldPosition).deflate(0.125)); List contents = new ArrayList<>(); for (ItemEntity item : items) { for (int i = 0; i < item.getItem().getCount(); i ++) { @@ -227,10 +223,10 @@ else if (!boiling && isHeated) { stack.setCount(1); contents.add(stack); } - item.remove(); + item.remove(RemovalReason.DISCARDED); } if (stirs == 0 && contents.isEmpty()) { // no action done; end recipe - Networking.sendToTracking(world, pos, new CrucibleFailPacket(pos)); + Networking.sendToTracking(level, worldPosition, new CrucibleFailPacket(worldPosition)); contents.clear(); steps.clear(); stirs = 0; @@ -243,19 +239,19 @@ else if (!boiling && isHeated) { CrucibleRecipe recipe = CrucibleRegistry.find(steps); if (recipe != null) { // if recipe found - Networking.sendToTracking(world, pos, new CrucibleSuccessPacket(pos, steamR, steamG, steamB)); - double angle = world.rand.nextDouble() * Math.PI * 2; - ItemEntity entity = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.75, pos.getZ() + 0.5, recipe.getResult().copy()); - entity.setMotion(Math.sin(angle) * 0.125, 0.25, Math.cos(angle) * 0.125); - entity.setPickupDelay(10); - world.addEntity(entity); + Networking.sendToTracking(level, worldPosition, new CrucibleSuccessPacket(worldPosition, steamR, steamG, steamB)); + double angle = level.random.nextDouble() * Math.PI * 2; + ItemEntity entity = new ItemEntity(level, worldPosition.getX() + 0.5, worldPosition.getY() + 0.75, worldPosition.getZ() + 0.5, recipe.getResult().copy()); + entity.setDeltaMovement(Math.sin(angle) * 0.125, 0.25, Math.cos(angle) * 0.125); + entity.setPickUpDelay(10); + level.addFreshEntity(entity); contents.clear(); steps.clear(); hasWater = boiling = false; } else { - world.playSound(null, pos, SoundEvents.BLOCK_BREWING_STAND_BREW, SoundCategory.BLOCKS, 1.0f, 1.0f); // try continue - stepCounter = 100; + level.playSound(null, worldPosition, SoundEvents.BREWING_STAND_BREW, SoundSource.BLOCKS, 1.0f, 1.0f); // try continue + stepCounter = Config.CRUCIBLE_STEP_DURATION.get(); } stirs = 0; sync(); @@ -263,10 +259,10 @@ else if (!boiling && isHeated) { } } - if (!world.isRemote && stepCounter == 0 && steps.size() == 0 - && hasWater && boiling && world.getGameTime() % 100 == 0) { - List items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(pos).shrink(0.125)); - if (items.size() > 0) stepCounter = 40; + if (!level.isClientSide && stepCounter == 0 && steps.size() == 0 + && hasWater && boiling && level.getGameTime() % 100 == 0) { + List items = level.getEntitiesOfClass(ItemEntity.class, new AABB(worldPosition).deflate(0.125)); + if (items.size() > 0) stepCounter = Config.CRUCIBLE_STEP_DURATION.get() / 2; } } } diff --git a/src/main/java/elucent/eidolon/tile/CrucibleTileRenderer.java b/src/main/java/elucent/eidolon/tile/CrucibleTileRenderer.java index 1b20736..4d45f25 100644 --- a/src/main/java/elucent/eidolon/tile/CrucibleTileRenderer.java +++ b/src/main/java/elucent/eidolon/tile/CrucibleTileRenderer.java @@ -1,80 +1,83 @@ package elucent.eidolon.tile; -import com.ibm.icu.impl.data.ResourceReader; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import elucent.eidolon.ritual.CrystalRitual; -import elucent.eidolon.ritual.Ritual; -import elucent.eidolon.util.RenderUtil; -import net.minecraft.block.CauldronBlock; +import elucent.eidolon.Registry; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureUtil; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.ColorHelper; -import net.minecraft.util.ColorHelper.PackedColor; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.world.biome.BiomeColors; - -import javax.annotation.Resource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.util.FastColor.ARGB32; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import com.mojang.math.Matrix4f; +import com.mojang.math.Vector3f; +import net.minecraft.client.renderer.BiomeColors; -public class CrucibleTileRenderer extends TileEntityRenderer { - private final ModelRenderer stirrer; +public class CrucibleTileRenderer implements BlockEntityRenderer { + private final ModelPart stirrer; public static final ResourceLocation STIRRER_TEXTURE = new ResourceLocation(Eidolon.MODID, "textures/block/crucible_stirrer.png"); + + public static LayerDefinition createModelLayer() { + MeshDefinition mesh = new MeshDefinition(); + + PartDefinition root = mesh.getRoot(); + PartDefinition stirrer = root.addOrReplaceChild("stirrer", CubeListBuilder.create() + .texOffs(0, 8).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-1.0F, 3.0F, -1.0F, 2.0F, 6.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(mesh, 16, 16); + } - public CrucibleTileRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); - stirrer = new ModelRenderer(16, 16, 0, 0); - stirrer.setRotationPoint(0.0F, 0.0F, 0.0F); - stirrer.setTextureOffset(0, 8).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 3.0F, 3.0F, 0.0F, false); - stirrer.setTextureOffset(0, 0).addBox(-1.0F, 3.0F, -1.0F, 2.0F, 6.0F, 2.0F, 0.0F, false); + public CrucibleTileRenderer() { + this.stirrer = Minecraft.getInstance().getEntityModels().bakeLayer(ClientRegistry.CRUCIBLE_STIRRER_LAYER).getChild("stirrer"); } @Override - public void render(CrucibleTileEntity tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + public void render(CrucibleTileEntity tile, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(STIRRER_TEXTURE); + RenderSystem.setShaderTexture(0, STIRRER_TEXTURE); float coeff = tile.stirTicks == 0 ? 0 : (tile.stirTicks - partialTicks) / 20.0f; - if (!tile.getWorld().getBlockState(tile.getPos().up()).isSolidSide(tile.getWorld(), tile.getPos().up(), Direction.DOWN)) { - matrixStackIn.push(); + if (!tile.getLevel().getBlockState(tile.getBlockPos().above()).isFaceSturdy(tile.getLevel(), tile.getBlockPos().above(), Direction.DOWN)) { + matrixStackIn.pushPose(); matrixStackIn.translate(0.5, 0.625, 0.5); - matrixStackIn.rotate(Vector3f.YP.rotationDegrees(45 + coeff * 360)); + matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(45 + coeff * 360)); matrixStackIn.translate(0, -0.125 * Math.sin(coeff * Math.PI), 0.125); - stirrer.rotateAngleX = (float) Math.PI / 8 * (1.0f - (float) Math.sin(coeff * Math.PI)); - stirrer.render(matrixStackIn, bufferIn.getBuffer(RenderType.getEntitySolid(STIRRER_TEXTURE)), combinedLightIn, combinedOverlayIn); - matrixStackIn.pop(); + stirrer.xRot = (float) Math.PI / 8 * (1.0f - (float) Math.sin(coeff * Math.PI)); + stirrer.render(matrixStackIn, bufferIn.getBuffer(RenderType.entitySolid(STIRRER_TEXTURE)), combinedLightIn, combinedOverlayIn); + matrixStackIn.popPose(); } if (tile.hasWater) { - CauldronBlock block; - TextureAtlasSprite water = mc.getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE) + TextureAtlasSprite water = mc.getTextureAtlas(TextureAtlas.LOCATION_BLOCKS) .apply(new ResourceLocation("minecraft", "block/water_still")); - IVertexBuilder builder = bufferIn.getBuffer(RenderType.getTranslucentNoCrumbling()); - Matrix4f mat = matrixStackIn.getLast().getMatrix(); - int color = BiomeColors.getWaterColor(tile.getWorld(), tile.getPos()); - int r = PackedColor.getRed(color), g = PackedColor.getGreen(color), - b = PackedColor.getBlue(color), a = PackedColor.getAlpha(color); + VertexConsumer builder = bufferIn.getBuffer(RenderType.translucentNoCrumbling()); + Matrix4f mat = matrixStackIn.last().pose(); + int color = BiomeColors.getAverageWaterColor(tile.getLevel(), tile.getBlockPos()); + int r = ARGB32.red(color), g = ARGB32.green(color), + b = ARGB32.blue(color), a = ARGB32.alpha(color); if (tile.steps.size() > 0) { r = (int)(tile.getRed() * 255); g = (int)(tile.getGreen() * 255); b = (int)(tile.getBlue() * 255); } - builder.pos(mat, 0.125f, 0.75f, 0.125f).color(r, g, b, 192).tex(water.getInterpolatedU(2), water.getInterpolatedV(2)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); - builder.pos(mat, 0.125f, 0.75f, 0.875f).color(r, g, b, 192).tex(water.getInterpolatedU(14), water.getInterpolatedV(2)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); - builder.pos(mat, 0.875f, 0.75f, 0.875f).color(r, g, b, 192).tex(water.getInterpolatedU(14), water.getInterpolatedV(14)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); - builder.pos(mat, 0.875f, 0.75f, 0.125f).color(r, g, b, 192).tex(water.getInterpolatedU(2), water.getInterpolatedV(14)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.125f, 0.75f, 0.125f).color(r, g, b, 192).uv(water.getU(2), water.getV(2)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.125f, 0.75f, 0.875f).color(r, g, b, 192).uv(water.getU(14), water.getV(2)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.875f, 0.75f, 0.875f).color(r, g, b, 192).uv(water.getU(14), water.getV(14)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.875f, 0.75f, 0.125f).color(r, g, b, 192).uv(water.getU(2), water.getV(14)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); } } } diff --git a/src/main/java/elucent/eidolon/tile/EffigyTileEntity.java b/src/main/java/elucent/eidolon/tile/EffigyTileEntity.java index f6831d4..fb74b51 100644 --- a/src/main/java/elucent/eidolon/tile/EffigyTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/EffigyTileEntity.java @@ -1,18 +1,15 @@ package elucent.eidolon.tile; import elucent.eidolon.Registry; -import elucent.eidolon.ritual.RitualRegistry; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; public class EffigyTileEntity extends TileEntityBase { long previous = -1; - public EffigyTileEntity() { - super(Registry.EFFIGY_TILE_ENTITY); + public EffigyTileEntity(BlockPos pos, BlockState state) { + super(Registry.EFFIGY_TILE_ENTITY, pos, state); } public boolean ready() { @@ -20,22 +17,20 @@ public boolean ready() { } public void pray() { - if (!world.isRemote) { - previous = world.getGameTime(); + if (!level.isClientSide) { + previous = level.getGameTime(); sync(); } } @Override - public void read(BlockState state, CompoundNBT tag) { - super.read(state, tag); + public void load(CompoundTag tag) { + super.load(tag); previous = tag.getLong("previous"); } @Override - public CompoundNBT write(CompoundNBT tag) { - tag = super.write(tag); + public void saveAdditional(CompoundTag tag) { tag.putLong("previous", previous); - return tag; } } diff --git a/src/main/java/elucent/eidolon/tile/GobletTileEntity.java b/src/main/java/elucent/eidolon/tile/GobletTileEntity.java index 0187677..9f77fcb 100644 --- a/src/main/java/elucent/eidolon/tile/GobletTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/GobletTileEntity.java @@ -1,21 +1,18 @@ package elucent.eidolon.tile; import elucent.eidolon.Registry; -import net.minecraft.block.BlockState; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.EntityType; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.registries.ForgeRegistries; public class GobletTileEntity extends TileEntityBase { EntityType type = null; - public GobletTileEntity() { - super(Registry.GOBLET_TILE_ENTITY); + public GobletTileEntity(BlockPos pos, BlockState state) { + super(Registry.GOBLET_TILE_ENTITY, pos, state); } public EntityType getEntityType() { @@ -28,16 +25,14 @@ public void setEntityType(EntityType type) { } @Override - public void read(BlockState state, CompoundNBT tag) { - super.read(state, tag); + public void load(CompoundTag tag) { + super.load(tag); if (tag.contains("type")) type = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(tag.getString("type"))); else type = null; } @Override - public CompoundNBT write(CompoundNBT tag) { - tag = super.write(tag); + public void saveAdditional(CompoundTag tag) { if (type != null) tag.putString("type", type.getRegistryName().toString()); - return tag; } } diff --git a/src/main/java/elucent/eidolon/tile/GobletTileRenderer.java b/src/main/java/elucent/eidolon/tile/GobletTileRenderer.java index a886ff2..3419a04 100644 --- a/src/main/java/elucent/eidolon/tile/GobletTileRenderer.java +++ b/src/main/java/elucent/eidolon/tile/GobletTileRenderer.java @@ -1,43 +1,34 @@ package elucent.eidolon.tile; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; -import elucent.eidolon.Eidolon; -import net.minecraft.block.CauldronBlock; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.model.ModelRenderer; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.ColorHelper.PackedColor; -import net.minecraft.util.Direction; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.world.biome.BiomeColors; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.resources.ResourceLocation; +import com.mojang.math.Matrix4f; -public class GobletTileRenderer extends TileEntityRenderer { +public class GobletTileRenderer implements BlockEntityRenderer { - public GobletTileRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); - } + public GobletTileRenderer() {} @Override - public void render(GobletTileEntity tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + public void render(GobletTileEntity tile, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Minecraft mc = Minecraft.getInstance(); if (tile.getEntityType() != null) { - TextureAtlasSprite water = mc.getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE) + TextureAtlasSprite water = mc.getTextureAtlas(TextureAtlas.LOCATION_BLOCKS) .apply(new ResourceLocation("minecraft", "block/water_still")); - IVertexBuilder builder = bufferIn.getBuffer(RenderType.getTranslucentNoCrumbling()); - Matrix4f mat = matrixStackIn.getLast().getMatrix(); - builder.pos(mat, 0.375f, 0.46875f, 0.375f).color(192, 16, 32, 224).tex(water.getInterpolatedU(6), water.getInterpolatedV(6)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); - builder.pos(mat, 0.375f, 0.46875f, 0.625f).color(192, 16, 32, 224).tex(water.getInterpolatedU(10), water.getInterpolatedV(6)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); - builder.pos(mat, 0.625f, 0.46875f, 0.625f).color(192, 16, 32, 224).tex(water.getInterpolatedU(10), water.getInterpolatedV(10)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); - builder.pos(mat, 0.625f, 0.46875f, 0.375f).color(192, 16, 32, 224).tex(water.getInterpolatedU(6), water.getInterpolatedV(10)).lightmap(combinedLightIn).normal(0, 1, 0).endVertex(); + VertexConsumer builder = bufferIn.getBuffer(RenderType.translucentNoCrumbling()); + Matrix4f mat = matrixStackIn.last().pose(); + builder.vertex(mat, 0.375f, 0.46875f, 0.375f).color(192, 16, 32, 224).uv(water.getU(6), water.getV(6)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.375f, 0.46875f, 0.625f).color(192, 16, 32, 224).uv(water.getU(10), water.getV(6)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.625f, 0.46875f, 0.625f).color(192, 16, 32, 224).uv(water.getU(10), water.getV(10)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); + builder.vertex(mat, 0.625f, 0.46875f, 0.375f).color(192, 16, 32, 224).uv(water.getU(6), water.getV(10)).uv2(combinedLightIn).normal(0, 1, 0).endVertex(); } } } diff --git a/src/main/java/elucent/eidolon/tile/HandTileEntity.java b/src/main/java/elucent/eidolon/tile/HandTileEntity.java index a4fc682..bd2b068 100644 --- a/src/main/java/elucent/eidolon/tile/HandTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/HandTileEntity.java @@ -2,65 +2,62 @@ import elucent.eidolon.Registry; import elucent.eidolon.ritual.IRitualItemProvider; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.Containers; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; public class HandTileEntity extends TileEntityBase implements IRitualItemProvider { ItemStack stack = ItemStack.EMPTY; - public HandTileEntity() { - this(Registry.HAND_TILE_ENTITY); + public HandTileEntity(BlockPos pos, BlockState state) { + this(Registry.HAND_TILE_ENTITY, pos, state); } - public HandTileEntity(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public HandTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { + super(tileEntityTypeIn, pos, state); } @Override public void onDestroyed(BlockState state, BlockPos pos) { - if (!stack.isEmpty()) InventoryHelper.spawnItemStack(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); + if (!stack.isEmpty()) Containers.dropItemStack(level, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); } @Override - public ActionResultType onActivated(BlockState state, BlockPos pos, PlayerEntity player, Hand hand) { - if (hand == Hand.MAIN_HAND) { - if (player.getHeldItem(hand).isEmpty() && !stack.isEmpty()) { - player.addItemStackToInventory(stack); + public InteractionResult onActivated(BlockState state, BlockPos pos, Player player, InteractionHand hand) { + if (hand == InteractionHand.MAIN_HAND) { + if (player.getItemInHand(hand).isEmpty() && !stack.isEmpty()) { + player.addItem(stack); stack = ItemStack.EMPTY; - if (!world.isRemote) sync(); - return ActionResultType.SUCCESS; + if (!level.isClientSide) sync(); + return InteractionResult.SUCCESS; } - else if (!player.getHeldItem(hand).isEmpty() && stack.isEmpty()) { - stack = player.getHeldItem(hand).copy(); + else if (!player.getItemInHand(hand).isEmpty() && stack.isEmpty()) { + stack = player.getItemInHand(hand).copy(); stack.setCount(1); - player.getHeldItem(hand).shrink(1); - if (player.getHeldItem(hand).isEmpty()) player.setHeldItem(hand, ItemStack.EMPTY); - if (!world.isRemote) sync(); - return ActionResultType.SUCCESS; + player.getItemInHand(hand).shrink(1); + if (player.getItemInHand(hand).isEmpty()) player.setItemInHand(hand, ItemStack.EMPTY); + if (!level.isClientSide) sync(); + return InteractionResult.SUCCESS; } } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public void read(BlockState state, CompoundNBT tag) { - super.read(state, tag); - stack = ItemStack.read(tag.getCompound("stack")); + public void load(CompoundTag tag) { + super.load(tag); + stack = ItemStack.of(tag.getCompound("stack")); } @Override - public CompoundNBT write(CompoundNBT tag) { - tag = super.write(tag); - tag.put("stack", stack.write(new CompoundNBT())); - return tag; + public void saveAdditional(CompoundTag tag) { + tag.put("stack", stack.save(new CompoundTag())); } @Override @@ -71,6 +68,6 @@ public ItemStack provide() { @Override public void take() { stack = ItemStack.EMPTY; - if (!world.isRemote) sync(); + if (!level.isClientSide) sync(); } } diff --git a/src/main/java/elucent/eidolon/tile/HandTileRenderer.java b/src/main/java/elucent/eidolon/tile/HandTileRenderer.java index 24be70f..9032e4b 100644 --- a/src/main/java/elucent/eidolon/tile/HandTileRenderer.java +++ b/src/main/java/elucent/eidolon/tile/HandTileRenderer.java @@ -1,32 +1,27 @@ package elucent.eidolon.tile; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import com.mojang.math.Vector3f; -public class HandTileRenderer extends TileEntityRenderer { - public HandTileRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); - } +public class HandTileRenderer implements BlockEntityRenderer { + public HandTileRenderer() {} @Override - public void render(HandTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + public void render(HandTileEntity tileEntityIn, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Minecraft mc = Minecraft.getInstance(); ItemRenderer ir = mc.getItemRenderer(); if (!tileEntityIn.stack.isEmpty()) { - matrixStackIn.push(); + matrixStackIn.pushPose(); matrixStackIn.translate(0.5,0.9375, 0.5); - matrixStackIn.rotate(Vector3f.YP.rotationDegrees(3 * (mc.world.getGameTime() % 360 + partialTicks))); - ir.renderItem(tileEntityIn.stack, TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn); - matrixStackIn.pop(); + matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(3 * (mc.level.getGameTime() % 360 + partialTicks))); + ir.renderStatic(tileEntityIn.stack, TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, 0); + matrixStackIn.popPose(); } } } diff --git a/src/main/java/elucent/eidolon/tile/NecroticFocusTileEntity.java b/src/main/java/elucent/eidolon/tile/NecroticFocusTileEntity.java index 8ba0d21..8ed4f89 100644 --- a/src/main/java/elucent/eidolon/tile/NecroticFocusTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/NecroticFocusTileEntity.java @@ -2,65 +2,62 @@ import elucent.eidolon.Registry; import elucent.eidolon.ritual.IRitualItemFocus; -import elucent.eidolon.ritual.IRitualItemProvider; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.Containers; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; public class NecroticFocusTileEntity extends TileEntityBase implements IRitualItemFocus { ItemStack stack = ItemStack.EMPTY; - public NecroticFocusTileEntity() { - this(Registry.NECROTIC_FOCUS_TILE_ENTITY); + public NecroticFocusTileEntity(BlockPos pos, BlockState state) { + this(Registry.NECROTIC_FOCUS_TILE_ENTITY, pos, state); } - public NecroticFocusTileEntity(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public NecroticFocusTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { + super(tileEntityTypeIn, pos, state); } @Override public void onDestroyed(BlockState state, BlockPos pos) { - if (!stack.isEmpty()) InventoryHelper.spawnItemStack(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); + if (!stack.isEmpty()) Containers.dropItemStack(level, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); } @Override - public ActionResultType onActivated(BlockState state, BlockPos pos, PlayerEntity player, Hand hand) { - if (hand == Hand.MAIN_HAND) { - if (player.getHeldItem(hand).isEmpty() && !stack.isEmpty()) { - player.addItemStackToInventory(stack); + public InteractionResult onActivated(BlockState state, BlockPos pos, Player player, InteractionHand hand) { + if (hand == InteractionHand.MAIN_HAND) { + if (player.getItemInHand(hand).isEmpty() && !stack.isEmpty()) { + player.addItem(stack); stack = ItemStack.EMPTY; - if (!world.isRemote) sync(); - return ActionResultType.SUCCESS; + if (!level.isClientSide) sync(); + return InteractionResult.SUCCESS; } - else if (!player.getHeldItem(hand).isEmpty() && stack.isEmpty()) { - stack = player.getHeldItem(hand).copy(); + else if (!player.getItemInHand(hand).isEmpty() && stack.isEmpty()) { + stack = player.getItemInHand(hand).copy(); stack.setCount(1); - player.getHeldItem(hand).shrink(1); - if (player.getHeldItem(hand).isEmpty()) player.setHeldItem(hand, ItemStack.EMPTY); - if (!world.isRemote) sync(); - return ActionResultType.SUCCESS; + player.getItemInHand(hand).shrink(1); + if (player.getItemInHand(hand).isEmpty()) player.setItemInHand(hand, ItemStack.EMPTY); + if (!level.isClientSide) sync(); + return InteractionResult.SUCCESS; } } - return ActionResultType.PASS; + return InteractionResult.PASS; } @Override - public void read(BlockState state, CompoundNBT tag) { - super.read(state, tag); - stack = ItemStack.read(tag.getCompound("stack")); + public void load(CompoundTag tag) { + super.load(tag); + stack = ItemStack.of(tag.getCompound("stack")); } @Override - public CompoundNBT write(CompoundNBT tag) { - tag = super.write(tag); - tag.put("stack", stack.write(new CompoundNBT())); - return tag; + public void saveAdditional(CompoundTag tag) { + tag.put("stack", stack.save(new CompoundTag())); } @Override @@ -71,6 +68,12 @@ public ItemStack provide() { @Override public void take() { stack = ItemStack.EMPTY; - if (!world.isRemote) sync(); + if (!level.isClientSide) sync(); } + + @Override + public void replace(ItemStack stack) { + this.stack = stack; + if (!level.isClientSide) sync(); + } } diff --git a/src/main/java/elucent/eidolon/tile/NecroticFocusTileRenderer.java b/src/main/java/elucent/eidolon/tile/NecroticFocusTileRenderer.java index 0acf73c..ce78ff0 100644 --- a/src/main/java/elucent/eidolon/tile/NecroticFocusTileRenderer.java +++ b/src/main/java/elucent/eidolon/tile/NecroticFocusTileRenderer.java @@ -1,32 +1,30 @@ package elucent.eidolon.tile; -import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; + import elucent.eidolon.block.HorizontalBlockBase; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.Direction; -import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.core.Direction; +import com.mojang.math.Vector3f; -public class NecroticFocusTileRenderer extends TileEntityRenderer { - public NecroticFocusTileRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); - } +public class NecroticFocusTileRenderer implements BlockEntityRenderer { + public NecroticFocusTileRenderer() {} @Override - public void render(NecroticFocusTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + public void render(NecroticFocusTileEntity tileEntityIn, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Minecraft mc = Minecraft.getInstance(); ItemRenderer ir = mc.getItemRenderer(); if (!tileEntityIn.stack.isEmpty()) { - matrixStackIn.push(); - Direction dir = tileEntityIn.getWorld().getBlockState(tileEntityIn.getPos()).get(HorizontalBlockBase.HORIZONTAL_FACING); - matrixStackIn.translate(0.5 + dir.getXOffset() * 0.25,0.5 + dir.getYOffset() * 0.25, 0.5 + dir.getZOffset() * 0.25); - matrixStackIn.rotate(Vector3f.YP.rotationDegrees(3 * (mc.world.getGameTime() % 360 + partialTicks))); - ir.renderItem(tileEntityIn.stack, TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn); - matrixStackIn.pop(); + matrixStackIn.pushPose(); + Direction dir = tileEntityIn.getLevel().getBlockState(tileEntityIn.getBlockPos()).getValue(HorizontalBlockBase.HORIZONTAL_FACING); + matrixStackIn.translate(0.5 + dir.getStepX() * 0.25,0.5 + dir.getStepY() * 0.25, 0.5 + dir.getStepZ() * 0.25); + matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(3 * (mc.level.getGameTime() % 360 + partialTicks))); + ir.renderStatic(tileEntityIn.stack, TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, 0); + matrixStackIn.popPose(); } } } diff --git a/src/main/java/elucent/eidolon/tile/ResearchTableTileEntity.java b/src/main/java/elucent/eidolon/tile/ResearchTableTileEntity.java new file mode 100644 index 0000000..9af48a5 --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/ResearchTableTileEntity.java @@ -0,0 +1,271 @@ +package elucent.eidolon.tile; + +import java.util.Arrays; +import java.util.List; +import java.util.ArrayList; + +import javax.annotation.Nullable; + +import elucent.eidolon.Eidolon; +import elucent.eidolon.Registry; +import elucent.eidolon.block.WoodenStandBlock; +import elucent.eidolon.gui.ResearchTableContainer; +import elucent.eidolon.gui.WoodenBrewingStandContainer; +import elucent.eidolon.research.Research; +import elucent.eidolon.research.Researches; +import elucent.eidolon.research.ResearchTask; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.BrewingStandBlock; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.Containers; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.Nameable; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.alchemy.PotionBrewing; +import net.minecraft.world.level.block.entity.BaseContainerBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.Direction; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.ContainerListener; +import net.minecraft.core.NonNullList; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraftforge.common.Tags; +import net.minecraftforge.common.util.LazyOptional; + +public class ResearchTableTileEntity extends TileEntityBase implements WorldlyContainer, MenuProvider { + private static final int[] SLOTS = new int[]{0, 1}; + private NonNullList stacks = NonNullList.withSize(2, ItemStack.EMPTY); + private NonNullList tasks = NonNullList.create(); + private Component name; + private int progress; + private int worldSeed; + private List listeners = new ArrayList<>(); + + static final int SEED = 1418644859; + + public final ContainerData dataAccess = new ContainerData() { + @Override + public int get(int index) { + switch(index) { + case 0: + return ResearchTableTileEntity.this.progress; + case 1: + return ResearchTableTileEntity.this.worldSeed; + default: + return 0; + } + } + + @Override + public void set(int index, int value) { + switch(index) { + case 0: + ResearchTableTileEntity.this.progress = value; + break; + case 1: + break; // can't set seed + } + } + + @Override + public int getCount() { + return 2; + } + }; + + public ResearchTableTileEntity(BlockPos pos, BlockState state) { + super(Registry.RESEARCH_TABLE_TILE_ENTITY, pos, state); + progress = 0; + } + + @Override + public void onLoad() { + super.onLoad(); + if (!level.isClientSide) worldSeed = SEED + 978060631 * (int)((ServerLevel)level).getSeed(); + } + + protected Component getDefaultName() { + return new TranslatableComponent("container." + Eidolon.MODID + ".research_table"); + } + + public void addListener(ContainerListener listener) { + this.listeners.add(listener); + } + + public void removeListener(ContainerListener listener) { + this.listeners.remove(listener); + } + + @Override + public int getContainerSize() { + return this.stacks.size(); + } + + @Override + public boolean isEmpty() { + for(ItemStack itemstack : this.stacks) { + if (!itemstack.isEmpty()) { + return false; + } + } + return true; + } + + @Override + public void onDestroyed(BlockState state, BlockPos pos) { + for (ItemStack stack : stacks) { + if (!stack.isEmpty()) Containers.dropItemStack(level, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); + } + } + + public void tick() { + if (progress < 0) { + progress = 0; + sync(); + } + if (progress > 0) { + if (stacks.get(0).isEmpty() || stacks.get(0).getItem() != Registry.RESEARCH_NOTES.get()) { + progress = 0; + sync(); + for (ContainerListener listener : listeners) + listener.dataChanged((AbstractContainerMenu)listener, 0, progress); + return; + } + progress --; + if (progress == 0) { + ItemStack notes = stacks.get(0); + CompoundTag notesTag = notes.getTag(); + Research r = Researches.find(new ResourceLocation(notesTag.getString("research"))); + int done = notesTag.getInt("stepsDone"); + done ++; + notesTag.putInt("stepsDone", done); + for (ContainerListener listener : listeners) + listener.slotChanged((AbstractContainerMenu)listener, 0, stacks.get(0)); + } + sync(); + for (ContainerListener listener : listeners) + listener.dataChanged((AbstractContainerMenu)listener, 0, progress); + } + } + + @Override + public void load(CompoundTag nbt) { + super.load(nbt); + this.stacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + ContainerHelper.loadAllItems(nbt, this.stacks); + this.progress = nbt.getInt("progress"); + this.worldSeed = nbt.getInt("worldSeed"); + } + + @Override + public void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); + compound.putInt("progress", this.progress); + compound.putInt("worldSeed", worldSeed); + ContainerHelper.saveAllItems(compound, this.stacks); + } + + @Override + public ItemStack getItem(int index) { + return index >= 0 && index < this.stacks.size() ? this.stacks.get(index) : ItemStack.EMPTY; + } + + @Override + public ItemStack removeItem(int index, int count) { + return ContainerHelper.removeItem(this.stacks, index, count); + } + + @Override + public ItemStack removeItemNoUpdate(int index) { + return ContainerHelper.takeItem(this.stacks, index); + } + + @Override + public void setItem(int index, ItemStack stack) { + if (index >= 0 && index < this.stacks.size()) { + this.stacks.set(index, stack); + } + } + + @Override + public boolean stillValid(Player player) { + if (this.level.getBlockEntity(this.worldPosition) != this) { + return false; + } else { + return !(player.distanceToSqr((double)this.worldPosition.getX() + 0.5D, (double)this.worldPosition.getY() + 0.5D, (double)this.worldPosition.getZ() + 0.5D) > 64.0D); + } + } + + @Override + public boolean canPlaceItem(int index, ItemStack stack) { + if (index == 0) { + return stack.is(Registry.RESEARCH_NOTES.get()); + } else if (index == 1) { + return stack.is(Registry.ARCANE_SEAL.get()); + } + return false; + } + + @Override + public int[] getSlotsForFace(Direction side) { + return SLOTS; + } + + @Override + public boolean canPlaceItemThroughFace(int index, ItemStack itemStackIn, @Nullable Direction direction) { + return this.canPlaceItem(index, itemStackIn); + } + + @Override + public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) { + if (index == 0) { + return stack.is(Registry.COMPLETED_RESEARCH.get()); + } else { + return false; + } + } + + @Override + public void clearContent() { + this.stacks.clear(); + } + + @Override + public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) { + return new ResearchTableContainer(id, inv, this, this.dataAccess); + } + + net.minecraftforge.common.util.LazyOptional handler = + LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this)); + + @Override + public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { + if (!this.remove && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + return handler.cast(); + } + return super.getCapability(capability, facing); + } + + @Override + public void setRemoved() { + super.setRemoved(); + handler.invalidate(); + } + + @Override + public Component getDisplayName() { + return new TextComponent(""); // Not rendered in the GUI. + } +} diff --git a/src/main/java/elucent/eidolon/tile/SoulEnchanterTileEntity.java b/src/main/java/elucent/eidolon/tile/SoulEnchanterTileEntity.java index 1d1a5de..62aea5f 100644 --- a/src/main/java/elucent/eidolon/tile/SoulEnchanterTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/SoulEnchanterTileEntity.java @@ -1,59 +1,52 @@ package elucent.eidolon.tile; -import elucent.eidolon.Registry; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; - import java.util.Random; -public class SoulEnchanterTileEntity extends TileEntityBase implements ITickableTileEntity { - public float field_195523_f; - public float field_195524_g; - public float field_195525_h; - public float field_195526_i; +import elucent.eidolon.Registry; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; + +public class SoulEnchanterTileEntity extends TileEntityBase { + public float flip; + public float oFlip; + public float flipT; + public float flipA; public float nextPageTurningSpeed; public float pageTurningSpeed; public float nextPageAngle; public float pageAngle; - public float field_195531_n; + public float tRot; private static final Random random = new Random(); - public SoulEnchanterTileEntity() { - this(Registry.SOUL_ENCHANTER_TILE_ENTITY); + public SoulEnchanterTileEntity(BlockPos pos, BlockState state) { + this(Registry.SOUL_ENCHANTER_TILE_ENTITY, pos, state); } - public SoulEnchanterTileEntity(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public SoulEnchanterTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { + super(tileEntityTypeIn, pos, state); } - @Override public void tick() { this.pageTurningSpeed = this.nextPageTurningSpeed; this.pageAngle = this.nextPageAngle; - PlayerEntity playerentity = this.world.getClosestPlayer((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D, 3.0D, false); + Player playerentity = this.level.getNearestPlayer((double)this.worldPosition.getX() + 0.5D, (double)this.worldPosition.getY() + 0.5D, (double)this.worldPosition.getZ() + 0.5D, 3.0D, false); if (playerentity != null) { - double d0 = playerentity.getPosX() - ((double)this.pos.getX() + 0.5D); - double d1 = playerentity.getPosZ() - ((double)this.pos.getZ() + 0.5D); - this.field_195531_n = (float) MathHelper.atan2(d1, d0); + double d0 = playerentity.getX() - ((double)this.worldPosition.getX() + 0.5D); + double d1 = playerentity.getZ() - ((double)this.worldPosition.getZ() + 0.5D); + this.tRot = (float) Mth.atan2(d1, d0); this.nextPageTurningSpeed += 0.1F; if (this.nextPageTurningSpeed < 0.5F || random.nextInt(40) == 0) { - float f1 = this.field_195525_h; + float f1 = this.flipT; do { - this.field_195525_h += (float)(random.nextInt(4) - random.nextInt(4)); - } while(f1 == this.field_195525_h); + this.flipT += (float)(random.nextInt(4) - random.nextInt(4)); + } while(f1 == this.flipT); } } else { - this.field_195531_n += 0.02F; + this.tRot += 0.02F; this.nextPageTurningSpeed -= 0.1F; } @@ -65,16 +58,16 @@ public void tick() { this.nextPageAngle += ((float)Math.PI * 2F); } - while(this.field_195531_n >= (float)Math.PI) { - this.field_195531_n -= ((float)Math.PI * 2F); + while(this.tRot >= (float)Math.PI) { + this.tRot -= ((float)Math.PI * 2F); } - while(this.field_195531_n < -(float)Math.PI) { - this.field_195531_n += ((float)Math.PI * 2F); + while(this.tRot < -(float)Math.PI) { + this.tRot += ((float)Math.PI * 2F); } float f2; - for(f2 = this.field_195531_n - this.nextPageAngle; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) { + for(f2 = this.tRot - this.nextPageAngle; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) { } while(f2 < -(float)Math.PI) { @@ -82,12 +75,12 @@ public void tick() { } this.nextPageAngle += f2 * 0.4F; - this.nextPageTurningSpeed = MathHelper.clamp(this.nextPageTurningSpeed, 0.0F, 1.0F); - this.field_195524_g = this.field_195523_f; - float f = (this.field_195525_h - this.field_195523_f) * 0.4F; + this.nextPageTurningSpeed = Mth.clamp(this.nextPageTurningSpeed, 0.0F, 1.0F); + this.oFlip = this.flip; + float f = (this.flipT - this.flip) * 0.4F; float f3 = 0.2F; - f = MathHelper.clamp(f, -0.2F, 0.2F); - this.field_195526_i += (f - this.field_195526_i) * 0.9F; - this.field_195523_f += this.field_195526_i; + f = Mth.clamp(f, -0.2F, 0.2F); + this.flipA += (f - this.flipA) * 0.9F; + this.flip += this.flipA; } } diff --git a/src/main/java/elucent/eidolon/tile/SoulEnchanterTileRenderer.java b/src/main/java/elucent/eidolon/tile/SoulEnchanterTileRenderer.java index 5353f09..e92b100 100644 --- a/src/main/java/elucent/eidolon/tile/SoulEnchanterTileRenderer.java +++ b/src/main/java/elucent/eidolon/tile/SoulEnchanterTileRenderer.java @@ -1,38 +1,37 @@ package elucent.eidolon.tile; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + import elucent.eidolon.ClientEvents; import elucent.eidolon.Eidolon; -import elucent.eidolon.Events; -import elucent.eidolon.block.HorizontalBlockBase; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.model.BookModel; -import net.minecraft.client.renderer.model.RenderMaterial; -import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3f; - -public class SoulEnchanterTileRenderer extends TileEntityRenderer { +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.BookModel; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.resources.model.Material; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import com.mojang.math.Vector3f; + +public class SoulEnchanterTileRenderer implements BlockEntityRenderer { public static final ResourceLocation BOOK_TEXTURE = new ResourceLocation(Eidolon.MODID, "entity/enchanter_book"); - public static final RenderMaterial BOOK_MATERIAL = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, BOOK_TEXTURE); - private final BookModel model = new BookModel(); + public static final Material BOOK_MATERIAL = new Material(TextureAtlas.LOCATION_BLOCKS, BOOK_TEXTURE); + private final BookModel model; - public SoulEnchanterTileRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { - super(rendererDispatcherIn); + public SoulEnchanterTileRenderer() { + model = new BookModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.BOOK)); } @Override - public void render(SoulEnchanterTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { - matrixStackIn.push(); + public void render(SoulEnchanterTileEntity tileEntityIn, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + matrixStackIn.pushPose(); matrixStackIn.translate(0.5D, 0.75D, 0.5D); float f = ClientEvents.getClientTicks(); - matrixStackIn.translate(0.0D, (double)(0.1F + MathHelper.sin(f * 0.1F) * 0.01F), 0.0D); + matrixStackIn.translate(0.0D, (double)(0.1F + Mth.sin(f * 0.1F) * 0.01F), 0.0D); float f1; for(f1 = tileEntityIn.nextPageAngle - tileEntityIn.pageAngle; f1 >= (float)Math.PI; f1 -= ((float)Math.PI * 2F)) { @@ -43,15 +42,15 @@ public void render(SoulEnchanterTileEntity tileEntityIn, float partialTicks, Mat } float f2 = tileEntityIn.pageAngle + f1 * partialTicks; - matrixStackIn.rotate(Vector3f.YP.rotation(-f2)); - matrixStackIn.rotate(Vector3f.ZP.rotationDegrees(80.0F)); - float f3 = MathHelper.lerp(partialTicks, tileEntityIn.field_195524_g, tileEntityIn.field_195523_f); - float f4 = MathHelper.frac(f3 + 0.25F) * 1.6F - 0.3F; - float f5 = MathHelper.frac(f3 + 0.75F) * 1.6F - 0.3F; - float f6 = MathHelper.lerp(partialTicks, tileEntityIn.pageTurningSpeed, tileEntityIn.nextPageTurningSpeed); - this.model.setBookState(f, MathHelper.clamp(f4, 0.0F, 1.0F), MathHelper.clamp(f5, 0.0F, 1.0F), f6); - IVertexBuilder ivertexbuilder = BOOK_MATERIAL.getBuffer(bufferIn, RenderType::getEntitySolid); - this.model.renderAll(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn, 1.0F, 1.0F, 1.0F, 1.0F); - matrixStackIn.pop(); + matrixStackIn.mulPose(Vector3f.YP.rotation(-f2)); + matrixStackIn.mulPose(Vector3f.ZP.rotationDegrees(80.0F)); + float f3 = Mth.lerp(partialTicks, tileEntityIn.oFlip, tileEntityIn.flip); + float f4 = Mth.frac(f3 + 0.25F) * 1.6F - 0.3F; + float f5 = Mth.frac(f3 + 0.75F) * 1.6F - 0.3F; + float f6 = Mth.lerp(partialTicks, tileEntityIn.pageTurningSpeed, tileEntityIn.nextPageTurningSpeed); + this.model.setupAnim(f, Mth.clamp(f4, 0.0F, 1.0F), Mth.clamp(f5, 0.0F, 1.0F), f6); + VertexConsumer ivertexbuilder = BOOK_MATERIAL.buffer(bufferIn, RenderType::entitySolid); + this.model.render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn, 1.0F, 1.0F, 1.0F, 1.0F); + matrixStackIn.popPose(); } } diff --git a/src/main/java/elucent/eidolon/tile/TileEntityBase.java b/src/main/java/elucent/eidolon/tile/TileEntityBase.java index 2e6ecda..61e4963 100644 --- a/src/main/java/elucent/eidolon/tile/TileEntityBase.java +++ b/src/main/java/elucent/eidolon/tile/TileEntityBase.java @@ -2,54 +2,56 @@ import elucent.eidolon.network.Networking; import elucent.eidolon.network.TESyncPacket; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.play.server.SUpdateTileEntityPacket; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.PacketDistributor; - -public class TileEntityBase extends TileEntity { - public TileEntityBase(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.network.PacketDistributor; +import net.minecraft.world.entity.player.Player; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; + +public class TileEntityBase extends BlockEntity { + public TileEntityBase(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { + super(tileEntityTypeIn, pos, state); } public void onDestroyed(BlockState state, BlockPos pos) { invalidateCaps(); } - public ActionResultType onActivated(BlockState state, BlockPos pos, PlayerEntity player, Hand hand) { - return ActionResultType.PASS; + public InteractionResult onActivated(BlockState state, BlockPos pos, Player player, InteractionHand hand) { + return InteractionResult.PASS; } public void sync() { - markDirty(); - if (world.isRemote) - Networking.INSTANCE.sendToServer(new TESyncPacket(pos, write(new CompoundNBT()))); - else - Networking.INSTANCE.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), new TESyncPacket(pos, write(new CompoundNBT()))); + setChanged(); +// if (level.isClientSide) +// Networking.INSTANCE.sendToServer(new TESyncPacket(worldPosition, save(new CompoundTag()))); +// else + CompoundTag tag = new CompoundTag(); + saveAdditional(tag); + Networking.INSTANCE.send(PacketDistributor.TRACKING_CHUNK.with(() -> level.getChunkAt(worldPosition)), new TESyncPacket(worldPosition, tag)); } @Override - public CompoundNBT getUpdateTag() { - return this.write(new CompoundNBT()); + public CompoundTag getUpdateTag() { + CompoundTag tag = new CompoundTag(); + this.saveAdditional(tag); + return tag; } @Override - public SUpdateTileEntityPacket getUpdatePacket() { - return new SUpdateTileEntityPacket(this.pos, 3, this.getUpdateTag()); + public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this, (e) -> e.getUpdateTag()); // (this.worldPosition, 3, this.getUpdateTag()); } @Override - public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { super.onDataPacket(net, pkt); - handleUpdateTag(world.getBlockState(pkt.getPos()), pkt.getNbtCompound()); + handleUpdateTag(pkt.getTag()); } } diff --git a/src/main/java/elucent/eidolon/tile/WoodenStandTileEntity.java b/src/main/java/elucent/eidolon/tile/WoodenStandTileEntity.java index 284bfeb..f60a663 100644 --- a/src/main/java/elucent/eidolon/tile/WoodenStandTileEntity.java +++ b/src/main/java/elucent/eidolon/tile/WoodenStandTileEntity.java @@ -1,41 +1,37 @@ package elucent.eidolon.tile; +import java.util.Arrays; + +import javax.annotation.Nullable; + import elucent.eidolon.Eidolon; import elucent.eidolon.Registry; import elucent.eidolon.block.WoodenStandBlock; import elucent.eidolon.gui.WoodenBrewingStandContainer; -import net.minecraft.block.BlockState; -import net.minecraft.block.BrewingStandBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.inventory.InventoryHelper; -import net.minecraft.inventory.ItemStackHelper; -import net.minecraft.inventory.container.Container; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.potion.PotionBrewing; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.LockableTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Direction; -import net.minecraft.util.IIntArray; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.IBlockReader; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.BrewingStandBlock; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.Containers; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.alchemy.PotionBrewing; +import net.minecraft.world.level.block.entity.BaseContainerBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.Direction; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.core.NonNullList; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraftforge.common.Tags; -import net.minecraftforge.common.brewing.BrewingRecipeRegistry; -import javax.annotation.Nullable; -import java.util.Arrays; - -public class WoodenStandTileEntity extends LockableTileEntity implements ISidedInventory, ITickableTileEntity { +public class WoodenStandTileEntity extends BaseContainerBlockEntity implements WorldlyContainer { private static final int[] SLOTS_FOR_UP = new int[]{3}; private static final int[] SLOTS_FOR_DOWN = new int[]{0, 1, 2, 3}; private static final int[] OUTPUT_SLOTS = new int[]{0, 1, 2}; @@ -43,7 +39,7 @@ public class WoodenStandTileEntity extends LockableTileEntity implements ISidedI private int brewTime, heat; private boolean[] filledSlots; private Item ingredientID; - public final IIntArray field_213954_a = new IIntArray() { + public final ContainerData dataAccess = new ContainerData() { public int get(int index) { switch(index) { case 0: @@ -65,22 +61,22 @@ public void set(int index, int value) { } } - public int size() { + public int getCount() { return 2; } }; - public WoodenStandTileEntity() { - super(Registry.WOODEN_STAND_TILE_ENTITY); + public WoodenStandTileEntity(BlockPos pos, BlockState state) { + super(Registry.WOODEN_STAND_TILE_ENTITY, pos, state); } @Override - protected ITextComponent getDefaultName() { - return new TranslationTextComponent("container." + Eidolon.MODID + ".wooden_brewing_stand"); + protected Component getDefaultName() { + return new TranslatableComponent("container." + Eidolon.MODID + ".wooden_brewing_stand"); } @Override - public int getSizeInventory() { + public int getContainerSize() { return this.brewingItemStacks.size(); } @@ -95,17 +91,16 @@ public boolean isEmpty() { return true; } - @Override public void tick() { boolean flag = this.canBrew(); boolean flag1 = this.brewTime > 0; ItemStack itemstack1 = this.brewingItemStacks.get(3); - if (world.getGameTime() % 20 == 0) { - TileEntity below = world.getTileEntity(pos.down()); + if (level.getGameTime() % 20 == 0) { + BlockEntity below = level.getBlockEntity(worldPosition.below()); if (below instanceof CrucibleTileEntity) { int prevHeat = heat; heat = ((CrucibleTileEntity)below).boiling ? 1 : 0; - if (prevHeat != heat) markDirty(); + if (prevHeat != heat) setChanged(); } } if (flag1) { @@ -113,34 +108,34 @@ public void tick() { boolean flag2 = this.brewTime == 0; if (flag2 && flag) { this.brewPotions(); - this.markDirty(); + this.setChanged(); } else if (!flag || heat == 0) { this.brewTime = 0; - this.markDirty(); + this.setChanged(); } else if (this.ingredientID != itemstack1.getItem()) { this.brewTime = 0; - this.markDirty(); + this.setChanged(); } } else if (flag && heat > 0) { this.brewTime = 800; this.ingredientID = itemstack1.getItem(); - this.markDirty(); + this.setChanged(); } - if (!this.world.isRemote) { + if (!this.level.isClientSide) { boolean[] aboolean = this.createFilledSlotsArray(); if (!Arrays.equals(aboolean, this.filledSlots)) { this.filledSlots = aboolean; - BlockState blockstate = this.world.getBlockState(this.getPos()); + BlockState blockstate = this.level.getBlockState(this.getBlockPos()); if (!(blockstate.getBlock() instanceof WoodenStandBlock)) { return; } for(int i = 0; i < BrewingStandBlock.HAS_BOTTLE.length; ++i) { - blockstate = blockstate.with(BrewingStandBlock.HAS_BOTTLE[i], Boolean.valueOf(aboolean[i])); + blockstate = blockstate.setValue(BrewingStandBlock.HAS_BOTTLE[i], Boolean.valueOf(aboolean[i])); } - this.world.setBlockState(this.pos, blockstate, 2); + this.level.setBlock(this.worldPosition, blockstate, 2); } } } @@ -162,12 +157,12 @@ private boolean canBrew() { if (!itemstack.isEmpty()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, itemstack, OUTPUT_SLOTS); // divert to VanillaBrewingRegistry if (itemstack.isEmpty()) { return false; - } else if (!PotionBrewing.isReagent(itemstack)) { + } else if (!PotionBrewing.isIngredient(itemstack)) { return false; } else { for(int i = 0; i < 3; ++i) { ItemStack itemstack1 = this.brewingItemStacks.get(i); - if (!itemstack1.isEmpty() && PotionBrewing.hasConversions(itemstack1, itemstack)) { + if (!itemstack1.isEmpty() && PotionBrewing.hasMix(itemstack1, itemstack)) { return true; } } @@ -182,55 +177,54 @@ private void brewPotions() { net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, itemstack, OUTPUT_SLOTS); net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); - BlockPos blockpos = this.getPos(); + BlockPos blockpos = this.getBlockPos(); if (itemstack.hasContainerItem()) { ItemStack itemstack1 = itemstack.getContainerItem(); itemstack.shrink(1); if (itemstack.isEmpty()) { itemstack = itemstack1; - } else if (!this.world.isRemote) { - InventoryHelper.spawnItemStack(this.world, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), itemstack1); + } else if (!this.level.isClientSide) { + Containers.dropItemStack(this.level, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), itemstack1); } } else itemstack.shrink(1); this.brewingItemStacks.set(3, itemstack); - this.world.playEvent(1035, blockpos, 0); + this.level.levelEvent(1035, blockpos, 0); } @Override - public void read(BlockState state, CompoundNBT nbt) { - super.read(state, nbt); - this.brewingItemStacks = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY); - ItemStackHelper.loadAllItems(nbt, this.brewingItemStacks); + public void load(CompoundTag nbt) { + super.load(nbt); + this.brewingItemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + ContainerHelper.loadAllItems(nbt, this.brewingItemStacks); this.brewTime = nbt.getShort("BrewTime"); } @Override - public CompoundNBT write(CompoundNBT compound) { - super.write(compound); + public void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); compound.putShort("BrewTime", (short)this.brewTime); - ItemStackHelper.saveAllItems(compound, this.brewingItemStacks); - return compound; + ContainerHelper.saveAllItems(compound, this.brewingItemStacks); } @Override - public ItemStack getStackInSlot(int index) { + public ItemStack getItem(int index) { return index >= 0 && index < this.brewingItemStacks.size() ? this.brewingItemStacks.get(index) : ItemStack.EMPTY; } @Override - public ItemStack decrStackSize(int index, int count) { - return ItemStackHelper.getAndSplit(this.brewingItemStacks, index, count); + public ItemStack removeItem(int index, int count) { + return ContainerHelper.removeItem(this.brewingItemStacks, index, count); } @Override - public ItemStack removeStackFromSlot(int index) { - return ItemStackHelper.getAndRemove(this.brewingItemStacks, index); + public ItemStack removeItemNoUpdate(int index) { + return ContainerHelper.takeItem(this.brewingItemStacks, index); } @Override - public void setInventorySlotContents(int index, ItemStack stack) { + public void setItem(int index, ItemStack stack) { if (index >= 0 && index < this.brewingItemStacks.size()) { this.brewingItemStacks.set(index, stack); } @@ -238,22 +232,22 @@ public void setInventorySlotContents(int index, ItemStack stack) { } @Override - public boolean isUsableByPlayer(PlayerEntity player) { - if (this.world.getTileEntity(this.pos) != this) { + public boolean stillValid(Player player) { + if (this.level.getBlockEntity(this.worldPosition) != this) { return false; } else { - return !(player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) > 64.0D); + return !(player.distanceToSqr((double)this.worldPosition.getX() + 0.5D, (double)this.worldPosition.getY() + 0.5D, (double)this.worldPosition.getZ() + 0.5D) > 64.0D); } } @Override - public boolean isItemValidForSlot(int index, ItemStack stack) { + public boolean canPlaceItem(int index, ItemStack stack) { if (index == 3) { return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack) && !Tags.Items.DUSTS_REDSTONE.contains(stack.getItem()) && !Tags.Items.DUSTS_GLOWSTONE.contains(stack.getItem()); } else { - return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack) && this.getStackInSlot(index).isEmpty(); + return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack) && this.getItem(index).isEmpty(); } } @@ -267,12 +261,12 @@ public int[] getSlotsForFace(Direction side) { } @Override - public boolean canInsertItem(int index, ItemStack itemStackIn, @Nullable Direction direction) { - return this.isItemValidForSlot(index, itemStackIn); + public boolean canPlaceItemThroughFace(int index, ItemStack itemStackIn, @Nullable Direction direction) { + return this.canPlaceItem(index, itemStackIn); } @Override - public boolean canExtractItem(int index, ItemStack stack, Direction direction) { + public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) { if (index == 3) { return stack.getItem() == Items.GLASS_BOTTLE; } else { @@ -281,13 +275,13 @@ public boolean canExtractItem(int index, ItemStack stack, Direction direction) { } @Override - public void clear() { + public void clearContent() { this.brewingItemStacks.clear(); } @Override - public Container createMenu(int id, PlayerInventory player) { - return new WoodenBrewingStandContainer(id, player, this, this.field_213954_a); + public AbstractContainerMenu createMenu(int id, Inventory player) { + return new WoodenBrewingStandContainer(id, player, this, this.dataAccess); } net.minecraftforge.common.util.LazyOptional[] handlers = @@ -295,7 +289,7 @@ public Container createMenu(int id, PlayerInventory player) { @Override public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { - if (!this.removed && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (!this.remove && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { if (facing == Direction.UP) return handlers[0].cast(); else if (facing == Direction.DOWN) @@ -307,8 +301,8 @@ else if (facing == Direction.DOWN) } @Override - public void remove() { - super.remove(); + public void setRemoved() { + super.setRemoved(); for (int x = 0; x < handlers.length; x++) handlers[x].invalidate(); } diff --git a/src/main/java/elucent/eidolon/tile/reagent/CisternTileEntity.java b/src/main/java/elucent/eidolon/tile/reagent/CisternTileEntity.java new file mode 100644 index 0000000..098a640 --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/reagent/CisternTileEntity.java @@ -0,0 +1,83 @@ +package elucent.eidolon.tile.reagent; + +import elucent.eidolon.Registry; +import elucent.eidolon.block.PillarBlockBase; +import elucent.eidolon.reagent.ReagentStack; +import elucent.eidolon.reagent.ReagentTank; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; + +public class CisternTileEntity extends ReagentTankTileEntity { + float upPressure = 0, downPressure = 0; + + public static class CisternTank extends ReagentTank { + public CisternTileEntity tile; + + public CisternTank(CisternTileEntity tile, int capacity) { + super(capacity); + this.tile = tile; + } + + @Override + public boolean canFill(ReagentStack stack) { + CisternTileEntity t = tile; + while (t.getBlockState().getValue(PillarBlockBase.BOTTOM)) { + BlockEntity nt = t.level.getBlockEntity(t.worldPosition.below()); + if (nt instanceof CisternTileEntity) t = (CisternTileEntity)nt; + else break; + } + return t.tank.getContents().isEmpty() || t.tank.getContents().reagent == stack.reagent; + } + } + + public CisternTileEntity(BlockPos pos, BlockState state) { + this(Registry.CISTERN_TILE_ENTITY, pos, state); + } + + public CisternTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state, 2048); + tank = new CisternTank(this, 2048); + // tank.fill(world, pos, new ReagentStack(ReagentRegistry.CRIMSOL, 2048)); + } + + @Override + public void tick() { + downPressure = upPressure = 0; + if (getBlockState().getValue(PillarBlockBase.BOTTOM)) { + BlockEntity t = level.getBlockEntity(worldPosition.below()); + if (t instanceof CisternTileEntity) + downPressure = ((CisternTileEntity)t).tank.getPressure(); + if (t instanceof CisternTileEntity + && ((CisternTileEntity)t).tank.getContents().amount < ((CisternTileEntity)t).tank.getCapacity() + && tank.getContents().amount > 0) { + CisternTileEntity c = (CisternTileEntity)t; + int change = tank.getContents().amount; + if (c.tank.getContents().amount + change > c.tank.getCapacity()) + change = c.tank.getCapacity() - c.tank.getContents().amount; + c.tank.fill(level, worldPosition, new ReagentStack(tank.getContents().reagent, change)); + tank.getContents().amount -= change; + c.onContentsChanged(); + onContentsChanged(); + } + } + if (getBlockState().getValue(PillarBlockBase.TOP)) { + BlockEntity t = level.getBlockEntity(worldPosition.above()); + if (t instanceof CisternTileEntity) + upPressure = ((CisternTileEntity)t).tank.getPressure(); + } + super.tick(); + } + + @Override + public boolean isOutput(Direction direction) { + return level.getBlockEntity(worldPosition.relative(direction)) instanceof PipeTileEntity; + } + + @Override + public boolean isInput(Direction direction) { + return true; + } +} diff --git a/src/main/java/elucent/eidolon/tile/reagent/CisternTileRenderer.java b/src/main/java/elucent/eidolon/tile/reagent/CisternTileRenderer.java new file mode 100644 index 0000000..81560ca --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/reagent/CisternTileRenderer.java @@ -0,0 +1,39 @@ +package elucent.eidolon.tile.reagent; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientEvents; +import elucent.eidolon.block.PillarBlockBase; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; + +public class CisternTileRenderer implements BlockEntityRenderer { + + public CisternTileRenderer() {} + + @Override + public void render(CisternTileEntity tile, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + Minecraft mc = Minecraft.getInstance(); + if (tile.getBlockState().getValue(PillarBlockBase.BOTTOM) && tile.downPressure < 1 && tile.tank.getPressure() < 1 / 64f) return; + if (tile.tank.getContents().amount == 0) return; + TextureAtlasSprite water = tile.tank.getContents().reagent.getSprite(); + float fill = (float)tile.tank.getContents().amount / tile.tank.getCapacity(); + if (fill > 1) fill = 1; + float h = 0.625f + + (tile.getBlockState().getValue(PillarBlockBase.BOTTOM) ? 0.1875f : 0) + + (tile.getBlockState().getValue(PillarBlockBase.TOP) ? 0.1875f : 0); + float yoff = tile.getBlockState().getValue(PillarBlockBase.BOTTOM) ? 0 : 0.1875f; + VertexConsumer builder = ClientEvents.getDelayedRender().getBuffer(RenderUtil.VAPOR_TRANSLUCENT); + RenderUtil.vaporCube(matrixStackIn, builder, water, + 0.125f, yoff, 0.125f, + 0.875f, yoff + h * fill, 0.875f, + 255, 255, 255, 255, combinedLightIn, + true, true, + !tile.getBlockState().getValue(PillarBlockBase.BOTTOM), + fill < 1 || tile.upPressure == 0, true, true); + } +} diff --git a/src/main/java/elucent/eidolon/tile/reagent/PipeTileEntity.java b/src/main/java/elucent/eidolon/tile/reagent/PipeTileEntity.java new file mode 100644 index 0000000..25dbebf --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/reagent/PipeTileEntity.java @@ -0,0 +1,29 @@ +package elucent.eidolon.tile.reagent; + +import elucent.eidolon.Registry; +import elucent.eidolon.block.PipeBlock; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; + +public class PipeTileEntity extends ReagentTankTileEntity { + + public PipeTileEntity(BlockPos pos, BlockState state) { + this(Registry.PIPE_TILE_ENTITY, pos, state); + } + + public PipeTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { + super(tileEntityTypeIn, pos, state, 128); + } + + @Override + public boolean isOutput(Direction direction) { + return getBlockState().getValue(PipeBlock.OUT) == direction; + } + + @Override + public boolean isInput(Direction direction) { + return getBlockState().getValue(PipeBlock.IN) == direction; + } +} diff --git a/src/main/java/elucent/eidolon/tile/reagent/PipeTileRenderer.java b/src/main/java/elucent/eidolon/tile/reagent/PipeTileRenderer.java new file mode 100644 index 0000000..1597a16 --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/reagent/PipeTileRenderer.java @@ -0,0 +1,101 @@ +package elucent.eidolon.tile.reagent; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import elucent.eidolon.ClientEvents; +import elucent.eidolon.block.PipeBlock; +import elucent.eidolon.util.RenderUtil; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.core.Direction; + +public class PipeTileRenderer implements BlockEntityRenderer { + + public PipeTileRenderer() {} + + public boolean attached(BlockState b, Direction d) { + return b.getValue(PipeBlock.IN) == d && b.getValue(PipeBlock.IN_ATTACHED) + || b.getValue(PipeBlock.OUT) == d && b.getValue(PipeBlock.OUT_ATTACHED); + } + + static final float L = 0.40625f, U = 0.59375f, W = U - L; + + @Override + public void render(PipeTileEntity tile, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + Minecraft mc = Minecraft.getInstance(); + if (tile.tank.getContents().amount == 0) return; + float fill = (float)tile.tank.getContents().amount / tile.tank.getCapacity(); + if (fill > 1) fill = 1; + BlockState state = tile.getBlockState(); + TextureAtlasSprite water = tile.tank.getContents().reagent.getSprite(); + VertexConsumer builder = ClientEvents.getDelayedRender().getBuffer(RenderUtil.VAPOR_TRANSLUCENT); + boolean nx = state.getValue(PipeBlock.IN) == Direction.WEST || state.getValue(PipeBlock.OUT) == Direction.WEST, + px = state.getValue(PipeBlock.IN) == Direction.EAST || state.getValue(PipeBlock.OUT) == Direction.EAST, + ny = state.getValue(PipeBlock.IN) == Direction.DOWN || state.getValue(PipeBlock.OUT) == Direction.DOWN, + py = state.getValue(PipeBlock.IN) == Direction.UP || state.getValue(PipeBlock.OUT) == Direction.UP, + nz = state.getValue(PipeBlock.IN) == Direction.NORTH || state.getValue(PipeBlock.OUT) == Direction.NORTH, + pz = state.getValue(PipeBlock.IN) == Direction.SOUTH || state.getValue(PipeBlock.OUT) == Direction.SOUTH; + if (py && ny) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, L, L, U, U, U, + 255, 255, 255, 255, combinedLightIn, + !nx, !px, !ny, !py, !nz, !pz); + } + else if (py) { + if (fill < 1) RenderUtil.vaporCube(matrixStackIn, builder, water, + L, L + fill * W, L, U, U, U, + 255, 255, 255, 255, combinedLightIn, + true, true, !ny, !py, true, true); + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, L, L, U, L + fill * W, U, + 255, 255, 255, 255, combinedLightIn, + !nx, !px, !ny, !py, !nz, !pz); + } + else { + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, L, L, U, L + fill * W, U, + 255, 255, 255, 255, combinedLightIn, + !nx, !px, !ny, !py, !nz, !pz); + } + if (nx) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + 0, L, L, L, L + W * fill, U, + 255, 255, 255, 255, combinedLightIn, + !attached(state, Direction.WEST), false, true, true, true, true); + } + if (px) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + U, L, L, 1, L + W * fill, U, + 255, 255, 255, 255, combinedLightIn, + false, !attached(state, Direction.EAST), true, true, true, true); + } + if (ny) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, 0, L, U, L, U, + 255, 255, 255, 255, combinedLightIn, + true, true, !attached(state, Direction.DOWN), false, true, true); + } + if (py) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, U, L, U, 1, U, + 255, 255, 255, 255, combinedLightIn, + true, true, false, !attached(state, Direction.UP), true, true); + } + if (nz) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, L, 0, U, L + W * fill, L, + 255, 255, 255, 255, combinedLightIn, + true, true, true, true, !attached(state, Direction.NORTH), false); + } + if (pz) { + RenderUtil.vaporCube(matrixStackIn, builder, water, + L, L, U, U, L + W * fill, 1, + 255, 255, 255, 255, combinedLightIn, + true, true, true, true, false, !attached(state, Direction.SOUTH)); + } + } +} diff --git a/src/main/java/elucent/eidolon/tile/reagent/ReagentTankTileEntity.java b/src/main/java/elucent/eidolon/tile/reagent/ReagentTankTileEntity.java new file mode 100644 index 0000000..e39d260 --- /dev/null +++ b/src/main/java/elucent/eidolon/tile/reagent/ReagentTankTileEntity.java @@ -0,0 +1,101 @@ +package elucent.eidolon.tile.reagent; + +import java.util.ArrayList; +import java.util.List; + +import elucent.eidolon.reagent.IReagentTankProvider; +import elucent.eidolon.reagent.ReagentStack; +import elucent.eidolon.reagent.ReagentTank; +import elucent.eidolon.tile.TileEntityBase; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.Mth; + +public abstract class ReagentTankTileEntity extends TileEntityBase implements IReagentTankProvider { + ReagentTank tank; + + public ReagentTankTileEntity(BlockEntityType type, BlockPos pos, BlockState state, int capacity) { + super(type, pos, state); + tank = new ReagentTank(capacity); + } + + @Override + public void load(CompoundTag tag) { + super.load(tag); + tank.read(tag.getCompound("tank")); + } + + @Override + public void saveAdditional(CompoundTag tag) { + super.saveAdditional(tag); + tag.put("tank", tank.write()); + } + + public void tick() { + if (tank.getContents().amount == 0) return; + List tanks = new ArrayList<>(); + for (Direction d : Direction.values()) { + if (isOutput(d)) { + BlockEntity t = level.getBlockEntity(worldPosition.relative(d)); + if (t instanceof IReagentTankProvider + && ((IReagentTankProvider)t).isInput(d.getOpposite()) + && ((IReagentTankProvider)t).getTank().canFill(tank.getContents()) + && (((IReagentTankProvider)t).getTank().getPressure() < tank.getPressure() || d == Direction.DOWN)) + tanks.add((IReagentTankProvider)t); + } + } + if (tanks.isEmpty()) return; + float total = tank.getPressure(), count = 1; + for (IReagentTankProvider t : tanks) { + total += t.getTank().getPressure(); + count++; + } + boolean dirty = false; + float avg = total / count; + int shared = (tank.getContents().amount - Mth.ceil(tank.getCapacity() * avg)); + float totalPressure = 0; + for (IReagentTankProvider t : tanks) totalPressure += avg - t.getTank().getPressure(); + int[] toSend = new int[tanks.size()]; + int i = 0; + int sum = 0; + for (IReagentTankProvider t : tanks) { + float minDiff = 2.0f / t.getTank().getCapacity(); + float diff = avg - t.getTank().getPressure(); + if (diff > 0 && diff < minDiff) diff = minDiff; + int change = (int) (shared * ((avg - t.getTank().getPressure()) / totalPressure)); + int needed = (int) (diff * t.getTank().getCapacity()); + toSend[i] = Math.min(64, Math.min(change, needed)); + sum += toSend[i]; + i ++; + } + if (tank.getContents().amount - sum <= tanks.size() * 4) { + for (int j = 0; j < tank.getContents().amount - sum; j ++) toSend[j % tanks.size()] ++; + } + i = 0; + for (IReagentTankProvider t : tanks) { + int change = Math.min(tank.getContents().amount, toSend[i ++]); + if (change > 0) { + if (t.getTank().fill(level, ((BlockEntity) t).getBlockPos(), new ReagentStack(tank.getContents().reagent, change))) { + tank.getContents().amount -= change; + t.onContentsChanged(); + dirty = true; + } + } + } + if (dirty) onContentsChanged(); + } + + @Override + public ReagentTank getTank() { + return tank; + } + + @Override + public void onContentsChanged() { + sync(); + } +} diff --git a/src/main/java/elucent/eidolon/util/ChunkUtil.java b/src/main/java/elucent/eidolon/util/ChunkUtil.java index 493c34e..b055551 100644 --- a/src/main/java/elucent/eidolon/util/ChunkUtil.java +++ b/src/main/java/elucent/eidolon/util/ChunkUtil.java @@ -1,17 +1,17 @@ package elucent.eidolon.util; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; public class ChunkUtil { - public static void load(World world, ChunkPos pos) { - assert !world.isRemote; - ((ServerWorld)world).forceChunk(pos.x, pos.z, true); + public static void load(Level world, ChunkPos pos) { + assert !world.isClientSide; + ((ServerLevel)world).setChunkForced(pos.x, pos.z, true); } - public static void unload(World world, ChunkPos pos) { - assert !world.isRemote; - ((ServerWorld)world).forceChunk(pos.x, pos.z, false); + public static void unload(Level world, ChunkPos pos) { + assert !world.isClientSide; + ((ServerLevel)world).setChunkForced(pos.x, pos.z, false); } } diff --git a/src/main/java/elucent/eidolon/util/ColorUtil.java b/src/main/java/elucent/eidolon/util/ColorUtil.java index 9db19bb..4dd3d87 100644 --- a/src/main/java/elucent/eidolon/util/ColorUtil.java +++ b/src/main/java/elucent/eidolon/util/ColorUtil.java @@ -1,8 +1,5 @@ package elucent.eidolon.util; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - public class ColorUtil { public static int getAlpha(int packedColor) { return packedColor >>> 24; diff --git a/src/main/java/elucent/eidolon/util/EntityUtil.java b/src/main/java/elucent/eidolon/util/EntityUtil.java index edd93fb..fd1cfce 100644 --- a/src/main/java/elucent/eidolon/util/EntityUtil.java +++ b/src/main/java/elucent/eidolon/util/EntityUtil.java @@ -1,13 +1,13 @@ package elucent.eidolon.util; import elucent.eidolon.Eidolon; -import net.minecraft.entity.LivingEntity; +import net.minecraft.world.entity.LivingEntity; public class EntityUtil { public static final String THRALL_KEY = Eidolon.MODID + ":thrall"; public static void enthrall(LivingEntity caster, LivingEntity thrall) { - thrall.getPersistentData().putUniqueId(THRALL_KEY, caster.getUniqueID()); + thrall.getPersistentData().putUUID(THRALL_KEY, caster.getUUID()); } public static boolean isEnthralled(LivingEntity entity) { @@ -15,6 +15,6 @@ public static boolean isEnthralled(LivingEntity entity) { } public static boolean isEnthralledBy(LivingEntity entity, LivingEntity owner) { - return entity != null && owner != null && isEnthralled(entity) && entity.getPersistentData().getUniqueId(THRALL_KEY).equals(owner.getUniqueID()); + return entity != null && owner != null && isEnthralled(entity) && entity.getPersistentData().getUUID(THRALL_KEY).equals(owner.getUUID()); } } diff --git a/src/main/java/elucent/eidolon/util/KnowledgeUtil.java b/src/main/java/elucent/eidolon/util/KnowledgeUtil.java new file mode 100644 index 0000000..974e9f4 --- /dev/null +++ b/src/main/java/elucent/eidolon/util/KnowledgeUtil.java @@ -0,0 +1,157 @@ +package elucent.eidolon.util; + +import elucent.eidolon.capability.IKnowledge; +import elucent.eidolon.network.KnowledgeUpdatePacket; +import elucent.eidolon.network.Networking; +import elucent.eidolon.research.Researches; +import elucent.eidolon.spell.Rune; +import elucent.eidolon.spell.Sign; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.TranslatableComponent; + +public class KnowledgeUtil { + public static void grantSign(Entity entity, Sign sign) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (k.knowsSign(sign)) return; + k.addSign(sign); + + ((ServerPlayer)entity).connection.send(new ClientboundSetActionBarTextPacket(new TranslatableComponent("eidolon.title.new_sign", new TranslatableComponent(sign.getRegistryName().getNamespace() + ".sign." + sign.getRegistryName().getPath())))); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void grantFact(Entity entity, ResourceLocation fact) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (k.knowsFact(fact)) return; + k.addFact(fact); + + ((ServerPlayer)entity).connection.send(new ClientboundSetActionBarTextPacket(new TranslatableComponent("eidolon.title.new_fact"))); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void grantResearch(Entity entity, ResourceLocation research) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (k.knowsResearch(research)) return; + k.addResearch(research); + + ((ServerPlayer)entity).connection.send(new ClientboundSetActionBarTextPacket(new TranslatableComponent("eidolon.title.new_research", ChatFormatting.GOLD + Researches.find(research).getName()))); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void grantRune(Entity entity, Rune rune) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (k.knowsRune(rune)) return; + k.addRune(rune); + + ((ServerPlayer)entity).connection.send(new ClientboundSetActionBarTextPacket(new TranslatableComponent("eidolon.title.new_rune", new TranslatableComponent(rune.getRegistryName().getNamespace() + ".rune." + rune.getRegistryName().getPath())))); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static boolean knowsSign(Player player, Sign sign) { + if (player.getCapability(IKnowledge.INSTANCE).isPresent()) { + return player.getCapability(IKnowledge.INSTANCE).resolve().get().knowsSign(sign); + } + return false; + } + + public static boolean knowsFact(Player player, ResourceLocation fact) { + if (player.getCapability(IKnowledge.INSTANCE).isPresent()) { + return player.getCapability(IKnowledge.INSTANCE).resolve().get().knowsFact(fact); + } + return false; + } + + public static boolean knowsResearch(Player player, ResourceLocation research) { + if (player.getCapability(IKnowledge.INSTANCE).isPresent()) { + return player.getCapability(IKnowledge.INSTANCE).resolve().get().knowsResearch(research); + } + return false; + } + + public static boolean knowsRune(Player player, Rune rune) { + if (player.getCapability(IKnowledge.INSTANCE).isPresent()) { + return player.getCapability(IKnowledge.INSTANCE).resolve().get().knowsRune(rune); + } + return false; + } + + public static void removeSign(Entity entity, Sign sign) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (!k.knowsSign(sign)) return; + k.removeSign(sign); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void removeFact(Entity entity, ResourceLocation fact) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (!k.knowsFact(fact)) return; + k.removeFact(fact); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void removeResearch(Entity entity, ResourceLocation research) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (!k.knowsResearch(research)) return; + k.removeResearch(research); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void removeRune(Entity entity, Rune rune) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + if (!k.knowsRune(rune)) return; + k.removeRune(rune); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void resetSigns(Entity entity) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + k.resetSigns(); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void resetFacts(Entity entity) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + k.resetFacts(); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void resetResearch(Entity entity) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + k.resetResearch(); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } + + public static void resetRunes(Entity entity) { + if (!(entity instanceof ServerPlayer)) return; + entity.getCapability(IKnowledge.INSTANCE, null).ifPresent((k) -> { + k.resetRunes(); + Networking.sendTo((Player)entity, new KnowledgeUpdatePacket((Player)entity, true)); + }); + } +} diff --git a/src/main/java/elucent/eidolon/util/RecipeUtil.java b/src/main/java/elucent/eidolon/util/RecipeUtil.java new file mode 100644 index 0000000..0458df6 --- /dev/null +++ b/src/main/java/elucent/eidolon/util/RecipeUtil.java @@ -0,0 +1,50 @@ +package elucent.eidolon.util; + +import java.util.List; +import java.util.stream.Collectors; + +import net.minecraft.world.level.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.tags.Tag; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.server.ServerLifecycleHooks; + +public class RecipeUtil { + public static RecipeManager getRecipeManager() { + return DistExecutor.unsafeRunForDist( + () -> () -> Minecraft.getInstance().getConnection().getRecipeManager(), + () -> () -> ServerLifecycleHooks.getCurrentServer().getRecipeManager() + ); + } + + public static Ingredient ingredientFromObject(Object object) { + if (object instanceof Item) return Ingredient.of((Item)object); + else if (object instanceof Block) return Ingredient.of(new ItemStack((Block)object)); + else if (object instanceof ItemStack) return Ingredient.of((ItemStack)object); + else if (object instanceof Tag) return Ingredient.of((Tag)object); + else return Ingredient.EMPTY; + } + + public static List ingredientsFromObjects(List objects) { + return objects.stream().map(RecipeUtil::ingredientFromObject).collect(Collectors.toList()); + } + + public static ItemStack stackFromObject(Object object) { + if (object instanceof Item) return new ItemStack((Item)object); + else if (object instanceof Block) return new ItemStack((Block)object); + else if (object instanceof ItemStack) return ((ItemStack)object).copy(); + else if (object instanceof Tag) { + Object first = ((Tag)object).getValues().get(0); + return stackFromObject(first); + } + else return ItemStack.EMPTY; + } + + public static List stacksFromObjects(List objects) { + return objects.stream().map(RecipeUtil::stackFromObject).collect(Collectors.toList()); + } +} diff --git a/src/main/java/elucent/eidolon/util/RenderUtil.java b/src/main/java/elucent/eidolon/util/RenderUtil.java index 48b7cd3..ae06588 100644 --- a/src/main/java/elucent/eidolon/util/RenderUtil.java +++ b/src/main/java/elucent/eidolon/util/RenderUtil.java @@ -1,32 +1,34 @@ package elucent.eidolon.util; -import com.mojang.blaze3d.matrix.MatrixStack; +import java.util.Random; + +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + import elucent.eidolon.ClientEvents; +import elucent.eidolon.ClientRegistry; import elucent.eidolon.Eidolon; -import elucent.eidolon.Events; +import elucent.eidolon.Registry; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.renderer.*; -import net.minecraft.client.renderer.entity.EnderDragonRenderer; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderStateShard; +import net.minecraft.client.renderer.RenderStateShard.ShaderStateShard; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Rotations; -import net.minecraft.util.math.vector.*; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.model.TransformationHelper; -import org.lwjgl.opengl.GL11; - -import java.util.Random; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.math.Matrix4f; +import com.mojang.math.Quaternion; +import net.minecraft.world.phys.Vec3; +import com.mojang.math.Vector3f; public class RenderUtil { - public static final RenderState.TransparencyState ADDITIVE_TRANSPARENCY = new RenderState.TransparencyState("lightning_transparency", () -> { + public static final RenderStateShard.TransparencyStateShard ADDITIVE_TRANSPARENCY = new RenderStateShard.TransparencyStateShard("lightning_transparency", () -> { RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); }, () -> { @@ -34,7 +36,7 @@ public class RenderUtil { RenderSystem.defaultBlendFunc(); }); - public static final RenderState.TransparencyState NORMAL_TRANSPARENCY = new RenderState.TransparencyState("lightning_transparency", () -> { + public static final RenderStateShard.TransparencyStateShard NORMAL_TRANSPARENCY = new RenderStateShard.TransparencyStateShard("lightning_transparency", () -> { RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); }, () -> { @@ -42,102 +44,129 @@ public class RenderUtil { RenderSystem.defaultBlendFunc(); }); - public static RenderType GLOWING_SPRITE = RenderType.makeType( +// @OnlyIn(Dist.CLIENT) +// public static class RescaledLightingState extends RenderStateShard.DiffuseLightingStateShard { +// public RescaledLightingState() { +// super(true); +// } +// +// @Override +// public void setupRenderState() { +// RenderSystem.enableLighting(); +// RenderSystem.enableRescaleNormal(); +// } +// +// @Override +// public void clearRenderState() { +// RenderSystem.disableLighting(); +// RenderSystem.disableRescaleNormal(); +// } +// } + + public static RenderType GLOWING_SPRITE = RenderType.create( Eidolon.MODID + ":glowing_sprite", - DefaultVertexFormats.POSITION_COLOR_TEX, - GL11.GL_QUADS, 256, - RenderType.State.getBuilder() - .shadeModel(new RenderState.ShadeModelState(false)) - .writeMask(new RenderState.WriteMaskState(true, false)) - .lightmap(new RenderState.LightmapState(false)) - .diffuseLighting(new RenderState.DiffuseLightingState(false)) - .transparency(ADDITIVE_TRANSPARENCY) - .texture(new RenderState.TextureState(AtlasTexture.LOCATION_BLOCKS_TEXTURE, false, false)) - .build(false) - ), GLOWING = RenderType.makeType( + DefaultVertexFormat.POSITION_TEX_COLOR, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setWriteMaskState(new RenderStateShard.WriteMaskStateShard(true, false)) + .setLightmapState(new RenderStateShard.LightmapStateShard(false)) + .setTransparencyState(ADDITIVE_TRANSPARENCY) + .setTextureState(new RenderStateShard.TextureStateShard(TextureAtlas.LOCATION_BLOCKS, false, false)) + .setShaderState(new ShaderStateShard(ClientRegistry::getGlowingSpriteShader)) + .createCompositeState(false) + ), GLOWING = RenderType.create( Eidolon.MODID + ":glowing", - DefaultVertexFormats.POSITION_COLOR, - GL11.GL_QUADS, 256, - RenderType.State.getBuilder() - .shadeModel(new RenderState.ShadeModelState(true)) - .writeMask(new RenderState.WriteMaskState(true, false)) - .lightmap(new RenderState.LightmapState(false)) - .diffuseLighting(new RenderState.DiffuseLightingState(false)) - .transparency(ADDITIVE_TRANSPARENCY) - .build(false) - ), DELAYED_PARTICLE = RenderType.makeType( + DefaultVertexFormat.POSITION_COLOR, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setWriteMaskState(new RenderStateShard.WriteMaskStateShard(true, false)) + .setLightmapState(new RenderStateShard.LightmapStateShard(false)) + .setTransparencyState(ADDITIVE_TRANSPARENCY) + .setShaderState(new ShaderStateShard(ClientRegistry::getGlowingShader)) + .createCompositeState(false) + ), DELAYED_PARTICLE = RenderType.create( Eidolon.MODID + ":delayed_particle", - DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP, - GL11.GL_QUADS, 256, - RenderType.State.getBuilder() - .shadeModel(new RenderState.ShadeModelState(true)) - .writeMask(new RenderState.WriteMaskState(true, false)) - .lightmap(new RenderState.LightmapState(false)) - .diffuseLighting(new RenderState.DiffuseLightingState(false)) - .transparency(NORMAL_TRANSPARENCY) - .texture(new RenderState.TextureState(AtlasTexture.LOCATION_PARTICLES_TEXTURE, false, false)) - .build(false) - ), GLOWING_PARTICLE = RenderType.makeType( + DefaultVertexFormat.PARTICLE, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setWriteMaskState(new RenderStateShard.WriteMaskStateShard(true, false)) + .setTransparencyState(NORMAL_TRANSPARENCY) + .setTextureState(new RenderStateShard.TextureStateShard(TextureAtlas.LOCATION_PARTICLES, false, false)) + .setShaderState(new ShaderStateShard(ClientRegistry::getSpriteParticleShader)) + .createCompositeState(false) + ), GLOWING_PARTICLE = RenderType.create( Eidolon.MODID + ":glowing_particle", - DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP, - GL11.GL_QUADS, 256, - RenderType.State.getBuilder() - .shadeModel(new RenderState.ShadeModelState(true)) - .writeMask(new RenderState.WriteMaskState(true, false)) - .lightmap(new RenderState.LightmapState(false)) - .diffuseLighting(new RenderState.DiffuseLightingState(false)) - .transparency(ADDITIVE_TRANSPARENCY) - .texture(new RenderState.TextureState(AtlasTexture.LOCATION_PARTICLES_TEXTURE, false, false)) - .build(false) - ), GLOWING_BLOCK_PARTICLE = RenderType.makeType( + DefaultVertexFormat.PARTICLE, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setWriteMaskState(new RenderStateShard.WriteMaskStateShard(true, false)) + .setLightmapState(new RenderStateShard.LightmapStateShard(false)) + .setTransparencyState(ADDITIVE_TRANSPARENCY) + .setTextureState(new RenderStateShard.TextureStateShard(TextureAtlas.LOCATION_PARTICLES, false, false)) + .setShaderState(new ShaderStateShard(ClientRegistry::getGlowingParticleShader)) + .createCompositeState(false) + ), GLOWING_BLOCK_PARTICLE = RenderType.create( Eidolon.MODID + ":glowing_particle", - DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP, - GL11.GL_QUADS, 256, - RenderType.State.getBuilder() - .shadeModel(new RenderState.ShadeModelState(true)) - .writeMask(new RenderState.WriteMaskState(true, false)) - .lightmap(new RenderState.LightmapState(false)) - .diffuseLighting(new RenderState.DiffuseLightingState(false)) - .transparency(ADDITIVE_TRANSPARENCY) - .texture(new RenderState.TextureState(AtlasTexture.LOCATION_BLOCKS_TEXTURE, false, false)) - .build(false) + DefaultVertexFormat.PARTICLE, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setWriteMaskState(new RenderStateShard.WriteMaskStateShard(true, false)) + .setLightmapState(new RenderStateShard.LightmapStateShard(false)) + .setTransparencyState(ADDITIVE_TRANSPARENCY) + .setTextureState(new RenderStateShard.TextureStateShard(TextureAtlas.LOCATION_BLOCKS, false, false)) + .setShaderState(new ShaderStateShard(ClientRegistry::getGlowingParticleShader)) + .createCompositeState(false) + ), VAPOR_TRANSLUCENT = RenderType.create( + Eidolon.MODID + ":vapor_translucent", + DefaultVertexFormat.BLOCK, + Mode.QUADS, 256, true, false, + RenderType.CompositeState.builder() + .setLightmapState(new RenderStateShard.LightmapStateShard(false)) + .setTransparencyState(NORMAL_TRANSPARENCY) + .setTextureState(new RenderStateShard.TextureStateShard(TextureAtlas.LOCATION_BLOCKS, false, false)) + .setShaderState(new ShaderStateShard(ClientRegistry::getVaporShader)) + .createCompositeState(false) ); static double ticks = 0; - public static void litQuad(MatrixStack mStack, IRenderTypeBuffer buffer, double x, double y, double w, double h, float r, float g, float b, TextureAtlasSprite sprite) { - IVertexBuilder builder = buffer.getBuffer(GLOWING_SPRITE); - - float f7 = sprite.getMinU(); - float f8 = sprite.getMaxU(); - float f5 = sprite.getMinV(); - float f6 = sprite.getMaxV(); - Matrix4f mat = mStack.getLast().getMatrix(); - builder.pos(mat, (float)x, (float)y + (float)h, 0).color(r, g, b, 1.0f).tex(f7, f6).endVertex(); - builder.pos(mat, (float)x + (float)w, (float)y + (float)h, 0).color(r, g, b, 1.0f).tex(f8, f6).endVertex(); - builder.pos(mat, (float)x + (float)w, (float)y, 0).color(r, g, b, 1.0f).tex(f8, f5).endVertex(); - builder.pos(mat, (float)x, (float)y, 0).color(r, g, b, 1.0f).tex(f7, f5).endVertex(); + public static void litQuad(PoseStack mStack, MultiBufferSource buffer, double x, double y, double w, double h, float r, float g, float b, float a, TextureAtlasSprite sprite) { + VertexConsumer builder = buffer.getBuffer(GLOWING_SPRITE); + + float f7 = sprite.getU0(); + float f8 = sprite.getU1(); + float f5 = sprite.getV0(); + float f6 = sprite.getV1(); + Matrix4f mat = mStack.last().pose(); + builder.vertex(mat, (float)x, (float)y + (float)h, 0).uv(f7, f6).color(r, g, b, a).endVertex(); + builder.vertex(mat, (float)x + (float)w, (float)y + (float)h, 0).uv(f8, f6).color(r, g, b, a).endVertex(); + builder.vertex(mat, (float)x + (float)w, (float)y, 0).uv(f8, f5).color(r, g, b, a).endVertex(); + builder.vertex(mat, (float)x, (float)y, 0).uv(f7, f5).color(r, g, b, a).endVertex(); + } + + public static void litQuad(PoseStack mStack, MultiBufferSource buffer, double x, double y, double w, double h, float r, float g, float b, TextureAtlasSprite sprite) { + litQuad(mStack, buffer, x, y, w, h, r, g, b, 1.0f, sprite); } - public static void litQuad(MatrixStack mStack, IRenderTypeBuffer buffer, double x, double y, double w, double h, float r, float g, float b, float u, float v, float uw, float vh) { - IVertexBuilder builder = buffer.getBuffer(GLOWING_SPRITE); + public static void litQuad(PoseStack mStack, MultiBufferSource buffer, double x, double y, double w, double h, float r, float g, float b, float u, float v, float uw, float vh) { + VertexConsumer builder = buffer.getBuffer(GLOWING_SPRITE); - Matrix4f mat = mStack.getLast().getMatrix(); - builder.pos(mat, (float)x, (float)y + (float)h, 0).color(r, g, b, 1.0f).tex(u, v + vh).endVertex(); - builder.pos(mat, (float)x + (float)w, (float)y + (float)h, 0).color(r, g, b, 1.0f).tex(u + uw, v + vh).endVertex(); - builder.pos(mat, (float)x + (float)w, (float)y, 0).color(r, g, b, 1.0f).tex(u + uw, v).endVertex(); - builder.pos(mat, (float)x, (float)y, 0).color(r, g, b, 1.0f).tex(u, v).endVertex(); + Matrix4f mat = mStack.last().pose(); + builder.vertex(mat, (float)x, (float)y + (float)h, 0).uv(u, v + vh).color(r, g, b, 1.0f).endVertex(); + builder.vertex(mat, (float)x + (float)w, (float)y + (float)h, 0).uv(u + uw, v + vh).color(r, g, b, 1.0f).endVertex(); + builder.vertex(mat, (float)x + (float)w, (float)y, 0).uv(u + uw, v).color(r, g, b, 1.0f).endVertex(); + builder.vertex(mat, (float)x, (float)y, 0).uv(u, v).color(r, g, b, 1.0f).endVertex(); } - public static void litBillboard(MatrixStack mStack, IRenderTypeBuffer buffer, double x, double y, double z, float r, float g, float b, TextureAtlasSprite sprite) { - IVertexBuilder builder = buffer.getBuffer(GLOWING_SPRITE); - ActiveRenderInfo renderInfo = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); - Vector3d vector3d = renderInfo.getProjectedView(); - float partialTicks = Minecraft.getInstance().getRenderPartialTicks(); + public static void litBillboard(PoseStack mStack, MultiBufferSource buffer, double x, double y, double z, float r, float g, float b, TextureAtlasSprite sprite) { + VertexConsumer builder = buffer.getBuffer(GLOWING_SPRITE); + Camera renderInfo = Minecraft.getInstance().gameRenderer.getMainCamera(); + Vec3 vector3d = renderInfo.getPosition(); + float partialTicks = Minecraft.getInstance().getFrameTime(); float f = (float)(x); float f1 = (float)(y); float f2 = (float)(z); - Quaternion quaternion = renderInfo.getRotation(); + Quaternion quaternion = renderInfo.rotation(); Vector3f[] avector3f = new Vector3f[]{new Vector3f(-0.5f, -0.5f, 0.0f), new Vector3f(-0.5f, 0.5f, 0.0f), new Vector3f(0.5f, 0.5f, 0.0f), new Vector3f(0.5f, -0.5f, 0.0f)}; float f4 = 1.0f; @@ -149,59 +178,102 @@ public static void litBillboard(MatrixStack mStack, IRenderTypeBuffer buffer, do vector3f.add(f, f1, f2); } - float f7 = sprite.getMinU(); - float f8 = sprite.getMaxU(); - float f5 = sprite.getMinV(); - float f6 = sprite.getMaxV(); - Matrix4f mat = mStack.getLast().getMatrix(); - builder.pos(mat, avector3f[0].getX(), avector3f[0].getY(), avector3f[0].getZ()).color(r, g, b, 1.0f).tex(f8, f6).endVertex(); - builder.pos(mat, avector3f[1].getX(), avector3f[1].getY(), avector3f[1].getZ()).color(r, g, b, 1.0f).tex(f8, f5).endVertex(); - builder.pos(mat, avector3f[2].getX(), avector3f[2].getY(), avector3f[2].getZ()).color(r, g, b, 1.0f).tex(f7, f5).endVertex(); - builder.pos(mat, avector3f[3].getX(), avector3f[3].getY(), avector3f[3].getZ()).color(r, g, b, 1.0f).tex(f7, f6).endVertex(); + float f7 = sprite.getU0(); + float f8 = sprite.getU1(); + float f5 = sprite.getV0(); + float f6 = sprite.getV1(); + Matrix4f mat = mStack.last().pose(); + builder.vertex(mat, avector3f[0].x(), avector3f[0].y(), avector3f[0].z()).uv(f8, f6).color(r, g, b, 1.0f).endVertex(); + builder.vertex(mat, avector3f[1].x(), avector3f[1].y(), avector3f[1].z()).uv(f8, f5).color(r, g, b, 1.0f).endVertex(); + builder.vertex(mat, avector3f[2].x(), avector3f[2].y(), avector3f[2].z()).uv(f7, f5).color(r, g, b, 1.0f).endVertex(); + builder.vertex(mat, avector3f[3].x(), avector3f[3].y(), avector3f[3].z()).uv(f7, f6).color(r, g, b, 1.0f).endVertex(); } - public static void dragon(MatrixStack mStack, IRenderTypeBuffer buf, double x, double y, double z, float radius, float r, float g, float b) { + public static void dragon(PoseStack mStack, MultiBufferSource buf, double x, double y, double z, float radius, float r, float g, float b) { float f5 = 0.5f; // max number of beams float f7 = Math.min(f5 > 0.8F ? (f5 - 0.8F) / 0.2F : 0.0F, 1.0F); Random random = new Random(432L); - IVertexBuilder builder = buf.getBuffer(GLOWING); - mStack.push(); + VertexConsumer builder = buf.getBuffer(GLOWING); + mStack.pushPose(); mStack.translate(x, y, z); float rotation = (float)(ClientEvents.getClientTicks() / 200); for(int i = 0; (float)i < (f5 + f5 * f5) / 2.0F * 60.0F; ++i) { - mStack.rotate(Vector3f.XP.rotationDegrees(random.nextFloat() * 360.0F)); - mStack.rotate(Vector3f.YP.rotationDegrees(random.nextFloat() * 360.0F)); - mStack.rotate(Vector3f.ZP.rotationDegrees(random.nextFloat() * 360.0F)); - mStack.rotate(Vector3f.XP.rotationDegrees(random.nextFloat() * 360.0F)); - mStack.rotate(Vector3f.YP.rotationDegrees(random.nextFloat() * 360.0F)); - mStack.rotate(Vector3f.ZP.rotationDegrees(random.nextFloat() * 360.0F + rotation * 90.0F)); + mStack.mulPose(Vector3f.XP.rotationDegrees(random.nextFloat() * 360.0F)); + mStack.mulPose(Vector3f.YP.rotationDegrees(random.nextFloat() * 360.0F)); + mStack.mulPose(Vector3f.ZP.rotationDegrees(random.nextFloat() * 360.0F)); + mStack.mulPose(Vector3f.XP.rotationDegrees(random.nextFloat() * 360.0F)); + mStack.mulPose(Vector3f.YP.rotationDegrees(random.nextFloat() * 360.0F)); + mStack.mulPose(Vector3f.ZP.rotationDegrees(random.nextFloat() * 360.0F + rotation * 90.0F)); float f3 = random.nextFloat() * 20.0F + 5.0F + f7 * 10.0F; float f4 = random.nextFloat() * 2.0F + 1.0F + f7 * 2.0F; f3 *= 0.05f * radius; f4 *= 0.05f * radius; - Matrix4f mat = mStack.getLast().getMatrix(); + Matrix4f mat = mStack.last().pose(); float alpha = 1 - f7; - builder.pos(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); - builder.pos(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); - builder.pos(mat, -ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); - builder.pos(mat, ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); - builder.pos(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); - builder.pos(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); - builder.pos(mat, ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); - builder.pos(mat, 0.0F, f3, 1.0F * f4).color(r, g, b, 0).endVertex(); - builder.pos(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); - builder.pos(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); - builder.pos(mat, 0.0F, f3, 1.0F * f4).color(r, g, b, 0).endVertex(); - builder.pos(mat, -ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); + builder.vertex(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); + builder.vertex(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); + builder.vertex(mat, -ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); + builder.vertex(mat, ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); + builder.vertex(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); + builder.vertex(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); + builder.vertex(mat, ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); + builder.vertex(mat, 0.0F, f3, 1.0F * f4).color(r, g, b, 0).endVertex(); + builder.vertex(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); + builder.vertex(mat, 0.0F, 0.0F, 0.0F).color(r, g, b, alpha).endVertex(); + builder.vertex(mat, 0.0F, f3, 1.0F * f4).color(r, g, b, 0).endVertex(); + builder.vertex(mat, -ROOT_3 * f4, f3, -0.5F * f4).color(r, g, b, 0).endVertex(); } - mStack.pop(); + mStack.popPose(); } // copied from EnderDragonRenderer private static final float ROOT_3 = (float)(Math.sqrt(3.0D) / 2.0D); + + public static void vaporCube(PoseStack mStack, VertexConsumer builder, TextureAtlasSprite sprite, + float x1, float y1, float z1, float x2, float y2, float z2, + int r, int g, int b, int a, int light, + boolean nx, boolean px, boolean ny, boolean py, boolean nz, boolean pz) { + Matrix4f mat = mStack.last().pose(); + if (py) { + builder.vertex(mat, x1, y2, z1).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(x1 * 16)).uv2(light).normal(0, 1, 0).endVertex(); + builder.vertex(mat, x1, y2, z2).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(x1 * 16)).uv2(light).normal(0, 1, 0).endVertex(); + builder.vertex(mat, x2, y2, z2).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(x2 * 16)).uv2(light).normal(0, 1, 0).endVertex(); + builder.vertex(mat, x2, y2, z1).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(x2 * 16)).uv2(light).normal(0, 1, 0).endVertex(); + } + if (ny) { + builder.vertex(mat, x1, y1, z2).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(x1 * 16)).uv2(light).normal(0, -1, 0).endVertex(); + builder.vertex(mat, x1, y1, z1).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(x1 * 16)).uv2(light).normal(0, -1, 0).endVertex(); + builder.vertex(mat, x2, y1, z1).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(x2 * 16)).uv2(light).normal(0, -1, 0).endVertex(); + builder.vertex(mat, x2, y1, z2).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(x2 * 16)).uv2(light).normal(0, -1, 0).endVertex(); + } + if (nz) { + builder.vertex(mat, x2, y1, z1).color(r, g, b, a).uv(sprite.getU(x1 * 16), sprite.getV(y1 * 16)).uv2(light).normal(0, 0, -1).endVertex(); + builder.vertex(mat, x1, y1, z1).color(r, g, b, a).uv(sprite.getU(x2 * 16), sprite.getV(y1 * 16)).uv2(light).normal(0, 0, -1).endVertex(); + builder.vertex(mat, x1, y2, z1).color(r, g, b, a).uv(sprite.getU(x2 * 16), sprite.getV(y2 * 16)).uv2(light).normal(0, 0, -1).endVertex(); + builder.vertex(mat, x2, y2, z1).color(r, g, b, a).uv(sprite.getU(x1 * 16), sprite.getV(y2 * 16)).uv2(light).normal(0, 0, -1).endVertex(); + } + if (pz) { + builder.vertex(mat, x1, y1, z2).color(r, g, b, a).uv(sprite.getU(x1 * 16), sprite.getV(y1 * 16)).uv2(light).normal(0, 0, 1).endVertex(); + builder.vertex(mat, x2, y1, z2).color(r, g, b, a).uv(sprite.getU(x2 * 16), sprite.getV(y1 * 16)).uv2(light).normal(0, 0, 1).endVertex(); + builder.vertex(mat, x2, y2, z2).color(r, g, b, a).uv(sprite.getU(x2 * 16), sprite.getV(y2 * 16)).uv2(light).normal(0, 0, 1).endVertex(); + builder.vertex(mat, x1, y2, z2).color(r, g, b, a).uv(sprite.getU(x1 * 16), sprite.getV(y2 * 16)).uv2(light).normal(0, 0, 1).endVertex(); + } + if (nx) { + builder.vertex(mat, x1, y1, z1).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(y1 * 16)).uv2(light).normal(-1, 0, 0).endVertex(); + builder.vertex(mat, x1, y1, z2).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(y1 * 16)).uv2(light).normal(-1, 0, 0).endVertex(); + builder.vertex(mat, x1, y2, z2).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(y2 * 16)).uv2(light).normal(-1, 0, 0).endVertex(); + builder.vertex(mat, x1, y2, z1).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(y2 * 16)).uv2(light).normal(-1, 0, 0).endVertex(); + } + if (px) { + builder.vertex(mat, x2, y1, z2).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(y1 * 16)).uv2(light).normal(1, 0, 0).endVertex(); + builder.vertex(mat, x2, y1, z1).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(y1 * 16)).uv2(light).normal(1, 0, 0).endVertex(); + builder.vertex(mat, x2, y2, z1).color(r, g, b, a).uv(sprite.getU(z2 * 16), sprite.getV(y2 * 16)).uv2(light).normal(1, 0, 0).endVertex(); + builder.vertex(mat, x2, y2, z2).color(r, g, b, a).uv(sprite.getU(z1 * 16), sprite.getV(y2 * 16)).uv2(light).normal(1, 0, 0).endVertex(); + } + } } diff --git a/src/main/java/elucent/eidolon/util/StackUtil.java b/src/main/java/elucent/eidolon/util/StackUtil.java deleted file mode 100644 index d75df50..0000000 --- a/src/main/java/elucent/eidolon/util/StackUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -package elucent.eidolon.util; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.tags.ITag; - -import java.util.List; -import java.util.stream.Collectors; - -public class StackUtil { - public static Ingredient ingredientFromObject(Object object) { - if (object instanceof Item) return Ingredient.fromItems((Item)object); - else if (object instanceof Block) return Ingredient.fromStacks(new ItemStack((Block)object)); - else if (object instanceof ItemStack) return Ingredient.fromStacks((ItemStack)object); - else if (object instanceof ITag) return Ingredient.fromTag((ITag)object); - else return Ingredient.EMPTY; - } - - public static List ingredientsFromObjects(List objects) { - return objects.stream().map(StackUtil::ingredientFromObject).collect(Collectors.toList()); - } - - public static ItemStack stackFromObject(Object object) { - if (object instanceof Item) return new ItemStack((Item)object); - else if (object instanceof Block) return new ItemStack((Block)object); - else if (object instanceof ItemStack) return ((ItemStack)object).copy(); - else if (object instanceof ITag) { - Object first = ((ITag)object).getAllElements().get(0); - return stackFromObject(first); - } - else return ItemStack.EMPTY; - } - - public static List stacksFromObjects(List objects) { - return objects.stream().map(StackUtil::stackFromObject).collect(Collectors.toList()); - } -} diff --git a/src/main/java/elucent/eidolon/world/BasicPiece.java b/src/main/java/elucent/eidolon/world/BasicPiece.java index 8fce5a8..54dd5a7 100644 --- a/src/main/java/elucent/eidolon/world/BasicPiece.java +++ b/src/main/java/elucent/eidolon/world/BasicPiece.java @@ -1,78 +1,69 @@ package elucent.eidolon.world; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Mirror; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.world.IServerWorld; -import net.minecraft.world.gen.feature.structure.IStructurePieceType; -import net.minecraft.world.gen.feature.structure.TemplateStructurePiece; -import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; -import net.minecraft.world.gen.feature.template.TemplateManager; - import java.util.Random; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.levelgen.feature.StructurePieceType; +import net.minecraft.world.level.levelgen.structure.TemplateStructurePiece; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; +import net.minecraft.world.level.levelgen.structure.templatesystem.BlockIgnoreProcessor; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; + public class BasicPiece extends TemplateStructurePiece { private ResourceLocation loc; Rotation rotation; Mirror mirror; - void modifyPlacement(PlacementSettings settings, BlockPos pos) { + void modifyPlacement(StructurePlaceSettings settings, BlockPos pos) { // } void init(BlockPos pos, Random random) { // } - - public BasicPiece(IStructurePieceType structurePieceTypeIn, CompoundNBT nbt) { - super(structurePieceTypeIn, nbt); - this.loc = new ResourceLocation(nbt.getString("template")); + + public BasicPiece(StructurePieceType structurePieceTypeIn, CompoundTag nbt, StructureManager manager) { + super(structurePieceTypeIn, nbt, manager, (rl) -> { + return new StructurePlaceSettings().setRotation(Rotation.valueOf(nbt.getString("rot"))).setMirror(Mirror.valueOf(nbt.getString("mirror"))).addProcessor(BlockIgnoreProcessor.STRUCTURE_BLOCK); + }); + this.loc = new ResourceLocation(nbt.getString("Template")); this.rotation = Rotation.valueOf(nbt.getString("rot")); this.mirror = Mirror.valueOf(nbt.getString("mirror")); } - public BasicPiece(IStructurePieceType type, ResourceLocation key, TemplateManager templateManager, CompoundNBT nbt) { - this(type, nbt); - Template part = templateManager.getTemplateDefaulted(key); - PlacementSettings placement = (new PlacementSettings().setRotation(rotation).setMirror(mirror)).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); - this.setup(part, this.templatePosition, placement); - this.template = templateManager.getTemplate(key); - } - - public BasicPiece(IStructurePieceType type, ResourceLocation key, TemplateManager templateManager, BlockPos pos, Random random) { + public BasicPiece(StructurePieceType type, ResourceLocation key, StructureManager templateManager, BlockPos pos, Random random) { this(type, key, templateManager, pos, Rotation.NONE, Mirror.NONE, random); } - public BasicPiece(IStructurePieceType type, ResourceLocation key, TemplateManager templateManager, BlockPos pos, Rotation rot, Mirror mirror, Random random) { - super(type, 0); + public BasicPiece(StructurePieceType type, ResourceLocation key, StructureManager templateManager, BlockPos pos, Rotation rot, Mirror mirror, Random random) { + super(type, 0, templateManager, key, "eidolon.structure." + key.getPath(), + new StructurePlaceSettings().setRotation(rot).setMirror(Mirror.NONE).addProcessor(BlockIgnoreProcessor.STRUCTURE_BLOCK), pos); this.templatePosition = pos; this.loc = key; this.rotation = rot; this.mirror = mirror; - Template part = templateManager.getTemplateDefaulted(key); - BlockPos d = part.getSize(); + this.template = templateManager.getOrCreate(key); + Vec3i d = template.getSize(); BlockPos o = new BlockPos(-((d.getX() - 1) / 2), 0, -(d.getZ() - 1) / 2); - templatePosition = templatePosition.add(o.rotate(this.rotation)).subtract(o); - - PlacementSettings placement = (new PlacementSettings().setRotation(rotation).setMirror(Mirror.NONE)).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); - this.setup(part, this.templatePosition, placement); - this.template = templateManager.getTemplate(key); + templatePosition = templatePosition.offset(o.rotate(this.rotation)).subtract(o); } @Override - protected void readAdditional(CompoundNBT tagCompound) { - super.readAdditional(tagCompound); - tagCompound.putString("template", loc.toString()); + protected void addAdditionalSaveData(StructurePieceSerializationContext ctx, CompoundTag tagCompound) { + super.addAdditionalSaveData(ctx, tagCompound); tagCompound.putString("rot", rotation.name()); tagCompound.putString("mirror", mirror.name()); } @Override - protected void handleDataMarker(String function, BlockPos pos, IServerWorld worldIn, Random rand, MutableBoundingBox sbb) {} + protected void handleDataMarker(String function, BlockPos pos, ServerLevelAccessor worldIn, Random rand, BoundingBox sbb) {} } diff --git a/src/main/java/elucent/eidolon/world/CatacombPieces.java b/src/main/java/elucent/eidolon/world/CatacombPieces.java index 2f83aa6..8574b0d 100644 --- a/src/main/java/elucent/eidolon/world/CatacombPieces.java +++ b/src/main/java/elucent/eidolon/world/CatacombPieces.java @@ -1,23 +1,16 @@ package elucent.eidolon.world; -import elucent.eidolon.Eidolon; -import elucent.eidolon.WorldGen; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Mirror; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.world.IServerWorld; -import net.minecraft.world.gen.feature.structure.IStructurePieceType; -import net.minecraft.world.gen.feature.structure.TemplateStructurePiece; -import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; -import net.minecraft.world.gen.feature.template.TemplateManager; - import java.util.Random; +import elucent.eidolon.Eidolon; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.levelgen.feature.StructurePieceType; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; + public class CatacombPieces { public static final ResourceLocation CORRIDOR_CENTER_ID = new ResourceLocation(Eidolon.MODID, "catacomb_corridor_center"), @@ -33,70 +26,70 @@ public class CatacombPieces { TURNAROUND_ID = new ResourceLocation(Eidolon.MODID, "catacomb_turnaround"), LAB_ID = new ResourceLocation(Eidolon.MODID, "catacomb_lab"); - public static IStructurePieceType + public static StructurePieceType CORRIDOR_CENTER = null, CORRIDOR_DOOR = null, SMALL_ROOM = null, TRAP = null, SHRINE = null, SKULL = null, SPAWNER = null, COFFIN = null, MEDIUM_ROOM = null, GRAVEYARD = null, TURNAROUND = null, LAB = null; public static class CorridorCenter extends RandomlyRotatedPiece { - public CorridorCenter(TemplateManager templateManager, CompoundNBT nbt) { super(CORRIDOR_CENTER, CORRIDOR_CENTER_ID, templateManager, nbt); } - public CorridorCenter(TemplateManager templateManager, BlockPos pos, Random random) { super(CORRIDOR_CENTER, CORRIDOR_CENTER_ID, templateManager, pos, random); } + public CorridorCenter(StructureManager manager, CompoundTag nbt) { super(CORRIDOR_CENTER, nbt, manager); } + public CorridorCenter(StructureManager templateManager, BlockPos pos, Random random) { super(CORRIDOR_CENTER, CORRIDOR_CENTER_ID, templateManager, pos, random); } } public static class CorridorDoor extends BasicPiece { - public CorridorDoor(TemplateManager templateManager, CompoundNBT nbt) { super(CORRIDOR_DOOR, CORRIDOR_DOOR_ID, templateManager, nbt); } - public CorridorDoor(TemplateManager templateManager, BlockPos pos, Rotation rot, Random random) { + public CorridorDoor(StructureManager manager, CompoundTag nbt) { super(CORRIDOR_DOOR, nbt, manager); } + public CorridorDoor(StructureManager templateManager, BlockPos pos, Rotation rot, Random random) { super(CORRIDOR_DOOR, CORRIDOR_DOOR_ID, templateManager, pos, rot, Mirror.NONE, random); } } public static class SmallRoom extends RandomlyRotatedPiece { - public SmallRoom(TemplateManager templateManager, CompoundNBT nbt) { super(SMALL_ROOM, SMALL_ROOM_ID, templateManager, nbt); } - public SmallRoom(TemplateManager templateManager, BlockPos pos, Random random) { super(SMALL_ROOM, SMALL_ROOM_ID, templateManager, pos, random); } + public SmallRoom(StructureManager manager, CompoundTag nbt) { super(SMALL_ROOM, nbt, manager); } + public SmallRoom(StructureManager templateManager, BlockPos pos, Random random) { super(SMALL_ROOM, SMALL_ROOM_ID, templateManager, pos, random); } } public static class Trap extends RandomlyRotatedPiece { - public Trap(TemplateManager templateManager, CompoundNBT nbt) { super(TRAP, TRAP_ID, templateManager, nbt); } - public Trap(TemplateManager templateManager, BlockPos pos, Random random) { super(TRAP, TRAP_ID, templateManager, pos, random); } + public Trap(StructureManager manager, CompoundTag nbt) { super(TRAP, nbt, manager); } + public Trap(StructureManager templateManager, BlockPos pos, Random random) { super(TRAP, TRAP_ID, templateManager, pos, random); } } public static class Shrine extends RandomlyRotatedPiece { - public Shrine(TemplateManager templateManager, CompoundNBT nbt) { super(SHRINE, SHRINE_ID, templateManager, nbt); } - public Shrine(TemplateManager templateManager, BlockPos pos, Random random) { super(SHRINE, SHRINE_ID, templateManager, pos, random); } + public Shrine(StructureManager manager, CompoundTag nbt) { super(SHRINE, nbt, manager); } + public Shrine(StructureManager templateManager, BlockPos pos, Random random) { super(SHRINE, SHRINE_ID, templateManager, pos, random); } } public static class Skull extends RandomlyRotatedPiece { - public Skull(TemplateManager templateManager, CompoundNBT nbt) { super(SKULL, SKULL_ID, templateManager, nbt); } - public Skull(TemplateManager templateManager, BlockPos pos, Random random) { super(SKULL, SKULL_ID, templateManager, pos, random); } + public Skull(StructureManager manager, CompoundTag nbt) { super(SKULL, nbt, manager); } + public Skull(StructureManager templateManager, BlockPos pos, Random random) { super(SKULL, SKULL_ID, templateManager, pos, random); } } public static class Spawner extends RandomlyRotatedPiece { - public Spawner(TemplateManager templateManager, CompoundNBT nbt) { super(SPAWNER, SPAWNER_ID, templateManager, nbt); } - public Spawner(TemplateManager templateManager, BlockPos pos, Random random) { super(SPAWNER, SPAWNER_ID, templateManager, pos, random); } + public Spawner(StructureManager manager, CompoundTag nbt) { super(SPAWNER, nbt, manager); } + public Spawner(StructureManager templateManager, BlockPos pos, Random random) { super(SPAWNER, SPAWNER_ID, templateManager, pos, random); } } public static class Coffin extends RandomlyRotatedPiece { - public Coffin(TemplateManager templateManager, CompoundNBT nbt) { super(COFFIN, COFFIN_ID, templateManager, nbt); } - public Coffin(TemplateManager templateManager, BlockPos pos, Random random) { super(COFFIN, COFFIN_ID, templateManager, pos, random); } + public Coffin(StructureManager manager, CompoundTag nbt) { super(COFFIN, nbt, manager); } + public Coffin(StructureManager templateManager, BlockPos pos, Random random) { super(COFFIN, COFFIN_ID, templateManager, pos, random); } } public static class MediumRoom extends RandomlyRotatedPiece { - public MediumRoom(TemplateManager templateManager, CompoundNBT nbt) { super(MEDIUM_ROOM, MEDIUM_ROOM_ID, templateManager, nbt); } - public MediumRoom(TemplateManager templateManager, BlockPos pos, Random random) { super(MEDIUM_ROOM, MEDIUM_ROOM_ID, templateManager, pos, random); } + public MediumRoom(StructureManager manager, CompoundTag nbt) { super(MEDIUM_ROOM, nbt, manager); } + public MediumRoom(StructureManager templateManager, BlockPos pos, Random random) { super(MEDIUM_ROOM, MEDIUM_ROOM_ID, templateManager, pos, random); } } public static class Graveyard extends RandomlyRotatedPiece { - public Graveyard(TemplateManager templateManager, CompoundNBT nbt) { super(GRAVEYARD, GRAVEYARD_ID, templateManager, nbt); } - public Graveyard(TemplateManager templateManager, BlockPos pos, Random random) { super(GRAVEYARD, GRAVEYARD_ID, templateManager, pos, random); } + public Graveyard(StructureManager manager, CompoundTag nbt) { super(GRAVEYARD, nbt, manager); } + public Graveyard(StructureManager templateManager, BlockPos pos, Random random) { super(GRAVEYARD, GRAVEYARD_ID, templateManager, pos, random); } } public static class Turnaround extends RandomlyRotatedPiece { - public Turnaround(TemplateManager templateManager, CompoundNBT nbt) { super(TURNAROUND, TURNAROUND_ID, templateManager, nbt); } - public Turnaround(TemplateManager templateManager, BlockPos pos, Random random) { super(TURNAROUND, TURNAROUND_ID, templateManager, pos, random); } + public Turnaround(StructureManager manager, CompoundTag nbt) { super(TURNAROUND, nbt, manager); } + public Turnaround(StructureManager templateManager, BlockPos pos, Random random) { super(TURNAROUND, TURNAROUND_ID, templateManager, pos, random); } } public static class Lab extends RandomlyRotatedPiece { - public Lab(TemplateManager templateManager, CompoundNBT nbt) { super(LAB, LAB_ID, templateManager, nbt); } - public Lab(TemplateManager templateManager, BlockPos pos, Random random) { super(LAB, LAB_ID, templateManager, pos, random); } + public Lab(StructureManager manager, CompoundTag nbt) { super(LAB, nbt, manager); } + public Lab(StructureManager templateManager, BlockPos pos, Random random) { super(LAB, LAB_ID, templateManager, pos, random); } } } diff --git a/src/main/java/elucent/eidolon/world/CatacombStructure.java b/src/main/java/elucent/eidolon/world/CatacombStructure.java index 55b1dc2..a7b75ca 100644 --- a/src/main/java/elucent/eidolon/world/CatacombStructure.java +++ b/src/main/java/elucent/eidolon/world/CatacombStructure.java @@ -1,76 +1,70 @@ package elucent.eidolon.world; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Random; +import java.util.Set; + import com.mojang.serialization.Codec; + import elucent.eidolon.Config; import elucent.eidolon.Eidolon; -import elucent.eidolon.WorldGen; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Mirror; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Rotation; -import net.minecraft.util.SharedSeedRandom; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.util.registry.DynamicRegistries; -import net.minecraft.world.IServerWorld; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.provider.BiomeProvider; -import net.minecraft.world.gen.ChunkGenerator; -import net.minecraft.world.gen.GenerationStage; -import net.minecraft.world.gen.Heightmap; -import net.minecraft.world.gen.feature.NoFeatureConfig; -import net.minecraft.world.gen.feature.structure.*; -import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; -import net.minecraft.world.gen.feature.template.TemplateManager; - -import java.util.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.world.level.levelgen.structure.StructurePiece; +import net.minecraft.world.level.levelgen.structure.pieces.PieceGenerator; +import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; -public class CatacombStructure extends Structure { - public CatacombStructure(Codec codec) { - super(codec); +public class CatacombStructure extends StructureFeature { + public CatacombStructure(Codec codec) { + super(codec, PieceGeneratorSupplier.simple(CatacombStructure::isFeatureChunk, new CatacombPieceGenerator())); } @Override - public GenerationStage.Decoration getDecorationStage() { - return GenerationStage.Decoration.UNDERGROUND_STRUCTURES; + public GenerationStep.Decoration step() { + return GenerationStep.Decoration.UNDERGROUND_STRUCTURES; } + + static Random rand = new Random(); - @Override - public IStartFactory getStartFactory() { - return Start::new; - } - - @Override - protected boolean func_230363_a_(ChunkGenerator generator, BiomeProvider provider, long seed, SharedSeedRandom rand, int chunkX, int chunkZ, Biome biome, ChunkPos pos, NoFeatureConfig config) { - int i = chunkX >> 4; - int j = chunkZ >> 4; - rand.setSeed((long) (i ^ j << 4) ^ seed); + static boolean isFeatureChunk(PieceGeneratorSupplier.Context ctx) { + int i = ctx.chunkPos().x >> 4; + int j = ctx.chunkPos().z >> 4; + rand.setSeed((long) (i ^ j << 4) ^ 1579937621); double prob = rand.nextInt(10000) / 10000.0f; return prob < (1 / Config.CATACOMB_RARITY.get()); } @Override - public String getStructureName() { + public String getFeatureName() { return new ResourceLocation(Eidolon.MODID, "catacomb").toString(); } - public static class Start extends StructureStart { - public Start(Structure config, int chunkX, int chunkZ, MutableBoundingBox bounds, int refs, long seed) { - super(config, chunkX, chunkZ, bounds, refs, seed); - } - - public void func_230364_a_(DynamicRegistries registries, ChunkGenerator generator, TemplateManager templateManager, int chunkX, int chunkZ, Biome biome, NoFeatureConfig config) { - int i = chunkX * 16; - int j = chunkZ * 16; - int k = Math.min(32, generator.getNoiseHeight(i, j, Heightmap.Type.OCEAN_FLOOR_WG)); + public static class CatacombPieceGenerator implements PieceGenerator { + @Override + public void generatePieces(StructurePiecesBuilder pieces, Context ctx) { + int i = ctx.chunkPos().x * 16; + int j = ctx.chunkPos().z * 16; + int k = Math.min(32, ctx.chunkGenerator().getFirstFreeHeight(i, j, Heightmap.Types.OCEAN_FLOOR_WG, ctx.heightAccessor())); if (k < 17) k = 17; - BlockPos blockpos = new BlockPos(i + rand.nextInt(16), rand.nextInt(k - 16) + 8, j + rand.nextInt(16)); + BlockPos blockpos = new BlockPos(i + ctx.random().nextInt(16), ctx.random().nextInt(k - 16) + 8, j + ctx.random().nextInt(16)); - generate(templateManager, blockpos, rand, components); - this.recalculateStructureSize(); + generate(ctx.structureManager(), blockpos, ctx.random(), pieces); } enum RoomType { @@ -82,7 +76,7 @@ enum RoomType { } interface ICatacombFactory { - StructurePiece create(TemplateManager tm, BlockPos pos, Random random); + StructurePiece create(StructureManager tm, BlockPos pos, Random random); } static ICatacombFactory[][] POOLS = new ICatacombFactory[][]{ @@ -132,9 +126,9 @@ ICatacombFactory roomFor(RoomType type, Random random) { return pool[random.nextInt(pool.length)]; } - BlockPos adjDims(ResourceLocation rl, TemplateManager tm) { - Template t = tm.getTemplate(rl); - BlockPos dims = t.getSize(); + BlockPos adjDims(ResourceLocation rl, StructureManager tm) { + StructureTemplate t = tm.get(rl).get(); + Vec3i dims = t.getSize(); return new BlockPos((dims.getX() - 3) / 4, 0, (dims.getZ() - 3) / 4); } @@ -174,11 +168,11 @@ BlockPos tryPlace(Map rooms, BlockPos desired, int w, int h) boolean can = true; for (int i = 0; i < w; i ++) { for (int j = 0; j < h; j ++) { - if (rooms.getOrDefault(desired.add(i, 0, j), RoomType.CORRIDOR) != RoomType.CORRIDOR) + if (rooms.getOrDefault(desired.offset(i, 0, j), RoomType.CORRIDOR) != RoomType.CORRIDOR) can = false; } } - if (can) return desired.add(-xx, 0, -yy); + if (can) return desired.offset(-xx, 0, -yy); } } return null; @@ -188,20 +182,20 @@ void setRoom(Map rooms, Set edges, RoomType type, Bloc rooms.put(pos, type); for (int i = 0; i < w; i ++) { for (int j = 0; j < h; j ++) { - if (i != 0 || j != 0) rooms.put(pos.add(i, 0, j), RoomType.EMPTY); + if (i != 0 || j != 0) rooms.put(pos.offset(i, 0, j), RoomType.EMPTY); if (i > 0) { - edges.remove(new Edge(pos.add(i, 0, j), pos.add(i - 1, 0, j), 0)); - edges.remove(new Edge(pos.add(i - 1, 0, j), pos.add(i, 0, j), 0)); + edges.remove(new Edge(pos.offset(i, 0, j), pos.offset(i - 1, 0, j), 0)); + edges.remove(new Edge(pos.offset(i - 1, 0, j), pos.offset(i, 0, j), 0)); } if (j > 0) { - edges.remove(new Edge(pos.add(i, 0, j), pos.add(i, 0, j - 1), 0)); - edges.remove(new Edge(pos.add(i, 0, j - 1), pos.add(i, 0, j), 0)); + edges.remove(new Edge(pos.offset(i, 0, j), pos.offset(i, 0, j - 1), 0)); + edges.remove(new Edge(pos.offset(i, 0, j - 1), pos.offset(i, 0, j), 0)); } } } } - void generate(TemplateManager tm, BlockPos pos, Random random, List components) { + void generate(StructureManager tm, BlockPos pos, Random random, StructurePiecesBuilder pieces) { // components.add(new CatacombPieces.CorridorCenter(templateManager, blockpos, rand)); int size = (random.nextInt(3) + 2) * 16 + 3; Map rooms = new HashMap<>(); @@ -271,16 +265,16 @@ void generate(TemplateManager tm, BlockPos pos, Random random, List e : rooms.entrySet()) { ICatacombFactory factory = e.getValue() == RoomType.EMPTY ? null : roomFor(e.getValue(), random); - BlockPos loc = pos.add(e.getKey().getX() * 4, 0, e.getKey().getZ() * 4); + BlockPos loc = pos.offset(e.getKey().getX() * 4, 0, e.getKey().getZ() * 4); switch (e.getValue()) { case SMALL_ROOM: - components.add(factory.create(tm, loc, random)); + pieces.addPiece(factory.create(tm, loc, random)); break; case MEDIUM_ROOM: - components.add(factory.create(tm, loc, random)); + pieces.addPiece(factory.create(tm, loc, random)); break; case CORRIDOR: - components.add(factory.create(tm, loc, random)); + pieces.addPiece(factory.create(tm, loc, random)); break; default: break; @@ -292,17 +286,16 @@ void generate(TemplateManager tm, BlockPos pos, Random random, List { - public LabStructure(Codec codec) { - super(codec); +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.world.level.levelgen.structure.pieces.PieceGenerator; +import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; + +public class LabStructure extends StructureFeature { + public LabStructure(Codec codec) { + super(codec, PieceGeneratorSupplier.simple(LabStructure::isFeatureChunk, new LabPieceGenerator())); } @Override - public GenerationStage.Decoration getDecorationStage() { - return GenerationStage.Decoration.UNDERGROUND_STRUCTURES; + public GenerationStep.Decoration step() { + return GenerationStep.Decoration.UNDERGROUND_STRUCTURES; } + + static Random rand = new Random(); - @Override - public IStartFactory getStartFactory() { - return Start::new; - } - - @Override - protected boolean func_230363_a_(ChunkGenerator generator, BiomeProvider provider, long seed, SharedSeedRandom rand, int chunkX, int chunkZ, Biome biome, ChunkPos pos, NoFeatureConfig config) { - int i = chunkX >> 4; - int j = chunkZ >> 4; - rand.setSeed((long) (i ^ j << 4) ^ seed); + static boolean isFeatureChunk(PieceGeneratorSupplier.Context ctx) { + int i = ctx.chunkPos().x >> 4; + int j = ctx.chunkPos().z >> 4; + rand.setSeed((long) (i ^ j << 4) * 1086585193); double prob = rand.nextInt(10000) / 10000.0f; return prob < (1 / Config.LAB_RARITY.get()); } @Override - public String getStructureName() { + public String getFeatureName() { return new ResourceLocation(Eidolon.MODID, "lab").toString(); } - - public static class Start extends StructureStart { - public Start(Structure config, int chunkX, int chunkZ, MutableBoundingBox bounds, int refs, long seed) { - super(config, chunkX, chunkZ, bounds, refs, seed); - } - - public void func_230364_a_(DynamicRegistries registries, ChunkGenerator generator, TemplateManager templateManager, int chunkX, int chunkZ, Biome biome, NoFeatureConfig config) { - int i = chunkX * 16; - int j = chunkZ * 16; - int k = Math.min(generator.getSeaLevel(), generator.getNoiseHeight(i, j, Heightmap.Type.OCEAN_FLOOR_WG)); + + public static class LabPieceGenerator implements PieceGenerator { + @Override + public void generatePieces(StructurePiecesBuilder pieces, Context ctx) { + int i = ctx.chunkPos().x * 16; + int j = ctx.chunkPos().z * 16; + int k = Math.min(ctx.chunkGenerator().getSeaLevel(), ctx.chunkGenerator().getFirstFreeHeight(i, j, Heightmap.Types.OCEAN_FLOOR_WG, ctx.heightAccessor())); if (k < 33) k = 33; - BlockPos blockpos = new BlockPos(i + rand.nextInt(16), rand.nextInt(k - 32) + 8, j + rand.nextInt(16)); - Rotation rotation = Rotation.randomRotation(rand); - - components.add(new Piece(templateManager, PART, blockpos, rotation, rand)); - this.recalculateStructureSize(); - } + BlockPos blockpos = new BlockPos(i + ctx.random().nextInt(16), ctx.random().nextInt(k - 32) + 8, j + ctx.random().nextInt(16)); + + pieces.addPiece(new RandomlyRotatedPiece(WorldGen.LAB_PIECE, PART, ctx.structureManager(), blockpos, ctx.random())); + } } private static final ResourceLocation PART = new ResourceLocation(Eidolon.MODID,"lab"); - - public static class Piece extends TemplateStructurePiece { - private ResourceLocation loc; - private Rotation rotation; - - public Piece(IStructurePieceType structurePieceTypeIn, CompoundNBT nbt) { - super(structurePieceTypeIn, nbt); - this.loc = new ResourceLocation(nbt.getString("template")); - this.rotation = Rotation.valueOf(nbt.getString("rot")); - } - - public Piece(TemplateManager templateManager, CompoundNBT nbt) { - this(WorldGen.LAB_PIECE, nbt); - Template part = templateManager.getTemplateDefaulted(PART); - PlacementSettings placement = (new PlacementSettings()).setRotation(this.rotation).setMirror(Mirror.NONE).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); - this.setup(part, this.templatePosition, placement); - this.template = templateManager.getTemplate(PART); - } - - public Piece(TemplateManager templateManager, ResourceLocation template, BlockPos pos, Rotation rot, Random random) { - super(WorldGen.LAB_PIECE, 0); - this.templatePosition = pos; - this.rotation = rot; - this.loc = template; - - Template part = templateManager.getTemplateDefaulted(PART); - PlacementSettings placement = (new PlacementSettings()).setRotation(this.rotation).setMirror(Mirror.NONE).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); - this.setup(part, this.templatePosition, placement); - this.template = templateManager.getTemplate(PART); - } - - @Override - protected void readAdditional(CompoundNBT tagCompound) { - super.readAdditional(tagCompound); - tagCompound.putString("template", loc.toString()); - tagCompound.putString("rot", rotation.name()); - } - - @Override - protected void handleDataMarker(String function, BlockPos pos, IServerWorld worldIn, Random rand, MutableBoundingBox sbb) { - // - } - } } diff --git a/src/main/java/elucent/eidolon/world/RandomlyRotatedPiece.java b/src/main/java/elucent/eidolon/world/RandomlyRotatedPiece.java index 72b9337..2ee259c 100644 --- a/src/main/java/elucent/eidolon/world/RandomlyRotatedPiece.java +++ b/src/main/java/elucent/eidolon/world/RandomlyRotatedPiece.java @@ -1,34 +1,22 @@ package elucent.eidolon.world; -import elucent.eidolon.Eidolon; -import elucent.eidolon.WorldGen; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.Mirror; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.world.IServerWorld; -import net.minecraft.world.gen.feature.structure.IStructurePieceType; -import net.minecraft.world.gen.feature.structure.TemplateStructurePiece; -import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; -import net.minecraft.world.gen.feature.template.TemplateManager; - import java.util.Random; -public class RandomlyRotatedPiece extends BasicPiece { +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.levelgen.feature.StructurePieceType; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; - public RandomlyRotatedPiece(IStructurePieceType structurePieceTypeIn, CompoundNBT nbt) { - super(structurePieceTypeIn, nbt); - } +public class RandomlyRotatedPiece extends BasicPiece { - public RandomlyRotatedPiece(IStructurePieceType type, ResourceLocation key, TemplateManager templateManager, CompoundNBT nbt) { - super(type, key, templateManager, nbt); + public RandomlyRotatedPiece(StructurePieceType structurePieceTypeIn, CompoundTag nbt, StructureManager manager) { + super(structurePieceTypeIn, nbt, manager); } - public RandomlyRotatedPiece(IStructurePieceType type, ResourceLocation key, TemplateManager templateManager, BlockPos pos, Random random) { + public RandomlyRotatedPiece(StructurePieceType type, ResourceLocation key, StructureManager templateManager, BlockPos pos, Random random) { super(type, key, templateManager, pos, Rotation.NONE, Mirror.NONE, random); } } diff --git a/src/main/java/elucent/eidolon/world/StrayTowerStructure.java b/src/main/java/elucent/eidolon/world/StrayTowerStructure.java index 6ce6f29..0d87330 100644 --- a/src/main/java/elucent/eidolon/world/StrayTowerStructure.java +++ b/src/main/java/elucent/eidolon/world/StrayTowerStructure.java @@ -1,119 +1,62 @@ package elucent.eidolon.world; +import java.util.Random; + import com.mojang.serialization.Codec; + import elucent.eidolon.Config; import elucent.eidolon.Eidolon; import elucent.eidolon.WorldGen; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.util.registry.DynamicRegistries; -import net.minecraft.world.IServerWorld; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.provider.BiomeProvider; -import net.minecraft.world.gen.ChunkGenerator; -import net.minecraft.world.gen.GenerationStage; -import net.minecraft.world.gen.Heightmap; -import net.minecraft.world.gen.feature.NoFeatureConfig; -import net.minecraft.world.gen.feature.structure.IStructurePieceType; -import net.minecraft.world.gen.feature.structure.Structure; -import net.minecraft.world.gen.feature.structure.StructureStart; -import net.minecraft.world.gen.feature.structure.TemplateStructurePiece; -import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; -import net.minecraft.world.gen.feature.template.PlacementSettings; -import net.minecraft.world.gen.feature.template.Template; -import net.minecraft.world.gen.feature.template.TemplateManager; - -import java.util.Random; - -public class StrayTowerStructure extends Structure { - public StrayTowerStructure(Codec codec) { - super(codec); +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.NoiseColumn; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.Heightmap.Types; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; +import net.minecraft.world.level.levelgen.feature.StructureFeature; +import net.minecraft.world.level.levelgen.structure.pieces.PieceGenerator; +import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; + +public class StrayTowerStructure extends StructureFeature { + public StrayTowerStructure(Codec codec) { + super(codec, PieceGeneratorSupplier.simple(StrayTowerStructure::isFeatureChunk, new StrayTowerPieceGenerator())); } @Override - public GenerationStage.Decoration getDecorationStage() { - return GenerationStage.Decoration.UNDERGROUND_STRUCTURES; + public GenerationStep.Decoration step() { + return GenerationStep.Decoration.SURFACE_STRUCTURES; } - - @Override - public IStartFactory getStartFactory() { - return Start::new; - } - - @Override - protected boolean func_230363_a_(ChunkGenerator generator, BiomeProvider provider, long seed, SharedSeedRandom rand, int chunkX, int chunkZ, Biome biome, ChunkPos pos, NoFeatureConfig config) { - int i = chunkX >> 4; - int j = chunkZ >> 4; - rand.setSeed((long) (i ^ j << 4) ^ seed); + + static Random rand = new Random(); + + static boolean isFeatureChunk(PieceGeneratorSupplier.Context ctx) { + if (!ctx.validBiomeOnTop(Types.WORLD_SURFACE)) return false; + int i = ctx.chunkPos().x >> 4; + int j = ctx.chunkPos().z >> 4; + rand.setSeed((long) (i ^ j << 4) * 1556190469); double prob = rand.nextInt(10000) / 10000.0f; return prob < (1 / Config.STRAY_TOWER_RARITY.get()); } + + public static class StrayTowerPieceGenerator implements PieceGenerator { + @Override + public void generatePieces(StructurePiecesBuilder pieces, Context ctx) { + int i = ctx.chunkPos().x * 16; + int j = ctx.chunkPos().z * 16; + int minH = 999; + for (int xx = -3; xx < 4; xx ++) for (int yy = -3; yy < 4; yy ++) { + minH = Math.min(minH, ctx.chunkGenerator().getBaseHeight(i + xx, j + yy, Types.WORLD_SURFACE_WG, ctx.heightAccessor())); + } + pieces.addPiece(new RandomlyRotatedPiece(WorldGen.STRAY_TOWER_PIECE, PART, ctx.structureManager(), new BlockPos(i, minH - 9, j), ctx.random())); + } + } @Override - public String getStructureName() { + public String getFeatureName() { return new ResourceLocation(Eidolon.MODID, "stray_tower").toString(); } - public static class Start extends StructureStart { - public Start(Structure config, int chunkX, int chunkZ, MutableBoundingBox bounds, int refs, long seed) { - super(config, chunkX, chunkZ, bounds, refs, seed); - } - - public void func_230364_a_(DynamicRegistries registries, ChunkGenerator generator, TemplateManager templateManager, int chunkX, int chunkZ, Biome biome, NoFeatureConfig config) { - int i = chunkX * 16 + rand.nextInt(16); - int j = chunkZ * 16 + rand.nextInt(16); - Rotation rotation = Rotation.randomRotation(rand); - - components.add(new Piece(templateManager, PART, new BlockPos(i, generator.getHeight(i, j, Heightmap.Type.WORLD_SURFACE_WG), j), rotation, rand)); - this.recalculateStructureSize(); - } - } - private static final ResourceLocation PART = new ResourceLocation(Eidolon.MODID,"stray_tower"); - - public static class Piece extends TemplateStructurePiece { - private ResourceLocation loc; - private Rotation rotation; - - public Piece(IStructurePieceType structurePieceTypeIn, CompoundNBT nbt) { - super(structurePieceTypeIn, nbt); - this.loc = new ResourceLocation(nbt.getString("template")); - this.rotation = Rotation.valueOf(nbt.getString("rot")); - } - - public Piece(TemplateManager templateManager, CompoundNBT nbt) { - this(WorldGen.STRAY_TOWER_PIECE, nbt); - Template part = templateManager.getTemplateDefaulted(PART); - PlacementSettings placement = (new PlacementSettings()).setRotation(this.rotation).setMirror(Mirror.NONE).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); - this.setup(part, this.templatePosition, placement); - this.template = templateManager.getTemplate(PART); - } - - public Piece(TemplateManager templateManager, ResourceLocation template, BlockPos pos, Rotation rot, Random random) { - super(WorldGen.STRAY_TOWER_PIECE, 0); - this.templatePosition = pos.down(10); - this.rotation = rot; - this.loc = template; - - Template part = templateManager.getTemplateDefaulted(PART); - PlacementSettings placement = (new PlacementSettings()).setRotation(this.rotation).setMirror(Mirror.NONE).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); - this.setup(part, this.templatePosition, placement); - this.template = templateManager.getTemplate(PART); - } - - @Override - protected void readAdditional(CompoundNBT tagCompound) { - super.readAdditional(tagCompound); - tagCompound.putString("template", loc.toString()); - tagCompound.putString("rot", rotation.name()); - } - - @Override - protected void handleDataMarker(String function, BlockPos pos, IServerWorld worldIn, Random rand, MutableBoundingBox sbb) { - // - } - } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 0afe83c..4c2bf10 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,9 +1,13 @@ -public net.minecraft.world.gen.feature.structure.TemplateStructurePiece field_186178_c # templatePosition -public net.minecraft.world.gen.feature.structure.Structure field_236385_u_ # structureList -public-f net.minecraft.world.gen.feature.structure.Structure func_236392_a_(Lnet/minecraft/world/gen/settings/StructureSeparationSettings;JLnet/minecraft/util/SharedSeedRandom;II)Lnet/minecraft/util/math/ChunkPos; #findPosForPos -public-f net.minecraft.world.gen.settings.DimensionStructuresSettings field_236193_d_ # field_236193_d_ -public-f net.minecraft.world.gen.FlatGenerationSettings field_202247_j # STRUCTURES +public net.minecraft.world.level.levelgen.structure.TemplateStructurePiece f_73658_ # templatePosition +public net.minecraft.world.level.levelgen.feature.StructureFeature f_67032_ # structureList +public-f net.minecraft.world.level.levelgen.feature.StructureFeature m_67067_(Lnet/minecraft/world/level/levelgen/feature/configurations/StructureFeatureConfiguration;JLnet/minecraft/world/level/levelgen/WorldgenRandom;II)Lnet/minecraft/world/level/ChunkPos; # findPosForPos +public-f net.minecraft.world.level.levelgen.StructureSettings f_64582_ # field_236193_d_ +public-f net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings f_70349_ # STRUCTURES public net.minecraft.world.gen.DimensionSettings field_242740_q # INSTANCE -public-f net.minecraft.world.gen.settings.DimensionStructuresSettings field_236191_b_ # DEFAULT_STRUCTURES -public-f net.minecraft.world.gen.feature.structure.Structure field_236384_t_ # field_236384_t_ -public net.minecraft.world.gen.SpellcastingIllagerEntity field_193089_bx # activeSpell \ No newline at end of file +public-f net.minecraft.world.level.levelgen.StructureSettings f_64580_ # DEFAULT_STRUCTURES +public-f net.minecraft.world.level.levelgen.feature.StructureFeature f_67031_ # field_236384_t_ +public net.minecraft.world.gen.SpellcastingIllagerEntity field_193089_bx # activeSpell +public-f net.minecraft.world.level.levelgen.feature.StructureFeature f_67031_ # NOISE_AFFECTING_FEATURES +public-f net.minecraft.world.level.levelgen.StructureSettings f_64580_ # DEFAULTS +public-f net.minecraft.world.level.levelgen.StructureSettings f_64582_ # structureConfig +public-f net.minecraft.world.level.levelgen.StructureSettings f_189361_ # configuredStructures \ No newline at end of file diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index d394393..4347227 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader="javafml" #mandatory -loaderVersion="[34,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[39,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. license="All rights reserved" issueTrackerURL="http://my.issue.tracker/" #optional [[mods]] #mandatory @@ -17,6 +17,6 @@ A spooky magic mod about necromancy. [[dependencies.eidolon]] modId="curios" mandatory=true - versionRange="[FORGE-1.16.3,)" + versionRange="[FORGE-1.18.1,)" ordering="AFTER" side="BOTH" \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/avennian_sprig.json b/src/main/resources/assets/eidolon/blockstates/avennian_sprig.json new file mode 100644 index 0000000..6cb788d --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/avennian_sprig.json @@ -0,0 +1,10 @@ +{ + "variants": { + "age=0": { + "model": "eidolon:block/avennian_sprig_0" + }, + "age=1": { + "model": "eidolon:block/avennian_sprig_1" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/bone_pile.json b/src/main/resources/assets/eidolon/blockstates/bone_pile.json new file mode 100644 index 0000000..591cace --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/bone_pile.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/bone_pile" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/bone_pile_slab.json b/src/main/resources/assets/eidolon/blockstates/bone_pile_slab.json new file mode 100644 index 0000000..588d77e --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/bone_pile_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "eidolon:item/bone_pile_slab" + }, + "type=double": { + "model": "eidolon:item/bone_pile" + }, + "type=top": { + "model": "eidolon:block/bone_pile_slab_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/bone_pile_stairs.json b/src/main/resources/assets/eidolon/blockstates/bone_pile_stairs.json new file mode 100644 index 0000000..5c77212 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/bone_pile_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "eidolon:item/bone_pile_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "x": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_left": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_right": { + "model": "eidolon:block/bone_pile_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=outer_left": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=outer_right": { + "model": "eidolon:block/bone_pile_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=straight": { + "model": "eidolon:item/bone_pile_stairs", + "x": 180, + "y": 180, + "uvlock": true + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/cistern.json b/src/main/resources/assets/eidolon/blockstates/cistern.json new file mode 100644 index 0000000..0cb259a --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/cistern.json @@ -0,0 +1,16 @@ +{ + "variants": { + "top=false,bottom=false": { + "model": "eidolon:item/cistern" + }, + "top=true,bottom=false": { + "model": "eidolon:block/cistern_lower" + }, + "top=true,bottom=true": { + "model": "eidolon:block/cistern_mid" + }, + "top=false,bottom=true": { + "model": "eidolon:block/cistern_upper" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/deep_lead_ore.json b/src/main/resources/assets/eidolon/blockstates/deep_lead_ore.json new file mode 100644 index 0000000..f8d18d2 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/deep_lead_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/deep_lead_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/deep_silver_ore.json b/src/main/resources/assets/eidolon/blockstates/deep_silver_ore.json new file mode 100644 index 0000000..6a91db1 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/deep_silver_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/deep_silver_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_bricks.json b/src/main/resources/assets/eidolon/blockstates/elder_bricks.json new file mode 100644 index 0000000..6db5031 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_bricks.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/elder_bricks" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_bricks_eye.json b/src/main/resources/assets/eidolon/blockstates/elder_bricks_eye.json new file mode 100644 index 0000000..8877019 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_bricks_eye.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/elder_bricks_eye" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_bricks_slab.json b/src/main/resources/assets/eidolon/blockstates/elder_bricks_slab.json new file mode 100644 index 0000000..374bb14 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_bricks_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "eidolon:item/elder_bricks_slab" + }, + "type=double": { + "model": "eidolon:item/elder_bricks" + }, + "type=top": { + "model": "eidolon:block/elder_bricks_slab_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_bricks_stairs.json b/src/main/resources/assets/eidolon/blockstates/elder_bricks_stairs.json new file mode 100644 index 0000000..d9bf67a --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_bricks_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "x": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_left": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_right": { + "model": "eidolon:block/elder_bricks_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=outer_left": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=outer_right": { + "model": "eidolon:block/elder_bricks_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=straight": { + "model": "eidolon:item/elder_bricks_stairs", + "x": 180, + "y": 180, + "uvlock": true + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_bricks_wall.json b/src/main/resources/assets/eidolon/blockstates/elder_bricks_wall.json new file mode 100644 index 0000000..be0e6c9 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_bricks_wall.json @@ -0,0 +1,90 @@ +{ + "multipart": [ + { + "when": { + "up": "true" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_post" + } + }, + { + "when": { + "north": "low" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side", + "uvlock": true + } + }, + { + "when": { + "east": "low" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side", + "y": 90, + "uvlock": true + } + }, + { + "when": { + "south": "low" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side", + "y": 180, + "uvlock": true + } + }, + { + "when": { + "west": "low" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side", + "y": 270, + "uvlock": true + } + }, + { + "when": { + "north": "tall" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side_tall", + "uvlock": true + } + }, + { + "when": { + "east": "tall" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side_tall", + "y": 90, + "uvlock": true + } + }, + { + "when": { + "south": "tall" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side_tall", + "y": 180, + "uvlock": true + } + }, + { + "when": { + "west": "tall" + }, + "apply": { + "model": "eidolon:block/elder_bricks_wall_side_tall", + "y": 270, + "uvlock": true + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_masonry.json b/src/main/resources/assets/eidolon/blockstates/elder_masonry.json new file mode 100644 index 0000000..f30d2de --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_masonry.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/elder_masonry" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_masonry_slab.json b/src/main/resources/assets/eidolon/blockstates/elder_masonry_slab.json new file mode 100644 index 0000000..e6046b1 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_masonry_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "eidolon:item/elder_masonry_slab" + }, + "type=double": { + "model": "eidolon:item/elder_masonry" + }, + "type=top": { + "model": "eidolon:block/elder_masonry_slab_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_masonry_stairs.json b/src/main/resources/assets/eidolon/blockstates/elder_masonry_stairs.json new file mode 100644 index 0000000..9de5f4a --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_masonry_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "x": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_left": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_right": { + "model": "eidolon:block/elder_masonry_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=outer_left": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=outer_right": { + "model": "eidolon:block/elder_masonry_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=straight": { + "model": "eidolon:item/elder_masonry_stairs", + "x": 180, + "y": 180, + "uvlock": true + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/elder_pillar.json b/src/main/resources/assets/eidolon/blockstates/elder_pillar.json new file mode 100644 index 0000000..a5aba43 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/elder_pillar.json @@ -0,0 +1,16 @@ +{ + "variants": { + "top=false,bottom=false": { + "model": "eidolon:item/elder_pillar" + }, + "top=true,bottom=false": { + "model": "eidolon:block/elder_pillar_bottom" + }, + "top=true,bottom=true": { + "model": "eidolon:block/elder_pillar_mid" + }, + "top=false,bottom=true": { + "model": "eidolon:block/elder_pillar_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/glass_tube.json b/src/main/resources/assets/eidolon/blockstates/glass_tube.json new file mode 100644 index 0000000..e33b804 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/glass_tube.json @@ -0,0 +1,375 @@ +{ + "multipart": [ + { + "when": { + "OR": [ + { "in": "up" }, + { "out": "up" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_up" + } + }, + { + "when": { + "OR": [ + { "in": "down" }, + { "out": "down" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_down" + } + }, + { + "when": { + "OR": [ + { "in": "north" }, + { "out": "north" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_north" + } + }, + { + "when": { + "OR": [ + { "in": "east" }, + { "out": "east" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_east" + } + }, + { + "when": { + "OR": [ + { "in": "south" }, + { "out": "south" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_south" + } + }, + { + "when": { + "OR": [ + { "in": "west" }, + { "out": "west" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_west" + } + }, + { + "when": { + "OR": [ + { "in": "west", "out": "east" }, + { "in": "east", "out": "west" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_straight", + "y": 90 + } + }, + { + "when": { + "OR": [ + { "in": "north", "out": "south" }, + { "in": "south", "out": "north" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_straight" + } + }, + { + "when": { + "OR": [ + { "in": "up", "out": "down" }, + { "in": "down", "out": "up" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_straight", + "x": 90 + } + }, + { + "when": { + "OR": [ + { "in": "north", "out": "up" }, + { "in": "up", "out": "north" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 270, + "y": 90 + } + }, + { + "when": { + "OR": [ + { "in": "east", "out": "up" }, + { "in": "up", "out": "east" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 270, + "y": 180 + } + }, + { + "when": { + "OR": [ + { "in": "south", "out": "up" }, + { "in": "up", "out": "south" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 270, + "y": 270 + } + }, + { + "when": { + "OR": [ + { "in": "west", "out": "up" }, + { "in": "up", "out": "west" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 270 + } + }, + { + "when": { + "OR": [ + { "in": "north", "out": "down" }, + { "in": "down", "out": "north" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 90, + "y": 90 + } + }, + { + "when": { + "OR": [ + { "in": "east", "out": "down" }, + { "in": "down", "out": "east" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 90, + "y": 180 + } + }, + { + "when": { + "OR": [ + { "in": "south", "out": "down" }, + { "in": "down", "out": "south" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 90, + "y": 270 + } + }, + { + "when": { + "OR": [ + { "in": "west", "out": "down" }, + { "in": "down", "out": "west" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "x": 90, + "y": 0 + } + }, + { + "when": { + "OR": [ + { "in": "west", "out": "north" }, + { "in": "north", "out": "west" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend" + } + }, + { + "when": { + "OR": [ + { "in": "east", "out": "north" }, + { "in": "north", "out": "east" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "y": 90 + } + }, + { + "when": { + "OR": [ + { "in": "east", "out": "south" }, + { "in": "south", "out": "east" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "y": 180 + } + }, + { + "when": { + "OR": [ + { "in": "west", "out": "south" }, + { "in": "south", "out": "west" } + ] + }, + "apply": { + "model": "eidolon:block/glass_tube_bend", + "y": 270 + } + }, + { + "when": { + "attachin": false, + "in": "west" + }, + "apply": { + "model": "eidolon:block/glass_tube_input", + "y": 270 + } + }, + { + "when": { + "attachin": false, + "in": "north" + }, + "apply": { + "model": "eidolon:block/glass_tube_input", + "y": 0 + } + }, + { + "when": { + "attachin": false, + "in": "east" + }, + "apply": { + "model": "eidolon:block/glass_tube_input", + "y": 90 + } + }, + { + "when": { + "attachin": false, + "in": "south" + }, + "apply": { + "model": "eidolon:block/glass_tube_input", + "y": 180 + } + }, + { + "when": { + "attachin": false, + "in": "up" + }, + "apply": { + "model": "eidolon:block/glass_tube_input", + "x": 270 + } + }, + { + "when": { + "attachin": false, + "in": "down" + }, + "apply": { + "model": "eidolon:block/glass_tube_input", + "x": 90 + } + }, + { + "when": { + "attachout": false, + "out": "west" + }, + "apply": { + "model": "eidolon:block/glass_tube_output", + "y": 270 + } + }, + { + "when": { + "attachout": false, + "out": "north" + }, + "apply": { + "model": "eidolon:block/glass_tube_output", + "y": 0 + } + }, + { + "when": { + "attachout": false, + "out": "east" + }, + "apply": { + "model": "eidolon:block/glass_tube_output", + "y": 90 + } + }, + { + "when": { + "attachout": false, + "out": "south" + }, + "apply": { + "model": "eidolon:block/glass_tube_output", + "y": 180 + } + }, + { + "when": { + "attachout": false, + "out": "up" + }, + "apply": { + "model": "eidolon:block/glass_tube_output", + "x": 270 + } + }, + { + "when": { + "attachout": false, + "out": "down" + }, + "apply": { + "model": "eidolon:block/glass_tube_output", + "x": 90 + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_bark.json b/src/main/resources/assets/eidolon/blockstates/illwood_bark.json new file mode 100644 index 0000000..537b4e2 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_bark.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "eidolon:block/illwood_bark_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "eidolon:item/illwood_bark" + }, + "axis=z": { + "model": "eidolon:block/illwood_bark_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_leaves.json b/src/main/resources/assets/eidolon/blockstates/illwood_leaves.json new file mode 100644 index 0000000..4638239 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_leaves.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/illwood_leaves" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_log.json b/src/main/resources/assets/eidolon/blockstates/illwood_log.json new file mode 100644 index 0000000..20ce5df --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_log.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "eidolon:block/illwood_log_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "eidolon:item/illwood_log" + }, + "axis=z": { + "model": "eidolon:block/illwood_log_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_planks.json b/src/main/resources/assets/eidolon/blockstates/illwood_planks.json new file mode 100644 index 0000000..21d92cd --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_planks.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/illwood_planks" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_planks_fence.json b/src/main/resources/assets/eidolon/blockstates/illwood_planks_fence.json new file mode 100644 index 0000000..91e7074 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_planks_fence.json @@ -0,0 +1,48 @@ +{ + "multipart": [ + { + "apply": { + "model": "eidolon:block/illwood_planks_fence_post" + } + }, + { + "when": { + "north": "true" + }, + "apply": { + "model": "eidolon:block/illwood_planks_fence_side", + "uvlock": true + } + }, + { + "when": { + "east": "true" + }, + "apply": { + "model": "eidolon:block/illwood_planks_fence_side", + "y": 90, + "uvlock": true + } + }, + { + "when": { + "south": "true" + }, + "apply": { + "model": "eidolon:block/illwood_planks_fence_side", + "y": 180, + "uvlock": true + } + }, + { + "when": { + "west": "true" + }, + "apply": { + "model": "eidolon:block/illwood_planks_fence_side", + "y": 270, + "uvlock": true + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_planks_fence_gate.json b/src/main/resources/assets/eidolon/blockstates/illwood_planks_fence_gate.json new file mode 100644 index 0000000..1f963c2 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_planks_fence_gate.json @@ -0,0 +1,80 @@ +{ + "variants": { + "facing=east,in_wall=false,open=false": { + "uvlock": true, + "y": 270, + "model": "eidolon:item/illwood_planks_fence_gate" + }, + "facing=east,in_wall=false,open=true": { + "uvlock": true, + "y": 270, + "model": "eidolon:block/illwood_planks_fence_gate_open" + }, + "facing=east,in_wall=true,open=false": { + "uvlock": true, + "y": 270, + "model": "eidolon:block/illwood_planks_fence_gate_wall" + }, + "facing=east,in_wall=true,open=true": { + "uvlock": true, + "y": 270, + "model": "eidolon:block/illwood_planks_fence_gate_wall_open" + }, + "facing=north,in_wall=false,open=false": { + "uvlock": true, + "y": 180, + "model": "eidolon:item/illwood_planks_fence_gate" + }, + "facing=north,in_wall=false,open=true": { + "uvlock": true, + "y": 180, + "model": "eidolon:block/illwood_planks_fence_gate_open" + }, + "facing=north,in_wall=true,open=false": { + "uvlock": true, + "y": 180, + "model": "eidolon:block/illwood_planks_fence_gate_wall" + }, + "facing=north,in_wall=true,open=true": { + "uvlock": true, + "y": 180, + "model": "eidolon:block/illwood_planks_fence_gate_wall_open" + }, + "facing=south,in_wall=false,open=false": { + "uvlock": true, + "model": "eidolon:item/illwood_planks_fence_gate" + }, + "facing=south,in_wall=false,open=true": { + "uvlock": true, + "model": "eidolon:block/illwood_planks_fence_gate_open" + }, + "facing=south,in_wall=true,open=false": { + "uvlock": true, + "model": "eidolon:block/illwood_planks_fence_gate_wall" + }, + "facing=south,in_wall=true,open=true": { + "uvlock": true, + "model": "eidolon:block/illwood_planks_fence_gate_wall_open" + }, + "facing=west,in_wall=false,open=false": { + "uvlock": true, + "y": 90, + "model": "eidolon:item/illwood_planks_fence_gate" + }, + "facing=west,in_wall=false,open=true": { + "uvlock": true, + "y": 90, + "model": "eidolon:block/illwood_planks_fence_gate_open" + }, + "facing=west,in_wall=true,open=false": { + "uvlock": true, + "y": 90, + "model": "eidolon:block/illwood_planks_fence_gate_wall" + }, + "facing=west,in_wall=true,open=true": { + "uvlock": true, + "y": 90, + "model": "eidolon:block/illwood_planks_fence_gate_wall_open" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_planks_slab.json b/src/main/resources/assets/eidolon/blockstates/illwood_planks_slab.json new file mode 100644 index 0000000..435605b --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_planks_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "eidolon:item/illwood_planks_slab" + }, + "type=double": { + "model": "eidolon:item/illwood_planks" + }, + "type=top": { + "model": "eidolon:block/illwood_planks_slab_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_planks_stairs.json b/src/main/resources/assets/eidolon/blockstates/illwood_planks_stairs.json new file mode 100644 index 0000000..83f7bd7 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_planks_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "x": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_left": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_right": { + "model": "eidolon:block/illwood_planks_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=outer_left": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=outer_right": { + "model": "eidolon:block/illwood_planks_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=straight": { + "model": "eidolon:item/illwood_planks_stairs", + "x": 180, + "y": 180, + "uvlock": true + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/illwood_sapling.json b/src/main/resources/assets/eidolon/blockstates/illwood_sapling.json new file mode 100644 index 0000000..3a6ca8d --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/illwood_sapling.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:block/illwood_sapling" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/incubator.json b/src/main/resources/assets/eidolon/blockstates/incubator.json new file mode 100644 index 0000000..f52ea89 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/incubator.json @@ -0,0 +1,10 @@ +{ + "variants": { + "half=bottom": { + "model": "eidolon:block/incubator_bottom" + }, + "half=top": { + "model": "eidolon:block/incubator_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/magic_candle.json b/src/main/resources/assets/eidolon/blockstates/magic_candle.json new file mode 100644 index 0000000..eeeceb0 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/magic_candle.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:block/magic_candle" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/magic_candlestick.json b/src/main/resources/assets/eidolon/blockstates/magic_candlestick.json new file mode 100644 index 0000000..e1b3204 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/magic_candlestick.json @@ -0,0 +1,23 @@ +{ + "variants": { + "facing=up": { + "model": "eidolon:block/magic_candlestick" + }, + "facing=north": { + "model": "eidolon:block/magic_candlestick_wall", + "y": 180 + }, + "facing=west": { + "model": "eidolon:block/magic_candlestick_wall", + "y": 90 + }, + "facing=south": { + "model": "eidolon:block/magic_candlestick_wall", + "y": 0 + }, + "facing=east": { + "model": "eidolon:block/magic_candlestick_wall", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/merammer_root.json b/src/main/resources/assets/eidolon/blockstates/merammer_root.json new file mode 100644 index 0000000..e589de4 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/merammer_root.json @@ -0,0 +1,10 @@ +{ + "variants": { + "age=0": { + "model": "eidolon:block/merammer_root_0" + }, + "age=1": { + "model": "eidolon:block/merammer_root_1" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/mossy_smooth_stone_bricks.json b/src/main/resources/assets/eidolon/blockstates/mossy_smooth_stone_bricks.json new file mode 100644 index 0000000..ed17f95 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/mossy_smooth_stone_bricks.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/mossy_smooth_stone_bricks" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/oanna_bloom.json b/src/main/resources/assets/eidolon/blockstates/oanna_bloom.json new file mode 100644 index 0000000..8504c20 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/oanna_bloom.json @@ -0,0 +1,10 @@ +{ + "variants": { + "age=0": { + "model": "eidolon:block/oanna_bloom_0" + }, + "age=1": { + "model": "eidolon:block/oanna_bloom_1" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/obelisk.json b/src/main/resources/assets/eidolon/blockstates/obelisk.json new file mode 100644 index 0000000..2ae3603 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/obelisk.json @@ -0,0 +1,16 @@ +{ + "variants": { + "top=false,bottom=false": { + "model": "eidolon:item/obelisk" + }, + "top=true,bottom=false": { + "model": "eidolon:block/obelisk_bottom" + }, + "top=true,bottom=true": { + "model": "eidolon:block/obelisk_mid" + }, + "top=false,bottom=true": { + "model": "eidolon:block/obelisk_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/raw_lead_block.json b/src/main/resources/assets/eidolon/blockstates/raw_lead_block.json new file mode 100644 index 0000000..3a83737 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/raw_lead_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/raw_lead_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/raw_silver_block.json b/src/main/resources/assets/eidolon/blockstates/raw_silver_block.json new file mode 100644 index 0000000..114797b --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/raw_silver_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/raw_silver_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/research_table.json b/src/main/resources/assets/eidolon/blockstates/research_table.json new file mode 100644 index 0000000..7ca6610 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/research_table.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=north": { + "model": "eidolon:item/research_table", + "y": 180 + }, + "facing=west": { + "model": "eidolon:item/research_table", + "y": 90 + }, + "facing=south": { + "model": "eidolon:item/research_table" + }, + "facing=east": { + "model": "eidolon:item/research_table", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/shadow_gem_block.json b/src/main/resources/assets/eidolon/blockstates/shadow_gem_block.json new file mode 100644 index 0000000..4bcfbb6 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/shadow_gem_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/shadow_gem_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/sildrian_seed.json b/src/main/resources/assets/eidolon/blockstates/sildrian_seed.json new file mode 100644 index 0000000..624667d --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/sildrian_seed.json @@ -0,0 +1,10 @@ +{ + "variants": { + "age=0": { + "model": "eidolon:block/sildrian_seed_0" + }, + "age=1": { + "model": "eidolon:block/sildrian_seed_1" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/silver_block.json b/src/main/resources/assets/eidolon/blockstates/silver_block.json new file mode 100644 index 0000000..aacdd6e --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/silver_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/silver_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/silver_ore.json b/src/main/resources/assets/eidolon/blockstates/silver_ore.json new file mode 100644 index 0000000..ac90234 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/silver_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/silver_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/smooth_stone_arch.json b/src/main/resources/assets/eidolon/blockstates/smooth_stone_arch.json new file mode 100644 index 0000000..f367c41 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/smooth_stone_arch.json @@ -0,0 +1,16 @@ +{ + "variants": { + "top=false,bottom=false": { + "model": "eidolon:item/smooth_stone_arch" + }, + "top=true,bottom=false": { + "model": "eidolon:block/smooth_stone_arch_bottom" + }, + "top=true,bottom=true": { + "model": "eidolon:block/smooth_stone_arch_mid" + }, + "top=false,bottom=true": { + "model": "eidolon:block/smooth_stone_arch_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry.json b/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry.json new file mode 100644 index 0000000..fc6af3b --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "eidolon:item/smooth_stone_masonry" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry_slab.json b/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry_slab.json new file mode 100644 index 0000000..79e4f6d --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "eidolon:item/smooth_stone_masonry_slab" + }, + "type=double": { + "model": "eidolon:item/smooth_stone_masonry" + }, + "type=top": { + "model": "eidolon:block/smooth_stone_masonry_slab_top" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry_stairs.json b/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry_stairs.json new file mode 100644 index 0000000..d9eca03 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/smooth_stone_masonry_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=east,half=top,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=east,half=top,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "x": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "y": 270, + "uvlock": true + }, + "facing=north,half=bottom,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=north,half=top,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "uvlock": true + }, + "facing=north,half=top,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=south,half=bottom,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=south,half=top,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=south,half=top,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "x": 180, + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "y": 90, + "uvlock": true + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "y": 180, + "uvlock": true + }, + "facing=west,half=bottom,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=inner_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_inner", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=outer_left": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "y": 180, + "uvlock": true + }, + "facing=west,half=top,shape=outer_right": { + "model": "eidolon:block/smooth_stone_masonry_stairs_outer", + "x": 180, + "y": 270, + "uvlock": true + }, + "facing=west,half=top,shape=straight": { + "model": "eidolon:item/smooth_stone_masonry_stairs", + "x": 180, + "y": 180, + "uvlock": true + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/stripped_illwood_bark.json b/src/main/resources/assets/eidolon/blockstates/stripped_illwood_bark.json new file mode 100644 index 0000000..81fd39b --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/stripped_illwood_bark.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "eidolon:block/stripped_illwood_bark_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "eidolon:item/stripped_illwood_bark" + }, + "axis=z": { + "model": "eidolon:block/stripped_illwood_bark_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/blockstates/stripped_illwood_log.json b/src/main/resources/assets/eidolon/blockstates/stripped_illwood_log.json new file mode 100644 index 0000000..889f643 --- /dev/null +++ b/src/main/resources/assets/eidolon/blockstates/stripped_illwood_log.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "eidolon:block/stripped_illwood_log_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "eidolon:item/stripped_illwood_log" + }, + "axis=z": { + "model": "eidolon:block/stripped_illwood_log_horizontal", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/lang/en_us.json b/src/main/resources/assets/eidolon/lang/en_us.json index b8c71c6..58b4d3f 100644 --- a/src/main/resources/assets/eidolon/lang/en_us.json +++ b/src/main/resources/assets/eidolon/lang/en_us.json @@ -18,9 +18,21 @@ "lore.eidolon.gravity_belt": "It feels light.", "lore.eidolon.glass_hand": "Risk and reward.", "lore.eidolon.top_hat": "Indubitably.", + "lore.eidolon.athame": "It feels red-powerful.", + "lore.eidolon.angels_sight": "It seems to be judging you.", + "lore.eidolon.terminus_mirror": "Gaze into whirling infinite.", + "lore.eidolon.deathbringer_scythe": "Gives you a sinking feeling.", + "lore.eidolon.soulbone_amulet": "It has an ineffable quality.", + "lore.eidolon.withered_heart": "It feels hollow in your hand.", + "lore.eidolon.grape_candy": "Grim Grape", + "lore.eidolon.red_candy": "Reaping Raspberry", "item.eidolon.lead_ingot": "Lead Ingot", + "item.eidolon.raw_lead": "Raw Lead", "item.eidolon.lead_nugget": "Lead Nugget", + "item.eidolon.silver_ingot": "Silver Ingot", + "item.eidolon.raw_silver": "Raw Silver", + "item.eidolon.silver_nugget": "Silver Nugget", "item.eidolon.pewter_blend": "Pewter Blend", "item.eidolon.pewter_ingot": "Pewter Ingot", "item.eidolon.pewter_nugget": "Pewter Nugget", @@ -28,6 +40,15 @@ "item.eidolon.arcane_gold_ingot": "Arcane Gold Ingot", "item.eidolon.arcane_gold_nugget": "Arcane Gold Nugget", "item.eidolon.gold_inlay": "Gold Inlay", + "item.eidolon.silver_helmet": "Silver Helmet", + "item.eidolon.silver_chestplate": "Silver Chestplate", + "item.eidolon.silver_leggings": "Silver Leggings", + "item.eidolon.silver_boots": "Silver Boots", + "item.eidolon.silver_sword": "Silver Sword", + "item.eidolon.silver_pickaxe": "Silver Pickaxe", + "item.eidolon.silver_axe": "Silver Axe", + "item.eidolon.silver_shovel": "Silver Shovel", + "item.eidolon.silver_hoe": "Silver Hoe", "item.eidolon.top_hat": "Top Hat", "item.eidolon.basic_ring": "Basic Ring", "item.eidolon.basic_amulet": "Basic Amulet", @@ -65,6 +86,7 @@ "item.eidolon.spawn_wraith": "Spawn Wraith", "item.eidolon.spawn_zombie_brute": "Spawn Zombie Brute", "item.eidolon.spawn_necromancer": "Spawn Necromancer", + "item.eidolon.spawn_slimy_slug": "Spawn Slug", "item.eidolon.codex": "Ars Ecclesia", "item.eidolon.music_disc_parousia": "Music Disc", "item.eidolon.reversal_pick": "Pickaxe of Inversion", @@ -86,15 +108,98 @@ "item.minecraft.splash_potion.effect.long_chilled": "Splash Potion of Chilling", "item.minecraft.tipped_arrow.effect.long_chilled": "Arrow of Chilling", "item.minecraft.lingering_potion.effect.long_chilled": "Lingering Potion of Chilling", + "item.minecraft.potion.effect.reinforced": "Potion of Reinforcing", + "item.minecraft.splash_potion.effect.reinforced": "Splash Potion of Reinforcing", + "item.minecraft.tipped_arrow.effect.reinforced": "Arrow of Reinforcing", + "item.minecraft.lingering_potion.effect.reinforced": "Lingering Potion of Reinforcing", + "item.minecraft.potion.effect.long_reinforced": "Potion of Reinforcing", + "item.minecraft.splash_potion.effect.long_reinforced": "Splash Potion of Reinforcing", + "item.minecraft.tipped_arrow.effect.long_reinforced": "Arrow of Reinforcing", + "item.minecraft.lingering_potion.effect.long_reinforced": "Lingering Potion of Reinforcing", + "item.minecraft.potion.effect.strong_reinforced": "Potion of Reinforcing", + "item.minecraft.splash_potion.effect.strong_reinforced": "Splash Potion of Reinforcing", + "item.minecraft.tipped_arrow.effect.strong_reinforced": "Arrow of Reinforcing", + "item.minecraft.lingering_potion.effect.strong_reinforced": "Lingering Potion of Reinforcing", + "item.minecraft.potion.effect.vulnerable": "Potion of Vulnerability", + "item.minecraft.splash_potion.effect.vulnerable": "Splash Potion of Vulnerability", + "item.minecraft.tipped_arrow.effect.vulnerable": "Arrow of Vulnerability", + "item.minecraft.lingering_potion.effect.vulnerable": "Lingering Potion of Vulnerability", + "item.minecraft.potion.effect.long_vulnerable": "Potion of Vulnerability", + "item.minecraft.splash_potion.effect.long_vulnerable": "Splash Potion of Vulnerability", + "item.minecraft.tipped_arrow.effect.long_vulnerable": "Arrow of Vulnerability", + "item.minecraft.lingering_potion.effect.long_vulnerable": "Lingering Potion of Vulnerability", + "item.minecraft.potion.effect.strong_vulnerable": "Potion of Vulnerability", + "item.minecraft.splash_potion.effect.strong_vulnerable": "Splash Potion of Vulnerability", + "item.minecraft.tipped_arrow.effect.strong_vulnerable": "Arrow of Vulnerability", + "item.minecraft.lingering_potion.effect.strong_vulnerable": "Lingering Potion of Vulnerability", + "item.minecraft.potion.effect.undeath": "Potion of Undeath", + "item.minecraft.splash_potion.effect.undeath": "Splash Potion of Undeath", + "item.minecraft.tipped_arrow.effect.undeath": "Arrow of Undeath", + "item.minecraft.lingering_potion.effect.undeath": "Lingering Potion of Undeath", + "item.minecraft.potion.effect.long_undeath": "Potion of Undeath", + "item.minecraft.splash_potion.effect.long_undeath": "Splash Potion of Undeath", + "item.minecraft.tipped_arrow.effect.long_undeath": "Arrow of Undeath", + "item.minecraft.lingering_potion.effect.long_undeath": "Lingering Potion of Undeath", + "item.minecraft.potion.effect.decay": "Potion of Decay", + "item.minecraft.splash_potion.effect.decay": "Splash Potion of Decay", + "item.minecraft.tipped_arrow.effect.decay": "Arrow of Decay", + "item.minecraft.lingering_potion.effect.decay": "Lingering Potion of Decay", + "item.minecraft.potion.effect.long_decay": "Potion of Decay", + "item.minecraft.splash_potion.effect.long_decay": "Splash Potion of Decay", + "item.minecraft.tipped_arrow.effect.long_decay": "Arrow of Decay", + "item.minecraft.lingering_potion.effect.long_decay": "Lingering Potion of Decay", + "item.minecraft.potion.effect.strong_decay": "Potion of Decay", + "item.minecraft.splash_potion.effect.strong_decay": "Splash Potion of Decay", + "item.minecraft.tipped_arrow.effect.strong_decay": "Arrow of Decay", + "item.minecraft.lingering_potion.effect.strong_decay": "Lingering Potion of Decay", + "item.eidolon.spawn_raven": "Spawn Raven", + "item.eidolon.raven_feather": "Raven Feather", + "item.eidolon.alchemists_tongs": "Alchemist's Tongs", + "item.eidolon.athame": "Athame", + "item.eidolon.terminus_mirror": "Mirror of Terminus", + "item.eidolon.angels_sight": "Archangel's Sight", + "item.eidolon.merammer_resin": "Merammer Resin", + "item.eidolon.enervating_ring": "Enervating Ring", + "item.eidolon.parchment": "Parchment", + "item.eidolon.magic_ink": "Magic Ink", + "item.eidolon.magicians_wax": "Magician's Wax", + "item.eidolon.arcane_seal": "Arcane Seal", + "item.eidolon.notetaking_tools": "Note-taking Tools", + "item.eidolon.research_notes": "Research Notes", + "item.eidolon.completed_research": "Completed Research", + "item.eidolon.summoning_staff": "Summoning Staff", + "item.eidolon.deathbringer_scythe": "Deathbringer's Scythe", + "item.eidolon.soulbone_amulet": "Soulbone Amulet", + "item.eidolon.imbued_bones": "Imbued Bones", + "item.eidolon.bonelord_helm": "Bone Paladin Helm", + "item.eidolon.bonelord_chestplate": "Bone Paladin Chestplate", + "item.eidolon.bonelord_greaves": "Bone Paladin Greaves", + "item.eidolon.withered_heart": "Withered Heart", + "item.eidolon.grape_candy": "Soul Candy", + "item.eidolon.red_candy": "Soul Candy", + "item.eidolon.raven_cloak": "Raven Cloak", + "item.eidolon.elder_brick": "Ancient Brick", "block.eidolon.lead_block": "Lead Block", "block.eidolon.lead_ore": "Lead Ore", + "block.eidolon.raw_lead_block": "Block of Raw Lead", + "block.eidolon.deep_lead_ore": "Deepslate Lead Ore", + "block.eidolon.silver_block": "Silver Block", + "block.eidolon.silver_ore": "Silver Ore", + "block.eidolon.raw_silver_block": "Block of Raw Silver", + "block.eidolon.deep_silver_ore": "Deepslate Silver Ore", "block.eidolon.pewter_block": "Pewter Block", "block.eidolon.arcane_gold_block": "Arcane Gold Block", + "block.eidolon.shadow_gem_block": "Shadow Gem Block", "block.eidolon.smooth_stone_bricks": "Smooth Stone Bricks", + "block.eidolon.mossy_smooth_stone_bricks": "Mossy Smooth Stone Bricks", "block.eidolon.smooth_stone_bricks_slab": "Smooth Stone Bricks Slab", "block.eidolon.smooth_stone_bricks_stairs": "Smooth Stone Bricks Stairs", "block.eidolon.smooth_stone_bricks_wall": "Smooth Stone Bricks Wall", + "block.eidolon.smooth_stone_masonry": "Smooth Stone Masonry", + "block.eidolon.smooth_stone_masonry_slab": "Smooth Stone Masonry Slab", + "block.eidolon.smooth_stone_masonry_stairs": "Smooth Stone Masonry Stairs", + "block.eidolon.smooth_stone_arch": "Smooth Stone Arch", "block.eidolon.smooth_stone_tiles": "Smooth Stone Tiles", "block.eidolon.smooth_stone_tiles_slab": "Smooth Stone Tiles Slab", "block.eidolon.smooth_stone_tiles_stairs": "Smooth Stone Tiles Stairs", @@ -106,9 +211,14 @@ "block.eidolon.polished_wood_pillar": "Polished Wood Pillar", "block.eidolon.brazier": "Brazier", "block.eidolon.planter": "Planter", + "block.eidolon.oanna_bloom": "Flowering Oanna", + "block.eidolon.merammer_root": "Merammer Root", + "block.eidolon.sildrian_seed": "Sildrian Seed", + "block.eidolon.avennian_sprig": "Sprig of Avenna", "block.eidolon.crucible": "Crucible", "block.eidolon.crafting_altar": "Crafting Altar", "block.eidolon.plinth": "Plinth", + "block.eidolon.obelisk": "Obelisk", "block.eidolon.stone_hand": "Stone Hand", "block.eidolon.enchanted_ash": "Enchanted Ash", "block.eidolon.necrotic_focus": "Necrotic Focus", @@ -116,12 +226,42 @@ "block.eidolon.stone_altar": "Stone Altar", "block.eidolon.candle": "Candle", "block.eidolon.candlestick": "Candlestick", + "block.eidolon.magic_candle": "Magic Candle", + "block.eidolon.magic_candlestick": "Magic Candlestick", "block.eidolon.goblet": "Goblet", "block.eidolon.unholy_effigy": "Elder Statue", "block.eidolon.straw_effigy": "Straw Effigy", "block.eidolon.worktable": "Magic Workbench", "block.eidolon.soul_enchanter": "Soul Enchanter", "block.eidolon.wooden_brewing_stand": "Apothecary Stand", + "block.eidolon.incubator": "Vesseler Jar", + "block.eidolon.glass_tube": "Glass Tube", + "block.eidolon.cistern": "Cistern", + "block.eidolon.research_table": "Research Table", + "block.eidolon.illwood_log": "Illwood Log", + "block.eidolon.illwood_bark": "Illwood Bark", + "block.eidolon.illwood_leaves": "Illwood Leaves", + "block.eidolon.stripped_illwood_log": "Stripped Illwood Log", + "block.eidolon.stripped_illwood_bark": "Illwood", + "block.eidolon.illwood_planks_fence_gate": "Illwood Fence Gate", + "block.eidolon.illwood_planks_fence": "Illwood Fence", + "block.eidolon.illwood_planks_slab": "Illwood Slab", + "block.eidolon.illwood_planks_stairs": "Illwood Stairs", + "block.eidolon.illwood_planks": "Illwood Planks", + "block.eidolon.illwood_sapling": "Illwood Sapling", + "block.eidolon.elder_bricks": "Ancient Bricks", + "block.eidolon.elder_bricks_masonry": "Ancient Bricks Masonry", + "block.eidolon.elder_bricks_slab": "Ancient Bricks Slab", + "block.eidolon.elder_bricks_stairs": "Ancient Bricks Stairs", + "block.eidolon.elder_bricks_wall": "Ancient Bricks Wall", + "block.eidolon.elder_bricks_eye": "Ancient Eye", + "block.eidolon.elder_pillar": "Ancient Pillar", + "block.eidolon.elder_masonry": "Ancient Masonry", + "block.eidolon.elder_masonry_slab": "Ancient Masonry Slab", + "block.eidolon.elder_masonry_stairs": "Ancient Masonry Stairs", + "block.eidolon.bone_pile": "Pile of Bones", + "block.eidolon.bone_pile_slab": "Bone Pile Slab", + "block.eidolon.bone_pile_stairs": "Bone Pile Stairs", "entity.eidolon.zombie_brute": "Zombie Brute", "entity.eidolon.wraith": "Wraith", @@ -129,6 +269,8 @@ "entity.eidolon.soulfire_projectile": "Soulfire Projectile", "entity.eidolon.bonechill_projectile": "Bonechill Projectile", "entity.eidolon.chant_caster": "Chant Caster", + "entity.eidolon.raven": "Raven", + "entity.eidolon.slimy_slug": "Slug", "death.attack.ritual": "%s got too involved in a ritual", "death.attack.ritual.player": "%s was sacrificed by %s", @@ -137,6 +279,12 @@ "effect.eidolon.chilled": "Chilled", "effect.eidolon.anchored": "Anchored", + "effect.eidolon.reinforced": "Reinforced", + "effect.eidolon.vulnerable": "Vulnerable", + "effect.eidolon.undeath": "Undeath", + + "eidolon.persistent_soul_hearts": "Persistent Soul Health", + "eidolon.max_soul_hearts": "Max Soul Health", "eidolon.subtitle.cast_soulfire": "Soulfire spell", "eidolon.subtitle.cast_bonechill": "Bonechill spell", @@ -151,14 +299,22 @@ "jei.eidolon.ritual": "Brazier", "eidolon.tooltip.necrotic": "Necrotic", + "eidolon.tooltip.active_summon": "Selected: ", + "eidolon.tooltip.no_selected_summon": "None", "eidolon.title.new_fact": "Acquired new knowledge", "eidolon.title.new_sign": "Unlocked: %s Sign", + "eidolon.title.new_research": "Learned about %s", + "eidolon.title.new_rune": "Unlocked: %s Rune", "eidolon.sign.wicked": "Wicked", "eidolon.sign.sacred": "Sacred", "eidolon.sign.blood": "Blood", "eidolon.sign.soul": "Soul", "eidolon.sign.mind": "Mind", + "eidolon.sign.flame": "Flame", + + "eidolon.rune.sin": "Sin", + "eidolon.rune.crimson_rose": "Crimson Rose", "eidolon.codex.chant_hover": "Chant", "eidolon.codex.cancel_hover": "Clear", @@ -167,6 +323,11 @@ "container.eidolon.enchant.shard.one": "%s Soul Shard", "container.eidolon.enchant.shard.many": "%s Soul Shards", "container.eidolon.wooden_brewing_stand": "Apothecary Stand", + + "research.eidolon.gluttony": "Gluttony", + + "commands.eidolon.knowledge.success.single": "Updated %s's knowledge", + "commands.eidolon.knowledge.success.multiple": "Updated knowledge of %s players", "eidolon.codex.chapter.monsters": "Monsters", "eidolon.codex.page.monsters.zombie_brute.title": "Zombie Brute", @@ -416,5 +577,9 @@ "eidolon.codex.chapter.mind_sign": "Mind Sign", "eidolon.codex.page.mind_sign.title": "Mind Sign", "eidolon.codex.page.mind_sign": "The mind is what separates intelligent beings from the world's other creatures. It is only with the mind, and the use of the mind sign, that complex magic becomes possible for the mortal practitioner.", - "eidolon.codex.category.signs": "Mystical Signs" + "eidolon.codex.category.signs": "Mystical Signs", + + "eidolon.codex.rune.sin": "A vile and wicked sigil. Adds one Wicked sign to the end of the spell.", + "eidolon.codex.rune.crimson_rose": "Thrives upon bloodshed. Consumes two Wicked signs from the end of the spell, and adds one Blood sign in their place.", + "eidolon.codex.category.runes": "Runecraft" } \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/aludel.json b/src/main/resources/assets/eidolon/models/block/aludel.json new file mode 100644 index 0000000..111d2a6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/aludel.json @@ -0,0 +1,177 @@ +{ + "credit": "Made with Blockbench", + "parent": "minecraft:block/block", + "textures": { + "0": "eidolon:block/aludel_parts", + "1": "eidolon:block/aludel_power", + "2": "eidolon:block/aludel_side", + "3": "eidolon:block/aludel_front", + "4": "eidolon:block/aludel_jar_side", + "5": "eidolon:block/aludel_jar_top", + "particle": "eidolon:block/aludel_parts" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 4], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 0, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 4, 16], "texture": "#2"}, + "up": {"uv": [0, 0, 16, 4], "texture": "#1"}, + "down": {"uv": [0, 16, 16, 12], "texture": "#1"} + } + }, + { + "from": [0, 0, 4], + "to": [4, 11, 12], + "faces": { + "east": {"uv": [4, 5, 12, 16], "texture": "#2"}, + "west": {"uv": [4, 5, 12, 16], "texture": "#2"}, + "up": {"uv": [0, 4, 8, 8], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 8, 4], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [12, 0, 4], + "to": [16, 11, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "east": {"uv": [12, 5, 4, 16], "texture": "#2"}, + "west": {"uv": [12, 5, 4, 16], "texture": "#2"}, + "up": {"uv": [0, 8, 8, 4], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 4, 8, 0], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [4, 2, 4], + "to": [12, 16, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "east": {"uv": [12, 0, 4, 14], "texture": "#3"}, + "south": {"uv": [12, 0, 4, 14], "texture": "#3"}, + "west": {"uv": [12, 0, 4, 14], "texture": "#3"} + } + }, + { + "from": [4, 0, 12], + "to": [12, 2, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [12, 14, 4, 16], "texture": "#3"}, + "south": {"uv": [12, 14, 4, 16], "texture": "#3"}, + "up": {"uv": [0, 0, 8, 4], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 8, 4], "texture": "#0"} + } + }, + { + "from": [4, 0, 4], + "to": [12, 2, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "down": {"uv": [8, 0, 16, 8], "texture": "#0"} + } + }, + { + "from": [0, 0, 12], + "to": [4, 16, 16], + "faces": { + "north": {"uv": [0, 0, 4, 16], "texture": "#3"}, + "east": {"uv": [12, 0, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 0, 4, 16], "texture": "#3"}, + "west": {"uv": [12, 0, 16, 16], "texture": "#2"}, + "up": {"uv": [12, 0, 16, 4], "texture": "#2"}, + "down": {"uv": [0, 12, 4, 16], "texture": "#3"} + } + }, + { + "from": [12, 0, 12], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [4, 0, 0, 16], "texture": "#3"}, + "east": {"uv": [16, 0, 12, 16], "texture": "#2"}, + "south": {"uv": [4, 0, 0, 16], "texture": "#3"}, + "west": {"uv": [16, 0, 12, 16], "texture": "#2"}, + "up": {"uv": [16, 0, 12, 4], "texture": "#2"}, + "down": {"uv": [4, 12, 0, 16], "texture": "#3"} + } + }, + { + "from": [2, 22, 2], + "to": [14, 30, 14], + "faces": { + "north": {"uv": [0, 0, 12, 8], "texture": "#4"}, + "east": {"uv": [0, 0, 12, 8], "texture": "#4"}, + "south": {"uv": [0, 0, 12, 8], "texture": "#4"}, + "west": {"uv": [0, 0, 12, 8], "texture": "#4"}, + "up": {"uv": [0, 0, 12, 12], "texture": "#5"}, + "down": {"uv": [0, 0, 12, 12], "texture": "#5"} + } + }, + { + "from": [4, 30, 4], + "to": [12, 32, 12], + "faces": { + "north": {"uv": [8, 8, 16, 10], "texture": "#4"}, + "east": {"uv": [8, 8, 16, 10], "texture": "#4"}, + "south": {"uv": [8, 8, 16, 10], "texture": "#4"}, + "west": {"uv": [8, 8, 16, 10], "texture": "#4"}, + "up": {"uv": [0, 8, 8, 16], "texture": "#4"} + } + }, + { + "from": [0, 20, 11.99], + "to": [4, 26, 15.99], + "rotation": {"angle": -22.5, "axis": "z", "origin": [0, 20, 13.99]}, + "faces": { + "north": {"uv": [1, 8, 7, 12], "rotation": 90, "texture": "#0"}, + "east": {"uv": [1, 0, 7, 4], "rotation": 270, "texture": "#0"}, + "south": {"uv": [7, 8, 1, 12], "rotation": 270, "texture": "#0"}, + "west": {"uv": [1, 0, 7, 4], "rotation": 270, "texture": "#0"}, + "up": {"uv": [2, 8, 6, 12], "rotation": 270, "texture": "#0"}, + "down": {"uv": [2, 8, 6, 12], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [12, 20, 11.99], + "to": [16, 26, 15.99], + "rotation": {"angle": 22.5, "axis": "z", "origin": [16, 20, 13.99]}, + "faces": { + "north": {"uv": [1, 12, 7, 8], "rotation": 90, "texture": "#0"}, + "east": {"uv": [1, 4, 7, 0], "rotation": 270, "texture": "#0"}, + "south": {"uv": [7, 12, 1, 8], "rotation": 270, "texture": "#0"}, + "west": {"uv": [1, 4, 7, 0], "rotation": 270, "texture": "#0"}, + "up": {"uv": [2, 12, 6, 8], "rotation": 270, "texture": "#0"}, + "down": {"uv": [2, 12, 6, 8], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [12, 20, 0.01], + "to": [16, 26, 4.01], + "rotation": {"angle": 22.5, "axis": "z", "origin": [16, 20, 2.01]}, + "faces": { + "north": {"uv": [1, 12, 7, 8], "rotation": 90, "texture": "#0"}, + "east": {"uv": [1, 4, 7, 0], "rotation": 270, "texture": "#0"}, + "south": {"uv": [7, 12, 1, 8], "rotation": 270, "texture": "#0"}, + "west": {"uv": [1, 4, 7, 0], "rotation": 270, "texture": "#0"}, + "up": {"uv": [2, 12, 6, 8], "rotation": 270, "texture": "#0"}, + "down": {"uv": [2, 12, 6, 8], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [0, 20, 0.01], + "to": [4, 26, 4.01], + "rotation": {"angle": -22.5, "axis": "z", "origin": [0, 20, 2.01]}, + "faces": { + "north": {"uv": [1, 8, 7, 12], "rotation": 90, "texture": "#0"}, + "east": {"uv": [1, 0, 7, 4], "rotation": 270, "texture": "#0"}, + "south": {"uv": [7, 8, 1, 12], "rotation": 270, "texture": "#0"}, + "west": {"uv": [1, 0, 7, 4], "rotation": 270, "texture": "#0"}, + "up": {"uv": [2, 8, 6, 12], "rotation": 270, "texture": "#0"}, + "down": {"uv": [2, 8, 6, 12], "rotation": 270, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/avennian_sprig_0.json b/src/main/resources/assets/eidolon/models/block/avennian_sprig_0.json new file mode 100644 index 0000000..3c5f567 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/avennian_sprig_0.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/avennian_sprig_0" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/avennian_sprig_1.json b/src/main/resources/assets/eidolon/models/block/avennian_sprig_1.json new file mode 100644 index 0000000..d572048 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/avennian_sprig_1.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/avennian_sprig_1" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/bone_pile_slab_top.json b/src/main/resources/assets/eidolon/models/block/bone_pile_slab_top.json new file mode 100644 index 0000000..2c0b61f --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/bone_pile_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "eidolon:block/bone_pile", + "top": "eidolon:block/bone_pile", + "side": "eidolon:block/bone_pile" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/bone_pile_stairs_inner.json b/src/main/resources/assets/eidolon/models/block/bone_pile_stairs_inner.json new file mode 100644 index 0000000..cc9949c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/bone_pile_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "eidolon:block/bone_pile", + "top": "eidolon:block/bone_pile", + "side": "eidolon:block/bone_pile" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/bone_pile_stairs_outer.json b/src/main/resources/assets/eidolon/models/block/bone_pile_stairs_outer.json new file mode 100644 index 0000000..b634a23 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/bone_pile_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "eidolon:block/bone_pile", + "top": "eidolon:block/bone_pile", + "side": "eidolon:block/bone_pile" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/cabinet_bottom.json b/src/main/resources/assets/eidolon/models/block/cabinet_bottom.json new file mode 100644 index 0000000..bc5c179 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/cabinet_bottom.json @@ -0,0 +1,100 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "eidolon:block/cabinet_bottom_front", + "1": "eidolon:block/cabinet_bottom_side", + "5": "eidolon:block/cabinet_bottom", + "particle": "eidolon:block/cabinet_bottom_front" + }, + "elements": [ + { + "from": [2, 0, 2], + "to": [4, 2, 4], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [12, 0, 2], + "to": [14, 2, 4], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [2, 0, 12], + "to": [4, 2, 14], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [12, 0, 12], + "to": [14, 2, 14], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [0, 2, 0], + "to": [16, 6, 16], + "faces": { + "north": {"uv": [0, 10, 16, 14], "texture": "#0"}, + "east": {"uv": [0, 10, 16, 14], "texture": "#1"}, + "south": {"uv": [0, 10, 16, 14], "texture": "#1"}, + "west": {"uv": [0, 10, 16, 14], "texture": "#1"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#5"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#5"} + } + }, + { + "from": [0, 6, 0], + "to": [3, 16, 16], + "faces": { + "north": {"uv": [13, 0, 16, 10], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 10], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 10], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 10], "texture": "#1"}, + "up": {"uv": [0, 10, 16, 13], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [13, 6, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [16, 0, 13, 10], "texture": "#0"}, + "east": {"uv": [16, 0, 0, 10], "texture": "#1"}, + "south": {"uv": [3, 0, 0, 10], "texture": "#1"}, + "west": {"uv": [16, 0, 0, 10], "texture": "#0"}, + "up": {"uv": [0, 13, 16, 10], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [3, 6, 13], + "to": [13, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [13, 0, 3, 10], "texture": "#0"}, + "south": {"uv": [13, 0, 3, 10], "texture": "#1"}, + "up": {"uv": [3, 13, 13, 10], "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/cabinet_top.json b/src/main/resources/assets/eidolon/models/block/cabinet_top.json new file mode 100644 index 0000000..fa00bbd --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/cabinet_top.json @@ -0,0 +1,58 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "eidolon:block/cabinet_bottom_side", + "2": "eidolon:block/cabinet_top", + "3": "eidolon:block/cabinet_top_front", + "4": "eidolon:block/cabinet_top_side", + "5": "eidolon:block/cabinet_bottom", + "particle": "eidolon:block/cabinet_bottom_front" + }, + "elements": [ + { + "from": [0, 12, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 4], "texture": "#3"}, + "east": {"uv": [0, 0, 16, 4], "texture": "#4"}, + "south": {"uv": [0, 0, 16, 4], "texture": "#4"}, + "west": {"uv": [0, 0, 16, 4], "texture": "#4"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#5"} + } + }, + { + "from": [3, 0, 13], + "to": [13, 12, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [13, 4, 3, 16], "texture": "#3"}, + "south": {"uv": [13, 4, 3, 16], "texture": "#4"}, + "down": {"uv": [3, 13, 13, 10], "texture": "#1"} + } + }, + { + "from": [0, 0, 0], + "to": [3, 12, 16], + "faces": { + "north": {"uv": [13, 4, 16, 16], "texture": "#3"}, + "east": {"uv": [0, 4, 16, 16], "texture": "#3"}, + "south": {"uv": [0, 4, 3, 16], "texture": "#4"}, + "west": {"uv": [0, 4, 16, 16], "texture": "#4"}, + "down": {"uv": [0, 10, 16, 13], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [13, 0, 0], + "to": [16, 12, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [16, 6, 13, 16], "texture": "#3"}, + "east": {"uv": [16, 4, 0, 16], "texture": "#4"}, + "south": {"uv": [3, 4, 0, 16], "texture": "#4"}, + "west": {"uv": [16, 4, 0, 16], "texture": "#3"}, + "down": {"uv": [0, 13, 16, 10], "rotation": 270, "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/censer.json b/src/main/resources/assets/eidolon/models/block/censer.json new file mode 100644 index 0000000..2d17f5e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/censer.json @@ -0,0 +1,154 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/censer", + "1": "eidolon:block/censer_cage", + "particle": "eidolon:block/censer" + }, + "elements": [ + { + "from": [5.5, 1, 5.5], + "to": [10.5, 3, 10.5], + "rotation": {"angle": 0, "axis": "y", "origin": [17.5, 9, 15.5]}, + "faces": { + "north": {"uv": [11, 5, 16, 7], "texture": "#0"}, + "east": {"uv": [11, 5, 16, 7], "texture": "#0"}, + "south": {"uv": [11, 5, 16, 7], "texture": "#0"}, + "west": {"uv": [11, 5, 16, 7], "texture": "#0"}, + "up": {"uv": [11, 0, 16, 5], "texture": "#0"}, + "down": {"uv": [11, 7, 16, 12], "texture": "#0"} + } + }, + { + "from": [5.5, 10, 5.5], + "to": [10.5, 11, 10.5], + "rotation": {"angle": 0, "axis": "y", "origin": [17.5, 18, 15.5]}, + "faces": { + "north": {"uv": [11, 5, 16, 6], "texture": "#0"}, + "east": {"uv": [11, 5, 16, 6], "texture": "#0"}, + "south": {"uv": [11, 5, 16, 6], "texture": "#0"}, + "west": {"uv": [11, 5, 16, 6], "texture": "#0"}, + "up": {"uv": [6, 1, 11, 6], "texture": "#0"}, + "down": {"uv": [11, 0, 16, 5], "texture": "#0"} + } + }, + { + "from": [5, 10, 5], + "to": [11, 11, 11], + "rotation": {"angle": -22.5, "axis": "z", "origin": [11, 11, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 7], "rotation": 180, "texture": "#0"}, + "east": {"uv": [0, 7, 1, 13], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 6, 6, 7], "texture": "#0"}, + "west": {"uv": [5, 0, 6, 6], "rotation": 90, "texture": "#0"}, + "up": {"uv": [0, 0, 6, 6], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 7, 6, 13], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [4.5, 3, 4.5], + "to": [11.5, 10, 11.5], + "rotation": {"angle": 0, "axis": "y", "origin": [17.5, 11, 15.5]}, + "faces": { + "north": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "east": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "south": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "west": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "up": {"uv": [7, 0, 14, 7], "texture": "#1"}, + "down": {"uv": [0, 7, 7, 14], "texture": "#1"} + } + }, + { + "from": [11.5, 3, 4.5], + "to": [4.5, 10, 11.5], + "rotation": {"angle": 0, "axis": "y", "origin": [24.5, 11, 15.5]}, + "faces": { + "north": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "east": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "south": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "west": {"uv": [0, 0, 7, 7], "texture": "#1"}, + "up": {"uv": [7, 0, 14, 7], "texture": "#1"}, + "down": {"uv": [0, 7, 7, 14], "texture": "#1"} + } + }, + { + "from": [7.5, 0, 4.75], + "to": [8.5, 2, 5.75], + "rotation": {"angle": 22.5, "axis": "x", "origin": [8, 0, 4.75]}, + "faces": { + "north": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "east": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "south": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "west": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "up": {"uv": [11, 12, 12, 13], "texture": "#0"}, + "down": {"uv": [11, 13, 12, 14], "texture": "#0"} + } + }, + { + "from": [7.5, 0, 10.25], + "to": [8.5, 2, 11.25], + "rotation": {"angle": -22.5, "axis": "x", "origin": [8, 0, 11.25]}, + "faces": { + "north": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "east": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "south": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "west": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "up": {"uv": [11, 12, 12, 13], "rotation": 180, "texture": "#0"}, + "down": {"uv": [11, 13, 12, 14], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [10.25, 0, 7.5], + "to": [11.25, 2, 8.5], + "rotation": {"angle": 22.5, "axis": "z", "origin": [11.25, 0, 8]}, + "faces": { + "north": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "east": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "south": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "west": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "up": {"uv": [11, 12, 12, 13], "rotation": 90, "texture": "#0"}, + "down": {"uv": [11, 13, 12, 14], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [4.75, 0, 7.5], + "to": [5.75, 2, 8.5], + "rotation": {"angle": -22.5, "axis": "z", "origin": [4.75, 0, 8]}, + "faces": { + "north": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "east": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "south": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "west": {"uv": [11, 12, 12, 14], "texture": "#0"}, + "up": {"uv": [11, 12, 12, 13], "rotation": 270, "texture": "#0"}, + "down": {"uv": [11, 13, 12, 14], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [6, 11, 6], + "to": [7, 12, 7], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 19, 14]}, + "faces": { + "north": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "east": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "south": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "west": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "up": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "down": {"uv": [10, 0, 11, 1], "texture": "#0"} + } + }, + { + "from": [6, 11, 9], + "to": [7, 12, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 19, 17]}, + "faces": { + "north": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "east": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "south": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "west": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "up": {"uv": [10, 0, 11, 1], "texture": "#0"}, + "down": {"uv": [10, 0, 11, 1], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/cistern_lower.json b/src/main/resources/assets/eidolon/models/block/cistern_lower.json new file mode 100644 index 0000000..1010b5b --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/cistern_lower.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/cistern_bottom", + "1": "eidolon:block/cistern_ends", + "4": "eidolon:block/cistern_top", + "particle": "eidolon:block/cistern_bottom" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [12, 2, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 8, 12]}, + "faces": { + "north": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "east": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "south": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "west": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + }, + { + "from": [1, 2, 1], + "to": [15, 16, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 10, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "east": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "south": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "west": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "down": {"uv": [0, 0, 14, 14], "texture": "#4"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/cistern_mid.json b/src/main/resources/assets/eidolon/models/block/cistern_mid.json new file mode 100644 index 0000000..10f2980 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/cistern_mid.json @@ -0,0 +1,21 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "2": "eidolon:block/cistern_mid", + "particle": "eidolon:block/cistern_bottom" + }, + "elements": [ + { + "from": [1, 0, 1], + "to": [15, 16, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 16], "texture": "#2"}, + "east": {"uv": [0, 0, 14, 16], "texture": "#2"}, + "south": {"uv": [0, 0, 14, 16], "texture": "#2"}, + "west": {"uv": [0, 0, 14, 16], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/cistern_upper.json b/src/main/resources/assets/eidolon/models/block/cistern_upper.json new file mode 100644 index 0000000..2303b43 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/cistern_upper.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "1": "eidolon:block/cistern_ends", + "4": "eidolon:block/cistern_top", + "5": "eidolon:block/cistern_upper", + "particle": "eidolon:block/cistern_bottom" + }, + "elements": [ + { + "from": [4, 14, 4], + "to": [12, 16, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 22, 12]}, + "faces": { + "north": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "east": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "south": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "west": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + }, + { + "from": [1, 0, 1], + "to": [15, 14, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 14], "texture": "#5"}, + "east": {"uv": [0, 0, 14, 14], "texture": "#5"}, + "south": {"uv": [0, 0, 14, 14], "texture": "#5"}, + "west": {"uv": [0, 0, 14, 14], "texture": "#5"}, + "up": {"uv": [0, 0, 14, 14], "texture": "#4"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/coalfired_engine_on.json b/src/main/resources/assets/eidolon/models/block/coalfired_engine_on.json new file mode 100644 index 0000000..989d28c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/coalfired_engine_on.json @@ -0,0 +1,115 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/coalfired_engine_bottom", + "1": "eidolon:block/coalfired_engine_on", + "2": "eidolon:block/coalfired_engine_parts", + "3": "eidolon:block/coalfired_engine_side", + "4": "eidolon:block/coalfired_engine_top", + "particle": "eidolon:block/coalfired_engine_bottom" + }, + "elements": [ + { + "from": [1, 2, 0], + "to": [15, 14, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [22, 10, 8]}, + "faces": { + "north": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "east": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "south": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "west": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "up": {"uv": [0, 0, 14, 14], "rotation": 180, "texture": "#4"}, + "down": {"uv": [0, 0, 14, 14], "texture": "#0"} + } + }, + { + "from": [4, 4, 14], + "to": [12, 12, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 12, 23]}, + "faces": { + "east": {"uv": [8, 7, 6, 15], "texture": "#2"}, + "south": {"uv": [8, 7, 16, 15], "texture": "#2"}, + "west": {"uv": [6, 7, 8, 15], "texture": "#2"}, + "up": {"uv": [8, 5, 16, 7], "texture": "#2"}, + "down": {"uv": [8, 3, 16, 5], "texture": "#2"} + } + }, + { + "from": [5, 14, 8], + "to": [11, 16, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 22, 16]}, + "faces": { + "north": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "east": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "south": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "west": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "up": {"uv": [0, 0, 6, 6], "texture": "#2"} + } + }, + { + "from": [5, 14, 0], + "to": [11, 16, 6], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 22, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "east": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "south": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "west": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "up": {"uv": [0, 0, 6, 6], "texture": "#2"} + } + }, + { + "from": [2, 0, 2], + "to": [4, 3, 4], + "rotation": {"angle": -22.5, "axis": "z", "origin": [2, 0, 3]}, + "faces": { + "north": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "east": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "south": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "west": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "up": {"uv": [2, 8, 4, 10], "texture": "#2"}, + "down": {"uv": [2, 8, 4, 10], "texture": "#2"} + } + }, + { + "from": [2, 0, 10], + "to": [4, 3, 12], + "rotation": {"angle": -22.5, "axis": "z", "origin": [2, 0, 11]}, + "faces": { + "north": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "east": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "south": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "west": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "up": {"uv": [2, 8, 4, 10], "texture": "#2"}, + "down": {"uv": [2, 8, 4, 10], "texture": "#2"} + } + }, + { + "from": [12, 0, 2], + "to": [14, 3, 4], + "rotation": {"angle": 22.5, "axis": "z", "origin": [14, 0, 3]}, + "faces": { + "north": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "east": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "south": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "west": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "up": {"uv": [4, 8, 2, 10], "texture": "#2"}, + "down": {"uv": [4, 8, 2, 10], "texture": "#2"} + } + }, + { + "from": [12, 0, 10], + "to": [14, 3, 12], + "rotation": {"angle": 22.5, "axis": "z", "origin": [14, 0, 11]}, + "faces": { + "north": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "east": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "south": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "west": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "up": {"uv": [4, 8, 2, 10], "texture": "#2"}, + "down": {"uv": [4, 8, 2, 10], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_bricks_slab_top.json b/src/main/resources/assets/eidolon/models/block/elder_bricks_slab_top.json new file mode 100644 index 0000000..25f4f4e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_bricks_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "eidolon:block/elder_masonry", + "top": "eidolon:block/elder_masonry", + "side": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_bricks_stairs_inner.json b/src/main/resources/assets/eidolon/models/block/elder_bricks_stairs_inner.json new file mode 100644 index 0000000..e43c3cb --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_bricks_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "eidolon:block/elder_bricks", + "top": "eidolon:block/elder_bricks", + "side": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_bricks_stairs_outer.json b/src/main/resources/assets/eidolon/models/block/elder_bricks_stairs_outer.json new file mode 100644 index 0000000..da579db --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_bricks_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "eidolon:block/elder_bricks", + "top": "eidolon:block/elder_bricks", + "side": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_post.json b/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_post.json new file mode 100644 index 0000000..7a41e08 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_post.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_wall_post", + "textures": { + "wall": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_side.json b/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_side.json new file mode 100644 index 0000000..2cd2f09 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_side.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_wall_side", + "textures": { + "wall": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_side_tall.json b/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_side_tall.json new file mode 100644 index 0000000..242bd9c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_bricks_wall_side_tall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_wall_side_tall", + "textures": { + "wall": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_masonry_slab_top.json b/src/main/resources/assets/eidolon/models/block/elder_masonry_slab_top.json new file mode 100644 index 0000000..25f4f4e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_masonry_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "eidolon:block/elder_masonry", + "top": "eidolon:block/elder_masonry", + "side": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_masonry_stairs_inner.json b/src/main/resources/assets/eidolon/models/block/elder_masonry_stairs_inner.json new file mode 100644 index 0000000..92bf41a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_masonry_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "eidolon:block/elder_masonry", + "top": "eidolon:block/elder_masonry", + "side": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_masonry_stairs_outer.json b/src/main/resources/assets/eidolon/models/block/elder_masonry_stairs_outer.json new file mode 100644 index 0000000..1b00abf --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_masonry_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "eidolon:block/elder_masonry", + "top": "eidolon:block/elder_masonry", + "side": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_pillar_bottom.json b/src/main/resources/assets/eidolon/models/block/elder_pillar_bottom.json new file mode 100644 index 0000000..ed8f7eb --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_pillar_bottom.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/elder_pillar_end", + "side": "eidolon:block/elder_pillar_bottom_side" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_pillar_mid.json b/src/main/resources/assets/eidolon/models/block/elder_pillar_mid.json new file mode 100644 index 0000000..52b44ab --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_pillar_mid.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/elder_pillar_end", + "side": "eidolon:block/elder_pillar_side" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/elder_pillar_top.json b/src/main/resources/assets/eidolon/models/block/elder_pillar_top.json new file mode 100644 index 0000000..2b97136 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/elder_pillar_top.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/elder_pillar_end", + "side": "eidolon:block/elder_pillar_top_side" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_bend.json b/src/main/resources/assets/eidolon/models/block/glass_tube_bend.json new file mode 100644 index 0000000..9b3e116 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_bend.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [6, 6, 6], + "to": [10, 10, 10], + "faces": { + "east": {"uv": [6, 6, 10, 10], "rotation": 270, "texture": "#0"}, + "south": {"uv": [6, 6, 10, 10], "rotation": 270, "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "rotation": 270, "texture": "#0"}, + "down": {"uv": [6, 6, 10, 10], "rotation": 270, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_down.json b/src/main/resources/assets/eidolon/models/block/glass_tube_down.json new file mode 100644 index 0000000..e9d1099 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_down.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [6, 0, 6], + "to": [10, 6, 10], + "faces": { + "north": {"uv": [10, 6, 16, 10], "rotation": 90, "texture": "#0"}, + "east": {"uv": [6, 0, 10, 6], "rotation": 180, "texture": "#0"}, + "south": {"uv": [10, 6, 16, 10], "rotation": 90, "texture": "#0"}, + "west": {"uv": [6, 0, 10, 6], "rotation": 180, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_east.json b/src/main/resources/assets/eidolon/models/block/glass_tube_east.json new file mode 100644 index 0000000..e6ad3bb --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_east.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [10, 6, 6], + "to": [16, 10, 10], + "faces": { + "north": {"uv": [0, 6, 6, 10], "texture": "#0"}, + "south": {"uv": [0, 6, 6, 10], "rotation": 180, "texture": "#0"}, + "up": {"uv": [6, 10, 10, 16], "rotation": 270, "texture": "#0"}, + "down": {"uv": [6, 10, 10, 16], "rotation": 270, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_input.json b/src/main/resources/assets/eidolon/models/block/glass_tube_input.json new file mode 100644 index 0000000..afff280 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_input.json @@ -0,0 +1,24 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "ambientocclusion": false, + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [5.5, 5.5, -1], + "to": [10.5, 10.5, 1], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 13.5, 8]}, + "faces": { + "north": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "east": {"uv": [10, 0, 12, 5], "texture": "#0"}, + "south": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "west": {"uv": [10, 0, 12, 5], "rotation": 180, "texture": "#0"}, + "up": {"uv": [10, 0, 12, 5], "rotation": 270, "texture": "#0"}, + "down": {"uv": [10, 0, 12, 5], "rotation": 90, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_north.json b/src/main/resources/assets/eidolon/models/block/glass_tube_north.json new file mode 100644 index 0000000..06f0e8c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_north.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [6, 6, 0], + "to": [10, 10, 6], + "faces": { + "east": {"uv": [10, 6, 16, 10], "texture": "#0"}, + "west": {"uv": [10, 6, 16, 10], "rotation": 180, "texture": "#0"}, + "up": {"uv": [6, 0, 10, 6], "texture": "#0"}, + "down": {"uv": [6, 0, 10, 6], "rotation": 180, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_output.json b/src/main/resources/assets/eidolon/models/block/glass_tube_output.json new file mode 100644 index 0000000..d6ad690 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_output.json @@ -0,0 +1,24 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "ambientocclusion": false, + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [5.5, 5.5, -1], + "to": [10.5, 10.5, 1], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 13.5, 8]}, + "faces": { + "north": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "east": {"uv": [12, 0, 10, 5], "texture": "#0"}, + "south": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "west": {"uv": [12, 0, 10, 5], "rotation": 180, "texture": "#0"}, + "up": {"uv": [12, 0, 10, 5], "rotation": 270, "texture": "#0"}, + "down": {"uv": [12, 0, 10, 5], "rotation": 90, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_south.json b/src/main/resources/assets/eidolon/models/block/glass_tube_south.json new file mode 100644 index 0000000..993ff5e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_south.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [6, 6, 10], + "to": [10, 10, 16], + "faces": { + "east": {"uv": [0, 6, 6, 10], "texture": "#0"}, + "west": {"uv": [0, 6, 6, 10], "rotation": 180, "texture": "#0"}, + "up": {"uv": [6, 10, 10, 16], "texture": "#0"}, + "down": {"uv": [6, 10, 10, 16], "rotation": 180, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_straight.json b/src/main/resources/assets/eidolon/models/block/glass_tube_straight.json new file mode 100644 index 0000000..6608ee9 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_straight.json @@ -0,0 +1,21 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [6, 6, 6], + "to": [10, 10, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 14, 14]}, + "faces": { + "east": {"uv": [6, 6, 10, 10], "texture": "#0"}, + "west": {"uv": [6, 6, 10, 10], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#0"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_up.json b/src/main/resources/assets/eidolon/models/block/glass_tube_up.json new file mode 100644 index 0000000..5cb00cd --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_up.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [6, 10, 6], + "to": [10, 16, 10], + "faces": { + "north": {"uv": [0, 6, 6, 10], "rotation": 90, "texture": "#0"}, + "east": {"uv": [6, 10, 10, 16], "rotation": 180, "texture": "#0"}, + "south": {"uv": [0, 6, 6, 10], "rotation": 90, "texture": "#0"}, + "west": {"uv": [6, 10, 10, 16], "rotation": 180, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/glass_tube_west.json b/src/main/resources/assets/eidolon/models/block/glass_tube_west.json new file mode 100644 index 0000000..9a62684 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/glass_tube_west.json @@ -0,0 +1,20 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [0, 6, 6], + "to": [6, 10, 10], + "faces": { + "north": {"uv": [10, 6, 16, 10], "texture": "#0"}, + "south": {"uv": [10, 6, 16, 10], "rotation": 180, "texture": "#0"}, + "up": {"uv": [6, 0, 10, 6], "rotation": 270, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 6], "rotation": 270, "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_bark_horizontal.json b/src/main/resources/assets/eidolon/models/block/illwood_bark_horizontal.json new file mode 100644 index 0000000..5f38ef8 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_bark_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "eidolon:block/illwood_log", + "side": "eidolon:block/illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_log_horizontal.json b/src/main/resources/assets/eidolon/models/block/illwood_log_horizontal.json new file mode 100644 index 0000000..a8ddbb4 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_log_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "eidolon:block/illwood_log_top", + "side": "eidolon:block/illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_open.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_open.json new file mode 100644 index 0000000..f9a29e2 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_open", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_wall.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_wall.json new file mode 100644 index 0000000..e9980d9 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_wall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_wall", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_wall_open.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_wall_open.json new file mode 100644 index 0000000..a31d173 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_gate_wall_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate_wall_open", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_post.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_post.json new file mode 100644 index 0000000..d163492 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_post.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_post", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_side.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_side.json new file mode 100644 index 0000000..feed77a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_fence_side.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_side", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_slab_top.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_slab_top.json new file mode 100644 index 0000000..a6136c7 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "eidolon:block/illwood_planks", + "top": "eidolon:block/illwood_planks", + "side": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_stairs_inner.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_stairs_inner.json new file mode 100644 index 0000000..d447292 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "eidolon:block/illwood_planks", + "top": "eidolon:block/illwood_planks", + "side": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_planks_stairs_outer.json b/src/main/resources/assets/eidolon/models/block/illwood_planks_stairs_outer.json new file mode 100644 index 0000000..e93de1c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_planks_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "eidolon:block/illwood_planks", + "top": "eidolon:block/illwood_planks", + "side": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/illwood_sapling.json b/src/main/resources/assets/eidolon/models/block/illwood_sapling.json new file mode 100644 index 0000000..256edf9 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/illwood_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/illwood_sapling" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/incubator_bottom.json b/src/main/resources/assets/eidolon/models/block/incubator_bottom.json new file mode 100644 index 0000000..facb77f --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/incubator_bottom.json @@ -0,0 +1,158 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "loader": "forge:multi-layer", + "textures": { + "particle": "eidolon:block/incubator_shared" + }, + "layers": { + "solid": { + "textures": { + "0": "eidolon:block/incubator_shared", + "1": "eidolon:block/incubator_bottom", + "2": "eidolon:block/incubator_detail", + "particle": "eidolon:block/incubator_shared" + }, + "elements": [ + { + "from": [5, 0, 5], + "to": [11, 4, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 2.5, 8]}, + "faces": { + "north": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "east": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "south": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "west": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "up": {"uv": [10, 10, 16, 16], "texture": "#2"}, + "down": {"uv": [10, 4, 16, 10], "texture": "#2"} + } + }, + { + "from": [7, 2.99, -1], + "to": [9, 3.99, 7], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "east": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "south": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "texture": "#0"} + } + }, + { + "from": [-1, 2.99, 7], + "to": [7, 3.99, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "east": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "west": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 270, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [7, 2.99, 9], + "to": [9, 3.99, 17], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "south": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "west": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 180, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [9, 2.99, 7], + "to": [17, 3.99, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "east": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "west": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 90, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6.5, 2.98, -4], + "to": [9.5, 6.98, 0], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "east": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "south": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "west": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "texture": "#2"} + } + }, + { + "from": [6.5, 2.98, -4], + "to": [9.5, 6.98, 0], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "east": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "south": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "west": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "texture": "#2"} + } + }, + { + "from": [-4, 2.98, 6.5], + "to": [0, 6.98, 9.5], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "east": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "south": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "west": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "rotation": 270, "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "rotation": 90, "texture": "#2"} + } + }, + { + "from": [6.5, 2.98, 16], + "to": [9.5, 6.98, 20], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "east": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "south": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "west": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "rotation": 180, "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "rotation": 180, "texture": "#2"} + } + } + ] + }, + "translucent": { + "textures": { + "0": "eidolon:block/incubator_shared", + "1": "eidolon:block/incubator_bottom", + "2": "eidolon:block/incubator_detail" + }, + "elements": [ + { + "from": [1, 4, 1], + "to": [15, 16, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 12, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "east": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "south": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "west": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "down": {"uv": [0, 0, 14, 14], "texture": "#0"} + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/incubator_top.json b/src/main/resources/assets/eidolon/models/block/incubator_top.json new file mode 100644 index 0000000..7ff50e2 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/incubator_top.json @@ -0,0 +1,157 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "loader": "forge:multi-layer", + "layers": { + "solid": { + "textures": { + "0": "eidolon:block/incubator_top", + "1": "eidolon:block/incubator_shared", + "2": "eidolon:block/incubator_detail" + }, + "elements": [ + { + "from": [7, 14.01, -1], + "to": [9, 15.01, 7], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 22, 8]}, + "faces": { + "north": {"uv": [14, 0, 16, 1], "texture": "#1"}, + "east": {"uv": [8, 14, 0, 15], "texture": "#1"}, + "south": {"uv": [14, 7, 16, 8], "texture": "#1"}, + "west": {"uv": [0, 14, 8, 15], "texture": "#1"}, + "up": {"uv": [14, 0, 16, 8], "texture": "#1"}, + "down": {"uv": [14, 8, 16, 16], "texture": "#1"} + } + }, + { + "from": [9, 14.01, 7], + "to": [17, 15.01, 9], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 22, 8]}, + "faces": { + "north": {"uv": [0, 14, 8, 15], "texture": "#1"}, + "east": {"uv": [14, 0, 16, 1], "texture": "#1"}, + "south": {"uv": [8, 14, 0, 15], "texture": "#1"}, + "west": {"uv": [14, 7, 16, 8], "texture": "#1"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 90, "texture": "#1"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [7, 14.01, 9], + "to": [9, 15.01, 17], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 22, 8]}, + "faces": { + "north": {"uv": [14, 7, 16, 8], "texture": "#1"}, + "east": {"uv": [0, 14, 8, 15], "texture": "#1"}, + "south": {"uv": [14, 0, 16, 1], "texture": "#1"}, + "west": {"uv": [8, 14, 0, 15], "texture": "#1"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 180, "texture": "#1"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 180, "texture": "#1"} + } + }, + { + "from": [-1, 14.01, 7], + "to": [7, 15.01, 9], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 22, 8]}, + "faces": { + "north": {"uv": [8, 14, 0, 15], "texture": "#1"}, + "east": {"uv": [14, 7, 16, 8], "texture": "#1"}, + "south": {"uv": [0, 14, 8, 15], "texture": "#1"}, + "west": {"uv": [14, 0, 16, 1], "texture": "#1"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 270, "texture": "#1"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 90, "texture": "#1"} + } + }, + { + "from": [6.99, 12, -3], + "to": [9.01, 15, 0], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 21, 8]}, + "faces": { + "north": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "east": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "south": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "west": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "texture": "#2"} + } + }, + { + "from": [6.99, 12, -3], + "to": [9.01, 15, 0], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 21, 8]}, + "faces": { + "north": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "east": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "south": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "west": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "texture": "#2"} + } + }, + { + "from": [-3, 12, 6.99], + "to": [0, 15, 9.01], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 21, 8]}, + "faces": { + "north": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "east": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "south": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "west": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "rotation": 270, "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "rotation": 90, "texture": "#2"} + } + }, + { + "from": [6.99, 12, 16], + "to": [9.01, 15, 19], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 21, 8]}, + "faces": { + "north": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "east": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "south": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "west": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "rotation": 180, "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "rotation": 180, "texture": "#2"} + } + }, + { + "from": [6, 13.99, 6], + "to": [10, 15.99, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [15, 22, 14]}, + "faces": { + "north": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "east": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "south": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "west": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "up": {"uv": [0, 4, 4, 8], "texture": "#2"}, + "down": {"uv": [0, 4, 4, 8], "texture": "#2"} + } + } + ] + }, + "translucent": { + "textures": { + "0": "eidolon:block/incubator_top", + "1": "eidolon:block/incubator_shared", + "2": "eidolon:block/incubator_detail" + }, + "elements": [ + { + "from": [1, 0, 1], + "to": [15, 14, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "east": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "south": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "west": {"uv": [0, 0, 14, 14], "texture": "#0"}, + "up": {"uv": [0, 0, 14, 14], "texture": "#1"} + } + } + ] + } + }, + "textures": { + "particle": "eidolon:block/incubator_top" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/magic_candle.json b/src/main/resources/assets/eidolon/models/block/magic_candle.json new file mode 100644 index 0000000..c0667ff --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/magic_candle.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/magic_candle", + "particle": "eidolon:block/magic_candle" + }, + "elements": [ + { + "from": [6.5, 0, 6.5], + "to": [9.5, 7, 9.5], + "rotation": {"angle": 0, "axis": "y", "origin": [14.5, 8, 16.5]}, + "faces": { + "north": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "up": {"uv": [6, 0, 9, 3], "texture": "#0"}, + "down": {"uv": [3, 0, 6, 3], "texture": "#0"} + } + }, + { + "from": [7.5, 7, 7.5], + "to": [8.5, 8, 8.5], + "rotation": {"angle": 0, "axis": "y", "origin": [15.5, 15, 15.5]}, + "faces": { + "north": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "south": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "up": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "down": {"uv": [9, 0, 10, 1], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/magic_candlestick.json b/src/main/resources/assets/eidolon/models/block/magic_candlestick.json new file mode 100644 index 0000000..25d0b2c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/magic_candlestick.json @@ -0,0 +1,73 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/magic_candle", + "particle": "eidolon:block/magic_candle" + }, + "elements": [ + { + "from": [6.5, 5, 6.5], + "to": [9.5, 12, 9.5], + "rotation": {"angle": 0, "axis": "y", "origin": [14.5, 13, 16.5]}, + "faces": { + "north": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "up": {"uv": [6, 0, 9, 3], "texture": "#0"}, + "down": {"uv": [3, 0, 6, 3], "texture": "#0"} + } + }, + { + "from": [7.5, 12, 7.5], + "to": [8.5, 13, 8.5], + "rotation": {"angle": 0, "axis": "y", "origin": [15.5, 20, 15.5]}, + "faces": { + "north": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "south": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "up": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "down": {"uv": [9, 0, 10, 1], "texture": "#0"} + } + }, + { + "from": [6, 3, 6], + "to": [10, 5, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 12, 14]}, + "faces": { + "north": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "east": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "south": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "west": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "up": {"uv": [0, 12, 4, 16], "texture": "#0"}, + "down": {"uv": [4, 12, 8, 16], "texture": "#0"} + } + }, + { + "from": [7, 1, 7], + "to": [9, 3, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 10, 14]}, + "faces": { + "north": {"uv": [1, 9, 3, 11], "texture": "#0"}, + "east": {"uv": [1, 9, 3, 11], "texture": "#0"}, + "south": {"uv": [1, 9, 3, 11], "texture": "#0"}, + "west": {"uv": [1, 9, 3, 11], "texture": "#0"} + } + }, + { + "from": [6.5, 0, 6.5], + "to": [9.5, 1, 9.5], + "rotation": {"angle": 0, "axis": "y", "origin": [14.5, 8, 16.5]}, + "faces": { + "north": {"uv": [0, 11, 3, 12], "texture": "#0"}, + "east": {"uv": [0, 11, 3, 12], "texture": "#0"}, + "south": {"uv": [0, 11, 3, 12], "texture": "#0"}, + "west": {"uv": [0, 11, 3, 12], "texture": "#0"}, + "up": {"uv": [3, 9, 6, 12], "texture": "#0"}, + "down": {"uv": [3, 9, 6, 12], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/magic_candlestick_wall.json b/src/main/resources/assets/eidolon/models/block/magic_candlestick_wall.json new file mode 100644 index 0000000..4d0c9ab --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/magic_candlestick_wall.json @@ -0,0 +1,85 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/magic_candle", + "particle": "eidolon:block/magic_candle" + }, + "elements": [ + { + "from": [6.5, 7, 1.5], + "to": [9.5, 14, 4.5], + "rotation": {"angle": 0, "axis": "y", "origin": [14.5, 15, 11.5]}, + "faces": { + "north": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 7], "texture": "#0"}, + "up": {"uv": [6, 0, 9, 3], "texture": "#0"}, + "down": {"uv": [3, 0, 6, 3], "texture": "#0"} + } + }, + { + "from": [7.5, 14, 2.5], + "to": [8.5, 15, 3.5], + "rotation": {"angle": 0, "axis": "y", "origin": [15.5, 22, 10.5]}, + "faces": { + "north": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "south": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "up": {"uv": [9, 0, 10, 1], "texture": "#0"}, + "down": {"uv": [9, 0, 10, 1], "texture": "#0"} + } + }, + { + "from": [6, 5, 1], + "to": [10, 7, 5], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 14, 9]}, + "faces": { + "north": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "east": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "south": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "west": {"uv": [0, 7, 4, 9], "texture": "#0"}, + "up": {"uv": [0, 12, 4, 16], "texture": "#0"}, + "down": {"uv": [4, 12, 8, 16], "texture": "#0"} + } + }, + { + "from": [7, 3, 2], + "to": [9, 5, 4], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 14, 9]}, + "faces": { + "north": {"uv": [8, 10, 10, 12], "texture": "#0"}, + "east": {"uv": [6, 10, 8, 12], "texture": "#0"}, + "south": {"uv": [8, 10, 10, 12], "texture": "#0"}, + "west": {"uv": [8, 10, 6, 12], "texture": "#0"}, + "down": {"uv": [1, 9, 3, 11], "texture": "#0"} + } + }, + { + "from": [7, 3, 1], + "to": [9, 5, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 14, 8]}, + "faces": { + "east": {"uv": [3, 9, 2, 11], "texture": "#0"}, + "west": {"uv": [3, 9, 2, 11], "texture": "#0"}, + "up": {"uv": [3, 9, 1, 10], "texture": "#0"}, + "down": {"uv": [3, 10, 1, 11], "texture": "#0"} + } + }, + { + "from": [6.5, 2.5, 0], + "to": [9.5, 5.5, 1], + "rotation": {"angle": 0, "axis": "y", "origin": [14.5, -4.5, 8]}, + "faces": { + "north": {"uv": [3, 9, 6, 12], "rotation": 180, "texture": "#0"}, + "east": {"uv": [0, 11, 3, 12], "rotation": 270, "texture": "#0"}, + "south": {"uv": [3, 9, 6, 12], "texture": "#0"}, + "west": {"uv": [0, 11, 3, 12], "rotation": 90, "texture": "#0"}, + "up": {"uv": [0, 11, 3, 12], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 11, 3, 12], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/merammer_root_0.json b/src/main/resources/assets/eidolon/models/block/merammer_root_0.json new file mode 100644 index 0000000..b25c437 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/merammer_root_0.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/merammer_root_0" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/merammer_root_1.json b/src/main/resources/assets/eidolon/models/block/merammer_root_1.json new file mode 100644 index 0000000..16150a5 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/merammer_root_1.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/merammer_root_1" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/oanna_bloom_0.json b/src/main/resources/assets/eidolon/models/block/oanna_bloom_0.json new file mode 100644 index 0000000..291df40 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/oanna_bloom_0.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/oanna_bloom_0" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/oanna_bloom_1.json b/src/main/resources/assets/eidolon/models/block/oanna_bloom_1.json new file mode 100644 index 0000000..806cdb1 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/oanna_bloom_1.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/oanna_bloom_1" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/obelisk_bottom.json b/src/main/resources/assets/eidolon/models/block/obelisk_bottom.json new file mode 100644 index 0000000..42559c3 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/obelisk_bottom.json @@ -0,0 +1,113 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/obelisk_bottom", + "1": "eidolon:block/obelisk_parts", + "2": "eidolon:block/obelisk_side_lower", + "3": "eidolon:block/obelisk_top_mid", + "particle": "eidolon:block/obelisk_side_lower" + }, + "elements": [ + { + "from": [2, 0, 2], + "to": [14, 16, 14], + "faces": { + "north": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "east": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "south": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "west": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "up": {"uv": [0, 0, 12, 12], "texture": "#3"}, + "down": {"uv": [0, 0, 12, 12], "texture": "#0"} + } + }, + { + "from": [0, -0.01, 0], + "to": [4, 5.99, 4], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [0, -0.01, 12], + "to": [4, 5.99, 16], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [12, -0.01, 12], + "to": [16, 5.99, 16], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [12, -0.01, 0], + "to": [16, 5.99, 4], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [0, 0, 4], + "to": [2, 4, 12], + "faces": { + "east": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "west": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "rotation": 90, "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 90, "texture": "#1"} + } + }, + { + "from": [4, 0, 0], + "to": [12, 4, 2], + "faces": { + "north": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "south": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "rotation": 180, "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "texture": "#1"} + } + }, + { + "from": [4, 0, 14], + "to": [12, 4, 16], + "faces": { + "north": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "south": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 180, "texture": "#1"} + } + }, + { + "from": [14, 0, 4], + "to": [16, 4, 12], + "faces": { + "east": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "west": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "rotation": 270, "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 270, "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/obelisk_mid.json b/src/main/resources/assets/eidolon/models/block/obelisk_mid.json new file mode 100644 index 0000000..e95ce78 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/obelisk_mid.json @@ -0,0 +1,24 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/obelisk_bottom", + "1": "eidolon:block/obelisk_side_mid", + "2": "eidolon:block/obelisk_top_mid", + "particle": "eidolon:block/obelisk_side_mid" + }, + "elements": [ + { + "from": [2, 0, 2], + "to": [14, 16, 14], + "faces": { + "north": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "east": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "south": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "up": {"uv": [0, 0, 12, 12], "texture": "#2"}, + "down": {"uv": [0, 0, 12, 12], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/obelisk_top.json b/src/main/resources/assets/eidolon/models/block/obelisk_top.json new file mode 100644 index 0000000..0dd27a0 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/obelisk_top.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/obelisk_bottom", + "1": "eidolon:block/obelisk_parts", + "3": "eidolon:block/obelisk_top", + "4": "eidolon:block/obelisk_side_top", + "particle": "eidolon:block/obelisk_side_top" + }, + "elements": [ + { + "from": [2, 0, 2], + "to": [14, 14, 14], + "faces": { + "north": {"uv": [0, 0, 12, 14], "texture": "#4"}, + "east": {"uv": [0, 0, 12, 14], "texture": "#4"}, + "south": {"uv": [0, 0, 12, 14], "texture": "#4"}, + "west": {"uv": [0, 0, 12, 14], "texture": "#4"}, + "up": {"uv": [0, 0, 12, 12], "texture": "#3"}, + "down": {"uv": [0, 0, 12, 12], "texture": "#0"} + } + }, + { + "from": [4, 14, 4], + "to": [12, 16, 12], + "faces": { + "north": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "east": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "south": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "west": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/sildrian_seed_0.json b/src/main/resources/assets/eidolon/models/block/sildrian_seed_0.json new file mode 100644 index 0000000..bc6b19e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/sildrian_seed_0.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/sildrian_seed_0" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/sildrian_seed_1.json b/src/main/resources/assets/eidolon/models/block/sildrian_seed_1.json new file mode 100644 index 0000000..5f10594 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/sildrian_seed_1.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "eidolon:block/sildrian_seed_1" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_bottom.json b/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_bottom.json new file mode 100644 index 0000000..2f32255 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_bottom.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/smooth_stone_bricks", + "side": "eidolon:block/smooth_stone_arch_bottom" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_mid.json b/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_mid.json new file mode 100644 index 0000000..b20a22c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_mid.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/smooth_stone_bricks", + "side": "eidolon:block/smooth_stone_arch_mid" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_top.json b/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_top.json new file mode 100644 index 0000000..09c7be5 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/smooth_stone_arch_top.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/smooth_stone_bricks", + "side": "eidolon:block/smooth_stone_arch_top" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_slab_top.json b/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_slab_top.json new file mode 100644 index 0000000..036184b --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "eidolon:block/smooth_stone_masonry", + "top": "eidolon:block/smooth_stone_masonry", + "side": "eidolon:block/smooth_stone_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_stairs_inner.json b/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_stairs_inner.json new file mode 100644 index 0000000..1eda631 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "eidolon:block/smooth_stone_masonry", + "top": "eidolon:block/smooth_stone_masonry", + "side": "eidolon:block/smooth_stone_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_stairs_outer.json b/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_stairs_outer.json new file mode 100644 index 0000000..3c57030 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/smooth_stone_masonry_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "eidolon:block/smooth_stone_masonry", + "top": "eidolon:block/smooth_stone_masonry", + "side": "eidolon:block/smooth_stone_masonry" + } +} diff --git a/src/main/resources/assets/eidolon/models/block/stripped_illwood_bark_horizontal.json b/src/main/resources/assets/eidolon/models/block/stripped_illwood_bark_horizontal.json new file mode 100644 index 0000000..2c73708 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/stripped_illwood_bark_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "eidolon:block/stripped_illwood_log", + "side": "eidolon:block/stripped_illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/block/stripped_illwood_log_horizontal.json b/src/main/resources/assets/eidolon/models/block/stripped_illwood_log_horizontal.json new file mode 100644 index 0000000..7d02820 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/block/stripped_illwood_log_horizontal.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column_horizontal", + "textures": { + "end": "eidolon:block/stripped_illwood_log_top", + "side": "eidolon:block/stripped_illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/alchemists_tongs.json b/src/main/resources/assets/eidolon/models/item/alchemists_tongs.json new file mode 100644 index 0000000..8a2632b --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/alchemists_tongs.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/alchemists_tongs" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/angels_sight.json b/src/main/resources/assets/eidolon/models/item/angels_sight.json new file mode 100644 index 0000000..8c0c1be --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/angels_sight.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/angels_sight" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/arcane_seal.json b/src/main/resources/assets/eidolon/models/item/arcane_seal.json new file mode 100644 index 0000000..65d5757 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/arcane_seal.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/arcane_seal" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/archive.json b/src/main/resources/assets/eidolon/models/item/archive.json new file mode 100644 index 0000000..348084d --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/archive.json @@ -0,0 +1,219 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/archive_bottom", + "1": "eidolon:block/archive_side", + "2": "eidolon:block/archive_top", + "3": "eidolon:block/archive_detail", + "particle": "eidolon:block/archive_bottom" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [-2, 19, 3.5], + "to": [0, 25, 5.5], + "rotation": {"angle": 45, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [10, 0, 12, 6], "texture": "#3"}, + "east": {"uv": [10, 0, 12, 6], "texture": "#3"}, + "south": {"uv": [10, 0, 12, 6], "texture": "#3"}, + "west": {"uv": [10, 0, 12, 6], "texture": "#3"}, + "up": {"uv": [8, 1, 10, 3], "texture": "#3"}, + "down": {"uv": [8, 4, 10, 6], "texture": "#3"} + } + }, + { + "from": [-1.5, 25, 4], + "to": [-0.5, 26, 5], + "rotation": {"angle": 45, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "east": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "south": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "west": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "up": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "down": {"uv": [9, 0, 10, 1], "texture": "#3"} + } + }, + { + "from": [4, 23, 3.5], + "to": [5, 24, 4.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "east": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "south": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "west": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "up": {"uv": [9, 0, 10, 1], "texture": "#3"}, + "down": {"uv": [9, 0, 10, 1], "texture": "#3"} + } + }, + { + "from": [-2, 16, 3.5], + "to": [0, 17, 5.5], + "rotation": {"angle": 45, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [6, 6, 8, 7], "texture": "#3"}, + "east": {"uv": [6, 6, 8, 7], "texture": "#3"}, + "south": {"uv": [6, 6, 8, 7], "texture": "#3"}, + "west": {"uv": [6, 6, 8, 7], "texture": "#3"}, + "up": {"uv": [6, 4, 8, 6], "texture": "#3"}, + "down": {"uv": [6, 4, 8, 6], "texture": "#3"} + } + }, + { + "from": [-1.5, 17, 4], + "to": [-0.5, 18, 5], + "rotation": {"angle": 45, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "east": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "south": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "west": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "up": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "down": {"uv": [5, 4, 6, 5], "texture": "#3"} + } + }, + { + "from": [-2.5, 18, 3], + "to": [0.5, 19, 6], + "rotation": {"angle": 45, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "east": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "south": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "west": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "up": {"uv": [4, 0, 7, 3], "texture": "#3"}, + "down": {"uv": [4, 0, 7, 3], "texture": "#3"} + } + }, + { + "from": [3.5, 18, 3], + "to": [5.5, 23, 5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [8, 1, 10, 6], "texture": "#3"}, + "east": {"uv": [8, 1, 10, 6], "texture": "#3"}, + "south": {"uv": [8, 1, 10, 6], "texture": "#3"}, + "west": {"uv": [8, 1, 10, 6], "texture": "#3"}, + "up": {"uv": [8, 1, 10, 3], "texture": "#3"}, + "down": {"uv": [8, 4, 10, 6], "texture": "#3"} + } + }, + { + "from": [4, 16, 3.5], + "to": [5, 17, 4.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "east": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "south": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "west": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "up": {"uv": [5, 4, 6, 5], "texture": "#3"}, + "down": {"uv": [5, 4, 6, 5], "texture": "#3"} + } + }, + { + "from": [3, 17, 2.5], + "to": [6, 18, 5.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "east": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "south": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "west": {"uv": [4, 3, 7, 4], "texture": "#3"}, + "up": {"uv": [4, 0, 7, 3], "texture": "#3"}, + "down": {"uv": [4, 0, 7, 3], "texture": "#3"} + } + }, + { + "from": [7, 16.1, 6], + "to": [11, 16.1, 12], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, -0.4, 0]}, + "faces": { + "north": {"uv": [0, 0, 4, 0], "texture": "#missing"}, + "east": {"uv": [0, 0, 6, 0], "texture": "#missing"}, + "south": {"uv": [0, 0, 4, 0], "texture": "#missing"}, + "west": {"uv": [0, 0, 6, 0], "texture": "#missing"}, + "up": {"uv": [12, 0, 16, 6], "texture": "#3"}, + "down": {"uv": [12, 0, 16, 6], "texture": "#3"} + } + }, + { + "from": [6, 16.1, 7], + "to": [12, 16.1, 11], + "rotation": {"angle": -22.5, "axis": "y", "origin": [0, -0.4, 0]}, + "faces": { + "north": {"uv": [0, 0, 6, 0], "texture": "#missing"}, + "east": {"uv": [0, 0, 4, 0], "texture": "#missing"}, + "south": {"uv": [0, 0, 6, 0], "texture": "#missing"}, + "west": {"uv": [0, 0, 4, 0], "texture": "#missing"}, + "up": {"uv": [12, 0, 16, 6], "rotation": 270, "texture": "#3"}, + "down": {"uv": [12, 0, 16, 6], "rotation": 90, "texture": "#3"} + } + }, + { + "from": [7, 16.2, -3], + "to": [15, 16.2, 3], + "rotation": {"angle": -45, "axis": "y", "origin": [0, -0.4, 0]}, + "faces": { + "north": {"uv": [0, 0, 6, 0], "texture": "#missing"}, + "east": {"uv": [0, 0, 4, 0], "texture": "#missing"}, + "south": {"uv": [0, 0, 6, 0], "texture": "#missing"}, + "west": {"uv": [0, 0, 4, 0], "texture": "#missing"}, + "up": {"uv": [6, 8, 12, 16], "rotation": 90, "texture": "#3"}, + "down": {"uv": [6, 8, 12, 16], "rotation": 90, "texture": "#3"} + } + }, + { + "from": [10.5, 22.5, 2], + "to": [15.5, 23.5, 7], + "rotation": {"angle": 22.5, "axis": "x", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "east": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "south": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "west": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "up": {"uv": [0, 4, 5, 9], "texture": "#3"}, + "down": {"uv": [0, 4, 5, 9], "texture": "#3"} + } + }, + { + "from": [11.5, 6.48109, 27.00647], + "to": [14.5, 6.48109, 29.00647], + "rotation": {"angle": -45, "axis": "x", "origin": [2, -4.51891, 8.00647]}, + "faces": { + "north": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "east": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "south": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "west": {"uv": [0, 9, 5, 10], "texture": "#3"}, + "up": {"uv": [0, 14, 3, 16], "texture": "#3"}, + "down": {"uv": [3, 14, 6, 16], "texture": "#3"} + } + }, + { + "from": [11, 16, 11], + "to": [15, 17, 15], + "faces": { + "north": {"uv": [0, 10, 4, 11], "texture": "#3"}, + "east": {"uv": [0, 10, 4, 11], "texture": "#3"}, + "south": {"uv": [0, 10, 4, 11], "texture": "#3"}, + "west": {"uv": [0, 10, 4, 11], "texture": "#3"}, + "up": {"uv": [0, 10, 4, 14], "texture": "#3"}, + "down": {"uv": [0, 10, 4, 14], "texture": "#3"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/athame.json b/src/main/resources/assets/eidolon/models/item/athame.json new file mode 100644 index 0000000..be7795e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/athame.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/athame" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/avennian_sprig.json b/src/main/resources/assets/eidolon/models/item/avennian_sprig.json new file mode 100644 index 0000000..58178f6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/avennian_sprig.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/avennian_sprig" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/bone_pile.json b/src/main/resources/assets/eidolon/models/item/bone_pile.json new file mode 100644 index 0000000..ec798f6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/bone_pile.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/bone_pile" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/bone_pile_slab.json b/src/main/resources/assets/eidolon/models/item/bone_pile_slab.json new file mode 100644 index 0000000..bf6a4bb --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/bone_pile_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "eidolon:block/bone_pile", + "top": "eidolon:block/bone_pile", + "side": "eidolon:block/bone_pile" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/bone_pile_stairs.json b/src/main/resources/assets/eidolon/models/item/bone_pile_stairs.json new file mode 100644 index 0000000..e7d67d7 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/bone_pile_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "eidolon:block/bone_pile", + "top": "eidolon:block/bone_pile", + "side": "eidolon:block/bone_pile" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/bonelord_chestplate.json b/src/main/resources/assets/eidolon/models/item/bonelord_chestplate.json new file mode 100644 index 0000000..b93240f --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/bonelord_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/bonelord_chestplate" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/bonelord_greaves.json b/src/main/resources/assets/eidolon/models/item/bonelord_greaves.json new file mode 100644 index 0000000..db7abc8 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/bonelord_greaves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/bonelord_greaves" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/bonelord_helm.json b/src/main/resources/assets/eidolon/models/item/bonelord_helm.json new file mode 100644 index 0000000..517d3b6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/bonelord_helm.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/bonelord_helm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/cabinet.json b/src/main/resources/assets/eidolon/models/item/cabinet.json new file mode 100644 index 0000000..73849a1 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/cabinet.json @@ -0,0 +1,148 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "eidolon:block/cabinet_bottom_front", + "1": "eidolon:block/cabinet_bottom_side", + "2": "eidolon:block/cabinet_top", + "3": "eidolon:block/cabinet_top_front", + "4": "eidolon:block/cabinet_top_side", + "5": "eidolon:block/cabinet_bottom", + "particle": "eidolon:block/cabinet_bottom_front" + }, + "elements": [ + { + "from": [2, 0, 2], + "to": [4, 2, 4], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [12, 0, 2], + "to": [14, 2, 4], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [2, 0, 12], + "to": [4, 2, 14], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [12, 0, 12], + "to": [14, 2, 14], + "faces": { + "north": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "east": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "south": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#0"}, + "down": {"uv": [2, 12, 4, 14], "texture": "#5"} + } + }, + { + "from": [0, 2, 0], + "to": [16, 6, 16], + "faces": { + "north": {"uv": [0, 10, 16, 14], "texture": "#0"}, + "east": {"uv": [0, 10, 16, 14], "texture": "#1"}, + "south": {"uv": [0, 10, 16, 14], "texture": "#1"}, + "west": {"uv": [0, 10, 16, 14], "texture": "#1"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#5"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#5"} + } + }, + { + "from": [0, 28, 0], + "to": [16, 32, 16], + "faces": { + "north": {"uv": [0, 0, 16, 4], "texture": "#3"}, + "east": {"uv": [0, 0, 16, 4], "texture": "#4"}, + "south": {"uv": [0, 0, 16, 4], "texture": "#4"}, + "west": {"uv": [0, 0, 16, 4], "texture": "#4"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#5"} + } + }, + { + "from": [0, 6, 0], + "to": [3, 16, 16], + "faces": { + "north": {"uv": [13, 0, 16, 10], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 10], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 10], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 10], "texture": "#1"}, + "up": {"uv": [0, 10, 16, 13], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [13, 6, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [16, 0, 13, 10], "texture": "#0"}, + "east": {"uv": [16, 0, 0, 10], "texture": "#1"}, + "south": {"uv": [3, 0, 0, 10], "texture": "#1"}, + "west": {"uv": [16, 0, 0, 10], "texture": "#0"}, + "up": {"uv": [0, 13, 16, 10], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [3, 6, 13], + "to": [13, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [13, 0, 3, 10], "texture": "#0"}, + "south": {"uv": [13, 0, 3, 10], "texture": "#1"}, + "up": {"uv": [3, 13, 13, 10], "texture": "#1"} + } + }, + { + "from": [3, 16, 13], + "to": [13, 28, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [13, 4, 3, 16], "texture": "#3"}, + "south": {"uv": [13, 4, 3, 16], "texture": "#4"}, + "down": {"uv": [3, 13, 13, 10], "texture": "#1"} + } + }, + { + "from": [0, 16, 0], + "to": [3, 28, 16], + "faces": { + "north": {"uv": [13, 4, 16, 16], "texture": "#3"}, + "east": {"uv": [0, 4, 16, 16], "texture": "#3"}, + "south": {"uv": [0, 4, 3, 16], "texture": "#4"}, + "west": {"uv": [0, 4, 16, 16], "texture": "#4"}, + "down": {"uv": [0, 10, 16, 13], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [13, 16, 0], + "to": [16, 28, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [16, 4, 13, 16], "texture": "#3"}, + "east": {"uv": [16, 4, 0, 16], "texture": "#4"}, + "south": {"uv": [3, 4, 0, 16], "texture": "#4"}, + "west": {"uv": [16, 4, 0, 16], "texture": "#3"}, + "down": {"uv": [0, 13, 16, 10], "rotation": 270, "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/cistern.json b/src/main/resources/assets/eidolon/models/item/cistern.json new file mode 100644 index 0000000..cc4522f --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/cistern.json @@ -0,0 +1,49 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "1": "eidolon:block/cistern_ends", + "3": "eidolon:block/cistern_side", + "4": "eidolon:block/cistern_top", + "particle": "eidolon:block/cistern_bottom" + }, + "elements": [ + { + "from": [4, 0, 4], + "to": [12, 2, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 8, 12]}, + "faces": { + "north": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "east": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "south": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "west": {"uv": [0, 10, 8, 12], "texture": "#1"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + }, + { + "from": [4, 14, 4], + "to": [12, 16, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 22, 12]}, + "faces": { + "north": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "east": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "south": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "west": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + }, + { + "from": [1, 2, 1], + "to": [15, 14, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 10, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "east": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "south": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "west": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "up": {"uv": [0, 0, 14, 14], "texture": "#4"}, + "down": {"uv": [0, 0, 14, 14], "texture": "#4"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/coalfired_engine.json b/src/main/resources/assets/eidolon/models/item/coalfired_engine.json new file mode 100644 index 0000000..7ec7dfb --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/coalfired_engine.json @@ -0,0 +1,115 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/coalfired_engine_bottom", + "1": "eidolon:block/coalfired_engine_front", + "2": "eidolon:block/coalfired_engine_parts", + "3": "eidolon:block/coalfired_engine_side", + "4": "eidolon:block/coalfired_engine_top", + "particle": "eidolon:block/coalfired_engine_bottom" + }, + "elements": [ + { + "from": [1, 2, 0], + "to": [15, 14, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [22, 10, 8]}, + "faces": { + "north": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "east": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "south": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "west": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "up": {"uv": [0, 0, 14, 14], "rotation": 180, "texture": "#4"}, + "down": {"uv": [0, 0, 14, 14], "texture": "#0"} + } + }, + { + "from": [4, 4, 14], + "to": [12, 12, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 12, 23]}, + "faces": { + "east": {"uv": [8, 7, 6, 15], "texture": "#2"}, + "south": {"uv": [8, 7, 16, 15], "texture": "#2"}, + "west": {"uv": [6, 7, 8, 15], "texture": "#2"}, + "up": {"uv": [8, 5, 16, 7], "texture": "#2"}, + "down": {"uv": [8, 3, 16, 5], "texture": "#2"} + } + }, + { + "from": [5, 14, 8], + "to": [11, 16, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 22, 16]}, + "faces": { + "north": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "east": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "south": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "west": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "up": {"uv": [0, 0, 6, 6], "texture": "#2"} + } + }, + { + "from": [5, 14, 0], + "to": [11, 16, 6], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 22, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "east": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "south": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "west": {"uv": [0, 6, 6, 8], "texture": "#2"}, + "up": {"uv": [0, 0, 6, 6], "texture": "#2"} + } + }, + { + "from": [2, 0, 2], + "to": [4, 3, 4], + "rotation": {"angle": -22.5, "axis": "z", "origin": [2, 0, 3]}, + "faces": { + "north": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "east": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "south": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "west": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "up": {"uv": [2, 8, 4, 10], "texture": "#2"}, + "down": {"uv": [2, 8, 4, 10], "texture": "#2"} + } + }, + { + "from": [2, 0, 10], + "to": [4, 3, 12], + "rotation": {"angle": -22.5, "axis": "z", "origin": [2, 0, 11]}, + "faces": { + "north": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "east": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "south": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "west": {"uv": [4, 8, 6, 11], "texture": "#2"}, + "up": {"uv": [2, 8, 4, 10], "texture": "#2"}, + "down": {"uv": [2, 8, 4, 10], "texture": "#2"} + } + }, + { + "from": [12, 0, 2], + "to": [14, 3, 4], + "rotation": {"angle": 22.5, "axis": "z", "origin": [14, 0, 3]}, + "faces": { + "north": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "east": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "south": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "west": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "up": {"uv": [4, 8, 2, 10], "texture": "#2"}, + "down": {"uv": [4, 8, 2, 10], "texture": "#2"} + } + }, + { + "from": [12, 0, 10], + "to": [14, 3, 12], + "rotation": {"angle": 22.5, "axis": "z", "origin": [14, 0, 11]}, + "faces": { + "north": {"uv": [0, 8, 2, 11], "texture": "#2"}, + "east": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "south": {"uv": [2, 8, 0, 11], "texture": "#2"}, + "west": {"uv": [6, 8, 4, 11], "texture": "#2"}, + "up": {"uv": [4, 8, 2, 10], "texture": "#2"}, + "down": {"uv": [4, 8, 2, 10], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/completed_research.json b/src/main/resources/assets/eidolon/models/item/completed_research.json new file mode 100644 index 0000000..a80b6a9 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/completed_research.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/completed_research" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/deathbringer_scythe.json b/src/main/resources/assets/eidolon/models/item/deathbringer_scythe.json new file mode 100644 index 0000000..67d0ead --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/deathbringer_scythe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/deathbringer_scythe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/deep_lead_ore.json b/src/main/resources/assets/eidolon/models/item/deep_lead_ore.json new file mode 100644 index 0000000..079126d --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/deep_lead_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/deep_lead_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/deep_silver_ore.json b/src/main/resources/assets/eidolon/models/item/deep_silver_ore.json new file mode 100644 index 0000000..cc158e8 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/deep_silver_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/deep_silver_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_brick.json b/src/main/resources/assets/eidolon/models/item/elder_brick.json new file mode 100644 index 0000000..f8194df --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_brick.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/elder_brick" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_bricks.json b/src/main/resources/assets/eidolon/models/item/elder_bricks.json new file mode 100644 index 0000000..6576cff --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_bricks.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_bricks_eye.json b/src/main/resources/assets/eidolon/models/item/elder_bricks_eye.json new file mode 100644 index 0000000..a610b93 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_bricks_eye.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/elder_bricks", + "side": "eidolon:block/elder_bricks_eye" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_bricks_slab.json b/src/main/resources/assets/eidolon/models/item/elder_bricks_slab.json new file mode 100644 index 0000000..c3bd1d1 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_bricks_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "eidolon:block/elder_bricks", + "top": "eidolon:block/elder_bricks", + "side": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_bricks_stairs.json b/src/main/resources/assets/eidolon/models/item/elder_bricks_stairs.json new file mode 100644 index 0000000..58c8c98 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_bricks_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "eidolon:block/elder_bricks", + "top": "eidolon:block/elder_bricks", + "side": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_bricks_wall.json b/src/main/resources/assets/eidolon/models/item/elder_bricks_wall.json new file mode 100644 index 0000000..22830a3 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_bricks_wall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/wall_inventory", + "textures": { + "wall": "eidolon:block/elder_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_masonry.json b/src/main/resources/assets/eidolon/models/item/elder_masonry.json new file mode 100644 index 0000000..9ba8516 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_masonry.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_masonry_slab.json b/src/main/resources/assets/eidolon/models/item/elder_masonry_slab.json new file mode 100644 index 0000000..17aff02 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_masonry_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "eidolon:block/elder_masonry", + "top": "eidolon:block/elder_masonry", + "side": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_masonry_stairs.json b/src/main/resources/assets/eidolon/models/item/elder_masonry_stairs.json new file mode 100644 index 0000000..b3f4acf --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_masonry_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "eidolon:block/elder_masonry", + "top": "eidolon:block/elder_masonry", + "side": "eidolon:block/elder_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/elder_pillar.json b/src/main/resources/assets/eidolon/models/item/elder_pillar.json new file mode 100644 index 0000000..2c7bb60 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/elder_pillar.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/elder_pillar_end", + "side": "eidolon:block/elder_pillar_both_side" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/enervating_ring.json b/src/main/resources/assets/eidolon/models/item/enervating_ring.json new file mode 100644 index 0000000..380129b --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/enervating_ring.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/enervating_ring" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/glass_tube.json b/src/main/resources/assets/eidolon/models/item/glass_tube.json new file mode 100644 index 0000000..9b5b2d0 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/glass_tube.json @@ -0,0 +1,47 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/glass_tube", + "particle": "eidolon:block/glass_tube" + }, + "elements": [ + { + "from": [5.5, 5.5, -1], + "to": [10.5, 10.5, 1], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 13.5, 8]}, + "faces": { + "north": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "east": {"uv": [12, 0, 10, 5], "texture": "#0"}, + "south": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "west": {"uv": [12, 0, 10, 5], "rotation": 180, "texture": "#0"}, + "up": {"uv": [12, 0, 10, 5], "rotation": 270, "texture": "#0"}, + "down": {"uv": [12, 0, 10, 5], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [5.5, 5.5, 15], + "to": [10.5, 10.5, 17], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 13.5, 24]}, + "faces": { + "north": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "east": {"uv": [12, 0, 10, 5], "texture": "#0"}, + "south": {"uv": [10, 10, 15, 15], "texture": "#0"}, + "west": {"uv": [12, 0, 10, 5], "rotation": 180, "texture": "#0"}, + "up": {"uv": [12, 0, 10, 5], "rotation": 270, "texture": "#0"}, + "down": {"uv": [12, 0, 10, 5], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [6, 6, 0], + "to": [10, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [17, 14, 8]}, + "faces": { + "east": {"uv": [0, 6, 16, 10], "texture": "#0"}, + "west": {"uv": [0, 6, 16, 10], "texture": "#0"}, + "up": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/grape_candy.json b/src/main/resources/assets/eidolon/models/item/grape_candy.json new file mode 100644 index 0000000..6dfbe7e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/grape_candy.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/grape_candy" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_bark.json b/src/main/resources/assets/eidolon/models/item/illwood_bark.json new file mode 100644 index 0000000..1dfd1fa --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_bark.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/illwood_log", + "side": "eidolon:block/illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_leaves.json b/src/main/resources/assets/eidolon/models/item/illwood_leaves.json new file mode 100644 index 0000000..9da11db --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_leaves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/illwood_leaves" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_log.json b/src/main/resources/assets/eidolon/models/item/illwood_log.json new file mode 100644 index 0000000..2d04ce3 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_log.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/illwood_log_top", + "side": "eidolon:block/illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_planks.json b/src/main/resources/assets/eidolon/models/item/illwood_planks.json new file mode 100644 index 0000000..126775d --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_planks.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_planks_fence.json b/src/main/resources/assets/eidolon/models/item/illwood_planks_fence.json new file mode 100644 index 0000000..1fcd68d --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_planks_fence.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_inventory", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_planks_fence_gate.json b/src/main/resources/assets/eidolon/models/item/illwood_planks_fence_gate.json new file mode 100644 index 0000000..3227c11 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_planks_fence_gate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_fence_gate", + "textures": { + "texture": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_planks_slab.json b/src/main/resources/assets/eidolon/models/item/illwood_planks_slab.json new file mode 100644 index 0000000..9e644ae --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_planks_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "eidolon:block/illwood_planks", + "top": "eidolon:block/illwood_planks", + "side": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_planks_stairs.json b/src/main/resources/assets/eidolon/models/item/illwood_planks_stairs.json new file mode 100644 index 0000000..ed99892 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_planks_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "eidolon:block/illwood_planks", + "top": "eidolon:block/illwood_planks", + "side": "eidolon:block/illwood_planks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/illwood_sapling.json b/src/main/resources/assets/eidolon/models/item/illwood_sapling.json new file mode 100644 index 0000000..126fe7a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/illwood_sapling.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:block/illwood_sapling" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/imbued_bones.json b/src/main/resources/assets/eidolon/models/item/imbued_bones.json new file mode 100644 index 0000000..bacfc0f --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/imbued_bones.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/imbued_bones" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/incubator.json b/src/main/resources/assets/eidolon/models/item/incubator.json new file mode 100644 index 0000000..ecbed99 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/incubator.json @@ -0,0 +1,320 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "loader": "forge:multi-layer", + "textures": { + "particle": "eidolon:block/incubator_shared" + }, + "layers": { + "solid": { + "textures": { + "0": "eidolon:block/incubator_shared", + "1": "eidolon:block/incubator_bottom", + "2": "eidolon:block/incubator_detail", + "3": "eidolon:block/incubator_top" + },"elements": [ + { + "from": [5, 0, 5], + "to": [11, 4, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 2.5, 8]}, + "faces": { + "north": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "east": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "south": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "west": {"uv": [10, 0, 16, 4], "texture": "#2"}, + "up": {"uv": [10, 10, 16, 16], "texture": "#2"}, + "down": {"uv": [10, 4, 16, 10], "texture": "#2"} + } + }, + { + "from": [7.25, 30.01, -1], + "to": [9, 31.01, 7], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 30.5, 8]}, + "faces": { + "north": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "east": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "south": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "texture": "#0"} + } + }, + { + "from": [-1, 30.01, 7], + "to": [7, 31.01, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 30.5, 8]}, + "faces": { + "north": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "east": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "west": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 270, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [7.25, 30.01, 9], + "to": [9, 31.01, 17], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 30.5, 8]}, + "faces": { + "north": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "south": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "west": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 180, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [9.25, 30.01, 7], + "to": [17, 31.01, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 30.5, 8]}, + "faces": { + "north": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "east": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "west": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 90, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6.5, 2.98, -4], + "to": [9.5, 6.98, 0], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "east": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "south": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "west": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "texture": "#2"} + } + }, + { + "from": [6.5, 2.98, -4], + "to": [9.5, 6.98, 0], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "east": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "south": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "west": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "texture": "#2"} + } + }, + { + "from": [-4, 2.98, 6.5], + "to": [0, 6.98, 9.5], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "east": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "south": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "west": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "rotation": 270, "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "rotation": 90, "texture": "#2"} + } + }, + { + "from": [6.5, 2.98, 16], + "to": [9.5, 6.98, 20], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 10.5, 8]}, + "faces": { + "north": {"uv": [7, 0, 10, 4], "texture": "#2"}, + "east": {"uv": [3, 0, 7, 4], "texture": "#2"}, + "south": {"uv": [0, 0, 3, 4], "texture": "#2"}, + "west": {"uv": [7, 0, 3, 4], "texture": "#2"}, + "up": {"uv": [4, 8, 7, 4], "rotation": 180, "texture": "#2"}, + "down": {"uv": [7, 8, 10, 4], "rotation": 180, "texture": "#2"} + } + }, + { + "from": [-1, 2.99, 7], + "to": [7, 3.99, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "east": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "west": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 270, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [9.25, 2.99, 7], + "to": [17, 3.99, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "east": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "west": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 90, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [7.25, 2.99, 9], + "to": [9, 3.99, 17], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "south": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "west": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 180, "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [7.25, 2.99, -1], + "to": [9, 3.99, 7], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 3.5, 8]}, + "faces": { + "north": {"uv": [14, 0, 16, 1], "texture": "#0"}, + "east": {"uv": [8, 14, 0, 15], "texture": "#0"}, + "south": {"uv": [14, 15, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 14, 8, 15], "texture": "#0"}, + "up": {"uv": [14, 0, 16, 8], "texture": "#0"}, + "down": {"uv": [14, 8, 16, 16], "texture": "#0"} + } + }, + { + "from": [6, 29.99, 6], + "to": [10, 31.99, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 38, 14]}, + "faces": { + "north": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "east": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "south": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "west": {"uv": [0, 8, 4, 10], "texture": "#2"}, + "up": {"uv": [0, 4, 4, 8], "texture": "#2"}, + "down": {"uv": [0, 4, 4, 8], "texture": "#2"} + } + }, + { + "from": [7, 28, -3], + "to": [9, 31, 0], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 38, 8]}, + "faces": { + "north": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "east": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "south": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "west": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "texture": "#2"} + } + }, + { + "from": [-3, 28, 7], + "to": [0, 31, 9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 38, 8]}, + "faces": { + "north": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "east": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "south": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "west": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "rotation": 270, "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "rotation": 90, "texture": "#2"} + } + }, + { + "from": [7, 28, -3], + "to": [9, 31, 0], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 38, 8]}, + "faces": { + "north": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "east": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "south": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "west": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "texture": "#2"} + } + }, + { + "from": [16, 28, 7], + "to": [19, 31, 9], + "rotation": {"angle": -45, "axis": "y", "origin": [8, 38, 8]}, + "faces": { + "north": {"uv": [2, 10, 5, 13], "texture": "#2"}, + "east": {"uv": [0, 10, 2, 13], "texture": "#2"}, + "south": {"uv": [5, 10, 2, 13], "texture": "#2"}, + "west": {"uv": [5, 10, 7, 13], "texture": "#2"}, + "up": {"uv": [3, 13, 5, 16], "rotation": 90, "texture": "#2"}, + "down": {"uv": [5, 13, 7, 16], "rotation": 270, "texture": "#2"} + } + } + ] + }, + "translucent": { + "textures": { + "0": "eidolon:block/incubator_shared", + "1": "eidolon:block/incubator_bottom", + "2": "eidolon:block/incubator_detail", + "3": "eidolon:block/incubator_top" + }, + "elements": [ + + { + "from": [1, 4, 1], + "to": [15, 16, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 12, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "east": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "south": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "west": {"uv": [0, 0, 14, 12], "texture": "#1"}, + "down": {"uv": [0, 0, 14, 14], "texture": "#0"} + } + }, + { + "from": [1, 16, 1], + "to": [15, 30, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 24, 9]}, + "faces": { + "north": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "east": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "south": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "west": {"uv": [0, 0, 14, 12], "texture": "#3"}, + "up": {"uv": [0, 0, 14, 14], "texture": "#3"} + } + } + ] + } + }, + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.28125, 0.28125, 0.28125] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.25, 0.25, 0.25] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.3, 0.3, 0.3] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.3, 0.3, 0.3] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.1875, 0.1875, 0.1875] + }, + "gui": { + "rotation": [30, 225, 0], + "translation": [0, -3, 0], + "scale": [0.46875, 0.46875, 0.46875] + }, + "fixed": { + "scale": [0.375, 0.375, 0.375] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/magic_candle.json b/src/main/resources/assets/eidolon/models/item/magic_candle.json new file mode 100644 index 0000000..5f71c8b --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/magic_candle.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/magic_candle" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/magic_candlestick.json b/src/main/resources/assets/eidolon/models/item/magic_candlestick.json new file mode 100644 index 0000000..37b0718 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/magic_candlestick.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/magic_candlestick" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/magic_ink.json b/src/main/resources/assets/eidolon/models/item/magic_ink.json new file mode 100644 index 0000000..d334202 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/magic_ink.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/magic_ink" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/magicians_wax.json b/src/main/resources/assets/eidolon/models/item/magicians_wax.json new file mode 100644 index 0000000..adc5072 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/magicians_wax.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/magicians_wax" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/merammer_resin.json b/src/main/resources/assets/eidolon/models/item/merammer_resin.json new file mode 100644 index 0000000..427ffc0 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/merammer_resin.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/merammer_resin" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/merammer_root.json b/src/main/resources/assets/eidolon/models/item/merammer_root.json new file mode 100644 index 0000000..f377de2 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/merammer_root.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/merammer_root" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/mossy_smooth_stone_bricks.json b/src/main/resources/assets/eidolon/models/item/mossy_smooth_stone_bricks.json new file mode 100644 index 0000000..997ccf5 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/mossy_smooth_stone_bricks.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/mossy_smooth_stone_bricks" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/notetaking_tools.json b/src/main/resources/assets/eidolon/models/item/notetaking_tools.json new file mode 100644 index 0000000..5b4032a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/notetaking_tools.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/notetaking_tools" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/oanna_bloom.json b/src/main/resources/assets/eidolon/models/item/oanna_bloom.json new file mode 100644 index 0000000..18edd28 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/oanna_bloom.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/oanna_bloom" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/obelisk.json b/src/main/resources/assets/eidolon/models/item/obelisk.json new file mode 100644 index 0000000..6fc371c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/obelisk.json @@ -0,0 +1,124 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/obelisk_bottom", + "1": "eidolon:block/obelisk_parts", + "2": "eidolon:block/obelisk_side", + "3": "eidolon:block/obelisk_top", + "particle": "eidolon:block/obelisk_side" + }, + "elements": [ + { + "from": [2, 0, 2], + "to": [14, 14, 14], + "faces": { + "north": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "east": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "south": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "west": {"uv": [0, 0, 12, 14], "texture": "#2"}, + "up": {"uv": [0, 0, 12, 12], "texture": "#3"}, + "down": {"uv": [0, 0, 12, 12], "texture": "#0"} + } + }, + { + "from": [4, 14, 4], + "to": [12, 16, 12], + "faces": { + "north": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "east": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "south": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "west": {"uv": [0, 8, 8, 10], "texture": "#1"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#1"} + } + }, + { + "from": [0, -0.01, 0], + "to": [4, 5.99, 4], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [0, -0.01, 12], + "to": [4, 5.99, 16], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [12, -0.01, 12], + "to": [16, 5.99, 16], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [12, -0.01, 0], + "to": [16, 5.99, 4], + "faces": { + "north": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "east": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "south": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 10, 16, 16], "texture": "#1"}, + "up": {"uv": [12, 6, 16, 10], "texture": "#1"}, + "down": {"uv": [12, 6, 16, 10], "texture": "#1"} + } + }, + { + "from": [0, 0, 4], + "to": [2, 4, 12], + "faces": { + "east": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "west": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "rotation": 90, "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 90, "texture": "#1"} + } + }, + { + "from": [4, 0, 0], + "to": [12, 4, 2], + "faces": { + "north": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "south": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "rotation": 180, "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "texture": "#1"} + } + }, + { + "from": [4, 0, 14], + "to": [12, 4, 16], + "faces": { + "north": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "south": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 180, "texture": "#1"} + } + }, + { + "from": [14, 0, 4], + "to": [16, 4, 12], + "faces": { + "east": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "west": {"uv": [4, 12, 12, 16], "texture": "#1"}, + "up": {"uv": [4, 12, 12, 14], "rotation": 270, "texture": "#1"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 270, "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/parchment.json b/src/main/resources/assets/eidolon/models/item/parchment.json new file mode 100644 index 0000000..09c9b06 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/parchment.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/parchment" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/planter.json b/src/main/resources/assets/eidolon/models/item/planter.json index b14b8bf..7d5bb2a 100644 --- a/src/main/resources/assets/eidolon/models/item/planter.json +++ b/src/main/resources/assets/eidolon/models/item/planter.json @@ -398,6 +398,5 @@ "down": {"uv": [6, 10, 8, 12], "rotation": 90, "texture": "#0"} } } - ], - "display": {} + ] } \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/raven_cloak.json b/src/main/resources/assets/eidolon/models/item/raven_cloak.json new file mode 100644 index 0000000..f62a68a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/raven_cloak.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/raven_cloak" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/raven_feather.json b/src/main/resources/assets/eidolon/models/item/raven_feather.json new file mode 100644 index 0000000..035c1a1 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/raven_feather.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/raven_feather" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/raw_lead.json b/src/main/resources/assets/eidolon/models/item/raw_lead.json new file mode 100644 index 0000000..a62d763 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/raw_lead.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/raw_lead" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/raw_lead_block.json b/src/main/resources/assets/eidolon/models/item/raw_lead_block.json new file mode 100644 index 0000000..7b9b0e6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/raw_lead_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/raw_lead_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/raw_silver.json b/src/main/resources/assets/eidolon/models/item/raw_silver.json new file mode 100644 index 0000000..d6b0781 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/raw_silver.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/raw_silver" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/raw_silver_block.json b/src/main/resources/assets/eidolon/models/item/raw_silver_block.json new file mode 100644 index 0000000..5f59fee --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/raw_silver_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/raw_silver_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/red_candy.json b/src/main/resources/assets/eidolon/models/item/red_candy.json new file mode 100644 index 0000000..74a827c --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/red_candy.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/red_candy" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/research_notes.json b/src/main/resources/assets/eidolon/models/item/research_notes.json new file mode 100644 index 0000000..4b122bc --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/research_notes.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/research_notes" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/research_table.json b/src/main/resources/assets/eidolon/models/item/research_table.json new file mode 100644 index 0000000..815cb74 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/research_table.json @@ -0,0 +1,278 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/research_table_bottom", + "1": "eidolon:block/research_table_mid", + "2": "eidolon:block/research_table_side", + "3": "eidolon:block/research_table_top", + "4": "eidolon:block/research_table_detail", + "particle": "eidolon:block/research_table_bottom" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 4, 16], + "faces": { + "north": {"uv": [0, 12, 16, 16], "texture": "#2"}, + "east": {"uv": [0, 12, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 12, 16, 16], "texture": "#2"}, + "west": {"uv": [0, 12, 16, 16], "texture": "#2"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [0, 10, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 18, 8]}, + "faces": { + "north": {"uv": [0, 0, 16, 6], "texture": "#2"}, + "east": {"uv": [0, 0, 16, 6], "texture": "#2"}, + "south": {"uv": [0, 0, 16, 6], "texture": "#2"}, + "west": {"uv": [0, 0, 16, 6], "texture": "#2"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#3"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + }, + { + "from": [2, 4, 2], + "to": [6, 10, 6], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 12, 10]}, + "faces": { + "north": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "east": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "south": {"uv": [2, 6, 6, 12], "texture": "#2"}, + "west": {"uv": [2, 6, 6, 12], "texture": "#2"} + } + }, + { + "from": [2, 4, 10], + "to": [6, 10, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 12, 18]}, + "faces": { + "north": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "east": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "south": {"uv": [2, 6, 6, 12], "texture": "#2"}, + "west": {"uv": [2, 6, 6, 12], "texture": "#2"} + } + }, + { + "from": [10, 4, 10], + "to": [14, 10, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 12, 18]}, + "faces": { + "north": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "east": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "south": {"uv": [2, 6, 6, 12], "texture": "#2"}, + "west": {"uv": [2, 6, 6, 12], "texture": "#2"} + } + }, + { + "from": [10, 4, 2], + "to": [14, 10, 6], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 12, 10]}, + "faces": { + "north": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "east": {"uv": [10, 6, 14, 12], "texture": "#2"}, + "south": {"uv": [2, 6, 6, 12], "texture": "#2"}, + "west": {"uv": [2, 6, 6, 12], "texture": "#2"} + } + }, + { + "from": [4, 15, 4], + "to": [12, 17, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [12, 23, 19]}, + "faces": { + "north": {"uv": [0, 8, 8, 10], "texture": "#4"}, + "east": {"uv": [0, 8, 8, 10], "texture": "#4"}, + "south": {"uv": [0, 8, 8, 10], "texture": "#4"}, + "west": {"uv": [0, 8, 8, 10], "texture": "#4"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#4"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#4"} + } + }, + { + "from": [3, 16, 3], + "to": [5, 18, 5], + "rotation": {"angle": -45, "axis": "y", "origin": [4, 17, 4]}, + "faces": { + "north": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "east": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "south": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "west": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "up": {"uv": [8, 2, 10, 4], "texture": "#4"}, + "down": {"uv": [8, 0, 10, 2], "texture": "#4"} + } + }, + { + "from": [3, 16, 11], + "to": [5, 18, 13], + "rotation": {"angle": -45, "axis": "y", "origin": [4, 17, 12]}, + "faces": { + "north": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "east": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "south": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "west": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "up": {"uv": [8, 2, 10, 4], "texture": "#4"}, + "down": {"uv": [8, 0, 10, 2], "texture": "#4"} + } + }, + { + "from": [11, 16, 11], + "to": [13, 18, 13], + "rotation": {"angle": -45, "axis": "y", "origin": [12, 17, 12]}, + "faces": { + "north": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "east": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "south": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "west": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "up": {"uv": [8, 2, 10, 4], "texture": "#4"}, + "down": {"uv": [8, 0, 10, 2], "texture": "#4"} + } + }, + { + "from": [11, 16, 3], + "to": [13, 18, 5], + "rotation": {"angle": -45, "axis": "y", "origin": [12, 17, 4]}, + "faces": { + "north": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "east": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "south": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "west": {"uv": [8, 0, 10, 2], "texture": "#4"}, + "up": {"uv": [8, 2, 10, 4], "texture": "#4"}, + "down": {"uv": [8, 0, 10, 2], "texture": "#4"} + } + }, + { + "from": [2.5, 16, 0.5], + "to": [3.5, 17, 1.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [3, 16.5, 1]}, + "faces": { + "north": {"uv": [15, 6, 16, 7], "texture": "#4"}, + "east": {"uv": [15, 6, 16, 7], "texture": "#4"}, + "south": {"uv": [15, 6, 16, 7], "texture": "#4"}, + "west": {"uv": [15, 6, 16, 7], "texture": "#4"}, + "up": {"uv": [15, 6, 16, 7], "rotation": 90, "texture": "#4"}, + "down": {"uv": [15, 6, 16, 7], "rotation": 270, "texture": "#4"} + } + }, + { + "from": [2.5, 23, 0.5], + "to": [3.5, 24, 1.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [3, 23.5, 1]}, + "faces": { + "north": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "east": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "south": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "west": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "up": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "down": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"} + } + }, + { + "from": [1.5, 17, -0.5], + "to": [4.5, 18, 2.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [3, 17.5, 1]}, + "faces": { + "north": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "east": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "south": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "west": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "up": {"uv": [12, 6, 15, 9], "rotation": 90, "texture": "#4"}, + "down": {"uv": [12, 6, 15, 9], "rotation": 270, "texture": "#4"} + } + }, + { + "from": [2, 18, 0], + "to": [4, 23, 2], + "rotation": {"angle": 22.5, "axis": "y", "origin": [3, 18.5, 1]}, + "faces": { + "north": {"uv": [12, 1, 14, 6], "texture": "#4"}, + "east": {"uv": [12, 1, 14, 6], "texture": "#4"}, + "south": {"uv": [12, 1, 14, 6], "texture": "#4"}, + "west": {"uv": [12, 1, 14, 6], "texture": "#4"}, + "up": {"uv": [14, 0, 16, 2], "texture": "#4"}, + "down": {"uv": [14, 0, 16, 2], "texture": "#4"} + } + }, + { + "from": [-0.5, 16, 1.5], + "to": [2.5, 17, 4.5], + "rotation": {"angle": -22.5, "axis": "y", "origin": [1, 16.5, 3]}, + "faces": { + "north": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "east": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "south": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "west": {"uv": [12, 8, 15, 9], "texture": "#4"}, + "up": {"uv": [12, 6, 15, 9], "texture": "#4"}, + "down": {"uv": [12, 6, 15, 9], "texture": "#4"} + } + }, + { + "from": [0, 17, 2], + "to": [2, 21, 4], + "rotation": {"angle": -22.5, "axis": "y", "origin": [1, 17.5, 3]}, + "faces": { + "north": {"uv": [14, 2, 16, 6], "texture": "#4"}, + "east": {"uv": [14, 2, 16, 6], "texture": "#4"}, + "south": {"uv": [14, 2, 16, 6], "texture": "#4"}, + "west": {"uv": [14, 2, 16, 6], "texture": "#4"}, + "up": {"uv": [14, 0, 16, 2], "rotation": 270, "texture": "#4"}, + "down": {"uv": [14, 0, 16, 2], "rotation": 90, "texture": "#4"} + } + }, + { + "from": [0.5, 21, 2.5], + "to": [1.5, 22, 3.5], + "rotation": {"angle": -22.5, "axis": "y", "origin": [1, 21.5, 3]}, + "faces": { + "north": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "east": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "south": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "west": {"uv": [13, 0, 14, 1], "rotation": 90, "texture": "#4"}, + "up": {"uv": [13, 0, 14, 1], "texture": "#4"}, + "down": {"uv": [13, 0, 14, 1], "rotation": 180, "texture": "#4"} + } + }, + { + "from": [13, 16, 13], + "to": [15, 18, 15], + "rotation": {"angle": 22.5, "axis": "y", "origin": [14, 17, 14]}, + "faces": { + "north": {"uv": [0, 11, 2, 13], "texture": "#4"}, + "east": {"uv": [0, 11, 2, 13], "texture": "#4"}, + "south": {"uv": [0, 11, 2, 13], "texture": "#4"}, + "west": {"uv": [0, 11, 2, 13], "texture": "#4"}, + "up": {"uv": [0, 11, 2, 13], "texture": "#4"}, + "down": {"uv": [0, 11, 2, 13], "texture": "#4"} + } + }, + { + "from": [12.5, 18, 12.5], + "to": [15.5, 19, 15.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [14, 19, 14]}, + "faces": { + "north": {"uv": [2, 12, 5, 13], "texture": "#4"}, + "east": {"uv": [2, 12, 5, 13], "texture": "#4"}, + "south": {"uv": [2, 12, 5, 13], "texture": "#4"}, + "west": {"uv": [2, 12, 5, 13], "texture": "#4"}, + "up": {"uv": [2, 10, 5, 13], "texture": "#4"}, + "down": {"uv": [2, 10, 5, 13], "texture": "#4"} + } + }, + { + "from": [13.5, 18, 13.5], + "to": [14.5, 22, 14.5], + "rotation": {"angle": -22.5, "axis": "z", "origin": [14, 18.5, 14]}, + "faces": { + "north": {"uv": [5, 10, 6, 14], "texture": "#4"}, + "east": {"uv": [5, 10, 6, 14], "texture": "#4"}, + "south": {"uv": [5, 10, 6, 14], "texture": "#4"}, + "west": {"uv": [5, 10, 6, 14], "texture": "#4"}, + "up": {"uv": [5, 10, 6, 11], "texture": "#4"}, + "down": {"uv": [5, 13, 6, 14], "texture": "#4"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/scriptorium.json b/src/main/resources/assets/eidolon/models/item/scriptorium.json new file mode 100644 index 0000000..1c011b8 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/scriptorium.json @@ -0,0 +1,217 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "eidolon:block/scriptorium_detail", + "1": "eidolon:block/scriptorium_top", + "2": "eidolon:block/scriptorium_legs", + "particle": "eidolon:block/scriptorium_detail" + }, + "elements": [ + { + "from": [0, 4.87917, 8.20119], + "to": [16, 8.87917, 20.20119], + "rotation": {"angle": -22.5, "axis": "x", "origin": [0, -2.12083, 0.20119]}, + "faces": { + "north": {"uv": [0, 12, 16, 16], "texture": "#1"}, + "east": {"uv": [0, 0, 12, 4], "texture": "#2"}, + "south": {"uv": [0, 12, 16, 16], "texture": "#1"}, + "west": {"uv": [12, 0, 0, 4], "texture": "#2"}, + "up": {"uv": [0, 12, 16, 0], "texture": "#1"}, + "down": {"uv": [0, 12, 16, 0], "texture": "#1"} + } + }, + { + "from": [1, 0, 11], + "to": [4, 12, 14], + "faces": { + "north": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "east": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "south": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "west": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "up": {"uv": [0, 4, 3, 7], "texture": "#2"}, + "down": {"uv": [0, 4, 3, 7], "texture": "#2"} + } + }, + { + "from": [12, 0, 11], + "to": [15, 12, 14], + "faces": { + "north": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "east": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "south": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "west": {"uv": [3, 4, 6, 16], "texture": "#2"}, + "up": {"uv": [0, 4, 3, 7], "texture": "#2"}, + "down": {"uv": [0, 4, 3, 7], "texture": "#2"} + } + }, + { + "from": [12, 0, 5], + "to": [15, 9, 8], + "faces": { + "north": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "east": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "south": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "west": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "up": {"uv": [0, 4, 3, 7], "texture": "#2"}, + "down": {"uv": [0, 4, 3, 7], "texture": "#2"} + } + }, + { + "from": [1, 0, 5], + "to": [4, 9, 8], + "faces": { + "north": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "east": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "south": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "west": {"uv": [0, 7, 3, 16], "texture": "#2"}, + "up": {"uv": [0, 4, 3, 7], "texture": "#2"}, + "down": {"uv": [0, 4, 3, 7], "texture": "#2"} + } + }, + { + "from": [-1.5, 8, 1], + "to": [7.5, 10, 7], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [6, 14, 15, 16], "texture": "#2"}, + "east": {"uv": [16, 0, 12, 2], "texture": "#2"}, + "south": {"uv": [6, 14, 15, 16], "texture": "#2"}, + "west": {"uv": [12, 0, 16, 2], "texture": "#2"}, + "up": {"uv": [6, 14, 15, 8], "texture": "#2"}, + "down": {"uv": [6, 8, 15, 14], "texture": "#2"} + } + }, + { + "from": [8.5, 7.99, 1], + "to": [17.5, 9.99, 7], + "rotation": {"angle": -22.5, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [15, 14, 6, 16], "texture": "#2"}, + "east": {"uv": [16, 0, 12, 2], "texture": "#2"}, + "south": {"uv": [15, 14, 6, 16], "texture": "#2"}, + "west": {"uv": [12, 0, 16, 2], "texture": "#2"}, + "up": {"uv": [15, 4, 6, 10], "texture": "#2"}, + "down": {"uv": [15, 10, 6, 4], "texture": "#2"} + } + }, + { + "from": [12, 3, 8], + "to": [14, 10, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "east": {"uv": [16, 9, 13, 16], "texture": "#0"}, + "west": {"uv": [16, 9, 13, 16], "texture": "#0"}, + "up": {"uv": [13, 16, 16, 14], "rotation": 90, "texture": "#0"}, + "down": {"uv": [13, 16, 16, 14], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [2, 3, 8], + "to": [4, 10, 11], + "faces": { + "east": {"uv": [13, 9, 16, 16], "texture": "#0"}, + "west": {"uv": [13, 9, 16, 16], "texture": "#0"}, + "up": {"uv": [13, 14, 16, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [13, 14, 16, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "from": [-1, 10, 1.5], + "to": [3, 13, 5.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [0, 4, 4, 7], "texture": "#0"}, + "east": {"uv": [0, 4, 4, 7], "texture": "#0"}, + "south": {"uv": [0, 4, 4, 7], "texture": "#0"}, + "west": {"uv": [0, 4, 4, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 4], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 4], "texture": "#0"} + } + }, + { + "from": [4.5, 10, -0.25], + "to": [7.5, 12, 2.75], + "faces": { + "north": {"uv": [6, 10, 9, 12], "texture": "#0"}, + "east": {"uv": [6, 10, 9, 12], "texture": "#0"}, + "south": {"uv": [6, 10, 9, 12], "texture": "#0"}, + "west": {"uv": [6, 10, 9, 12], "texture": "#0"}, + "up": {"uv": [6, 7, 9, 10], "texture": "#0"}, + "down": {"uv": [6, 7, 9, 10], "texture": "#0"} + } + }, + { + "from": [5, 12, 0.25], + "to": [7, 13, 2.25], + "faces": { + "north": {"uv": [5, 6, 7, 7], "texture": "#0"}, + "east": {"uv": [5, 6, 7, 7], "texture": "#0"}, + "south": {"uv": [5, 6, 7, 7], "texture": "#0"}, + "west": {"uv": [5, 6, 7, 7], "texture": "#0"}, + "up": {"uv": [5, 4, 7, 6], "texture": "#0"}, + "down": {"uv": [5, 4, 7, 6], "texture": "#0"} + } + }, + { + "from": [-0.5, 13, 2], + "to": [2.5, 14, 5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [0, 0, 0]}, + "faces": { + "north": {"uv": [4, 3, 7, 4], "texture": "#0"}, + "east": {"uv": [4, 3, 7, 4], "texture": "#0"}, + "south": {"uv": [4, 3, 7, 4], "texture": "#0"}, + "west": {"uv": [4, 3, 7, 4], "texture": "#0"}, + "up": {"uv": [4, 0, 7, 3], "texture": "#0"} + } + }, + { + "from": [3.08678, 14, 0.8509], + "to": [3.08678, 22, 6.8509], + "rotation": {"angle": -22.5, "axis": "y", "origin": [-1.66322, 0, -0.3991]}, + "faces": { + "east": {"uv": [6, 8, 0, 16], "texture": "#0"}, + "west": {"uv": [0, 8, 6, 16], "texture": "#0"} + } + }, + { + "from": [9, 10, 1.5], + "to": [17, 11, 5.5], + "rotation": {"angle": -22.5, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [8, 4, 16, 5], "texture": "#0"}, + "east": {"uv": [8, 5, 12, 6], "texture": "#0"}, + "south": {"uv": [8, 4, 16, 5], "texture": "#0"}, + "west": {"uv": [8, 5, 12, 6], "texture": "#0"}, + "up": {"uv": [8, 0, 16, 4], "texture": "#0"}, + "down": {"uv": [8, 0, 16, 4], "texture": "#0"} + } + }, + { + "from": [7, 11, -1.5], + "to": [15, 12, 2.5], + "rotation": {"angle": 22.5, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [8, 4, 16, 5], "texture": "#0"}, + "east": {"uv": [8, 5, 12, 6], "texture": "#0"}, + "south": {"uv": [8, 4, 16, 5], "texture": "#0"}, + "west": {"uv": [8, 5, 12, 6], "texture": "#0"}, + "up": {"uv": [8, 0, 16, 4], "texture": "#0"}, + "down": {"uv": [8, 0, 16, 4], "texture": "#0"} + } + }, + { + "from": [8, 11.01, -0.25], + "to": [16, 11.01, 3.75], + "rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]}, + "faces": { + "north": {"uv": [8, 4, 16, 5], "texture": "#0"}, + "east": {"uv": [8, 5, 12, 6], "texture": "#0"}, + "south": {"uv": [8, 4, 16, 5], "texture": "#0"}, + "west": {"uv": [8, 5, 12, 6], "texture": "#0"}, + "up": {"uv": [8, 0, 16, 4], "texture": "#0"}, + "down": {"uv": [8, 0, 16, 4], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/shadow_gem_block.json b/src/main/resources/assets/eidolon/models/item/shadow_gem_block.json new file mode 100644 index 0000000..c639d05 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/shadow_gem_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/shadow_gem_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/sildrian_seed.json b/src/main/resources/assets/eidolon/models/item/sildrian_seed.json new file mode 100644 index 0000000..8503cb0 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/sildrian_seed.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/sildrian_seed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_axe.json b/src/main/resources/assets/eidolon/models/item/silver_axe.json new file mode 100644 index 0000000..cf7d6ca --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_axe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/silver_axe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_block.json b/src/main/resources/assets/eidolon/models/item/silver_block.json new file mode 100644 index 0000000..ede2af5 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/silver_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_boots.json b/src/main/resources/assets/eidolon/models/item/silver_boots.json new file mode 100644 index 0000000..42ee629 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/silver_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_chestplate.json b/src/main/resources/assets/eidolon/models/item/silver_chestplate.json new file mode 100644 index 0000000..88be3dc --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/silver_chestplate" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_helmet.json b/src/main/resources/assets/eidolon/models/item/silver_helmet.json new file mode 100644 index 0000000..6c51f91 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/silver_helmet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_hoe.json b/src/main/resources/assets/eidolon/models/item/silver_hoe.json new file mode 100644 index 0000000..f927c1d --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_hoe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/silver_hoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_ingot.json b/src/main/resources/assets/eidolon/models/item/silver_ingot.json new file mode 100644 index 0000000..fe20e71 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_ingot.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/silver_ingot" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_leggings.json b/src/main/resources/assets/eidolon/models/item/silver_leggings.json new file mode 100644 index 0000000..52e841e --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_leggings.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/silver_leggings" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_nugget.json b/src/main/resources/assets/eidolon/models/item/silver_nugget.json new file mode 100644 index 0000000..e34cf80 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_nugget.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/silver_nugget" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_ore.json b/src/main/resources/assets/eidolon/models/item/silver_ore.json new file mode 100644 index 0000000..ada6b94 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/silver_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_pickaxe.json b/src/main/resources/assets/eidolon/models/item/silver_pickaxe.json new file mode 100644 index 0000000..4f3f43a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_pickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/silver_pickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_shovel.json b/src/main/resources/assets/eidolon/models/item/silver_shovel.json new file mode 100644 index 0000000..85822ef --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_shovel.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/silver_shovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/silver_sword.json b/src/main/resources/assets/eidolon/models/item/silver_sword.json new file mode 100644 index 0000000..e655f29 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/silver_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/silver_sword" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/smooth_stone_arch.json b/src/main/resources/assets/eidolon/models/item/smooth_stone_arch.json new file mode 100644 index 0000000..5e7c451 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/smooth_stone_arch.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/smooth_stone_bricks", + "side": "eidolon:block/smooth_stone_arch" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry.json b/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry.json new file mode 100644 index 0000000..68743b4 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "eidolon:block/smooth_stone_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry_slab.json b/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry_slab.json new file mode 100644 index 0000000..e63268a --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "eidolon:block/smooth_stone_masonry", + "top": "eidolon:block/smooth_stone_masonry", + "side": "eidolon:block/smooth_stone_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry_stairs.json b/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry_stairs.json new file mode 100644 index 0000000..f9bf8ba --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/smooth_stone_masonry_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "eidolon:block/smooth_stone_masonry", + "top": "eidolon:block/smooth_stone_masonry", + "side": "eidolon:block/smooth_stone_masonry" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/soulbone_amulet.json b/src/main/resources/assets/eidolon/models/item/soulbone_amulet.json new file mode 100644 index 0000000..a515cf6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/soulbone_amulet.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/soulbone_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/spawn_raven.json b/src/main/resources/assets/eidolon/models/item/spawn_raven.json new file mode 100644 index 0000000..38194e8 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/spawn_raven.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:item/template_spawn_egg" +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/spawn_slimy_slug.json b/src/main/resources/assets/eidolon/models/item/spawn_slimy_slug.json new file mode 100644 index 0000000..38194e8 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/spawn_slimy_slug.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:item/template_spawn_egg" +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/stripped_illwood_bark.json b/src/main/resources/assets/eidolon/models/item/stripped_illwood_bark.json new file mode 100644 index 0000000..e25f9d3 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/stripped_illwood_bark.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/stripped_illwood_log", + "side": "eidolon:block/stripped_illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/stripped_illwood_log.json b/src/main/resources/assets/eidolon/models/item/stripped_illwood_log.json new file mode 100644 index 0000000..e737f87 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/stripped_illwood_log.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "eidolon:block/stripped_illwood_log_top", + "side": "eidolon:block/stripped_illwood_log" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/summoning_staff.json b/src/main/resources/assets/eidolon/models/item/summoning_staff.json new file mode 100644 index 0000000..6bfabfa --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/summoning_staff.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "eidolon:item/summoning_staff" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/terminus_mirror.json b/src/main/resources/assets/eidolon/models/item/terminus_mirror.json new file mode 100644 index 0000000..ca2d9c6 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/terminus_mirror.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/terminus_mirror" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/withered_heart.json b/src/main/resources/assets/eidolon/models/item/withered_heart.json new file mode 100644 index 0000000..f2bace7 --- /dev/null +++ b/src/main/resources/assets/eidolon/models/item/withered_heart.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "eidolon:item/withered_heart" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/models/item/worktable.json b/src/main/resources/assets/eidolon/models/item/worktable.json index 5b51021..a89a787 100644 --- a/src/main/resources/assets/eidolon/models/item/worktable.json +++ b/src/main/resources/assets/eidolon/models/item/worktable.json @@ -131,58 +131,6 @@ "up": {"uv": [0, 8, 6, 14], "texture": "#4"}, "down": {"uv": [0, 2, 6, 8], "texture": "#4"} } - }, - { - "from": [13, 6.5, 7], - "to": [18, 11.5, 9], - "rotation": {"angle": 45, "axis": "z", "origin": [15.5, 9, 8]}, - "faces": { - "north": {"uv": [6, 0, 11, 5], "texture": "#4"}, - "east": {"uv": [11, 0, 13, 5], "texture": "#4"}, - "south": {"uv": [11, 0, 6, 5], "texture": "#4"}, - "west": {"uv": [13, 0, 15, 5], "texture": "#4"}, - "up": {"uv": [11, 0, 13, 5], "rotation": 90, "texture": "#4"}, - "down": {"uv": [13, 0, 15, 5], "rotation": 90, "texture": "#4"} - } - }, - { - "from": [7, 6.5, 13], - "to": [9, 11.5, 18], - "rotation": {"angle": -45, "axis": "x", "origin": [8, 9, 15.5]}, - "faces": { - "north": {"uv": [13, 0, 15, 5], "texture": "#4"}, - "east": {"uv": [11, 0, 6, 5], "rotation": 270, "texture": "#4"}, - "south": {"uv": [11, 0, 13, 5], "texture": "#4"}, - "west": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#4"}, - "up": {"uv": [11, 0, 13, 5], "rotation": 180, "texture": "#4"}, - "down": {"uv": [13, 0, 15, 5], "texture": "#4"} - } - }, - { - "from": [7, 6.5, -2], - "to": [9, 11.5, 3], - "rotation": {"angle": 45, "axis": "x", "origin": [8, 9, 0.5]}, - "faces": { - "north": {"uv": [13, 0, 11, 5], "texture": "#4"}, - "east": {"uv": [11, 5, 6, 0], "rotation": 270, "texture": "#4"}, - "south": {"uv": [15, 0, 13, 5], "texture": "#4"}, - "west": {"uv": [6, 5, 11, 0], "rotation": 90, "texture": "#4"}, - "up": {"uv": [11, 5, 13, 0], "rotation": 180, "texture": "#4"}, - "down": {"uv": [13, 5, 15, 0], "texture": "#4"} - } - }, - { - "from": [-2, 6.5, 7], - "to": [3, 11.5, 9], - "rotation": {"angle": -45, "axis": "z", "origin": [0.5, 9, 8]}, - "faces": { - "north": {"uv": [11, 0, 6, 5], "texture": "#4"}, - "east": {"uv": [15, 0, 13, 5], "texture": "#4"}, - "south": {"uv": [6, 0, 11, 5], "texture": "#4"}, - "west": {"uv": [13, 0, 11, 5], "texture": "#4"}, - "up": {"uv": [11, 5, 13, 0], "rotation": 90, "texture": "#4"}, - "down": {"uv": [13, 5, 15, 0], "rotation": 90, "texture": "#4"} - } } ] } \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/particles/glowing_slash_particle.json b/src/main/resources/assets/eidolon/particles/glowing_slash_particle.json new file mode 100644 index 0000000..d0b1a24 --- /dev/null +++ b/src/main/resources/assets/eidolon/particles/glowing_slash_particle.json @@ -0,0 +1,5 @@ +{ + "textures": [ + "eidolon:beam" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/particles/rune_particle.json b/src/main/resources/assets/eidolon/particles/rune_particle.json new file mode 100644 index 0000000..0ad9fe1 --- /dev/null +++ b/src/main/resources/assets/eidolon/particles/rune_particle.json @@ -0,0 +1,5 @@ +{ + "textures": [ + "eidolon:wisp" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/particles/slash_particle.json b/src/main/resources/assets/eidolon/particles/slash_particle.json new file mode 100644 index 0000000..d0b1a24 --- /dev/null +++ b/src/main/resources/assets/eidolon/particles/slash_particle.json @@ -0,0 +1,5 @@ +{ + "textures": [ + "eidolon:beam" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing.fsh b/src/main/resources/assets/eidolon/shaders/core/glowing.fsh new file mode 100644 index 0000000..d7da70e --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing.fsh @@ -0,0 +1,15 @@ +#version 150 + +in vec4 vertexColor; + +uniform vec4 ColorModulator; + +out vec4 fragColor; + +void main() { + vec4 color = vertexColor; + if (color.a == 0.0) { + discard; + } + fragColor = color * ColorModulator; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing.json b/src/main/resources/assets/eidolon/shaders/core/glowing.json new file mode 100644 index 0000000..ef91b7e --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing.json @@ -0,0 +1,19 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1" + }, + "vertex": "eidolon:glowing", + "fragment": "eidolon:glowing", + "attributes": [ + "Color" + ], + "samplers": [ + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing.vsh b/src/main/resources/assets/eidolon/shaders/core/glowing.vsh new file mode 100644 index 0000000..19d3fdb --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing.vsh @@ -0,0 +1,15 @@ +#version 150 + +in vec3 Position; +in vec4 Color; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; + +out vec4 vertexColor; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexColor = Color; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_entity.fsh b/src/main/resources/assets/eidolon/shaders/core/glowing_entity.fsh new file mode 100644 index 0000000..c46a768 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_entity.fsh @@ -0,0 +1,23 @@ +#version 150 + +#moj_import + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; +uniform float FogStart; +uniform float FogEnd; + +in float vertexDistance; +in vec4 vertexColor; +in vec2 texCoord0; + +out vec4 fragColor; + +void main() { + vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; + if (color.a < 0.001) { + discard; + } + fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd); +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_entity.json b/src/main/resources/assets/eidolon/shaders/core/glowing_entity.json new file mode 100644 index 0000000..58464f2 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_entity.json @@ -0,0 +1,24 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1" + }, + "vertex": "eidolon:glowing_entity", + "fragment": "eidolon:glowing_entity", + "attributes": [ + "Position", + "Color", + "UV0" + ], + "samplers": [ + { "name": "Sampler0" } + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, + { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, + { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] } + ] +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_entity.vsh b/src/main/resources/assets/eidolon/shaders/core/glowing_entity.vsh new file mode 100644 index 0000000..e0277a8 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_entity.vsh @@ -0,0 +1,21 @@ +#version 150 + +in vec3 Position; +in vec4 Color; +in vec2 UV0; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; +uniform mat4 TextureMat; + +out float vertexDistance; +out vec4 vertexColor; +out vec2 texCoord0; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz); + vertexColor = Color; + texCoord0 = UV0; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_particle.fsh b/src/main/resources/assets/eidolon/shaders/core/glowing_particle.fsh new file mode 100644 index 0000000..95ab1f5 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_particle.fsh @@ -0,0 +1,24 @@ +#version 150 + +#moj_import + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; +uniform float FogStart; +uniform float FogEnd; +uniform vec4 FogColor; + +in float vertexDistance; +in vec2 texCoord0; +in vec4 vertexColor; + +out vec4 fragColor; + +void main() { + vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; + if (color.a < 0.001) { + discard; + } + fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_particle.json b/src/main/resources/assets/eidolon/shaders/core/glowing_particle.json new file mode 100644 index 0000000..e3257be --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_particle.json @@ -0,0 +1,27 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1" + }, + "vertex": "eidolon:glowing_particle", + "fragment": "eidolon:glowing_particle", + "attributes": [ + "Position", + "UV0", + "Color", + "UV2" + ], + "samplers": [ + { "name": "Sampler0" }, + { "name": "Sampler2" } + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, + { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, + { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } + ] +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_particle.vsh b/src/main/resources/assets/eidolon/shaders/core/glowing_particle.vsh new file mode 100644 index 0000000..f6a6cbb --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_particle.vsh @@ -0,0 +1,23 @@ +#version 150 + +in vec3 Position; +in vec2 UV0; +in vec4 Color; +in ivec2 UV2; + +uniform sampler2D Sampler2; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; + +out float vertexDistance; +out vec2 texCoord0; +out vec4 vertexColor; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz); + texCoord0 = UV0; + vertexColor = Color; // unlit +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.fsh b/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.fsh new file mode 100644 index 0000000..7b99ac3 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.fsh @@ -0,0 +1,18 @@ +#version 150 + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; + +in vec2 texCoord0; +in vec4 vertexColor; + +out vec4 fragColor; + +void main() { + vec4 color = texture(Sampler0, texCoord0) * vertexColor; + if (color.a < 0.001) { + discard; + } + fragColor = color * ColorModulator; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.json b/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.json new file mode 100644 index 0000000..915460d --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.json @@ -0,0 +1,22 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1" + }, + "vertex": "eidolon:glowing_sprite", + "fragment": "eidolon:glowing_sprite", + "attributes": [ + "Position", + "UV0", + "Color" + ], + "samplers": [ + { "name": "Sampler0" } + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.vsh b/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.vsh new file mode 100644 index 0000000..1ed8e40 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/glowing_sprite.vsh @@ -0,0 +1,18 @@ +#version 150 + +in vec3 Position; +in vec2 UV0; +in vec4 Color; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; + +out vec2 texCoord0; +out vec4 vertexColor; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + texCoord0 = UV0; + vertexColor = Color; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/sprite_particle.fsh b/src/main/resources/assets/eidolon/shaders/core/sprite_particle.fsh new file mode 100644 index 0000000..95ab1f5 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/sprite_particle.fsh @@ -0,0 +1,24 @@ +#version 150 + +#moj_import + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; +uniform float FogStart; +uniform float FogEnd; +uniform vec4 FogColor; + +in float vertexDistance; +in vec2 texCoord0; +in vec4 vertexColor; + +out vec4 fragColor; + +void main() { + vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; + if (color.a < 0.001) { + discard; + } + fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); +} diff --git a/src/main/resources/assets/eidolon/shaders/core/sprite_particle.json b/src/main/resources/assets/eidolon/shaders/core/sprite_particle.json new file mode 100644 index 0000000..fba6ffe --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/sprite_particle.json @@ -0,0 +1,27 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "eidolon:sprite_particle", + "fragment": "eidolon:sprite_particle", + "attributes": [ + "Position", + "UV0", + "Color", + "UV2" + ], + "samplers": [ + { "name": "Sampler0" }, + { "name": "Sampler2" } + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, + { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, + { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } + ] +} diff --git a/src/main/resources/assets/eidolon/shaders/core/sprite_particle.vsh b/src/main/resources/assets/eidolon/shaders/core/sprite_particle.vsh new file mode 100644 index 0000000..db98217 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/sprite_particle.vsh @@ -0,0 +1,23 @@ +#version 150 + +in vec3 Position; +in vec2 UV0; +in vec4 Color; +in ivec2 UV2; + +uniform sampler2D Sampler2; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; + +out float vertexDistance; +out vec2 texCoord0; +out vec4 vertexColor; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz); + texCoord0 = UV0; + vertexColor = Color; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/vapor.fsh b/src/main/resources/assets/eidolon/shaders/core/vapor.fsh new file mode 100644 index 0000000..f619104 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/vapor.fsh @@ -0,0 +1,17 @@ +#version 150 + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; + +in vec4 vertexColor; +in vec2 texCoord0; +in vec2 texCoord2; +in vec4 normal; + +out vec4 fragColor; + +void main() { + vec4 color = texture(Sampler0, texCoord0) * vertexColor; + fragColor = color * ColorModulator; +} diff --git a/src/main/resources/assets/eidolon/shaders/core/vapor.json b/src/main/resources/assets/eidolon/shaders/core/vapor.json new file mode 100644 index 0000000..d2d9299 --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/vapor.json @@ -0,0 +1,24 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "eidolon:vapor", + "fragment": "eidolon:vapor", + "attributes": [ + "Position", + "Color", + "UV0", + "UV2", + "Normal" + ], + "samplers": [ + { "name": "Sampler0" } + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/eidolon/shaders/core/vapor.vsh b/src/main/resources/assets/eidolon/shaders/core/vapor.vsh new file mode 100644 index 0000000..96201fb --- /dev/null +++ b/src/main/resources/assets/eidolon/shaders/core/vapor.vsh @@ -0,0 +1,24 @@ +#version 150 + +in vec3 Position; +in vec4 Color; +in vec2 UV0; +in vec2 UV2; +in vec3 Normal; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; + +out vec4 vertexColor; +out vec2 texCoord0; +out vec2 texCoord2; +out vec4 normal; + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexColor = Color; + texCoord0 = UV0; + texCoord2 = UV2; + normal = ProjMat * ModelViewMat * vec4(Normal, 0.0); +} diff --git a/src/main/resources/assets/eidolon/sounds.json b/src/main/resources/assets/eidolon/sounds.json index 4f19cc4..0218393 100644 --- a/src/main/resources/assets/eidolon/sounds.json +++ b/src/main/resources/assets/eidolon/sounds.json @@ -19,9 +19,9 @@ "subtitle": "eidolon.subtitle.splash_bonechill", "sounds": [ "eidolon:splash_bonechill" ] }, - "select_sign": { + "select_rune": { "category": "neutral", - "sounds": [ "eidolon:select_sign" ] + "sounds": [ "eidolon:select_rune" ] }, "chant_word": { "category": "neutral", diff --git a/src/main/resources/assets/eidolon/sounds/select_sign.ogg b/src/main/resources/assets/eidolon/sounds/select_rune.ogg similarity index 100% rename from src/main/resources/assets/eidolon/sounds/select_sign.ogg rename to src/main/resources/assets/eidolon/sounds/select_rune.ogg diff --git a/src/main/resources/assets/eidolon/textures/block/Sprite-0001.aseprite b/src/main/resources/assets/eidolon/textures/block/Sprite-0001.aseprite new file mode 100644 index 0000000..381791e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/Sprite-0001.aseprite differ diff --git a/src/main/resources/assets/eidolon/textures/block/aludel_front.png b/src/main/resources/assets/eidolon/textures/block/aludel_front.png new file mode 100644 index 0000000..79e5c17 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/aludel_front.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/aludel_jar_side.png b/src/main/resources/assets/eidolon/textures/block/aludel_jar_side.png new file mode 100644 index 0000000..2b4def4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/aludel_jar_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/aludel_jar_top.png b/src/main/resources/assets/eidolon/textures/block/aludel_jar_top.png new file mode 100644 index 0000000..e9b3ab8 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/aludel_jar_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/aludel_parts.png b/src/main/resources/assets/eidolon/textures/block/aludel_parts.png new file mode 100644 index 0000000..136a893 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/aludel_parts.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/aludel_power.png b/src/main/resources/assets/eidolon/textures/block/aludel_power.png new file mode 100644 index 0000000..858b396 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/aludel_power.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/aludel_side.png b/src/main/resources/assets/eidolon/textures/block/aludel_side.png new file mode 100644 index 0000000..2903955 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/aludel_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/archive_bottom.png b/src/main/resources/assets/eidolon/textures/block/archive_bottom.png new file mode 100644 index 0000000..72b1d7f Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/archive_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/archive_detail.png b/src/main/resources/assets/eidolon/textures/block/archive_detail.png new file mode 100644 index 0000000..4c810b9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/archive_detail.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/archive_side.png b/src/main/resources/assets/eidolon/textures/block/archive_side.png new file mode 100644 index 0000000..aed27d4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/archive_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/archive_top.png b/src/main/resources/assets/eidolon/textures/block/archive_top.png new file mode 100644 index 0000000..84006c1 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/archive_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/avennian_sprig_0.png b/src/main/resources/assets/eidolon/textures/block/avennian_sprig_0.png new file mode 100644 index 0000000..132c599 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/avennian_sprig_0.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/avennian_sprig_1.png b/src/main/resources/assets/eidolon/textures/block/avennian_sprig_1.png new file mode 100644 index 0000000..fca44ac Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/avennian_sprig_1.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/bone_pile.png b/src/main/resources/assets/eidolon/textures/block/bone_pile.png new file mode 100644 index 0000000..28277fa Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/bone_pile.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cabinet_bottom.png b/src/main/resources/assets/eidolon/textures/block/cabinet_bottom.png new file mode 100644 index 0000000..4cd6329 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cabinet_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cabinet_bottom_front.png b/src/main/resources/assets/eidolon/textures/block/cabinet_bottom_front.png new file mode 100644 index 0000000..6e495cc Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cabinet_bottom_front.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cabinet_bottom_side.png b/src/main/resources/assets/eidolon/textures/block/cabinet_bottom_side.png new file mode 100644 index 0000000..0ed8291 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cabinet_bottom_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cabinet_top.png b/src/main/resources/assets/eidolon/textures/block/cabinet_top.png new file mode 100644 index 0000000..95273e0 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cabinet_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cabinet_top_front.png b/src/main/resources/assets/eidolon/textures/block/cabinet_top_front.png new file mode 100644 index 0000000..2532bfd Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cabinet_top_front.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cabinet_top_side.png b/src/main/resources/assets/eidolon/textures/block/cabinet_top_side.png new file mode 100644 index 0000000..55ee5f2 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cabinet_top_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/censer.png b/src/main/resources/assets/eidolon/textures/block/censer.png new file mode 100644 index 0000000..31d9c71 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/censer.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/censer_cage.png b/src/main/resources/assets/eidolon/textures/block/censer_cage.png new file mode 100644 index 0000000..b4b0a72 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/censer_cage.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cistern_bottom.png b/src/main/resources/assets/eidolon/textures/block/cistern_bottom.png new file mode 100644 index 0000000..5636b5e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cistern_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cistern_ends.png b/src/main/resources/assets/eidolon/textures/block/cistern_ends.png new file mode 100644 index 0000000..13e9a72 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cistern_ends.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cistern_mid.png b/src/main/resources/assets/eidolon/textures/block/cistern_mid.png new file mode 100644 index 0000000..0f45040 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cistern_mid.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cistern_side.png b/src/main/resources/assets/eidolon/textures/block/cistern_side.png new file mode 100644 index 0000000..98c5936 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cistern_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cistern_top.png b/src/main/resources/assets/eidolon/textures/block/cistern_top.png new file mode 100644 index 0000000..94c74d0 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cistern_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/cistern_upper.png b/src/main/resources/assets/eidolon/textures/block/cistern_upper.png new file mode 100644 index 0000000..a6669be Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/cistern_upper.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/coalfired_engine_bottom.png b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_bottom.png new file mode 100644 index 0000000..cc4db30 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/coalfired_engine_front.png b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_front.png new file mode 100644 index 0000000..c5c1869 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_front.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/coalfired_engine_on.png b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_on.png new file mode 100644 index 0000000..618cafc Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_on.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/coalfired_engine_parts.png b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_parts.png new file mode 100644 index 0000000..2dc2093 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_parts.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/coalfired_engine_side.png b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_side.png new file mode 100644 index 0000000..51ce4f1 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/coalfired_engine_top.png b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_top.png new file mode 100644 index 0000000..a27a025 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/coalfired_engine_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/crimsol.png b/src/main/resources/assets/eidolon/textures/block/crimsol.png new file mode 100644 index 0000000..dc0e7bf Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/crimsol.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/crimsol.png.mcmeta b/src/main/resources/assets/eidolon/textures/block/crimsol.png.mcmeta new file mode 100644 index 0000000..ae24a2f --- /dev/null +++ b/src/main/resources/assets/eidolon/textures/block/crimsol.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/textures/block/deep_lead_ore.png b/src/main/resources/assets/eidolon/textures/block/deep_lead_ore.png new file mode 100644 index 0000000..4360a46 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/deep_lead_ore.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/deep_silver_ore.png b/src/main/resources/assets/eidolon/textures/block/deep_silver_ore.png new file mode 100644 index 0000000..7483808 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/deep_silver_ore.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_bricks.png b/src/main/resources/assets/eidolon/textures/block/elder_bricks.png new file mode 100644 index 0000000..df435d9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_bricks.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_bricks_eye.png b/src/main/resources/assets/eidolon/textures/block/elder_bricks_eye.png new file mode 100644 index 0000000..5c5c835 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_bricks_eye.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_masonry.png b/src/main/resources/assets/eidolon/textures/block/elder_masonry.png new file mode 100644 index 0000000..12a485b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_masonry.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_pillar_both_side.png b/src/main/resources/assets/eidolon/textures/block/elder_pillar_both_side.png new file mode 100644 index 0000000..a1941a5 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_pillar_both_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_pillar_bottom_side.png b/src/main/resources/assets/eidolon/textures/block/elder_pillar_bottom_side.png new file mode 100644 index 0000000..e1744fa Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_pillar_bottom_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_pillar_end.png b/src/main/resources/assets/eidolon/textures/block/elder_pillar_end.png new file mode 100644 index 0000000..3734271 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_pillar_end.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_pillar_side.png b/src/main/resources/assets/eidolon/textures/block/elder_pillar_side.png new file mode 100644 index 0000000..864fc98 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_pillar_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/elder_pillar_top_side.png b/src/main/resources/assets/eidolon/textures/block/elder_pillar_top_side.png new file mode 100644 index 0000000..cf5420a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/elder_pillar_top_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/esprit.png b/src/main/resources/assets/eidolon/textures/block/esprit.png new file mode 100644 index 0000000..de62f04 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/esprit.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/esprit.png.mcmeta b/src/main/resources/assets/eidolon/textures/block/esprit.png.mcmeta new file mode 100644 index 0000000..ae24a2f --- /dev/null +++ b/src/main/resources/assets/eidolon/textures/block/esprit.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/textures/block/glass_tube.png b/src/main/resources/assets/eidolon/textures/block/glass_tube.png new file mode 100644 index 0000000..7db37ed Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/glass_tube.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/illwood_leaves.png b/src/main/resources/assets/eidolon/textures/block/illwood_leaves.png new file mode 100644 index 0000000..8b96df6 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/illwood_leaves.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/illwood_log.png b/src/main/resources/assets/eidolon/textures/block/illwood_log.png new file mode 100644 index 0000000..d0ffe9e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/illwood_log.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/illwood_log_top.png b/src/main/resources/assets/eidolon/textures/block/illwood_log_top.png new file mode 100644 index 0000000..6aae949 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/illwood_log_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/illwood_planks.png b/src/main/resources/assets/eidolon/textures/block/illwood_planks.png new file mode 100644 index 0000000..fec63e6 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/illwood_planks.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/illwood_sapling.png b/src/main/resources/assets/eidolon/textures/block/illwood_sapling.png new file mode 100644 index 0000000..6244ba5 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/illwood_sapling.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/incubator_bottom.png b/src/main/resources/assets/eidolon/textures/block/incubator_bottom.png new file mode 100644 index 0000000..45ba864 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/incubator_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/incubator_detail.png b/src/main/resources/assets/eidolon/textures/block/incubator_detail.png new file mode 100644 index 0000000..ab541ed Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/incubator_detail.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/incubator_shared.png b/src/main/resources/assets/eidolon/textures/block/incubator_shared.png new file mode 100644 index 0000000..483d3c4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/incubator_shared.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/incubator_top.png b/src/main/resources/assets/eidolon/textures/block/incubator_top.png new file mode 100644 index 0000000..68ae4b9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/incubator_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/magic_candle.png b/src/main/resources/assets/eidolon/textures/block/magic_candle.png new file mode 100644 index 0000000..d4b263e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/magic_candle.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/merammer_root_0.png b/src/main/resources/assets/eidolon/textures/block/merammer_root_0.png new file mode 100644 index 0000000..5b8ff46 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/merammer_root_0.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/merammer_root_1.png b/src/main/resources/assets/eidolon/textures/block/merammer_root_1.png new file mode 100644 index 0000000..100058a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/merammer_root_1.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/mossy_smooth_stone_bricks.png b/src/main/resources/assets/eidolon/textures/block/mossy_smooth_stone_bricks.png new file mode 100644 index 0000000..12eb4c2 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/mossy_smooth_stone_bricks.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/oanna_bloom_0.png b/src/main/resources/assets/eidolon/textures/block/oanna_bloom_0.png new file mode 100644 index 0000000..812ee1a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/oanna_bloom_0.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/oanna_bloom_1.png b/src/main/resources/assets/eidolon/textures/block/oanna_bloom_1.png new file mode 100644 index 0000000..62313e4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/oanna_bloom_1.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_bottom.png b/src/main/resources/assets/eidolon/textures/block/obelisk_bottom.png new file mode 100644 index 0000000..5e3fd4a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_parts.png b/src/main/resources/assets/eidolon/textures/block/obelisk_parts.png new file mode 100644 index 0000000..69dc7d3 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_parts.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_side.png b/src/main/resources/assets/eidolon/textures/block/obelisk_side.png new file mode 100644 index 0000000..6c32417 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_side_lower.png b/src/main/resources/assets/eidolon/textures/block/obelisk_side_lower.png new file mode 100644 index 0000000..eaa87e3 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_side_lower.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_side_mid.png b/src/main/resources/assets/eidolon/textures/block/obelisk_side_mid.png new file mode 100644 index 0000000..b1f825a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_side_mid.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_side_top.png b/src/main/resources/assets/eidolon/textures/block/obelisk_side_top.png new file mode 100644 index 0000000..7442d4b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_side_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_top.png b/src/main/resources/assets/eidolon/textures/block/obelisk_top.png new file mode 100644 index 0000000..e97635b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/obelisk_top_mid.png b/src/main/resources/assets/eidolon/textures/block/obelisk_top_mid.png new file mode 100644 index 0000000..a6f9b92 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/obelisk_top_mid.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/planter_side.png b/src/main/resources/assets/eidolon/textures/block/planter_side.png index feb6c0f..02343f1 100644 Binary files a/src/main/resources/assets/eidolon/textures/block/planter_side.png and b/src/main/resources/assets/eidolon/textures/block/planter_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/planter_soil.png b/src/main/resources/assets/eidolon/textures/block/planter_soil.png index 40644a1..e070e5b 100644 Binary files a/src/main/resources/assets/eidolon/textures/block/planter_soil.png and b/src/main/resources/assets/eidolon/textures/block/planter_soil.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/raw_lead_block.png b/src/main/resources/assets/eidolon/textures/block/raw_lead_block.png new file mode 100644 index 0000000..7b488df Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/raw_lead_block.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/raw_silver_block.png b/src/main/resources/assets/eidolon/textures/block/raw_silver_block.png new file mode 100644 index 0000000..0073e16 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/raw_silver_block.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/research_table_bottom.png b/src/main/resources/assets/eidolon/textures/block/research_table_bottom.png new file mode 100644 index 0000000..a18adf8 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/research_table_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/research_table_detail.png b/src/main/resources/assets/eidolon/textures/block/research_table_detail.png new file mode 100644 index 0000000..2181a51 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/research_table_detail.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/research_table_mid.png b/src/main/resources/assets/eidolon/textures/block/research_table_mid.png new file mode 100644 index 0000000..51dcfff Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/research_table_mid.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/research_table_side.png b/src/main/resources/assets/eidolon/textures/block/research_table_side.png new file mode 100644 index 0000000..4f7bf5a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/research_table_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/research_table_top.png b/src/main/resources/assets/eidolon/textures/block/research_table_top.png new file mode 100644 index 0000000..06e1b66 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/research_table_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/scriptorium_detail.png b/src/main/resources/assets/eidolon/textures/block/scriptorium_detail.png new file mode 100644 index 0000000..1d0f726 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/scriptorium_detail.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/scriptorium_legs.png b/src/main/resources/assets/eidolon/textures/block/scriptorium_legs.png new file mode 100644 index 0000000..756d5d9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/scriptorium_legs.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/scriptorium_top.png b/src/main/resources/assets/eidolon/textures/block/scriptorium_top.png new file mode 100644 index 0000000..e604857 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/scriptorium_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/shadow_gem_block.png b/src/main/resources/assets/eidolon/textures/block/shadow_gem_block.png new file mode 100644 index 0000000..4084fe8 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/shadow_gem_block.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/sildrian_seed_0.png b/src/main/resources/assets/eidolon/textures/block/sildrian_seed_0.png new file mode 100644 index 0000000..9808106 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/sildrian_seed_0.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/sildrian_seed_1.png b/src/main/resources/assets/eidolon/textures/block/sildrian_seed_1.png new file mode 100644 index 0000000..1754bff Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/sildrian_seed_1.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/silver_block.png b/src/main/resources/assets/eidolon/textures/block/silver_block.png new file mode 100644 index 0000000..ce9e02e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/silver_block.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/silver_ore.png b/src/main/resources/assets/eidolon/textures/block/silver_ore.png new file mode 100644 index 0000000..1e44cbc Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/silver_ore.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch.png b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch.png new file mode 100644 index 0000000..8536a36 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_bottom.png b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_bottom.png new file mode 100644 index 0000000..0c707f9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_bottom.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_mid.png b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_mid.png new file mode 100644 index 0000000..267d7f1 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_mid.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_top.png b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_top.png new file mode 100644 index 0000000..4e64a40 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/smooth_stone_arch_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/smooth_stone_masonry.png b/src/main/resources/assets/eidolon/textures/block/smooth_stone_masonry.png new file mode 100644 index 0000000..c1d5efb Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/smooth_stone_masonry.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/stripped_illwood_log.png b/src/main/resources/assets/eidolon/textures/block/stripped_illwood_log.png new file mode 100644 index 0000000..9f1e5ef Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/stripped_illwood_log.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/stripped_illwood_log_top.png b/src/main/resources/assets/eidolon/textures/block/stripped_illwood_log_top.png new file mode 100644 index 0000000..a90f2e9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/stripped_illwood_log_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/vapor.png b/src/main/resources/assets/eidolon/textures/block/vapor.png new file mode 100644 index 0000000..f4971e3 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/block/vapor.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/vapor.png.mcmeta b/src/main/resources/assets/eidolon/textures/block/vapor.png.mcmeta new file mode 100644 index 0000000..1c15072 --- /dev/null +++ b/src/main/resources/assets/eidolon/textures/block/vapor.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "interpolate": true, + "frametime": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/eidolon/textures/block/worktable_side.png b/src/main/resources/assets/eidolon/textures/block/worktable_side.png index f464f4c..303089e 100644 Binary files a/src/main/resources/assets/eidolon/textures/block/worktable_side.png and b/src/main/resources/assets/eidolon/textures/block/worktable_side.png differ diff --git a/src/main/resources/assets/eidolon/textures/block/worktable_top.png b/src/main/resources/assets/eidolon/textures/block/worktable_top.png index ec6b6be..7d096e7 100644 Binary files a/src/main/resources/assets/eidolon/textures/block/worktable_top.png and b/src/main/resources/assets/eidolon/textures/block/worktable_top.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/banana_slug.png b/src/main/resources/assets/eidolon/textures/entity/banana_slug.png new file mode 100644 index 0000000..1ab13c9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/banana_slug.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/bonelord_armor.png b/src/main/resources/assets/eidolon/textures/entity/bonelord_armor.png new file mode 100644 index 0000000..409b91f Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/bonelord_armor.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/brown_slug.png b/src/main/resources/assets/eidolon/textures/entity/brown_slug.png new file mode 100644 index 0000000..5a36a2e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/brown_slug.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/giant_skeleton.png b/src/main/resources/assets/eidolon/textures/entity/giant_skeleton.png new file mode 100644 index 0000000..7d5b17b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/giant_skeleton.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/necromancer_eyes.png b/src/main/resources/assets/eidolon/textures/entity/necromancer_eyes.png index 48b20ac..3f01aa6 100644 Binary files a/src/main/resources/assets/eidolon/textures/entity/necromancer_eyes.png and b/src/main/resources/assets/eidolon/textures/entity/necromancer_eyes.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/raven.png b/src/main/resources/assets/eidolon/textures/entity/raven.png new file mode 100644 index 0000000..5683bb1 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/raven.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/raven_cloak.png b/src/main/resources/assets/eidolon/textures/entity/raven_cloak.png new file mode 100644 index 0000000..8f79da4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/raven_cloak.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/shattered_soul.png b/src/main/resources/assets/eidolon/textures/entity/shattered_soul.png new file mode 100644 index 0000000..425c957 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/shattered_soul.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/silver_armor.png b/src/main/resources/assets/eidolon/textures/entity/silver_armor.png new file mode 100644 index 0000000..7887d2b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/silver_armor.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/slimy_slug.png b/src/main/resources/assets/eidolon/textures/entity/slimy_slug.png new file mode 100644 index 0000000..e6a4289 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/slimy_slug.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/tall_archive_doors.png b/src/main/resources/assets/eidolon/textures/entity/tall_archive_doors.png new file mode 100644 index 0000000..4b71729 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/tall_archive_doors.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/tranquil_soul.png b/src/main/resources/assets/eidolon/textures/entity/tranquil_soul.png new file mode 100644 index 0000000..0b59059 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/tranquil_soul.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/wight.png b/src/main/resources/assets/eidolon/textures/entity/wight.png new file mode 100644 index 0000000..a8d86f9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/entity/wight.png differ diff --git a/src/main/resources/assets/eidolon/textures/entity/zombie_brute.png b/src/main/resources/assets/eidolon/textures/entity/zombie_brute.png index 6eee2d1..bcbf85d 100644 Binary files a/src/main/resources/assets/eidolon/textures/entity/zombie_brute.png and b/src/main/resources/assets/eidolon/textures/entity/zombie_brute.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/codex_bg.png b/src/main/resources/assets/eidolon/textures/gui/codex_bg.png index f63da5e..4a9b8d8 100644 Binary files a/src/main/resources/assets/eidolon/textures/gui/codex_bg.png and b/src/main/resources/assets/eidolon/textures/gui/codex_bg.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/codex_crucible_page.png b/src/main/resources/assets/eidolon/textures/gui/codex_crucible_page.png index 0536f77..9646053 100644 Binary files a/src/main/resources/assets/eidolon/textures/gui/codex_crucible_page.png and b/src/main/resources/assets/eidolon/textures/gui/codex_crucible_page.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/codex_rune_index_page.png b/src/main/resources/assets/eidolon/textures/gui/codex_rune_index_page.png new file mode 100644 index 0000000..06a0444 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/gui/codex_rune_index_page.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/codex_rune_page.png b/src/main/resources/assets/eidolon/textures/gui/codex_rune_page.png new file mode 100644 index 0000000..3aec026 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/gui/codex_rune_page.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/icons.png b/src/main/resources/assets/eidolon/textures/gui/icons.png index 1bde526..988a842 100644 Binary files a/src/main/resources/assets/eidolon/textures/gui/icons.png and b/src/main/resources/assets/eidolon/textures/gui/icons.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/inscription_table.png b/src/main/resources/assets/eidolon/textures/gui/inscription_table.png new file mode 100644 index 0000000..750050c Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/gui/inscription_table.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/mana_bar.png b/src/main/resources/assets/eidolon/textures/gui/mana_bar.png new file mode 100644 index 0000000..f79f80b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/gui/mana_bar.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/research_table.png b/src/main/resources/assets/eidolon/textures/gui/research_table.png new file mode 100644 index 0000000..a44c3ba Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/gui/research_table.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/soul_enchanter.png b/src/main/resources/assets/eidolon/textures/gui/soul_enchanter.png index 7931657..45eef29 100644 Binary files a/src/main/resources/assets/eidolon/textures/gui/soul_enchanter.png and b/src/main/resources/assets/eidolon/textures/gui/soul_enchanter.png differ diff --git a/src/main/resources/assets/eidolon/textures/gui/worktable.png b/src/main/resources/assets/eidolon/textures/gui/worktable.png index 8bf768d..909502b 100644 Binary files a/src/main/resources/assets/eidolon/textures/gui/worktable.png and b/src/main/resources/assets/eidolon/textures/gui/worktable.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/alchemists_tongs.png b/src/main/resources/assets/eidolon/textures/item/alchemists_tongs.png new file mode 100644 index 0000000..60cfc04 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/alchemists_tongs.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/ancient_armor_plate.png b/src/main/resources/assets/eidolon/textures/item/ancient_armor_plate.png new file mode 100644 index 0000000..aa7da0c Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/ancient_armor_plate.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/ancient_metal_scrap.png b/src/main/resources/assets/eidolon/textures/item/ancient_metal_scrap.png new file mode 100644 index 0000000..fffeb13 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/ancient_metal_scrap.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/angels_sight.png b/src/main/resources/assets/eidolon/textures/item/angels_sight.png new file mode 100644 index 0000000..b9d332f Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/angels_sight.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/arcane_seal.png b/src/main/resources/assets/eidolon/textures/item/arcane_seal.png new file mode 100644 index 0000000..d09cd02 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/arcane_seal.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/athame.png b/src/main/resources/assets/eidolon/textures/item/athame.png new file mode 100644 index 0000000..6ce7512 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/athame.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/avennian_sprig.png b/src/main/resources/assets/eidolon/textures/item/avennian_sprig.png new file mode 100644 index 0000000..0b71fa4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/avennian_sprig.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/basic_ring.png b/src/main/resources/assets/eidolon/textures/item/basic_ring.png index b14063e..7dce387 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/basic_ring.png and b/src/main/resources/assets/eidolon/textures/item/basic_ring.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/bone_stake.png b/src/main/resources/assets/eidolon/textures/item/bone_stake.png new file mode 100644 index 0000000..549c7f6 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/bone_stake.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/bonelord_chestplate.png b/src/main/resources/assets/eidolon/textures/item/bonelord_chestplate.png new file mode 100644 index 0000000..002f9a3 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/bonelord_chestplate.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/bonelord_greaves.png b/src/main/resources/assets/eidolon/textures/item/bonelord_greaves.png new file mode 100644 index 0000000..1510556 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/bonelord_greaves.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/bonelord_helm.png b/src/main/resources/assets/eidolon/textures/item/bonelord_helm.png new file mode 100644 index 0000000..519c12e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/bonelord_helm.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/completed_research.png b/src/main/resources/assets/eidolon/textures/item/completed_research.png new file mode 100644 index 0000000..d2fc7b2 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/completed_research.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/deathbringer_scythe.png b/src/main/resources/assets/eidolon/textures/item/deathbringer_scythe.png new file mode 100644 index 0000000..c0ec619 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/deathbringer_scythe.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/ebon_wings.png b/src/main/resources/assets/eidolon/textures/item/ebon_wings.png new file mode 100644 index 0000000..07e0389 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/ebon_wings.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/elder_brick.png b/src/main/resources/assets/eidolon/textures/item/elder_brick.png new file mode 100644 index 0000000..9f33748 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/elder_brick.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/enervating_ring.png b/src/main/resources/assets/eidolon/textures/item/enervating_ring.png index d29019b..c12d58f 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/enervating_ring.png and b/src/main/resources/assets/eidolon/textures/item/enervating_ring.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/essence_of_crimson.png b/src/main/resources/assets/eidolon/textures/item/essence_of_crimson.png index d2252a4..581e4e3 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/essence_of_crimson.png and b/src/main/resources/assets/eidolon/textures/item/essence_of_crimson.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/essence_of_death.png b/src/main/resources/assets/eidolon/textures/item/essence_of_death.png index 7134e13..a0cb3ff 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/essence_of_death.png and b/src/main/resources/assets/eidolon/textures/item/essence_of_death.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/giant_bone.png b/src/main/resources/assets/eidolon/textures/item/giant_bone.png new file mode 100644 index 0000000..994009e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/giant_bone.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/goblet.png b/src/main/resources/assets/eidolon/textures/item/goblet.png index bf7a706..8d3395a 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/goblet.png and b/src/main/resources/assets/eidolon/textures/item/goblet.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/grape_candy.png b/src/main/resources/assets/eidolon/textures/item/grape_candy.png new file mode 100644 index 0000000..097edaf Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/grape_candy.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/holy_symbol.png b/src/main/resources/assets/eidolon/textures/item/holy_symbol.png new file mode 100644 index 0000000..f1f80fa Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/holy_symbol.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/imbued_bones.png b/src/main/resources/assets/eidolon/textures/item/imbued_bones.png new file mode 100644 index 0000000..87e4fdb Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/imbued_bones.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/lead_ingot.png b/src/main/resources/assets/eidolon/textures/item/lead_ingot.png index 41a73ad..1d42729 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/lead_ingot.png and b/src/main/resources/assets/eidolon/textures/item/lead_ingot.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/lesser_soul_gem.png b/src/main/resources/assets/eidolon/textures/item/lesser_soul_gem.png index e26bded..a9e5185 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/lesser_soul_gem.png and b/src/main/resources/assets/eidolon/textures/item/lesser_soul_gem.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/magic_candle.png b/src/main/resources/assets/eidolon/textures/item/magic_candle.png new file mode 100644 index 0000000..dae7698 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/magic_candle.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/magic_candlestick.png b/src/main/resources/assets/eidolon/textures/item/magic_candlestick.png new file mode 100644 index 0000000..f508fc2 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/magic_candlestick.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/magic_ink.png b/src/main/resources/assets/eidolon/textures/item/magic_ink.png new file mode 100644 index 0000000..7471c40 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/magic_ink.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/magicians_wax.png b/src/main/resources/assets/eidolon/textures/item/magicians_wax.png new file mode 100644 index 0000000..d6bd50b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/magicians_wax.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/merammer_resin.png b/src/main/resources/assets/eidolon/textures/item/merammer_resin.png new file mode 100644 index 0000000..74e2e17 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/merammer_resin.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/merammer_root.png b/src/main/resources/assets/eidolon/textures/item/merammer_root.png new file mode 100644 index 0000000..a4e92a0 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/merammer_root.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/notetaking_tools.png b/src/main/resources/assets/eidolon/textures/item/notetaking_tools.png new file mode 100644 index 0000000..81e5654 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/notetaking_tools.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/oanna_bloom.png b/src/main/resources/assets/eidolon/textures/item/oanna_bloom.png new file mode 100644 index 0000000..3ed4934 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/oanna_bloom.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/parchment.png b/src/main/resources/assets/eidolon/textures/item/parchment.png new file mode 100644 index 0000000..9081ad9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/parchment.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/pewter_ingot.png b/src/main/resources/assets/eidolon/textures/item/pewter_ingot.png index e1cf45e..1e63be3 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/pewter_ingot.png and b/src/main/resources/assets/eidolon/textures/item/pewter_ingot.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/pewter_nugget.png b/src/main/resources/assets/eidolon/textures/item/pewter_nugget.png index abe6f7f..2ffe1b9 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/pewter_nugget.png and b/src/main/resources/assets/eidolon/textures/item/pewter_nugget.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/raven_cloak.png b/src/main/resources/assets/eidolon/textures/item/raven_cloak.png new file mode 100644 index 0000000..465fe05 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/raven_cloak.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/raven_feather.png b/src/main/resources/assets/eidolon/textures/item/raven_feather.png index 24c4b47..7242592 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/raven_feather.png and b/src/main/resources/assets/eidolon/textures/item/raven_feather.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/raven_wings.png b/src/main/resources/assets/eidolon/textures/item/raven_wings.png new file mode 100644 index 0000000..8349053 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/raven_wings.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/raw_lead.png b/src/main/resources/assets/eidolon/textures/item/raw_lead.png new file mode 100644 index 0000000..a140d8e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/raw_lead.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/raw_silver.png b/src/main/resources/assets/eidolon/textures/item/raw_silver.png new file mode 100644 index 0000000..f116579 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/raw_silver.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/red_candy.png b/src/main/resources/assets/eidolon/textures/item/red_candy.png new file mode 100644 index 0000000..5b8178e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/red_candy.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/refined_crimson.png b/src/main/resources/assets/eidolon/textures/item/refined_crimson.png index 8398b39..581e4e3 100644 Binary files a/src/main/resources/assets/eidolon/textures/item/refined_crimson.png and b/src/main/resources/assets/eidolon/textures/item/refined_crimson.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/research_notes.png b/src/main/resources/assets/eidolon/textures/item/research_notes.png new file mode 100644 index 0000000..42c83b7 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/research_notes.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/sildrian_seed.png b/src/main/resources/assets/eidolon/textures/item/sildrian_seed.png new file mode 100644 index 0000000..9297df7 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/sildrian_seed.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_axe.png b/src/main/resources/assets/eidolon/textures/item/silver_axe.png new file mode 100644 index 0000000..6d7cbdd Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_axe.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_boots.png b/src/main/resources/assets/eidolon/textures/item/silver_boots.png new file mode 100644 index 0000000..5525582 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_boots.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_chestplate.png b/src/main/resources/assets/eidolon/textures/item/silver_chestplate.png new file mode 100644 index 0000000..f8d34e2 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_chestplate.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_helmet.png b/src/main/resources/assets/eidolon/textures/item/silver_helmet.png new file mode 100644 index 0000000..c82b00f Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_helmet.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_hoe.png b/src/main/resources/assets/eidolon/textures/item/silver_hoe.png new file mode 100644 index 0000000..b6bc4fd Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_hoe.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_ingot.png b/src/main/resources/assets/eidolon/textures/item/silver_ingot.png new file mode 100644 index 0000000..5a33588 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_ingot.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_leggings.png b/src/main/resources/assets/eidolon/textures/item/silver_leggings.png new file mode 100644 index 0000000..3bcc1f2 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_leggings.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_nugget.png b/src/main/resources/assets/eidolon/textures/item/silver_nugget.png new file mode 100644 index 0000000..4ecfccd Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_nugget.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_pickaxe.png b/src/main/resources/assets/eidolon/textures/item/silver_pickaxe.png new file mode 100644 index 0000000..180c34b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_pickaxe.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_shovel.png b/src/main/resources/assets/eidolon/textures/item/silver_shovel.png new file mode 100644 index 0000000..786011b Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_shovel.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/silver_sword.png b/src/main/resources/assets/eidolon/textures/item/silver_sword.png new file mode 100644 index 0000000..3619509 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/silver_sword.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/soulbone_amulet.png b/src/main/resources/assets/eidolon/textures/item/soulbone_amulet.png new file mode 100644 index 0000000..34425db Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/soulbone_amulet.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/summoning_staff.png b/src/main/resources/assets/eidolon/textures/item/summoning_staff.png new file mode 100644 index 0000000..5ef7b7e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/summoning_staff.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/terminus_mirror.png b/src/main/resources/assets/eidolon/textures/item/terminus_mirror.png new file mode 100644 index 0000000..85cd1f0 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/terminus_mirror.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/unholy_symbol_base.png b/src/main/resources/assets/eidolon/textures/item/unholy_symbol_base.png new file mode 100644 index 0000000..382686d Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/unholy_symbol_base.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/warping_mail.png b/src/main/resources/assets/eidolon/textures/item/warping_mail.png new file mode 100644 index 0000000..c87f5eb Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/warping_mail.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/withered_heart.png b/src/main/resources/assets/eidolon/textures/item/withered_heart.png new file mode 100644 index 0000000..0e3ae0a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/withered_heart.png differ diff --git a/src/main/resources/assets/eidolon/textures/item/wooden_stake.png b/src/main/resources/assets/eidolon/textures/item/wooden_stake.png new file mode 100644 index 0000000..82ae9e3 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/item/wooden_stake.png differ diff --git a/src/main/resources/assets/eidolon/textures/mob_effect/reinforced.png b/src/main/resources/assets/eidolon/textures/mob_effect/reinforced.png new file mode 100644 index 0000000..d3a829d Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/mob_effect/reinforced.png differ diff --git a/src/main/resources/assets/eidolon/textures/mob_effect/undeath.png b/src/main/resources/assets/eidolon/textures/mob_effect/undeath.png new file mode 100644 index 0000000..1413465 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/mob_effect/undeath.png differ diff --git a/src/main/resources/assets/eidolon/textures/mob_effect/vulnerable.png b/src/main/resources/assets/eidolon/textures/mob_effect/vulnerable.png new file mode 100644 index 0000000..426f491 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/mob_effect/vulnerable.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/absorption_ritual.png b/src/main/resources/assets/eidolon/textures/particle/absorption_ritual.png new file mode 100644 index 0000000..500e3f0 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/absorption_ritual.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/aura.png b/src/main/resources/assets/eidolon/textures/particle/aura.png new file mode 100644 index 0000000..08ac11d Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/aura.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/basic_ring.png b/src/main/resources/assets/eidolon/textures/particle/basic_ring.png deleted file mode 100644 index c805d11..0000000 Binary files a/src/main/resources/assets/eidolon/textures/particle/basic_ring.png and /dev/null differ diff --git a/src/main/resources/assets/eidolon/textures/particle/beam.png b/src/main/resources/assets/eidolon/textures/particle/beam.png new file mode 100644 index 0000000..282c13f Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/beam.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/bubble.png b/src/main/resources/assets/eidolon/textures/particle/bubble.png index 3c4c4cd..6c548e6 100644 Binary files a/src/main/resources/assets/eidolon/textures/particle/bubble.png and b/src/main/resources/assets/eidolon/textures/particle/bubble.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/burst.png b/src/main/resources/assets/eidolon/textures/particle/burst.png index 990356f..fe6e417 100644 Binary files a/src/main/resources/assets/eidolon/textures/particle/burst.png and b/src/main/resources/assets/eidolon/textures/particle/burst.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/death_sign.png b/src/main/resources/assets/eidolon/textures/particle/death_sign.png new file mode 100644 index 0000000..500e3f0 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/death_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/eye.png b/src/main/resources/assets/eidolon/textures/particle/eye.png new file mode 100644 index 0000000..b411c1e Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/eye.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/feather.png b/src/main/resources/assets/eidolon/textures/particle/feather.png new file mode 100644 index 0000000..c8359a9 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/feather.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/flame_sign.png b/src/main/resources/assets/eidolon/textures/particle/flame_sign.png new file mode 100644 index 0000000..fad0328 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/flame_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/harmony_sign.png b/src/main/resources/assets/eidolon/textures/particle/harmony_sign.png new file mode 100644 index 0000000..d18dbd4 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/harmony_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/magic_sign.png b/src/main/resources/assets/eidolon/textures/particle/magic_sign.png new file mode 100644 index 0000000..c75d119 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/magic_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/mind_sign.png b/src/main/resources/assets/eidolon/textures/particle/mind_sign.png index 5c80bd5..691c8d7 100644 Binary files a/src/main/resources/assets/eidolon/textures/particle/mind_sign.png and b/src/main/resources/assets/eidolon/textures/particle/mind_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/recharge_ritual.png b/src/main/resources/assets/eidolon/textures/particle/recharge_ritual.png new file mode 100644 index 0000000..1931fa7 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/recharge_ritual.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/ring.png b/src/main/resources/assets/eidolon/textures/particle/ring.png new file mode 100644 index 0000000..c28eb92 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/ring.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/warding_sign.png b/src/main/resources/assets/eidolon/textures/particle/warding_sign.png index 5a77a8a..4d7b93c 100644 Binary files a/src/main/resources/assets/eidolon/textures/particle/warding_sign.png and b/src/main/resources/assets/eidolon/textures/particle/warding_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/particle/winter_sign.png b/src/main/resources/assets/eidolon/textures/particle/winter_sign.png new file mode 100644 index 0000000..cbc2925 Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/particle/winter_sign.png differ diff --git a/src/main/resources/assets/eidolon/textures/rune/crimson_rose.png b/src/main/resources/assets/eidolon/textures/rune/crimson_rose.png new file mode 100644 index 0000000..db7fa8a Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/rune/crimson_rose.png differ diff --git a/src/main/resources/assets/eidolon/textures/rune/sin.png b/src/main/resources/assets/eidolon/textures/rune/sin.png new file mode 100644 index 0000000..6b90bbd Binary files /dev/null and b/src/main/resources/assets/eidolon/textures/rune/sin.png differ diff --git a/src/main/resources/data/curios/tags/items/body.json b/src/main/resources/data/curios/tags/items/body.json index d9b8239..b03c63d 100644 --- a/src/main/resources/data/curios/tags/items/body.json +++ b/src/main/resources/data/curios/tags/items/body.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:warded_mail" + "eidolon:warded_mail", + "eidolon:raven_cloak" ] } \ No newline at end of file diff --git a/src/main/resources/data/curios/tags/items/necklace.json b/src/main/resources/data/curios/tags/items/necklace.json index 94f0136..19e0156 100644 --- a/src/main/resources/data/curios/tags/items/necklace.json +++ b/src/main/resources/data/curios/tags/items/necklace.json @@ -4,6 +4,8 @@ "eidolon:basic_amulet", "eidolon:sanguine_amulet", "eidolon:void_amulet", - "eidolon:glass_hand" + "eidolon:glass_hand", + "eidolon:terminus_mirror", + "eidolon:soulbone_amulet" ] } \ No newline at end of file diff --git a/src/main/resources/data/curios/tags/items/ring.json b/src/main/resources/data/curios/tags/items/ring.json index 2c59bf6..ada5b46 100644 --- a/src/main/resources/data/curios/tags/items/ring.json +++ b/src/main/resources/data/curios/tags/items/ring.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:basic_ring" + "eidolon:basic_ring", + "eidolon:angels_sight" ] } \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/avennian_sprig.json b/src/main/resources/data/eidolon/loot_tables/blocks/avennian_sprig.json new file mode 100644 index 0000000..e3b0937 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/avennian_sprig.json @@ -0,0 +1,43 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:avennian_sprig" + } + ] + }, + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.5 + } + ], + "name": "eidolon:avennian_sprig" + } + ], + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:avennian_sprig", + "properties": { + "age": "1" + } + } + ] + } + ], + "functions": [ + { + "function": "minecraft:explosion_decay" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/deep_lead_ore.json b/src/main/resources/data/eidolon/loot_tables/blocks/deep_lead_ore.json new file mode 100644 index 0000000..c1a232b --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/deep_lead_ore.json @@ -0,0 +1,49 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "eidolon:deep_lead_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "eidolon:raw_lead" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/deep_silver_ore.json b/src/main/resources/data/eidolon/loot_tables/blocks/deep_silver_ore.json new file mode 100644 index 0000000..0790f66 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/deep_silver_ore.json @@ -0,0 +1,49 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "eidolon:deep_silver_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "eidolon:raw_silver" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/lead_ore.json b/src/main/resources/data/eidolon/loot_tables/blocks/lead_ore.json index 12780c7..3e75104 100644 --- a/src/main/resources/data/eidolon/loot_tables/blocks/lead_ore.json +++ b/src/main/resources/data/eidolon/loot_tables/blocks/lead_ore.json @@ -2,16 +2,46 @@ "type": "minecraft:block", "pools": [ { - "rolls": 1, + "rolls": 1.0, + "bonus_rolls": 0.0, "entries": [ { - "type": "minecraft:item", - "name": "eidolon:lead_ore" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "eidolon:lead_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "eidolon:raw_lead" + } + ] } ] } diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/magic_candle.json b/src/main/resources/data/eidolon/loot_tables/blocks/magic_candle.json new file mode 100644 index 0000000..f4b5c1c --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/magic_candle.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:magic_candle" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/magic_candlestick.json b/src/main/resources/data/eidolon/loot_tables/blocks/magic_candlestick.json new file mode 100644 index 0000000..74a41da --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/magic_candlestick.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:magic_candlestick" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/merammer_root.json b/src/main/resources/data/eidolon/loot_tables/blocks/merammer_root.json new file mode 100644 index 0000000..fe11b42 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/merammer_root.json @@ -0,0 +1,43 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:merammer_root" + } + ] + }, + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.5 + } + ], + "name": "eidolon:merammer_root" + } + ], + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:merammer_root", + "properties": { + "age": "1" + } + } + ] + } + ], + "functions": [ + { + "function": "minecraft:explosion_decay" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/oanna_bloom.json b/src/main/resources/data/eidolon/loot_tables/blocks/oanna_bloom.json new file mode 100644 index 0000000..cf1e351 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/oanna_bloom.json @@ -0,0 +1,43 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:oanna_bloom" + } + ] + }, + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.5 + } + ], + "name": "eidolon:oanna_bloom" + } + ], + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:oanna_bloom", + "properties": { + "age": "1" + } + } + ] + } + ], + "functions": [ + { + "function": "minecraft:explosion_decay" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/obelisk.json b/src/main/resources/data/eidolon/loot_tables/blocks/obelisk.json new file mode 100644 index 0000000..5a070b8 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/obelisk.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:obelisk" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/planter.json b/src/main/resources/data/eidolon/loot_tables/blocks/planter.json new file mode 100644 index 0000000..8345dae --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/planter.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:planter" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/polished_planks_slab.json b/src/main/resources/data/eidolon/loot_tables/blocks/polished_planks_slab.json index d1c5194..7ee862b 100644 --- a/src/main/resources/data/eidolon/loot_tables/blocks/polished_planks_slab.json +++ b/src/main/resources/data/eidolon/loot_tables/blocks/polished_planks_slab.json @@ -6,13 +6,26 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:set_count", + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:polished_planks_slab", + "properties": { + "type": "double" + } + } + ], + "count": 2 + }, + { + "function": "minecraft:explosion_decay" + } + ], "name": "eidolon:polished_planks_slab" } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } ] } ] diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/polished_wood_pillar.json b/src/main/resources/data/eidolon/loot_tables/blocks/polished_wood_pillar.json new file mode 100644 index 0000000..4013a4e --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/polished_wood_pillar.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:polished_wood_pillar" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/raw_lead_block.json b/src/main/resources/data/eidolon/loot_tables/blocks/raw_lead_block.json new file mode 100644 index 0000000..be640e6 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/raw_lead_block.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:raw_lead_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/raw_silver_block.json b/src/main/resources/data/eidolon/loot_tables/blocks/raw_silver_block.json new file mode 100644 index 0000000..fbb1551 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/raw_silver_block.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:raw_silver_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/research_table.json b/src/main/resources/data/eidolon/loot_tables/blocks/research_table.json new file mode 100644 index 0000000..1d673f7 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/research_table.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:research_table" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/shadow_gem_block.json b/src/main/resources/data/eidolon/loot_tables/blocks/shadow_gem_block.json new file mode 100644 index 0000000..83dbee7 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/shadow_gem_block.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:shadow_gem_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/sildrian_seed.json b/src/main/resources/data/eidolon/loot_tables/blocks/sildrian_seed.json new file mode 100644 index 0000000..2390fd9 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/sildrian_seed.json @@ -0,0 +1,43 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:sildrian_seed" + } + ] + }, + { + "rolls": 1.0, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.5 + } + ], + "name": "eidolon:sildrian_seed" + } + ], + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:sildrian_seed", + "properties": { + "age": "1" + } + } + ] + } + ], + "functions": [ + { + "function": "minecraft:explosion_decay" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/silver_block.json b/src/main/resources/data/eidolon/loot_tables/blocks/silver_block.json new file mode 100644 index 0000000..202dd45 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/silver_block.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "eidolon:silver_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/silver_ore.json b/src/main/resources/data/eidolon/loot_tables/blocks/silver_ore.json new file mode 100644 index 0000000..18197d1 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/blocks/silver_ore.json @@ -0,0 +1,49 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "eidolon:silver_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "eidolon:raw_silver" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_bricks_slab.json b/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_bricks_slab.json index 22473c8..9d5437f 100644 --- a/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_bricks_slab.json +++ b/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_bricks_slab.json @@ -6,13 +6,26 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:set_count", + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:smooth_stone_bricks_slab", + "properties": { + "type": "double" + } + } + ], + "count": 2 + }, + { + "function": "minecraft:explosion_decay" + } + ], "name": "eidolon:smooth_stone_bricks_slab" } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } ] } ] diff --git a/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_tiles_slab.json b/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_tiles_slab.json index 727b7b6..59e54ef 100644 --- a/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_tiles_slab.json +++ b/src/main/resources/data/eidolon/loot_tables/blocks/smooth_stone_tiles_slab.json @@ -6,13 +6,26 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:set_count", + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "eidolon:smooth_stone_tiles_slab", + "properties": { + "type": "double" + } + } + ], + "count": 2 + }, + { + "function": "minecraft:explosion_decay" + } + ], "name": "eidolon:smooth_stone_tiles_slab" } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } ] } ] diff --git a/src/main/resources/data/eidolon/loot_tables/entities/raven.json b/src/main/resources/data/eidolon/loot_tables/entities/raven.json new file mode 100644 index 0000000..7496d97 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/entities/raven.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 0.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:looting_enchant", + "count": { + "min": 0.0, + "max": 1.0 + } + } + ], + "name": "eidolon:raven_feather" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/loot_tables/entities/slimy_slug.json b/src/main/resources/data/eidolon/loot_tables/entities/slimy_slug.json new file mode 100644 index 0000000..e16ab06 --- /dev/null +++ b/src/main/resources/data/eidolon/loot_tables/entities/slimy_slug.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 0.0, + "max": 1.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:looting_enchant", + "count": { + "min": 0.0, + "max": 1.0 + } + } + ], + "name": "minecraft:slime_ball" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/arcane_gold_block.json b/src/main/resources/data/eidolon/recipes/arcane_gold_block.json index bd3a752..4a4826c 100644 --- a/src/main/resources/data/eidolon/recipes/arcane_gold_block.json +++ b/src/main/resources/data/eidolon/recipes/arcane_gold_block.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:arcane_gold_ingot" + "tag": "forge:ingots/arcane_gold" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/arcane_gold_ingot.json b/src/main/resources/data/eidolon/recipes/arcane_gold_ingot.json index 072f538..60c2b9e 100644 --- a/src/main/resources/data/eidolon/recipes/arcane_gold_ingot.json +++ b/src/main/resources/data/eidolon/recipes/arcane_gold_ingot.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:arcane_gold_nugget" + "tag": "forge:nuggets/arcane_gold" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/arcane_gold_ingot_alchemy.json b/src/main/resources/data/eidolon/recipes/arcane_gold_ingot_alchemy.json new file mode 100644 index 0000000..a3fb662 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/arcane_gold_ingot_alchemy.json @@ -0,0 +1,22 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:dusts/redstone" }, + { "tag": "forge:dusts/redstone" }, + { "item": "eidolon:soul_shard" } + ] + }, + { + "items": [ + { "tag": "forge:ingots/gold" }, + { "tag": "forge:ingots/gold" } + ] + } + ], + "result": { + "item": "eidolon:arcane_gold_ingot", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/arcane_seal.json b/src/main/resources/data/eidolon/recipes/arcane_seal.json new file mode 100644 index 0000000..3a6345d --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/arcane_seal.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + " w ", + "www", + " w " + ], + "key": { + "w": { + "item": "eidolon:magicians_wax" + } + }, + "result": { + "item": "eidolon:arcane_seal", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/athame.json b/src/main/resources/data/eidolon/recipes/athame.json new file mode 100644 index 0000000..d48e6af --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/athame.json @@ -0,0 +1,29 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " p", + " s ", + "e " + ], + "reagents": "n d ", + "key": { + "p": { + "tag": "forge:ingots/pewter" + }, + "s": { + "item": "eidolon:pewter_inlay" + }, + "e": { + "tag": "forge:ender_pearls" + }, + "n": { + "tag": "forge:nuggets/gold" + }, + "d": { + "tag": "forge:nuggets/silver" + } + }, + "result": { + "item": "eidolon:athame" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/basic_amulet.json b/src/main/resources/data/eidolon/recipes/basic_amulet.json index 7166000..efcc18e 100644 --- a/src/main/resources/data/eidolon/recipes/basic_amulet.json +++ b/src/main/resources/data/eidolon/recipes/basic_amulet.json @@ -11,7 +11,7 @@ "item": "minecraft:string" }, "y": { - "item": "eidolon:arcane_gold_ingot" + "tag": "forge:ingots/arcane_gold" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/basic_ring.json b/src/main/resources/data/eidolon/recipes/basic_ring.json index e63ce40..f1b89c4 100644 --- a/src/main/resources/data/eidolon/recipes/basic_ring.json +++ b/src/main/resources/data/eidolon/recipes/basic_ring.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:arcane_gold_ingot" + "tag": "forge:ingots/arcane_gold" }, "y": { "item": "eidolon:soul_shard" diff --git a/src/main/resources/data/eidolon/recipes/beef_to_flesh.json b/src/main/resources/data/eidolon/recipes/beef_to_flesh.json new file mode 100644 index 0000000..b4c9664 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/beef_to_flesh.json @@ -0,0 +1,14 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:mushrooms" }, + { "item": "minecraft:beef" } + ] + } + ], + "result": { + "item": "minecraft:rotten_flesh" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/blast_raw_lead.json b/src/main/resources/data/eidolon/recipes/blast_raw_lead.json new file mode 100644 index 0000000..d245189 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/blast_raw_lead.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:blasting", + "ingredient": { + "item": "eidolon:raw_lead" + }, + "result": "eidolon:lead_ingot", + "experience": 0.5, + "cookingtime": 100 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/blast_raw_silver.json b/src/main/resources/data/eidolon/recipes/blast_raw_silver.json new file mode 100644 index 0000000..5f34363 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/blast_raw_silver.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:blasting", + "ingredient": { + "item": "eidolon:raw_silver" + }, + "result": "eidolon:silver_ingot", + "experience": 0.5, + "cookingtime": 100 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/blast_silver_dust.json b/src/main/resources/data/eidolon/recipes/blast_silver_dust.json new file mode 100644 index 0000000..fc053dc --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/blast_silver_dust.json @@ -0,0 +1,25 @@ +{ + "type": "forge:conditional", + "recipes": [ + { + "conditions": [ + { + "value": { + "tag": "forge:dusts/silver", + "type": "forge:tag_empty" + }, + "type": "forge:not" + } + ], + "recipe": { + "type": "minecraft:blasting", + "ingredient": { + "tag": "forge:dusts/silver" + }, + "result": "eidolon:silver_ingot", + "experience": 0.5, + "cookingtime": 100 + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/blast_silver_ore.json b/src/main/resources/data/eidolon/recipes/blast_silver_ore.json new file mode 100644 index 0000000..debfc17 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/blast_silver_ore.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:blasting", + "ingredient": { + "tag": "forge:ores/silver" + }, + "result": "eidolon:silver_ingot", + "experience": 0.5, + "cookingtime": 100 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/bonechill_wand.json b/src/main/resources/data/eidolon/recipes/bonechill_wand.json new file mode 100644 index 0000000..6cf507c --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/bonechill_wand.json @@ -0,0 +1,32 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " px", + " sp", + "i " + ], + "reagents": "lbbb", + "key": { + "i": { + "item": "eidolon:pewter_inlay" + }, + "p": { + "tag": "forge:ingots/pewter" + }, + "s": { + "tag": "forge:rods/wooden" + }, + "x": { + "item": "eidolon:wraith_heart" + }, + "b": { + "item": "minecraft:bone_meal" + }, + "l": { + "item": "eidolon:lesser_soul_gem" + } + }, + "result": { + "item": "eidolon:bonechill_wand" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/brazier.json b/src/main/resources/data/eidolon/recipes/brazier.json index 21ed4a4..a0af542 100644 --- a/src/main/resources/data/eidolon/recipes/brazier.json +++ b/src/main/resources/data/eidolon/recipes/brazier.json @@ -8,13 +8,13 @@ ], "key": { "x": { - "item": "eidolon:pewter_ingot" + "tag": "forge:ingots/pewter" }, "y": { "tag": "forge:storage_blocks/coal" }, "z": { - "item": "minecraft:stick" + "tag": "forge:rods/wooden" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/candle.json b/src/main/resources/data/eidolon/recipes/candle.json index d23180c..7c2a2eb 100644 --- a/src/main/resources/data/eidolon/recipes/candle.json +++ b/src/main/resources/data/eidolon/recipes/candle.json @@ -10,7 +10,7 @@ "tag": "forge:string" }, "t": { - "item": "eidolon:tallow" + "tag": "forge:tallow" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/chicken_to_flesh.json b/src/main/resources/data/eidolon/recipes/chicken_to_flesh.json new file mode 100644 index 0000000..732f4bc --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/chicken_to_flesh.json @@ -0,0 +1,14 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:mushrooms" }, + { "item": "minecraft:chicken" } + ] + } + ], + "result": { + "item": "minecraft:rotten_flesh" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/cleaving_axe.json b/src/main/resources/data/eidolon/recipes/cleaving_axe.json new file mode 100644 index 0000000..7233d91 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/cleaving_axe.json @@ -0,0 +1,26 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "pp ", + "ps ", + " s " + ], + "reagents": "u i ", + "key": { + "p": { + "tag": "forge:ingots/pewter" + }, + "u": { + "item": "eidolon:unholy_symbol" + }, + "i": { + "item": "eidolon:pewter_inlay" + }, + "s": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:cleaving_axe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/crimson_essence_fungus.json b/src/main/resources/data/eidolon/recipes/crimson_essence_fungus.json new file mode 100644 index 0000000..5320486 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/crimson_essence_fungus.json @@ -0,0 +1,21 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:crimson_fungus" }, + { "item": "minecraft:nether_wart" } + ] + }, + { + "stirs": 1, + "items": [ + { "tag": "forge:dusts/sulfur" } + ] + } + ], + "result": { + "item": "eidolon:crimson_essence", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/crimson_essence_roots.json b/src/main/resources/data/eidolon/recipes/crimson_essence_roots.json new file mode 100644 index 0000000..d1d1f91 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/crimson_essence_roots.json @@ -0,0 +1,21 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:crimson_roots" }, + { "item": "minecraft:nether_wart" } + ] + }, + { + "stirs": 1, + "items": [ + { "tag": "forge:dusts/sulfur" } + ] + } + ], + "result": { + "item": "eidolon:crimson_essence", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/crimson_essence_vines.json b/src/main/resources/data/eidolon/recipes/crimson_essence_vines.json new file mode 100644 index 0000000..777ab07 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/crimson_essence_vines.json @@ -0,0 +1,21 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:weeping_vines" }, + { "item": "minecraft:nether_wart" } + ] + }, + { + "stirs": 1, + "items": [ + { "tag": "forge:dusts/sulfur" } + ] + } + ], + "result": { + "item": "eidolon:crimson_essence", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/death_essence.json b/src/main/resources/data/eidolon/recipes/death_essence.json new file mode 100644 index 0000000..5e96f45 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/death_essence.json @@ -0,0 +1,27 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "eidolon:zombie_heart" }, + { "item": "minecraft:rotten_flesh" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "minecraft:bone_meal" }, + { "item": "minecraft:bone_meal" } + ] + }, + { + "items": [ + { "item": "minecraft:charcoal" } + ] + } + ], + "result": { + "item": "eidolon:death_essence", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/death_essence_withered.json b/src/main/resources/data/eidolon/recipes/death_essence_withered.json new file mode 100644 index 0000000..5f8d564 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/death_essence_withered.json @@ -0,0 +1,27 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "eidolon:withered_heart" }, + { "item": "minecraft:rotten_flesh" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "minecraft:bone_meal" }, + { "item": "minecraft:bone_meal" } + ] + }, + { + "items": [ + { "item": "minecraft:charcoal" } + ] + } + ], + "result": { + "item": "eidolon:death_essence", + "count": 8 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/deathbringer_scythe.json b/src/main/resources/data/eidolon/recipes/deathbringer_scythe.json new file mode 100644 index 0000000..9bdad8f --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/deathbringer_scythe.json @@ -0,0 +1,33 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "bwb", + "brb", + "bsb" + ], + "reagents": "gege", + "key": { + "e": { + "item": "eidolon:death_essence" + }, + "b": { + "tag": "forge:bones" + }, + "r": { + "item": "eidolon:reaper_scythe" + }, + "s": { + "item": "minecraft:skeleton_skull" + }, + "g": { + "item": "eidolon:shadow_gem" + }, + "w": { + "item": "minecraft:wither_skeleton_skull" + } + + }, + "result": { + "item": "eidolon:deathbringer_scythe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_block.json b/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_block.json index 3a7346e..3abc763 100644 --- a/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_block.json +++ b/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_block.json @@ -3,7 +3,7 @@ "group": "eidolon", "ingredients": [ { - "item": "eidolon:arcane_gold_block" + "tag": "forge:storage_blocks/arcane_gold" } ], "result": { diff --git a/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_ingot.json b/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_ingot.json index 1e0cf1a..9b4e2f9 100644 --- a/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_ingot.json +++ b/src/main/resources/data/eidolon/recipes/decompress_arcane_gold_ingot.json @@ -3,7 +3,7 @@ "group": "eidolon", "ingredients": [ { - "item": "eidolon:arcane_gold_ingot" + "tag": "forge:ingots/arcane_gold" } ], "result": { diff --git a/src/main/resources/data/eidolon/recipes/decompress_pewter_block.json b/src/main/resources/data/eidolon/recipes/decompress_pewter_block.json index eb2b4b4..06e62c6 100644 --- a/src/main/resources/data/eidolon/recipes/decompress_pewter_block.json +++ b/src/main/resources/data/eidolon/recipes/decompress_pewter_block.json @@ -3,7 +3,7 @@ "group": "eidolon", "ingredients": [ { - "item": "eidolon:pewter_block" + "tag": "forge:storage_blocks/pewter" } ], "result": { diff --git a/src/main/resources/data/eidolon/recipes/decompress_pewter_ingot.json b/src/main/resources/data/eidolon/recipes/decompress_pewter_ingot.json index bad0168..126ceae 100644 --- a/src/main/resources/data/eidolon/recipes/decompress_pewter_ingot.json +++ b/src/main/resources/data/eidolon/recipes/decompress_pewter_ingot.json @@ -3,7 +3,7 @@ "group": "eidolon", "ingredients": [ { - "item": "eidolon:pewter_ingot" + "tag": "forge:ingots/pewter" } ], "result": { diff --git a/src/main/resources/data/eidolon/recipes/decompress_raw_lead_block.json b/src/main/resources/data/eidolon/recipes/decompress_raw_lead_block.json new file mode 100644 index 0000000..22e33c9 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/decompress_raw_lead_block.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "eidolon", + "ingredients": [ + { + "item": "eidolon:raw_lead_block" + } + ], + "result": { + "item": "eidolon:raw_lead", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/decompress_raw_silver_block.json b/src/main/resources/data/eidolon/recipes/decompress_raw_silver_block.json new file mode 100644 index 0000000..7d0f1a9 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/decompress_raw_silver_block.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "eidolon", + "ingredients": [ + { + "item": "eidolon:raw_silver_block" + } + ], + "result": { + "item": "eidolon:raw_silver", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/decompress_shadow_gem_block.json b/src/main/resources/data/eidolon/recipes/decompress_shadow_gem_block.json new file mode 100644 index 0000000..192c357 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/decompress_shadow_gem_block.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "eidolon", + "ingredients": [ + { + "tag": "forge:storage_blocks/shadow_gem" + } + ], + "result": { + "item": "eidolon:shadow_gem", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/decompress_silver_block.json b/src/main/resources/data/eidolon/recipes/decompress_silver_block.json new file mode 100644 index 0000000..2568d42 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/decompress_silver_block.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "eidolon", + "ingredients": [ + { + "tag": "forge:storage_blocks/silver" + } + ], + "result": { + "item": "eidolon:silver_ingot", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/decompress_silver_ingot.json b/src/main/resources/data/eidolon/recipes/decompress_silver_ingot.json new file mode 100644 index 0000000..1daaf32 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/decompress_silver_ingot.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "eidolon", + "ingredients": [ + { + "tag": "forge:ingots/silver" + } + ], + "result": { + "item": "eidolon:silver_nugget", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/enchanted_ash_from_block.json b/src/main/resources/data/eidolon/recipes/enchanted_ash_from_block.json new file mode 100644 index 0000000..447cb03 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/enchanted_ash_from_block.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:smelting", + "ingredient": { + "item": "minecraft:bone_block" + }, + "result": { + "item": "eidolon:enchanted_ash", + "count": 6 + }, + "experience": 0.1, + "cookingtime": 200 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/ender_calx.json b/src/main/resources/data/eidolon/recipes/ender_calx.json new file mode 100644 index 0000000..4a2ec01 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/ender_calx.json @@ -0,0 +1,15 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:ender_pearls" }, + { "item": "eidolon:enchanted_ash" } + ] + } + ], + "result": { + "item": "eidolon:ender_calx", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/flesh_to_leather.json b/src/main/resources/data/eidolon/recipes/flesh_to_leather.json new file mode 100644 index 0000000..2856f9a --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/flesh_to_leather.json @@ -0,0 +1,20 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "eidolon:enchanted_ash" }, + { "item": "eidolon:enchanted_ash" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "minecraft:rotten_flesh" } + ] + } + ], + "result": { + "item": "minecraft:leather" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/fungus_sprouts.json b/src/main/resources/data/eidolon/recipes/fungus_sprouts.json new file mode 100644 index 0000000..4046851 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/fungus_sprouts.json @@ -0,0 +1,25 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:mushrooms" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "minecraft:bone_meal" } + ] + }, + { + "items": [ + { "item": "minecraft:wheat_seeds" } + ] + } + ], + "result": { + "item": "eidolon:fungus_sprouts", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/gilding_apple.json b/src/main/resources/data/eidolon/recipes/gilding_apple.json new file mode 100644 index 0000000..548a32d --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/gilding_apple.json @@ -0,0 +1,25 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:ingots/gold" }, + { "tag": "forge:ingots/gold" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "eidolon:enchanted_ash" } + ] + }, + { + "items": [ + { "item": "minecraft:apple" } + ] + } + ], + "result": { + "item": "minecraft:golden_apple" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/gilding_carrot.json b/src/main/resources/data/eidolon/recipes/gilding_carrot.json new file mode 100644 index 0000000..0a1f363 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/gilding_carrot.json @@ -0,0 +1,25 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:nuggets/gold" }, + { "tag": "forge:nuggets/gold" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "eidolon:enchanted_ash" } + ] + }, + { + "items": [ + { "item": "minecraft:carrot" } + ] + } + ], + "result": { + "item": "minecraft:golden_carrot" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/gilding_melon.json b/src/main/resources/data/eidolon/recipes/gilding_melon.json new file mode 100644 index 0000000..d482170 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/gilding_melon.json @@ -0,0 +1,25 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:nuggets/gold" }, + { "tag": "forge:nuggets/gold" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "eidolon:enchanted_ash" } + ] + }, + { + "items": [ + { "item": "minecraft:melon_slice" } + ] + } + ], + "result": { + "item": "minecraft:glistering_melon_slice" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/glass_hand.json b/src/main/resources/data/eidolon/recipes/glass_hand.json new file mode 100644 index 0000000..a0c473d --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/glass_hand.json @@ -0,0 +1,32 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " d ", + " a ", + " g " + ], + "reagents": "hsws", + "key": { + "d": { + "tag": "forge:storage_blocks/diamond" + }, + "a": { + "item": "eidolon:basic_amulet" + }, + "g": { + "item": "minecraft:glass" + }, + "h": { + "item": "eidolon:zombie_heart" + }, + "s": { + "item": "eidolon:lesser_soul_gem" + }, + "w": { + "item": "eidolon:wraith_heart" + } + }, + "result": { + "item": "eidolon:glass_hand" + } + } \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/glowstone_dust.json b/src/main/resources/data/eidolon/recipes/glowstone_dust.json new file mode 100644 index 0000000..611d711 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/glowstone_dust.json @@ -0,0 +1,23 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:glow_berries" }, + { "item": "minecraft:glow_berries" }, + { "item": "minecraft:glow_berries" }, + { "item": "minecraft:glow_berries" } + ] + }, + { + "stirs": 2, + "items": [ + { "tag": "forge:dusts/sulfur" } + ] + } + ], + "result": { + "item": "minecraft:glowstone_dust", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/goblet.json b/src/main/resources/data/eidolon/recipes/goblet.json index 5b2a737..2cd0296 100644 --- a/src/main/resources/data/eidolon/recipes/goblet.json +++ b/src/main/resources/data/eidolon/recipes/goblet.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:arcane_gold_ingot" + "tag": "forge:ingots/arcane_gold" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/gold_inlay.json b/src/main/resources/data/eidolon/recipes/gold_inlay.json index 7c69c87..8338eb6 100644 --- a/src/main/resources/data/eidolon/recipes/gold_inlay.json +++ b/src/main/resources/data/eidolon/recipes/gold_inlay.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:arcane_gold_ingot" + "tag": "forge:ingots/arcane_gold" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/gravity_belt.json b/src/main/resources/data/eidolon/recipes/gravity_belt.json new file mode 100644 index 0000000..eb34182 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/gravity_belt.json @@ -0,0 +1,32 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " p ", + "fbf", + " l " + ], + "reagents": "cici", + "key": { + "f": { + "tag": "forge:feathers" + }, + "p": { + "tag": "forge:ender_pearls" + }, + "l": { + "item": "eidolon:lesser_soul_gem" + }, + "b": { + "item": "eidolon:basic_belt" + }, + "c": { + "item": "eidolon:ender_calx" + }, + "i": { + "item": "eidolon:pewter_inlay" + } + }, + "result": { + "item": "eidolon:gravity_belt" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/gunpowder_alchemy.json b/src/main/resources/data/eidolon/recipes/gunpowder_alchemy.json new file mode 100644 index 0000000..c5e0613 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/gunpowder_alchemy.json @@ -0,0 +1,21 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:dusts/sulfur" }, + { "item": "minecraft:bone_meal" } + ] + }, + { + "stirs": 1, + "items": [ + { "item": "minecraft:charcoal" } + ] + } + ], + "result": { + "item": "minecraft:gunpowder", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/lesser_soul_gem.json b/src/main/resources/data/eidolon/recipes/lesser_soul_gem.json new file mode 100644 index 0000000..fcf4937 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/lesser_soul_gem.json @@ -0,0 +1,30 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:dusts/redstone" }, + { "tag": "forge:dusts/redstone" }, + { "item": "minecraft:lapis_lazuli" }, + { "item": "minecraft:lapis_lazuli" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "eidolon:soul_shard" }, + { "item": "eidolon:soul_shard" }, + { "item": "eidolon:soul_shard" }, + { "item": "eidolon:soul_shard" } + ] + }, + { + "items": [ + { "tag": "forge:gems/quartz" } + ] + } + ], + "result": { + "item": "eidolon:lesser_soul_gem" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/magic_candle.json b/src/main/resources/data/eidolon/recipes/magic_candle.json new file mode 100644 index 0000000..ac8a362 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/magic_candle.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "s", + "t" + ], + "key": { + "s": { + "tag": "forge:string" + }, + "t": { + "item": "eidolon:magicians_wax" + } + }, + "result": { + "item": "eidolon:magic_candle", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/magic_candlestick.json b/src/main/resources/data/eidolon/recipes/magic_candlestick.json new file mode 100644 index 0000000..820a992 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/magic_candlestick.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "y", + "x", + "y" + ], + "key": { + "x": { + "item": "eidolon:magic_candle" + }, + "y": { + "item": "eidolon:arcane_gold_nugget" + } + }, + "result": { + "item": "eidolon:magic_candlestick", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/magic_ink.json b/src/main/resources/data/eidolon/recipes/magic_ink.json new file mode 100644 index 0000000..cf8cd66 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/magic_ink.json @@ -0,0 +1,34 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:dyes/black" }, + { "tag": "forge:dyes/black" }, + { "item": "minecraft:glow_ink_sac" } + ] + }, + { + "items": [ + { "tag": "forge:dyes/blue" } + ], + "stirs": 1 + }, + { + "items": [ + { "tag": "forge:nuggets/silver" }, + { "tag": "forge:nuggets/silver" } + ], + "stirs": 1 + }, + { + "items": [ + { "item": "minecraft:glass_bottle" } + ] + } + ], + "result": { + "item": "eidolon:magic_ink", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/magicians_wax.json b/src/main/resources/data/eidolon/recipes/magicians_wax.json new file mode 100644 index 0000000..2890d88 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/magicians_wax.json @@ -0,0 +1,31 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "eidolon:ender_calx" } + ] + }, + { + "items": [ + { "tag": "forge:dusts/redstone" }, + { "tag": "forge:dusts/redstone" }, + { "tag": "forge:dusts/redstone" }, + { "tag": "forge:dusts/redstone" }, + { "tag": "forge:dyes/red" }, + { "tag": "forge:dyes/red" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "eidolon:tallow" }, + { "item": "eidolon:tallow" } + ] + } + ], + "result": { + "item": "eidolon:magicians_wax", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/mind_shielding_plate.json b/src/main/resources/data/eidolon/recipes/mind_shielding_plate.json new file mode 100644 index 0000000..81e3d57 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/mind_shielding_plate.json @@ -0,0 +1,26 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "lll", + "lll", + "h h" + ], + "reagents": "b q ", + "key": { + "l": { + "tag": "forge:ingots/lead" + }, + "h": { + "item": "minecraft:leather" + }, + "b": { + "tag": "forge:storage_blocks/lapis" + }, + "q": { + "tag": "forge:gems/quartz" + } + }, + "result": { + "item": "eidolon:mind_shielding_plate" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/mutton_to_flesh.json b/src/main/resources/data/eidolon/recipes/mutton_to_flesh.json new file mode 100644 index 0000000..d4e01f7 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/mutton_to_flesh.json @@ -0,0 +1,14 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:mushrooms" }, + { "item": "minecraft:mutton" } + ] + } + ], + "result": { + "item": "minecraft:rotten_flesh" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/necrotic_focus.json b/src/main/resources/data/eidolon/recipes/necrotic_focus.json index 4d82a18..37c9478 100644 --- a/src/main/resources/data/eidolon/recipes/necrotic_focus.json +++ b/src/main/resources/data/eidolon/recipes/necrotic_focus.json @@ -11,7 +11,7 @@ "item": "minecraft:stone" }, "y": { - "item": "eidolon:pewter_ingot" + "tag": "forge:ingots/pewter" }, "z": { "item": "minecraft:bone" diff --git a/src/main/resources/data/eidolon/recipes/notetaking_tools.json b/src/main/resources/data/eidolon/recipes/notetaking_tools.json new file mode 100644 index 0000000..dfb5e67 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/notetaking_tools.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "eidolon", + "ingredients": [ + { + "item": "eidolon:parchment" + }, + { + "item": "eidolon:magic_ink" + }, + { + "tag": "forge:feathers" + }, + { + "tag": "forge:nuggets/arcane_gold" + } + ], + "result": { + "item": "eidolon:notetaking_tools" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/obelisk.json b/src/main/resources/data/eidolon/recipes/obelisk.json new file mode 100644 index 0000000..40559f0 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/obelisk.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + " x ", + "yyy", + "yyy" + ], + "key": { + "x": { + "item": "minecraft:chiseled_stone_bricks" + }, + "y": { + "item": "minecraft:stone" + } + }, + "result": { + "item": "eidolon:obelisk" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/parchment.json b/src/main/resources/data/eidolon/recipes/parchment.json new file mode 100644 index 0000000..ecd1280 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/parchment.json @@ -0,0 +1,28 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:leather" } + ] + }, + { + "stirs": 1 + }, + { + "stirs": 1 + }, + { + "items": [ + { "item": "minecraft:paper" }, + { "item": "minecraft:paper" }, + { "item": "minecraft:paper" }, + { "item": "eidolon:enchanted_ash" } + ] + } + ], + "result": { + "item": "eidolon:parchment", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/pewter_block.json b/src/main/resources/data/eidolon/recipes/pewter_block.json index 032312a..7d1af9d 100644 --- a/src/main/resources/data/eidolon/recipes/pewter_block.json +++ b/src/main/resources/data/eidolon/recipes/pewter_block.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:pewter_ingot" + "tag": "forge:ingots/pewter" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/pewter_ingot.json b/src/main/resources/data/eidolon/recipes/pewter_ingot.json index 2dc5f05..cad776c 100644 --- a/src/main/resources/data/eidolon/recipes/pewter_ingot.json +++ b/src/main/resources/data/eidolon/recipes/pewter_ingot.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:pewter_nugget" + "tag": "forge:nuggets/pewter" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/pewter_inlay.json b/src/main/resources/data/eidolon/recipes/pewter_inlay.json index c4d79fb..1c06489 100644 --- a/src/main/resources/data/eidolon/recipes/pewter_inlay.json +++ b/src/main/resources/data/eidolon/recipes/pewter_inlay.json @@ -8,7 +8,7 @@ ], "key": { "x": { - "item": "eidolon:pewter_ingot" + "tag": "forge:ingots/pewter" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/planter.json b/src/main/resources/data/eidolon/recipes/planter.json new file mode 100644 index 0000000..340480b --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/planter.json @@ -0,0 +1,32 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "ywy", + "zxz", + "z z" + ], + "reagents": "a s ", + "key": { + "x": { + "item": "eidolon:pewter_inlay" + }, + "y": { + "tag": "forge:ingots/pewter" + }, + "z": { + "tag": "minecraft:planks" + }, + "w": { + "item": "minecraft:dirt" + }, + "a": { + "item": "eidolon:enchanted_ash" + }, + "s": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:planter" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/polished_planks.json b/src/main/resources/data/eidolon/recipes/polished_planks.json new file mode 100644 index 0000000..cf70adc --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/polished_planks.json @@ -0,0 +1,28 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, + { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" }, { "tag": "minecraft:planks" } + ] + }, + { + "stirs": 1, + "items": [ + { "item": "eidolon:enchanted_ash" }, + { "item": "eidolon:soul_shard" } + ] + } + ], + "result": { + "item": "eidolon:polished_planks", + "count": 32 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/polished_planks_pillar.json b/src/main/resources/data/eidolon/recipes/polished_planks_pillar.json index 904466f..ffe3aac 100644 --- a/src/main/resources/data/eidolon/recipes/polished_planks_pillar.json +++ b/src/main/resources/data/eidolon/recipes/polished_planks_pillar.json @@ -2,19 +2,17 @@ "type": "minecraft:crafting_shaped", "group": "eidolon", "pattern": [ - "xyx", - "xyx" + "x", + "x", + "x" ], "key": { "x": { "item": "eidolon:polished_planks" - }, - "y": { - "item": "minecraft:stick" } }, "result": { - "item": "eidolon:polished_planks_fence", + "item": "eidolon:polished_wood_pillar", "count": 3 } } \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/polished_planks_stairs.json b/src/main/resources/data/eidolon/recipes/polished_planks_stairs.json index ffe3aac..8f9e7c2 100644 --- a/src/main/resources/data/eidolon/recipes/polished_planks_stairs.json +++ b/src/main/resources/data/eidolon/recipes/polished_planks_stairs.json @@ -2,9 +2,9 @@ "type": "minecraft:crafting_shaped", "group": "eidolon", "pattern": [ - "x", - "x", - "x" + "x ", + "xx ", + "xxx" ], "key": { "x": { @@ -12,7 +12,7 @@ } }, "result": { - "item": "eidolon:polished_wood_pillar", - "count": 3 + "item": "eidolon:polished_planks_stairs", + "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/pork_to_flesh.json b/src/main/resources/data/eidolon/recipes/pork_to_flesh.json new file mode 100644 index 0000000..c8ec211 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/pork_to_flesh.json @@ -0,0 +1,14 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:mushrooms" }, + { "item": "minecraft:porkchop" } + ] + } + ], + "result": { + "item": "minecraft:rotten_flesh" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/prestigious_palm.json b/src/main/resources/data/eidolon/recipes/prestigious_palm.json new file mode 100644 index 0000000..1c64597 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/prestigious_palm.json @@ -0,0 +1,29 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " w ", + "www", + " l " + ], + "reagents": "sece", + "key": { + "w": { + "item": "eidolon:wicked_weave" + }, + "l": { + "item": "eidolon:lesser_soul_gem" + }, + "s": { + "item": "eidolon:warped_sprouts" + }, + "e": { + "item": "eidolon:ender_calx" + }, + "c": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:prestigious_palm" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/rabbit_to_flesh.json b/src/main/resources/data/eidolon/recipes/rabbit_to_flesh.json new file mode 100644 index 0000000..ce6683d --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/rabbit_to_flesh.json @@ -0,0 +1,14 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "tag": "forge:mushrooms" }, + { "item": "minecraft:rabbit" } + ] + } + ], + "result": { + "item": "minecraft:rotten_flesh" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/raven_feather_arrows.json b/src/main/resources/data/eidolon/recipes/raven_feather_arrows.json new file mode 100644 index 0000000..977c69d --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/raven_feather_arrows.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "f", + "s", + "r" + ], + "key": { + "f": { + "item": "minecraft:flint" + }, + "s": { + "tag": "forge:rods/wooden" + }, + "r": { + "item": "eidolon:raven_feather" + } + }, + "result": { + "item": "minecraft:arrow", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/raw_lead_block.json b/src/main/resources/data/eidolon/recipes/raw_lead_block.json new file mode 100644 index 0000000..f5a5260 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/raw_lead_block.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "xxx", + "xxx" + ], + "key": { + "x": { + "item": "eidolon:raw_lead" + } + }, + "result": { + "item": "eidolon:raw_lead_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/raw_silver_block.json b/src/main/resources/data/eidolon/recipes/raw_silver_block.json new file mode 100644 index 0000000..7c36d3a --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/raw_silver_block.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "xxx", + "xxx" + ], + "key": { + "x": { + "item": "eidolon:raw_silver" + } + }, + "result": { + "item": "eidolon:raw_silver_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/reaper_scythe.json b/src/main/resources/data/eidolon/recipes/reaper_scythe.json new file mode 100644 index 0000000..ac4f7c0 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/reaper_scythe.json @@ -0,0 +1,29 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "pp ", + " sp", + "s " + ], + "reagents": "utct", + "key": { + "p": { + "tag": "forge:ingots/pewter" + }, + "u": { + "item": "eidolon:unholy_symbol" + }, + "t": { + "item": "eidolon:tattered_cloth" + }, + "c": { + "item": "eidolon:soul_shard" + }, + "s": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:reaper_scythe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/research_table.json b/src/main/resources/data/eidolon/recipes/research_table.json new file mode 100644 index 0000000..530d168 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/research_table.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + " c ", + "xxx", + "zzz" + ], + "key": { + "x": { + "item": "minecraft:red_carpet" + }, + "z": { + "tag": "minecraft:planks" + }, + "c": { + "item": "eidolon:magic_candle" + } + }, + "result": { + "item": "eidolon:research_table" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/resolute_belt.json b/src/main/resources/data/eidolon/recipes/resolute_belt.json new file mode 100644 index 0000000..baf68b8 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/resolute_belt.json @@ -0,0 +1,35 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " i ", + "gbg", + " d " + ], + "reagents": "lsas", + "key": { + "i": { + "item": "eidolon:gold_inlay" + }, + "g": { + "tag": "forge:ingots/arcane_gold" + }, + "b": { + "item": "eidolon:basic_belt" + }, + "d": { + "tag": "forge:gems/diamond" + }, + "l": { + "item": "minecraft:leather" + }, + "s": { + "item": "eidolon:soul_shard" + }, + "a": { + "item": "eidolon:enchanted_ash" + } + }, + "result": { + "item": "eidolon:resolute_belt" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/reversal_pick.json b/src/main/resources/data/eidolon/recipes/reversal_pick.json new file mode 100644 index 0000000..c2c53e5 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/reversal_pick.json @@ -0,0 +1,35 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "oco", + " p ", + " i " + ], + "reagents": "esgs", + "key": { + "o": { + "item": "minecraft:obsidian" + }, + "c": { + "item": "minecraft:crying_obsidian" + }, + "p": { + "tag": "forge:ingots/pewter" + }, + "i": { + "item": "eidolon:pewter_inlay" + }, + "e": { + "tag": "forge:ender_pearls" + }, + "s": { + "item": "eidolon:soul_shard" + }, + "g": { + "item": "eidolon:lesser_soul_gem" + } + }, + "result": { + "item": "eidolon:reversal_pick" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/shadow_gem.json b/src/main/resources/data/eidolon/recipes/shadow_gem.json new file mode 100644 index 0000000..36c3665 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/shadow_gem.json @@ -0,0 +1,33 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:coal" } + ] + }, + { + "stirs": 1, + "items": [ + { "item": "minecraft:ghast_tear" }, + { "item": "eidolon:death_essence" } + ] + }, + { + "stirs": 1, + "items": [ + { "item": "eidolon:soul_shard" }, + { "item": "eidolon:soul_shard" }, + { "item": "eidolon:death_essence" } + ] + }, + { + "items": [ + { "tag": "forge:gems/diamond" } + ] + } + ], + "result": { + "item": "eidolon:shadow_gem" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/shadow_gem_block.json b/src/main/resources/data/eidolon/recipes/shadow_gem_block.json new file mode 100644 index 0000000..dcec5d2 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/shadow_gem_block.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "xxx", + "xxx" + ], + "key": { + "x": { + "tag": "forge:gems/shadow_gem" + } + }, + "result": { + "item": "eidolon:shadow_gem_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_axe.json b/src/main/resources/data/eidolon/recipes/silver_axe.json new file mode 100644 index 0000000..19ad58c --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_axe.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xx", + "xy", + " y" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + }, + "y": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:silver_axe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_block.json b/src/main/resources/data/eidolon/recipes/silver_block.json new file mode 100644 index 0000000..1d613f3 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_block.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "xxx", + "xxx" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + } + }, + "result": { + "item": "eidolon:silver_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_boots.json b/src/main/resources/data/eidolon/recipes/silver_boots.json new file mode 100644 index 0000000..1eb775e --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_boots.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "x x", + "x x" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + } + }, + "result": { + "item": "eidolon:silver_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_chestplate.json b/src/main/resources/data/eidolon/recipes/silver_chestplate.json new file mode 100644 index 0000000..1789878 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_chestplate.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "x x", + "xxx", + "xxx" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + } + }, + "result": { + "item": "eidolon:silver_chestplate" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_helmet.json b/src/main/resources/data/eidolon/recipes/silver_helmet.json new file mode 100644 index 0000000..5a6d097 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_helmet.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "x x" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + } + }, + "result": { + "item": "eidolon:silver_helmet" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_hoe.json b/src/main/resources/data/eidolon/recipes/silver_hoe.json new file mode 100644 index 0000000..c9980df --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_hoe.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xx", + "y ", + "y " + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + }, + "y": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:silver_hoe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_ingot.json b/src/main/resources/data/eidolon/recipes/silver_ingot.json new file mode 100644 index 0000000..6aa1128 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_ingot.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "xxx", + "xxx" + ], + "key": { + "x": { + "tag": "forge:nuggets/silver" + } + }, + "result": { + "item": "eidolon:silver_ingot" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_leggings.json b/src/main/resources/data/eidolon/recipes/silver_leggings.json new file mode 100644 index 0000000..24219e3 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_leggings.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + "x x", + "x x" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + } + }, + "result": { + "item": "eidolon:silver_leggings" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_pickaxe.json b/src/main/resources/data/eidolon/recipes/silver_pickaxe.json new file mode 100644 index 0000000..802735c --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_pickaxe.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "xxx", + " y ", + " y " + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + }, + "y": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:silver_pickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_shovel.json b/src/main/resources/data/eidolon/recipes/silver_shovel.json new file mode 100644 index 0000000..ad98504 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_shovel.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "x", + "y", + "y" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + }, + "y": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:silver_shovel" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/silver_sword.json b/src/main/resources/data/eidolon/recipes/silver_sword.json new file mode 100644 index 0000000..51abbb7 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/silver_sword.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "group": "eidolon", + "pattern": [ + "x", + "x", + "y" + ], + "key": { + "x": { + "tag": "forge:ingots/silver" + }, + "y": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "eidolon:silver_sword" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/smelt_raw_lead.json b/src/main/resources/data/eidolon/recipes/smelt_raw_lead.json new file mode 100644 index 0000000..9db08b6 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/smelt_raw_lead.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:smelting", + "ingredient": { + "item": "eidolon:raw_lead" + }, + "result": "eidolon:lead_ingot", + "experience": 0.5, + "cookingtime": 200 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/smelt_raw_silver.json b/src/main/resources/data/eidolon/recipes/smelt_raw_silver.json new file mode 100644 index 0000000..6cb6238 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/smelt_raw_silver.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:smelting", + "ingredient": { + "item": "eidolon:raw_silver" + }, + "result": "eidolon:silver_ingot", + "experience": 0.5, + "cookingtime": 200 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/smelt_silver_dust.json b/src/main/resources/data/eidolon/recipes/smelt_silver_dust.json new file mode 100644 index 0000000..26acf92 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/smelt_silver_dust.json @@ -0,0 +1,25 @@ +{ + "type": "forge:conditional", + "recipes": [ + { + "conditions": [ + { + "value": { + "tag": "forge:dusts/silver", + "type": "forge:tag_empty" + }, + "type": "forge:not" + } + ], + "recipe": { + "type": "minecraft:smelting", + "ingredient": { + "tag": "forge:dusts/silver" + }, + "result": "eidolon:silver_ingot", + "experience": 0.5, + "cookingtime": 200 + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/smelt_silver_ore.json b/src/main/resources/data/eidolon/recipes/smelt_silver_ore.json new file mode 100644 index 0000000..ca161a0 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/smelt_silver_ore.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:smelting", + "ingredient": { + "tag": "forge:ores/silver" + }, + "result": "eidolon:silver_ingot", + "experience": 0.5, + "cookingtime": 200 +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/smelt_stone_brick.json b/src/main/resources/data/eidolon/recipes/smelt_stone_brick.json deleted file mode 100644 index 6d865b3..0000000 --- a/src/main/resources/data/eidolon/recipes/smelt_stone_brick.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "minecraft:smelting", - "ingredient": { - "item": "minecraft:stone_bricks" - }, - "result": "eidolon:smooth_stone_bricks", - "experience": 0.1, - "cookingtime": 200 -} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/soul_enchanter.json b/src/main/resources/data/eidolon/recipes/soul_enchanter.json new file mode 100644 index 0000000..af3b45e --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/soul_enchanter.json @@ -0,0 +1,29 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " b ", + "gog", + "ooo" + ], + "reagents": "didi", + "key": { + "b": { + "item": "minecraft:book" + }, + "g": { + "tag": "forge:ingots/arcane_gold" + }, + "o": { + "item": "minecraft:obsidian" + }, + "d": { + "tag": "forge:gems/diamond" + }, + "i": { + "item": "eidolon:gold_inlay" + } + }, + "result": { + "item": "eidolon:soul_enchanter" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/soulbone_amulet.json b/src/main/resources/data/eidolon/recipes/soulbone_amulet.json new file mode 100644 index 0000000..228216d --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/soulbone_amulet.json @@ -0,0 +1,32 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "bab", + "bhb", + " c " + ], + "reagents": "cege", + "key": { + "e": { + "item": "eidolon:death_essence" + }, + "b": { + "tag": "forge:bones" + }, + "c": { + "item": "eidolon:ender_calx" + }, + "g": { + "item": "eidolon:shadow_gem" + }, + "a": { + "item": "eidolon:basic_amulet" + }, + "h": { + "item": "eidolon:wraith_heart" + } + }, + "result": { + "item": "eidolon:soulbone_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/soulfire_wand.json b/src/main/resources/data/eidolon/recipes/soulfire_wand.json new file mode 100644 index 0000000..947df52 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/soulfire_wand.json @@ -0,0 +1,32 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " gx", + " sg", + "i " + ], + "reagents": "lbbb", + "key": { + "i": { + "item": "eidolon:gold_inlay" + }, + "g": { + "tag": "forge:ingots/arcane_gold" + }, + "s": { + "tag": "forge:rods/wooden" + }, + "x": { + "item": "eidolon:shadow_gem" + }, + "b": { + "item": "minecraft:blaze_powder" + }, + "l": { + "item": "eidolon:lesser_soul_gem" + } + }, + "result": { + "item": "eidolon:soulfire_wand" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/stone_altar.json b/src/main/resources/data/eidolon/recipes/stone_altar.json new file mode 100644 index 0000000..2061027 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/stone_altar.json @@ -0,0 +1,27 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "sss", + "SSS", + "SiS" + ], + "reagents": "u ", + "key": { + "s": { + "item": "minecraft:smooth_stone_slab" + }, + "S": { + "item": "minecraft:stone" + }, + "i": { + "item": "eidolon:pewter_inlay" + }, + "u": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:stone_altar", + "count": 3 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/sulfur.json b/src/main/resources/data/eidolon/recipes/sulfur.json new file mode 100644 index 0000000..eb0879a --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/sulfur.json @@ -0,0 +1,15 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:coal" }, + { "item": "eidolon:enchanted_ash" } + ] + } + ], + "result": { + "item": "eidolon:sulfur", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/unholy_effigy.json b/src/main/resources/data/eidolon/recipes/unholy_effigy.json new file mode 100644 index 0000000..6effabc --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/unholy_effigy.json @@ -0,0 +1,26 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " S ", + "sss", + " s " + ], + "reagents": "u i ", + "key": { + "s": { + "item": "minecraft:stone" + }, + "S": { + "item": "minecraft:smooth_stone" + }, + "u": { + "item": "eidolon:unholy_symbol" + }, + "i": { + "item": "eidolon:gold_inlay" + } + }, + "result": { + "item": "eidolon:unholy_effigy" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/void_amulet.json b/src/main/resources/data/eidolon/recipes/void_amulet.json new file mode 100644 index 0000000..7a43436 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/void_amulet.json @@ -0,0 +1,29 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " p ", + "iai", + " o " + ], + "reagents": "s s ", + "key": { + "p": { + "tag": "forge:ingots/pewter" + }, + "i": { + "item": "eidolon:pewter_inlay" + }, + "a": { + "item": "eidolon:basic_amulet" + }, + "o": { + "item": "minecraft:obsidian" + }, + "s": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:void_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/warded_mail.json b/src/main/resources/data/eidolon/recipes/warded_mail.json new file mode 100644 index 0000000..164dafa --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/warded_mail.json @@ -0,0 +1,26 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " s ", + "aia", + " a " + ], + "reagents": "pppp", + "key": { + "p": { + "item": "eidolon:pewter_inlay" + }, + "i": { + "item": "minecraft:iron_chestplate" + }, + "a": { + "item": "eidolon:enchanted_ash" + }, + "s": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:warded_mail" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/warlock_boots.json b/src/main/resources/data/eidolon/recipes/warlock_boots.json new file mode 100644 index 0000000..ddab69e --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/warlock_boots.json @@ -0,0 +1,20 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " ", + "w w", + "w w" + ], + "reagents": "s s ", + "key": { + "w": { + "item": "eidolon:wicked_weave" + }, + "s": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:warlock_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/warlock_cloak.json b/src/main/resources/data/eidolon/recipes/warlock_cloak.json new file mode 100644 index 0000000..1ba8314 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/warlock_cloak.json @@ -0,0 +1,20 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "www", + "www", + "w w" + ], + "reagents": "s s ", + "key": { + "w": { + "item": "eidolon:wicked_weave" + }, + "s": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:warlock_cloak" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/warlock_hat.json b/src/main/resources/data/eidolon/recipes/warlock_hat.json new file mode 100644 index 0000000..0102d51 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/warlock_hat.json @@ -0,0 +1,20 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + " w ", + " w ", + "w w" + ], + "reagents": "s s ", + "key": { + "w": { + "item": "eidolon:wicked_weave" + }, + "s": { + "item": "eidolon:soul_shard" + } + }, + "result": { + "item": "eidolon:warlock_hat" + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/warped_sprouts.json b/src/main/resources/data/eidolon/recipes/warped_sprouts.json new file mode 100644 index 0000000..c83b524 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/warped_sprouts.json @@ -0,0 +1,25 @@ +{ + "type": "eidolon:crucible", + "steps": [ + { + "items": [ + { "item": "minecraft:warped_fungus" } + ] + }, + { + "stirs": 2, + "items": [ + { "item": "eidolon:ender_calx" } + ] + }, + { + "items": [ + { "item": "minecraft:nether_wart" } + ] + } + ], + "result": { + "item": "eidolon:warped_sprouts", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/wicked_weave.json b/src/main/resources/data/eidolon/recipes/wicked_weave.json new file mode 100644 index 0000000..d9e28c3 --- /dev/null +++ b/src/main/resources/data/eidolon/recipes/wicked_weave.json @@ -0,0 +1,27 @@ +{ + "type": "eidolon:worktable", + "pattern": [ + "www", + "wsw", + "www" + ], + "reagents": "u b ", + "key": { + "w": { + "item": "minecraft:white_wool" + }, + "s": { + "item": "eidolon:shadow_gem" + }, + "u": { + "item": "eidolon:unholy_symbol" + }, + "b": { + "tag": "forge:dyes/blue" + } + }, + "result": { + "item": "eidolon:wicked_weave", + "count": 8 + } +} \ No newline at end of file diff --git a/src/main/resources/data/eidolon/recipes/wooden_brewing_stand.json b/src/main/resources/data/eidolon/recipes/wooden_brewing_stand.json index a14262f..51edbdb 100644 --- a/src/main/resources/data/eidolon/recipes/wooden_brewing_stand.json +++ b/src/main/resources/data/eidolon/recipes/wooden_brewing_stand.json @@ -7,10 +7,10 @@ ], "key": { "x": { - "item": "minecraft:stick" + "tag": "forge:rods/wooden" }, "y": { - "item": "eidolon:pewter_ingot" + "tag": "forge:ingots/pewter" } }, "result": { diff --git a/src/main/resources/data/eidolon/recipes/worktable.json b/src/main/resources/data/eidolon/recipes/worktable.json index 7a2634b..859b6f4 100644 --- a/src/main/resources/data/eidolon/recipes/worktable.json +++ b/src/main/resources/data/eidolon/recipes/worktable.json @@ -2,19 +2,19 @@ "type": "minecraft:crafting_shaped", "group": "eidolon", "pattern": [ + " y ", "xxx", - "yzy", "zzz" ], "key": { "x": { - "item": "minecraft:red_carpet" + "item": "minecraft:purple_carpet" }, "y": { - "item": "eidolon:pewter_ingot" + "item": "eidolon:pewter_inlay" }, "z": { - "tag": "planks" + "tag": "minecraft:planks" } }, "result": { diff --git a/src/main/resources/data/eidolon/tags/items/zombie_food.json b/src/main/resources/data/eidolon/tags/items/zombie_food.json new file mode 100644 index 0000000..be58446 --- /dev/null +++ b/src/main/resources/data/eidolon/tags/items/zombie_food.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "minecraft:rotten_flesh", + "eidolon:zombie_heart" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/ores.json b/src/main/resources/data/forge/tags/blocks/ores.json index be72bb4..effd373 100644 --- a/src/main/resources/data/forge/tags/blocks/ores.json +++ b/src/main/resources/data/forge/tags/blocks/ores.json @@ -1,6 +1,9 @@ { "replace": false, "values": [ - "eidolon:lead_ore" + "eidolon:lead_ore", + "eidolon:silver_ore", + "eidolon:deep_lead_ore", + "eidolon:deep_silver_ore" ] } \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/ores/lead.json b/src/main/resources/data/forge/tags/blocks/ores/lead.json index be72bb4..149f6eb 100644 --- a/src/main/resources/data/forge/tags/blocks/ores/lead.json +++ b/src/main/resources/data/forge/tags/blocks/ores/lead.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:lead_ore" + "eidolon:lead_ore", + "eidolon:deep_lead_ore" ] } \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/ores/silver.json b/src/main/resources/data/forge/tags/blocks/ores/silver.json new file mode 100644 index 0000000..90a108f --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/ores/silver.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "eidolon:silver_ore", + "eidolon:deep_silver_ore" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks.json b/src/main/resources/data/forge/tags/blocks/storage_blocks.json index 46a8001..37a3eb3 100644 --- a/src/main/resources/data/forge/tags/blocks/storage_blocks.json +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks.json @@ -3,6 +3,8 @@ "values": [ "eidolon:lead_block", "eidolon:pewter_block", - "eidolon:arcane_gold_block" + "eidolon:arcane_gold_block", + "eidolon:silver_block", + "eidolon:shadow_gem_block" ] } \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks/shadow_gem.json b/src/main/resources/data/forge/tags/blocks/storage_blocks/shadow_gem.json new file mode 100644 index 0000000..6267399 --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks/shadow_gem.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:shadow_gem_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks/silver.json b/src/main/resources/data/forge/tags/blocks/storage_blocks/silver.json new file mode 100644 index 0000000..2efc358 --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks/silver.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:silver_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/dusts.json b/src/main/resources/data/forge/tags/items/dusts.json new file mode 100644 index 0000000..4f6a3b3 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/dusts.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:sulfur" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/feathers.json b/src/main/resources/data/forge/tags/items/feathers.json new file mode 100644 index 0000000..d8353c5 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/feathers.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:raven_feather" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/gems.json b/src/main/resources/data/forge/tags/items/gems.json new file mode 100644 index 0000000..c9eae70 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/gems.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:shadow_gem" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/gems/shadow_gem.json b/src/main/resources/data/forge/tags/items/gems/shadow_gem.json new file mode 100644 index 0000000..c9eae70 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/gems/shadow_gem.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:shadow_gem" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/ingots.json b/src/main/resources/data/forge/tags/items/ingots.json new file mode 100644 index 0000000..a7e2da2 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/ingots.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "eidolon:lead_ingot", + "eidolon:pewter_ingot", + "eidolon:arcane_gold_ingot", + "eidolon:silver_ingot" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/ingots/silver.json b/src/main/resources/data/forge/tags/items/ingots/silver.json new file mode 100644 index 0000000..c0c3f69 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/ingots/silver.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:silver_ingot" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/nuggets/silver.json b/src/main/resources/data/forge/tags/items/nuggets/silver.json new file mode 100644 index 0000000..0a16076 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/nuggets/silver.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:silver_nugget" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/ores.json b/src/main/resources/data/forge/tags/items/ores.json index be72bb4..5911251 100644 --- a/src/main/resources/data/forge/tags/items/ores.json +++ b/src/main/resources/data/forge/tags/items/ores.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:lead_ore" + "eidolon:lead_ore", + "eidolon:silver_ore" ] } \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/ores/lead.json b/src/main/resources/data/forge/tags/items/ores/lead.json index be72bb4..149f6eb 100644 --- a/src/main/resources/data/forge/tags/items/ores/lead.json +++ b/src/main/resources/data/forge/tags/items/ores/lead.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:lead_ore" + "eidolon:lead_ore", + "eidolon:deep_lead_ore" ] } \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/ores/silver.json b/src/main/resources/data/forge/tags/items/ores/silver.json new file mode 100644 index 0000000..90a108f --- /dev/null +++ b/src/main/resources/data/forge/tags/items/ores/silver.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "eidolon:silver_ore", + "eidolon:deep_silver_ore" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/raw_materials/lead.json b/src/main/resources/data/forge/tags/items/raw_materials/lead.json new file mode 100644 index 0000000..2161e6b --- /dev/null +++ b/src/main/resources/data/forge/tags/items/raw_materials/lead.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:raw_lead" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/raw_materials/silver.json b/src/main/resources/data/forge/tags/items/raw_materials/silver.json new file mode 100644 index 0000000..07b42d6 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/raw_materials/silver.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:raw_silver" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks.json b/src/main/resources/data/forge/tags/items/storage_blocks.json index 46a8001..37a3eb3 100644 --- a/src/main/resources/data/forge/tags/items/storage_blocks.json +++ b/src/main/resources/data/forge/tags/items/storage_blocks.json @@ -3,6 +3,8 @@ "values": [ "eidolon:lead_block", "eidolon:pewter_block", - "eidolon:arcane_gold_block" + "eidolon:arcane_gold_block", + "eidolon:silver_block", + "eidolon:shadow_gem_block" ] } \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks/raw_lead.json b/src/main/resources/data/forge/tags/items/storage_blocks/raw_lead.json new file mode 100644 index 0000000..8538c23 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks/raw_lead.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:raw_lead_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks/raw_silver.json b/src/main/resources/data/forge/tags/items/storage_blocks/raw_silver.json new file mode 100644 index 0000000..2192248 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks/raw_silver.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:raw_silver_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks/shadow_gem.json b/src/main/resources/data/forge/tags/items/storage_blocks/shadow_gem.json new file mode 100644 index 0000000..6267399 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks/shadow_gem.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:shadow_gem_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks/silver.json b/src/main/resources/data/forge/tags/items/storage_blocks/silver.json new file mode 100644 index 0000000..2efc358 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks/silver.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:silver_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/tallow.json b/src/main/resources/data/forge/tags/items/tallow.json new file mode 100644 index 0000000..5697da5 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/tallow.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "eidolon:tallow" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/fence_gates.json b/src/main/resources/data/minecraft/tags/blocks/fence_gates.json index bd96de8..d7e30bd 100644 --- a/src/main/resources/data/minecraft/tags/blocks/fence_gates.json +++ b/src/main/resources/data/minecraft/tags/blocks/fence_gates.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:polished_planks_fence_gate" + "eidolon:polished_planks_fence_gate", + "eidolon:illwood_planks_fence_gate" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/illwood_logs.json b/src/main/resources/data/minecraft/tags/blocks/illwood_logs.json new file mode 100644 index 0000000..1b1dc9b --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/illwood_logs.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "eidolon:illwood_log", + "eidolon:stripped_illwood_log" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/logs_that_burn.json b/src/main/resources/data/minecraft/tags/blocks/logs_that_burn.json new file mode 100644 index 0000000..04f6216 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/logs_that_burn.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#minecraft:illwood_logs" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json new file mode 100644 index 0000000..c69c5d8 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -0,0 +1,25 @@ +{ + "replace": false, + "values": [ + "eidolon:brazier", + "eidolon:polished_planks_fence_gate", + "eidolon:polished_planks_fence", + "eidolon:polished_planks_slab", + "eidolon:polished_planks_stairs", + "eidolon:polished_planks", + "eidolon:polished_wood_pillar", + "eidolon:illwood_planks_fence_gate", + "eidolon:illwood_planks_fence", + "eidolon:illwood_planks_slab", + "eidolon:illwood_planks_stairs", + "eidolon:illwood_planks", + "eidolon:illwood_log", + "eidolon:illwood_bark", + "eidolon:stripped_illwood_log", + "eidolon:stripped_illwood_bark", + "eidolon:wooden_altar", + "eidolon:wooden_brewing_stand", + "eidolon:worktable", + "eidolon:research_table" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json new file mode 100644 index 0000000..882fcbe --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -0,0 +1,45 @@ +{ + "replace": false, + "values": [ + "eidolon:crucible", + "eidolon:lead_ore", + "eidolon:lead_block", + "eidolon:silver_ore", + "eidolon:silver_block", + "eidolon:deep_lead_ore", + "eidolon:raw_lead_block", + "eidolon:deep_silver_ore", + "eidolon:raw_silver_block", + "eidolon:pewter_block", + "eidolon:arcane_gold_block", + "eidolon:necrotic_focus", + "eidolon:obelisk", + "eidolon:plinth", + "eidolon:shadow_gem_block", + "eidolon:smooth_stone_bricks_slab", + "eidolon:smooth_stone_bricks_stairs", + "eidolon:smooth_stone_bricks_wall", + "eidolon:smooth_stone_bricks", + "eidolon:smooth_stone_tiles_slab", + "eidolon:smooth_stone_tiles_stairs", + "eidolon:smooth_stone_tiles", + "eidolon:smooth_stone_masonry", + "eidolon:smooth_stone_masonry_slab", + "eidolon:smooth_stone_masonry_stairs", + "eidolon:smooth_stone_arch", + "eidolon:mossy_smooth_stone_bricks", + "eidolon:elder_bricks", + "eidolon:elder_bricks_slab", + "eidolon:elder_bricks_stairs", + "eidolon:elder_bricks_wall", + "eidolon:elder_bricks_eye", + "eidolon:elder_pillar", + "eidolon:elder_masonry", + "eidolon:elder_masonry_slab", + "eidolon:elder_masonry_stairs", + "eidolon:soul_enchanter", + "eidolon:stone_altar", + "eidolon:stone_hand", + "eidolon:unholy_effigy" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json b/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json new file mode 100644 index 0000000..ee3f44d --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "eidolon:lead_ore", + "eidolon:lead_block", + "eidolon:silver_ore", + "eidolon:silver_block", + "eidolon:deep_lead_ore", + "eidolon:raw_lead_block", + "eidolon:deep_silver_ore", + "eidolon:raw_silver_block", + "eidolon:pewter_block", + "eidolon:arcane_gold_block", + "eidolon:shadow_gem_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/planks.json b/src/main/resources/data/minecraft/tags/blocks/planks.json index 252f89a..10223f0 100644 --- a/src/main/resources/data/minecraft/tags/blocks/planks.json +++ b/src/main/resources/data/minecraft/tags/blocks/planks.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:polished_planks" + "eidolon:polished_planks", + "eidolon:illwood_planks" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/walls.json b/src/main/resources/data/minecraft/tags/blocks/walls.json index 14d2864..299d0bc 100644 --- a/src/main/resources/data/minecraft/tags/blocks/walls.json +++ b/src/main/resources/data/minecraft/tags/blocks/walls.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:smooth_stone_bricks_wall" + "eidolon:smooth_stone_bricks_wall", + "eidolon:elder_bricks_wall" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/wooden_fences.json b/src/main/resources/data/minecraft/tags/blocks/wooden_fences.json index 95c6a40..8ee6f2c 100644 --- a/src/main/resources/data/minecraft/tags/blocks/wooden_fences.json +++ b/src/main/resources/data/minecraft/tags/blocks/wooden_fences.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:polished_planks_fence" + "eidolon:polished_planks_fence", + "eidolon:illwood_planks_fence" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/wooden_slabs.json b/src/main/resources/data/minecraft/tags/blocks/wooden_slabs.json index 9d694ea..730595d 100644 --- a/src/main/resources/data/minecraft/tags/blocks/wooden_slabs.json +++ b/src/main/resources/data/minecraft/tags/blocks/wooden_slabs.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:polished_planks_slab" + "eidolon:polished_planks_slab", + "eidolon:illwood_planks_slab" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/wooden_stairs.json b/src/main/resources/data/minecraft/tags/blocks/wooden_stairs.json index 32121a4..28cf8f7 100644 --- a/src/main/resources/data/minecraft/tags/blocks/wooden_stairs.json +++ b/src/main/resources/data/minecraft/tags/blocks/wooden_stairs.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "eidolon:polished_planks_stairs" + "eidolon:polished_planks_stairs", + "eidolon:illwood_planks_stairs" ] } \ No newline at end of file diff --git a/src/main/resources/eidolon.mixins.json b/src/main/resources/eidolon.mixins.json index 45c5f9b..e1b2a21 100644 --- a/src/main/resources/eidolon.mixins.json +++ b/src/main/resources/eidolon.mixins.json @@ -4,9 +4,15 @@ "compatibilityLevel": "JAVA_8", "refmap": "eidolon.refmap.json", "mixins": [ + "ZombieVillagerMixin", + "PotionBrewingMixin", "LivingEntityMixin", - "ZombieVillagerEntityMixin", - "PotionBrewingMixin" + "PlayerRendererMixin", + "LevelRendererMixin", + "AbstractArrowMixin", + "StructureSettingsMixin", + "AbstractContainerMenuMixin", + "LocalPlayerMixin" ], "minVersion": "0.8" } \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index c79a362..7719e8f 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "examplemod resources", + "description": "eidolon resources", "pack_format": 6, "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." }