commit 46daaa5d564ec2354bfae88ea21be6f295989567 Author: Magistu <77356543+Magistu@users.noreply.github.com> Date: Tue Jan 31 13:12:58 2023 +0300 initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f811f6a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..12f8644 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + +# other +eclipse +run + +# Files from Forge MDK +forge*changelog.txt diff --git a/CREDITS.txt b/CREDITS.txt new file mode 100644 index 0000000..a70c53d --- /dev/null +++ b/CREDITS.txt @@ -0,0 +1,65 @@ +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 new file mode 100644 index 0000000..b0cbe2b --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,520 @@ +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/README.txt b/README.txt new file mode 100644 index 0000000..867e97e --- /dev/null +++ b/README.txt @@ -0,0 +1,46 @@ + +Source installation information for modders +------------------------------------------- +This code follows the Minecraft Forge installation methodology. It will apply +some small patches to the vanilla MCP source code, giving you and it access +to some of the data and functions you need to build a successful mod. + +Note also that the patches are built against "un-renamed" MCP source code (aka +SRG Names) - this means that you will not be able to read them directly against +normal code. + +Setup Process: +============================== + +Step 1: Open your command-line and browse to the folder where you extracted the zip file. + +Step 2: You're left with a choice. +If you prefer to use Eclipse: +1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux) +2. Open Eclipse, Import > Existing Gradle Project > Select Folder + or run `gradlew eclipse` to generate the project. + +If you prefer to use IntelliJ: +1. Open IDEA, and import project. +2. Select your build.gradle file and have it import. +3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux) +4. Refresh the Gradle Project in IDEA if required. + +If at any point you are missing libraries in your IDE, or you've run into problems you can +run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything +{this does not affect your code} and then start the process again. + +Mapping Names: +============================= +By default, the MDK is configured to use the official mapping names from Mojang for methods and fields +in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this +license, if you do not agree with it you can change your mapping names to other crowdsourced names in your +build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here: +https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + +Additional Resources: +========================= +Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/ +LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0 +Forge Forum: https://forums.minecraftforge.net/ +Forge Discord: https://discord.gg/UvedJ9m diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d644391 --- /dev/null +++ b/build.gradle @@ -0,0 +1,203 @@ +plugins { + id 'eclipse' + id 'maven-publish' + id 'net.minecraftforge.gradle' version '5.1.+' +} + +version = '1.0' +group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = 'modid' + +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(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. + // Channel: Version: + // official MCVersion Official field/method names from Mojang mapping files + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official + // + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // + // Use non-default mappings at your own risk. They may not always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + mappings channel: 'official', version: '1.19.2' + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'examplemod' + + mods { + examplemod { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'REGISTRIES' + + property 'forge.logging.console.level', 'debug' + + property 'forge.enabledGameTestNamespaces', 'examplemod' + + mods { + examplemod { + source sourceSets.main + } + } + } + + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'REGISTRIES' + + property 'forge.logging.console.level', 'debug' + + property 'forge.enabledGameTestNamespaces', 'examplemod' + + mods { + examplemod { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'REGISTRIES' + + property 'forge.logging.console.level', 'debug' + + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + + mods { + examplemod { + source sourceSets.main + } + } + } + } +} + +// Include resources generated by data generators. +sourceSets.main.resources { srcDir 'src/generated/resources' } + +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you + + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // flatDir { + // dir 'libs' + // } + maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' } + + maven { + // location of the maven that hosts JEI files + name = "Progwml6 maven" + url = "https://dvs1.progwml6.com/files/maven/" + } + maven { + // location of a maven mirror for JEI files, as a fallback + name = "ModMaven" + url = "https://modmaven.dev" + } +} + +dependencies { + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. + minecraft 'net.minecraftforge:forge:1.19.2-43.2.4' + + implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.19:3.1.39') + + // compile against the JEI API but do not include it at runtime + compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")) + compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")) + // at runtime, use the full JEI jar for Forge + runtimeOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")) + + // Real mod deobf dependency examples - these get remapped to your current mappings + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + + // Examples using mod jars from ./libs + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") + + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html +} + +// Example for how to get properties into the manifest for reading at runtime. +jar { + manifest { + attributes([ + "Specification-Title" : "examplemod", + "Specification-Vendor" : "examplemodsareus", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } +} + +// Example configuration to allow publishing using the maven-publish plugin +// This is the preferred method to reobfuscate your jar file +jar.finalizedBy('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing +// publish.dependsOn('reobfJar') + +publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + } +} + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..5405441 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,590 @@ +1.19.2 Changelog +43.2 +==== + - 43.2.4 Fire TickEvent.LevelTickEvent on ClientLevel tick (#9302) + - 43.2.3 Disable guiLight3d for generated item models (#9231) + - 43.2.2 Fix config key used by resource cache (#9253) + This bring it in line with the config key defined in the spec and + default config file in ResourceManagerBootCacheConfigurationHandler. + Fixes #9252 + - 43.2.1 [1.19.2] Fix compatibility checker task configuration (#9233) + * Fix compatibility checker task configuration + The setupCheckJarCompatibility task exists to configure the main + compatibility checker task, checkJarCompatibility, because certain + configuration steps for that task could not be done until after the + configuration phase of Gradle. + However, that setup task previously held all the configuration for the + main check task in its task action. This caused problems because the + main check task's inputs are linked to other tasks, and the previous + situation made it so its configuration (by the setup task) happened + _after_ Gradle built the task dependency model/tree. + This meant that certain tasks which the main check task depended on did + not run before that task, because Gradle was unaware of this inter-task + dependency until it was too late (when it was already executing tasks). + This fixes the issue by moving the bulk of the configuration for the + main check task from the action of the setup task to the main + buildscript, therefore allowing Gradle to know about those task + dependencies and factor them in to its process of determining what tasks + to run and in what order. + The remaining configuration step in the setup task for the main check + task is linked to the setup task, and does not affect the task's + dependencies (because it uses a configuration which it resolves + immediately), so it stays in the setup task. + * Force checker setup task to never be up-to-date + The setup task configures the main check task, so it should always run + before that task. However, because it has an input and output, the setup + task is affected by Gradle's incremental build feature, which leads to + the possibility that Gradle considers the setup task as up-to-date, + therefore not executing its action and causing errors with the main + check task down the line. + - 43.2.0 43.2 Recommended Build. + +43.1 +==== + - 43.1.65 Allow discovering services from the mods folder that use java's modular definition. (#9143) + - 43.1.64 Make Datapack Registries support ICondition(s) (#9113) + - 43.1.63 Enable additional build types to handle pull request validation. (#9159) + - 43.1.62 Check source permission level before selector permission (#9147) + In some situations, such as execution of a function by an advancement as + part of its reward, a command source stack may have a backing source of + a ServerPlayer which may lack the entity selector permission and have an + explicit permission level that should allow the use of entity selectors, + through CommandSourceStack#withPermission. + We now check if the permission level of the command source stack is + sufficient for entity selectors _before_ checking if the source is a + player and if they have the requisite permission. + This means that an operator permission level of 2 will always override + the Forge entity selector permission. + Fixes #9137 + - 43.1.61 Fix fires spreading too/igniting custom portal frames. (#9142) + - 43.1.60 Add supplier to FlowerBlock so it works with custom MobEffects (#9139) + - 43.1.59 Fix some logical bugs related to the Grindstone Event (#9089) + - 43.1.58 Call baked model's `getModelData` before `getRenderTypes` (#9163) + - 43.1.57 Make Util.memoize thread-safe (#9155) + - 43.1.56 Rendering tweaks and fixes: Part 4 (#9065) + - 43.1.55 Fix `Transformation` loading `PoseStack` (#9083) + - 43.1.54 Add simple block appearance API (#9066) + - 43.1.53 Fix invalidated modded packets when on LAN (#9157) + - 43.1.52 Improve extensibility of DetectorRailBlock and PoweredRailBlock (#9130) + - 43.1.51 Fix launch handler minecraft classpath locator (#9120) + - 43.1.50 Add HitResult to `EntityTeleportEvent$EnderPearl` (#9135) + - 43.1.49 Throw aggregate exception for erroneous registry event dispatch (#9111) + This means that exceptions occurring during the dispatch of the registry + events, such as those from the suppliers of RegistryObjects, properly + cause a crash rather than merely being logged and allowing the game to + reach the main menu. + Fixes #8720 + - 43.1.48 Add missing semi-colon near the Dist import statement in example mod. + - 43.1.47 Fix ClientModEvents example not subscribing to client-sided events (#9097) + - 43.1.46 Use GitHub action to lock issues with the `spam` label (#9087) + - 43.1.45 Remove structures slave map to Feature registry (#9091) + - 43.1.44 Improve logging of missing or unsupported dependencies (#9104) + - 43.1.43 [1.19.x] Fix ValueSpec caching the return value incorrectly (#9046) + - 43.1.42 [1.19.x] Add event for registering spawn placements, and modifying existing (#9024) + - 43.1.41 [1.19.x] Add event for items being stacked or swapped in a GUI. (#9050) + - 43.1.40 [1.19.x] Fix PlayerInteractEvent.EntityInteractSpecific not cancelling on a server (#9079) + - 43.1.39 Fix canceling phantom spawns preventing any further attempts that tick. (#9041) + - 43.1.38 Rename fluid type milk translation keys (#9077) + - 43.1.37 Fix minecart speed with water (#9076) + - 43.1.36 Add a cancellable event that gets fired when a Totem of Undying is used (#9069) + - 43.1.35 Fix performance issue and logging when resource caching is enabled (#9029) + - 43.1.34 Fix NPE when feeding wolves and cats (#9074) + - 43.1.33 Fix logically breaking change to ForgeConfigSpec.Builder#comment where modders could not add a empty line to the start of comments. (#9061) + - 43.1.32 Fix ServiceLoader bug + - 43.1.31 Fix ClientChatReceivedEvent for system messages + - 43.1.30 Make ForgeConfigSpec$Builder.comment able to be called multiple times for the same entry. (#9056) + - 43.1.29 Fix control modifier for mac with `KeyMapping`s using Alt instead of Super (#9057) + - 43.1.28 Fix is_desert tag not being applied correctly. (#9051) + - 43.1.27 Fix mob griefing event for SmallFireballs not using owner entity. (#9038) + - 43.1.26 Fix minecarts on rails not properly slowing down in water (#9033) + - 43.1.25 Change codestyle for BookShelves tag. Closes #9027 + Add IS_CAVE tag Closes #8885 + Add IS_DESERT tag Closes #8979 + Simplify Mangrove Swamp tags Closes #8980 + - 43.1.24 Allow faces of an "elements" model to have disabled ambient occlusion (#9019) + - 43.1.23 [1.19.x] Recipe ID-based grouping between modded and vanilla recipes. (#8876) + - 43.1.22 Update fence_gates/wooden (#8936) + - 43.1.21 [1.19.x] Added event for growing fungus (#8981) + - 43.1.20 Added Bookshelves block tag (#8991) + - 43.1.19 Create a Forge EntityType Tag for Bosses (#9017) + - 43.1.18 Allow mods to specify shader import namespace (#9021) + - 43.1.17 Grindstone Events (#8934) + One to modify the output, and one to modify the input. + - 43.1.16 Fix the serialized names of the enum (#9014) + - 43.1.15 Fix `tryEmptyContainerAndStow` duping fluids with stackable containers (#9004) + - 43.1.14 Add mod mismatch event (#8989) + - 43.1.13 [1.19.x] add methods with more context to tree growers (#8956) + - 43.1.12 [1.19.X] Adding more precise events for Advancements (#8360) + - 43.1.11 Default IItemHandler capability for shulker box itemstacks (#8827) + Co-authored-by: LexManos <LexManos@gmail.com> + - 43.1.10 [1.19] Add hook for items to remain in the hotbar when picking blocks/entities (#8872) + - 43.1.9 [1.19.x] Block Model Builder Root Transform Support (#8860) + Co-authored-by: sciwhiz12 <sciwhiz12@gmail.com> + - 43.1.8 [1.19.x] Make LivingSetAttackTargetEvent compatible with the Brain/Behavior system. (Port of PR #8918) (#8954) + - 43.1.7 [1.19.x] Add IForgeBlock#onTreeGrow to replace IForgeBlock#onPlantGrow from 1.16 (#8999) + - 43.1.6 [1.19.x] Moved Player.resetAttackStrengthTicker() to the end of Player.attack() (#9000) + - 43.1.5 fix misplaced patch in sapling block (#9005) + - 43.1.4 Fix failed entity interactions consuming the click. (#9007) + - 43.1.3 Fix entity selector permission check to check original source (#8995) + Permission checks should be against the command source and not the + target entity, as is done in vanilla. + Fixes #8994 + - 43.1.2 Hotfix for 1.19.2 item animation bug (#8987) + * [HOT FIX]: Fixes #8985 by no-oping for vanilla models instead of throwing error + - 43.1.1 Add ability to Auto register capabilities via annotation (#8972) + - 43.1.0 1.19.2 RB + +43.0 +==== + - 43.0.22 Added ItemDecorator API (#8794) + - 43.0.21 [1.19.x] Custom usage animations for items (#8932) + - 43.0.20 Allow registering custom `ColorResolver`s (#8880) + - 43.0.19 [1.19] Allow custom outline rendering on EntityRenderers and BlockEntityRenderers (#8938) + - 43.0.18 Redirect checks for entity selector use to a permission (#8947) + This allows greater flexibility for configuring servers with + operator-like permissions to user groups through the permissions API and + their permissions handler of choice without needing to grant the + vanilla operator permission to any player. + The new permission is "forge:use_entity_selectors", which is granted by + default to players with permission level 2 (GAMEMASTERS) and above. + The hook falls back to checking the permission level if the source of + the command is not a ServerPlayer, such as for command blocks and + functions. + - 43.0.17 Allow FakePlayer to report its position (#8963) + - 43.0.16 Add alternate version of renderEntityInInventory to allow for directly specifying the angles (#8961) + - 43.0.15 Add cancellable ToastAddEvent (#8952) + - 43.0.14 Modify ScreenEvent.RenderInventoryMobEffects to allow moving the effect stack left or right (#8951) + - 43.0.13 Fix Enchantment#doPostHurt and Enchantment#doPostAttack being called twice for players. Fixes MC-248272 (#8948) + - 43.0.12 Remove reflective implementation of ICustomPacket. (#8973) + Make vanilla custom packets able to be sent multiple times. Closes #8969 + - 43.0.11 Filter name spaces to directories only. Closes #8413 + - 43.0.10 Fix a corner case where the UMLB can not extract a version from a library. (#8967) + - 43.0.9 Fix worlds with removed dimension types unable to load. (#8959) Closes #8800 + - 43.0.8 Fix issue where unknown chunk generators would cause DFU to fail. (#8957) + - 43.0.7 Fix comments and documentation that were missed during the review of #8712 (#8945) + - 43.0.6 Make AnvilUpdateEvent fire even if the second input is empty, which means it fires even if only changing the item name. (#8905) + - 43.0.5 Fix `LivingEntity#isBlocking` to use `ToolActions#SHIELD_BLOCK` instead of `UseAnim#BLOCK` (#8933) + - 43.0.4 Add Custom HolderSet Types allowing for logical combining of sets. (#8928) + - 43.0.3 Add values to VersionSupportMatrix to support loading mods that restrict versions to 1.19.1 on 1.19.2 (#8946) + - 43.0.2 Fix certain particles not updating their bounding box when their position changes (#8925) + - 43.0.1 Update EventBus to address concurrency issue in ModLauncher Factory. Closes #8924 + - 43.0.0 1.19.2 + +42.0 +==== + - 42.0.9 Remove calls to getStepHeight in Player#maybeBackOffFromEdge (#8927) + - 42.0.8 Add forge tags for tools and armors, these DO NOT replace ToolActions, and are designed just for Recipes. (#8914) + - 42.0.7 Add Biomes.BEACH to Tags (#8892) + - 42.0.6 Let NetworkInstance.isRemotePresent check minecraft:register for channel IDs. (#8921) + - 42.0.5 Add an event for when the chunk ticket level is updated (#8909) + - 42.0.4 Re-add PotentialSpawns event (#8712) + - 42.0.3 Fix misplaced patch in ItemEntityRenderer breaking ItemEntityRenderer#shouldBob() (#8919) + - 42.0.2 [1.19] [HotFix] Fix the dedicated server not having access to the JiJ filesystems. (#8931) + - 42.0.1 Match Mojang's action bar fix for MC-72687 (#8917) + - 42.0.0 Forge 1.19.1 + Load natives from classpath + Make command argument types a forge registry + Add `EntityMobGriefingEvent` to `Allay#wantsToPickUp` + Overhaul `ServerChatEvent` to use `ChatDecorator` system + Remove `ClientChatEvent#setMessage` for now + Gradle 7.5 + +41.1 +==== + - 41.1.0 Mark 1.19 RB + +41.0 +==== + - 41.0.113 Allow faces of an "elements" model to be made emissive (#8890) + - 41.0.112 Fix invalid channel names sent from the server causing the network thread to error. (#8902) + - 41.0.111 Fix PlayerEvent.BreakSpeed using magic block position to signify invalid position. Closes #8906 + - 41.0.110 Fix cases where URIs would not work properly with JarInJar (#8900) + - 41.0.109 Add new hook to allow modification of lightmap via Dimension special effects (#8863) + - 41.0.108 Fix Forge's packet handling on play messages. (#8875) + - 41.0.107 Add API for tab list header/footer (#8803) + - 41.0.106 Allow modded blocks overriding canStickTo prevent sticking to vanilla blocks/other modded blocks (#8837) + - 41.0.105 Multiple tweaks and fixes to the recent changes in the client refactor PR: Part 3 (#8864) + Fix weighted baked models not respecting children render types + Allow fluid container model to use base texture as particle + Fix inverted behavior in composite model building. Fixes #8871 + - 41.0.104 Fix crossbows not firing ArrowLooseEvent (#8887) + - 41.0.103 Add User-Agent header to requests made by the update checker (#8881) + Format: Java-http-client/<Java version> MinecraftForge/<ForgeVer> <ModId>/<ModVersion> + - 41.0.102 Output the full path in a crash report so it is easier to find the outer mod when a crash in Jar-In-Jar occurs. (#8856) + - 41.0.101 Clean up the pick item ("middle mouse click") patches (#8870) + - 41.0.100 [1.19.x] Hotfix for test mods while the refactor is ongoing + - 41.0.99 add event to SugarCaneBlock (#8877) + - 41.0.98 Fix Global Loot Modifiers not using Dispatch Codec (#8859) + - 41.0.97 Allow block render types to be set in datagen (#8852) + - 41.0.96 Fix renderBreakingTexture not using the target's model data (#8849) + - 41.0.95 Multiple tweaks and fixes to the recent changes in the client refactor PR: Part 2 (#8854) + * Add getter for the component names in an unbaked geometry + * Fix render type hint not being copied in BlockGeometryBakingContext + * Ensure BlockRenderDispatches's renderSingleBlock uses the correct buffer + - 41.0.94 [1.19.x] Apply general renames, A SRG is provided for modders. (#8840) + See https://gist.github.com/SizableShrimp/882a671ff74256d150776da08c89ef72 + - 41.0.93 Fix mob block breaking AI not working correctly when chunk 0,0 is unloaded. Closes #8853 + - 41.0.92 Fix crash when breaking blocks with multipart models and remove caching. Closes #8850 + - 41.0.91 Fixed `CompositeModel.Baked.Builder.build()` passing arguments in the wrong order (#8846) + - 41.0.90 Make cutout mipmaps explicitly opt-in for item/entity rendering (#8845) + * Make cutout mipmaps explicitly opt-in for item/entity rendering + * Default render type domain to "minecraft" in model datagens + - 41.0.89 Fixed multipart block models not using the new model driven render type system. (#8844) + - 41.0.88 Update to the latest JarJar to fix a collision issue where multiple jars could provide an exact match. (#8847) + - 41.0.87 Add FML config to disable DFU optimizations client-side. (#8842) + * Add client-side command line argument to disable DFU optimizations. + * Switch to using FMLConfig value instead. + - 41.0.86 [1.19] Fixed broken BufferBuilder.putBulkData(ByteBuffer) added by Forge (#8819) + * Fixes BufferBuilder.putBulkData(ByteBuffer) + * use nextElementByte + * Fixed merge conflict + - 41.0.85 [1.19.x] Fix shulker boxes allowing input of items, that return false for Item#canFitInsideContainerItems, through hoppers. (#8823) + * Make ShulkerBoxBlockEntity#canPlaceItemThroughFace delegate to Item#canFitInsideContainerItems. + * Switch to using Or and add comment. + * Switch Or to And. + - 41.0.84 [1.19.x] Added RenderLevelStageEvent to replace RenderLevelLastEvent (#8820) + * Ported RenderLevelStageEvent from 1.18.2 + * Updated to fix merge conflicts + - 41.0.83 [1.19.x] Fix door datagenerator (#8821) + * Fix door datagenerator + Fix datagenerator for door blocks. Successor to #8687, addresses comments made there about statement complexity. + * Fix extra space around parameter + Fix extra space before comma around a parameter. + - 41.0.82 Create PieceBeardifierModifier to re-enable piecewise beardifier definitions (#8798) + - 41.0.81 Allow blocks to provide a dynamic MaterialColor for display on maps (#8812) + - 41.0.80 [1.19.x] BiomeTags Fixes/Improvements (#8711) + * dimension specific tag fix + * remove forge:is_beach cause vanilla has it already + * remove forge tags for new 1.19 vanilla tags (savanna, beach, overworld, end) + Co-authored-by: Flemmli97 <Flemmli97@users.noreply.github.com> + - 41.0.79 1.19 - Remove GlobalLootModifierSerializer and move to Codecs (#8721) + * convert GLM serializer class to codec + * cleanup + * GLM list needs to be sorted + * datagen + * simplify serialization + * fix test mods (oops) + * properly use suppliers for codec as they are registry obj + - 41.0.78 Implement item hooks for potions and enchantments (#8718) + * Implement item hooks for potions and enchantments + * code style fixes + - 41.0.77 Re-apply missing patch to ServerLevel.EntityCallbacks#onTrackingEnd() (#8828) + - 41.0.76 Double Bar Rendering fixed (#8806) (#8807) + * Double Bar Rendering fixed (#8806) + * Added requested changes by sciwhiz12 + - 41.0.75 Multiple tweaks and fixes to the recent changes in the client refactor PR (#8836) + * Add an easy way to get the NamedGuiOverlay from a vanilla overlay + * Fix static member ordering crash in UnitTextureAtlasSprite + * Allow boss bar rendering to be cancelled + * Make fluid container datagen use the new name + - 41.0.74 Add FogMode to ViewportEvent.RenderFog (#8825) + - 41.0.73 Provide additional context to the getFieldOfView event (#8830) + - 41.0.72 Pass renderType to IForgeBakedModel.useAmbientOcclusion (#8834) + - 41.0.71 Load custom ITransformationServices from the classpath in dev (#8818) + * Add a classpath transformer discoverer to load custom transformation services from the classpath + * Update ClasspathTransformerDiscoverer to 1.18 + * Update license year + * Update license header + * Fix the other license headers + * Update ClasspathTransformerDiscoverer to 1.19 + - 41.0.70 Handle modded packets on the network thread (#8703) + * Handle modded packets on the network thread + - On the server we simply need to remove the call to + ensureRunningOnSameThread. + - On the client side, we now handle the packet at the very start of the + call. We make sure we're running from a network thread to prevent + calling the handling code twice. + While this does mean we no longer call .release(), in practice this + doesn't cause any leaks as ClientboundCustomPayloadPacket releases + for us. + * Clarify behaviour a little in the documentation + * Javadoc formatting + * Add a helper method for handling packets on the main thread + Also rename the network thread one. Should make it clearer the expected + behaviour of the two, and make it clearer there's a potentially breaking + change. + * Add back consumer() methods + Also document EventNetworkChannel, to clarify the thread behaviour + there. + * Add since = "1.19" to deprecated annotations + - 41.0.69 Cache resource listing calls in resource packs (#8829) + * Make the resource lookups cached. + * Include configurability and handle patch cleanup. + * Document and comment the cache manager. + * Make thread selection configurable. + * Implement a configurable loading mechanic that falls back to default behaviour when the config is not bound yet. + * Use boolean supplier and fix wildcard import. + * Clean up the VPR since this is more elegant. + * Clean up the VPR since this is more elegant. + * Address review comments. + * Address more review comments. + * Fix formatting on `getSource` + * Address comments by ichtt + * Adapt to pups requests. + * Stupid idea. + * Attempt this again with a copy on write list. + * Fix a concurrency and loading issue. + * Fix #8813 + Checks if the paths are valid resource paths. + * Move the new methods on vanilla Patch. + - 41.0.68 Update SJH and JIJ + - 41.0.67 Fix #8833 (#8835) + - 41.0.66 Fix backwards fabulous check in SimpleBakedModel (#8832) + Yet another blunder we missed during the review of #8786. + - 41.0.65 Make texture atlas in StandaloneGeometryBakingContext configurable (#8831) + - 41.0.64 [1.19.X] Client code cleanup, updates, and other refactors (#8786) + * Revert "Allow safely registering RenderType predicates at any time (#8685)" + This reverts commit be7275443fd939db9c58bcad47079c3767789ac1. + * Renderable API refactors + - Rename "render values" to "context" + - Rename SimpleRenderable to CompositeRenderable to better reflect its use + - Remove IMultipartRenderValues since it doesn't have any real use + - Add extensive customization options to BakedModelRenderable + * ClientRegistry and MinecraftForgeClient refactors + - Add sprite loader manager and registration event + - Add spectator shader manager and registration event + - Add client tooltip factory manager and registration event + - Add recipe book manager and registration event + - Add key mapping registration event + - Remove ClientRegistry, as everything has been moved out of it + - Remove registration methods from MinecraftForgeClient, as they have dedicated events now + * Dimension special effects refactors + - Fold handlers into an extension class and remove public mutable fields + - Add dimension special effects manager and registration event + * HUD overlay refactors + - Rename to IGuiOverlay match vanilla (instead of Ingame) + - Add overlay manager and registration event + - Move vanilla overlays to a standalone enum + * Model loader refactors + - Rename IModelLoader to IGeometryLoader + - Add loader manager and registration event + - Fold all model events into one + - Move registration of additionally loaded models to an event + - Remove ForgeModelBakery and related classes as they served no purpose anymore + * Render properties refactors + - Rename all render properties to client extensions and relocate accordingly + - Move lookups to the respective interfaces + * Model data refactors + - Convert model data to a final class backed by an immutable map and document mutability requirements. This addresses several thread-safety issues in the current implementation which could result in race conditions + - Transfer ownership of the data manager to the client level. This addresses several issues that arise when multiple levels are used at once + * GUI and widget refactors + - Move all widgets to the correct package + - Rename GuiUtils and children to match vanilla naming + * New vertex pipeline API + - Move to vanilla's VertexConsumer + - Roll back recent PR making VertexConsumer format-aware. This is the opposite of what vanilla does, and should not be relevant with the updated lighting pipeline + * Lighting pipeline refactors + - Move to dedicated lighting package + - Separate flat and smooth lighters + - Convert from a vertex pipeline transformer to a pure vertex source (input is baked quads) + * Model geometry API refactors + - Rename IModelGeometry to IUnbakedGeometry + - Rename IModelConfiguration to IGeometryBakingContext + - Rename other elements to match vanilla naming + - Remove current changes to ModelState, as they do not belong there. Transforms should be specified through vanilla's system. ModelState is intended to transfer state from the blockstate JSON + - Remove multipart geometries and geometry parts. After some discussion, these should not be exposed. Instead, geometries should be baked with only the necessary parts enabled + * Make render types a first-class citizen in baked models + - Add named render types (block + entity + fabulous entity) + - Add named render type manager + registration event + - Make BakedModel aware of render types and transfer control over which ones are used to it instead of ItemBlockRenderTypes (fallback) + - (additional) Add concatenated list view. A wrapper for multiple lists that iterates through them in order without the cost of merging them. Useful for merging lists of baked quads + * General event refactors + - Several renames to either match vanilla or improve clarity + - Relocate client chat event dispatching out of common code + * Forge model type refactors + - Rename SeparatePerspectiveModel to SeparateTransformsModel + - Rename ItemModelMesherForge to ForgeItemModelShaper + - Rename DynamicBucketModel to DynamicFluidContainerModel + - Prefix all OBJ-related classes with "Obj" and decouple parsing from construction + - Extract ElementsModel from model loader registry + - Add EmptyModel (baked, unbaked and loader) + - Refactor CompositeModel to take over ItemMultiLayerBakedModel + - Remove FluidModel as it's not used and isn't compatible with the new fluid rendering in modern versions + - Move model loader registration to a proper event handler + - Update names of several JSON fields (backwards-compatible) + - Update datagens to match + * Miscellaneous changes and overlapping patches + - Dispatch all new registration events + - Convert ExtendedServerListData to a record + - Add/remove hooks from ForgeHooksClient as necessary + * Update test mods + * Fix VertexConsumerWrapper returning parent instead of itself + * Additional event cleanup pass + As discussed on Discord: + - Remove "@hidden" and "@see <callsite>" javadoc annotations from all client events and replace them with @ApiStatus.Internal annotation + - Make all events that shouldn't be fired directly into abstract classes with protected constructors + - Another styling pass, just in case (caught some missed classes) + * Add proper deprecation javadocs and de-dupe some vertex consumer code + * Replace sets of chunk render types with a faster BitSet-backed collection + This largely addresses potential performance concerns that using a plain HashSet might involve by making lookups and iteration as linear as they can likely be (aside from using a plain byte/int/long for bit storage). Further performance concerns related to the implementation may be addressed separately, as all the implementation details are hidden from the end user + * Requested changes + - Remove MinecraftForgeClient and move members to Minecraft, IForgeMinecraft and StencilManager + - Allow non-default elements to be passed into VertexConsumer and add support to derived classes + - Move array instantiation out of quad processing in lighting pipeline + - Fix flipped fluid container model + - Set default UV1 to the correct values in the remapping pipeline + - Minor documentation changes + * Add/update EXC entries and fix AT comment + * Add test mod as per Orion's request + * Additional requested changes + * Allow custom model types to request the particle texture to be loaded + * Even more requested changes + * Improve generics in ConcatenatedListView and add missing fallbacks + * Fix fluid render types being bound to the fluid and not its holder + * Remove non-contractual nullability in ChunkRenderTypeSet and add isEmpty + Additionally, introduce chunk render type checks in ItemBlockRenderTypes + Co-authored-by: Dennis C <xfacthd@gmx.de> + - 41.0.63 Implement full support for IPv6 (#8742) + - 41.0.62 Fix certain user-configured options being overwritten incorrectly due to validators. (#8780) + - 41.0.61 Allow safely registering RenderType predicates at any time (#8685) + - 41.0.60 Fix crash after loading error due to fluid texture gathering and config lookup (#8802) + - 41.0.59 Remove the configuration option for handling empty tags in ingredients. (#8799) + Now empty tags are considered broken in all states. + - 41.0.58 Fix MC-105317 Structure blocks do not rotate entities correctly when loading (#8792) + - 41.0.57 Fire ChunkWatchEvents after sending packets (#8747) + - 41.0.56 Add item handler capability to chest boats (#8787) + - 41.0.55 Add getter for correct BiomeSpecialEffectsBuilder to BiomeInfo$Builder (#8781) + - 41.0.54 Fix BlockToolModificationEvent missing cancelable annotation (#8778) + - 41.0.53 Fix ticking chunk tickets from forge's chunk manager not causing chunks to fully tick (#8775) + - 41.0.52 Fix default audio device config loading string comparison issue (#8767) + - 41.0.51 Fix missed vanilla method overrides in ForgeRegistry (#8766) + - 41.0.50 Add MinecraftServer reference to ServerTickEvent (#8765) + - 41.0.49 Fix TagsProviders for datapack registries not recognizing existing files (#8761) + - 41.0.48 Add callback after a BlockState was changed and the neighbors were updated (#8686) + - 41.0.47 Add biome tag entries for 1.19 biomes (#8684) + - 41.0.46 Make fishing rods use tool actions for relevant logic (#8681) + - 41.0.45 Update BootstrapLauncher to 1.1.1 and remove the forced + merge of text2speech since new BSL does it. + - 41.0.44 Merge text2speech libs together so the natives are part of the jar + - 41.0.43 Make Forge ConfigValues implement Supplier. (#8776) + - 41.0.42 Fix merge derp in AbstractModProvider and logic derp in ModDiscoverer + - 41.0.41 Add "send to mods in order" method to ModList and use it (#8759) + * Add "send to mods in order" method to ModList and use it in RegistryEvents and DataGen.. + * Also preserve order in runAll + * Do better comparator thanks @pupnewfster + * postEvent as well. + - 41.0.40 Update SJH to 2.0.2.. (#8774) + * Update SJH to 2.0.3.. + - 41.0.39 Sanity check the version specified in the mod file (#8749) + * Sanity check the version specified in the mod file to + make sure it's compatible with JPMS standards for + version strings. + Closes #8748 + Requires SPI 6 + - 41.0.38 Fix SP-Devtime world loading crash due to missing server configs (#8757) + - 41.0.37 Remove ForgeWorldPreset and related code (#8756) + Vanilla has a working replacement. + - 41.0.36 Change ConfigValue#get() to throw if called before config loaded (#8236) + This prevents silent issues where a mod gets the value of the setting + before configs are loaded, which means the default value is always + returned. + As there may be situations where the getting the config setting before + configs are loaded is needed, and it is not preferable to hardcode the + default value, the original behavior is made available through #getRaw. + Implements and closes #7716 + * Remove getRaw() method + This is effectively replaced with the expression `spec.isLoaded() ? + configValue.get() : configValue.getDefault()`. + * Remove forceSystemNanoTime config setting + As implemented, it never had any effect as any place where the config + value would be queried happens before the configs are loaded. + - 41.0.35 Fix EnumArgument to use enum names for suggestions (#8728) + Previously, the suggestions used the string representation of the enum + through Enum#toString, which can differ from the name of the enum as + required by Enum#valueOf, causing invalid suggestions (both in gui and + through the error message). + - 41.0.34 Jar-In-Jar (#8715) + - 41.0.33 [1.19] Fix data-gen output path of custom data-pack registries (#8724) + - 41.0.32 Fix player dive and surface animations in custom fluids (#8738) + - 41.0.31 [1.19.x] Affect ItemEntity Motion in Custom Fluids (#8737) + - 41.0.30 [1.19] Add support for items to add enchantments without setting them in NBT (#8719) + - 41.0.29 [1.19.x] Add stock biome modifier types for adding features and spawns (#8697) + - 41.0.28 [1.19.x] Fluid API Overhaul (#8695) + - 41.0.27 Replace StructureSpawnListGatherEvent with StructureModifiers (#8717) + - 41.0.26 Use stack sensitive translation key by default for FluidAttributes. (#8707) + - 41.0.25 Delete LootItemRandomChanceCondition which added looting bonus enchantment incorrectly. (#8733) + - 41.0.24 Update EventBus to 6.0, ModLauncher to 10.0.1 and BootstrapLauncher to 1.1 (#8725) + - 41.0.23 Replace support bot with support action (#8700) + - 41.0.22 Fix Reach Distance / Attack Range being clamped at 6.0 (#8699) + - 41.0.21 [1.19.x] Fix mods' worldgen data not being loaded when creating new singleplayer worlds (#8693) + - 41.0.20 [1.19.x] Fix experimental confirmation screen (#8727) + - 41.0.19 Move is_mountain to forge's tag instead of vanilla's (#8726) + - 41.0.18 [1.19.x] Add CommandBuildContext to Register Command Events (#8716) + - 41.0.17 Only rewrite datagen cache when needed (#8709) + - 41.0.16 Implement a simple feature system for Forge (#8670) + * Implement a simple feature system for Forge. Allows mods to demand certain features are available in the loading system. An example for java_version is provided, but not expected to be used widely. This is more targeted to properties of the display, such as GL version and glsl profile. + Requires https://github.com/MinecraftForge/ForgeSPI/pull/13 to be merged first in ForgeSPI, and the SPI to be updated appropriately in build.gradle files. + * rebase onto 1.19 and add in SPI update + - 41.0.15 displayTest option in mods.toml (#8656) + * displayTest option in mods.toml + * "MATCH_VERSION" (or none) is existing match version string behaviour + * "IGNORE_SERVER_VERSION" accepts anything and sends special SERVERONLY string + * "IGNORE_ALL_VERSION" accepts anything and sends an empty string + * "NONE" allows the mod to supply their own displaytest using the IExtensionPoint mechanism. + * Update display test with feedback and added the mods.toml discussion in mdk. + - 41.0.14 Update forgeSPI to v5 (#8696) + - 41.0.13 Make IVertexConsumers such as the lighting pipeline, be aware of which format they are dealing with. (#8692) + Also fix Lighting pipeline ignoring the overlay coords from the block renderer. + - 41.0.12 Fixed misaligned patch to invalidateCaps in Entity (#8705) + - 41.0.11 Fix readAdditionalLevelSaveData (#8704) + - 41.0.10 Fixes setPos to syncPacketPositionCodec (#8702) + - 41.0.9 Fix wrong param passed to PlayLevelSoundEvent.AtEntity (#8688) + - 41.0.8 Override initialize in SlotItemHandler, so it uses the itemhandler instead of container (#8679) + - 41.0.7 Update MDK for 1.19 changes (#8675) + - 41.0.6 Add helper to RecipeType, and fix eclipse compiler error in test class. + - 41.0.5 Update modlauncher to latest (#8691) + - 41.0.4 Fix getting entity data serializer id crashing due to improper port to new registry system (#8678) + - 41.0.3 Fire registry events in the order vanilla registers to registries (#8677) + Custom registries are still fired in alphabetical order, after all vanilla registries. + Move forge's data_serializers registry to forge namespace. + - 41.0.2 Add method with pre/post wrap to allow setting/clearing mod context. (#8682) + Fixes ActiveContainer in ModContext not being present in registry events. Closes #8680 + - 41.0.1 Fix the Curlie oopsie + - 41.0.0 Forge 1.19 + * Bump pack.mcmeta formats + * 1.19 biome modifiers + * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable + * Add docs and package-info to client extension interfaces package + * Move RenderBlockOverlayEvent hooks to ForgeHooksClient + * Add package-infos to client events package + * Rename SoundLoadEvent to SoundEngineLoadEvent + This reduces confusion from consumers which may think the + name SoundLoadEvent refers to an individual sound being loaded rather + than the sound engine. + * Document and change SoundLoadEvent to fire on mod bus + Previously, it fired on both the mod bus and the Forge bus, which is + confusing for consumers. + * Delete SoundSetupEvent + Looking at its original implementation shows that there isn't an + appropriate place in the new sound code to reinsert the event, and the + place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. + * Perform some cleanup on client events + - Removed nullable annotations from ClientPlayerNetworkEvent + - Renamed #getPartialTicks methods to #getPartialTick, to be consistent + with vanilla's naming of the partial tick + - Cleanup documentation to remove line breaks, use the + spelling 'cancelled' over + 'canceled', and improve docs on existing and + new methods. + * Remove EntityEvent.CanUpdate + Closes MinecraftForge/MinecraftForge#6394 + * Switch to Jetbrains nullability annotations + * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent + * Remove ForgeWorldPresetScreens + * Remove IForgeRegistryEntry + * Remove use of List<Throwable> in FML's CompletableFutures + * Add docs to mod loading stages, stages, and phases + * Gradle 7.4.2 + * Use SLF4J in FMLLoader and other subprojects + * Switch dynamic versions in subprojects to pinned ones + * Switch ForgeRoot and MDK to FG plugin markers + * Configure Forge javadoc task + The task now uses a custom stylesheet with MCForge elements, and + configured to combine the generation from the four FML subprojects + (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project + into the javadoc output. + * Update docs/md files, for 1.19 update and the move away from IRC to Discord. + * Make "Potentially dangerous alternative prefix" a debug warning, not info. + Co-authored-by: Curle <curle@gemwire.uk> + Co-authored-by: sciwhiz12 <arnoldnunag12@gmail.com> + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..c4c7276 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,7 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false + +mc_version=1.19.2 +jei_version=11.5.0.297 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..a69d9cb --- /dev/null +++ b/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# 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 ;; #( + MSYS* | 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" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f127cfd --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@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 Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +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 execute + +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 + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..3703f36 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,6 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { url = 'https://maven.minecraftforge.net/' } + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/SiegeMachines.java b/src/main/java/ru/magistu/siegemachines/SiegeMachines.java new file mode 100644 index 0000000..924a3dd --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/SiegeMachines.java @@ -0,0 +1,89 @@ +package ru.magistu.siegemachines; + +import net.minecraftforge.fml.event.lifecycle.*; +import ru.magistu.siegemachines.block.ModBlocks; +import ru.magistu.siegemachines.client.ClientProxy; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.data.recipes.ModRecipes; +import ru.magistu.siegemachines.entity.EntityTypes; +import ru.magistu.siegemachines.gui.ModMenuTypes; +import ru.magistu.siegemachines.item.ModItems; +import ru.magistu.siegemachines.network.PacketHandler; +import ru.magistu.siegemachines.proxy.IProxy; +import ru.magistu.siegemachines.server.ServerProxy; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.UUID; + +// The value here should match an entry in the META-INF/mods.toml file +@Mod(SiegeMachines.ID) +public class SiegeMachines { + public static final String ID = "siegemachines"; + + public static final IProxy PROXY = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> ServerProxy::new); + public static final int RENDER_UPDATE_RANGE = 128; + public static final int RENDER_UPDATE_TIME = 20; + public static final int RENDER_UPDATE_RANGE_SQR = RENDER_UPDATE_RANGE * RENDER_UPDATE_RANGE; + + // Directly reference a log4j logger. + private static final Logger LOGGER = LogManager.getLogger(); + + IEventBus eventBus; + + + public SiegeMachines() + { + eventBus = FMLJavaModLoadingContext.get().getModEventBus(); + + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); + + EntityTypes.register(eventBus); + SoundTypes.register(eventBus); + ModMenuTypes.register(eventBus); + ModBlocks.register(eventBus); + ModItems.register(eventBus); + ModRecipes.register(eventBus); + + PacketHandler.init(); + + MinecraftForge.EVENT_BUS.register(this); + } + + + private void setup(final FMLCommonSetupEvent event) + { + + } + + private void doClientStuff(final FMLClientSetupEvent event) + { + PROXY.clientSetup(event); + } + + private void enqueueIMC(final InterModEnqueueEvent event) + { + + } + + private void processIMC(final InterModProcessEvent event) + { + + } + + // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD + // Event bus for receiving Registry Events) + @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) + public static class RegistryEvents + { + + } +} diff --git a/src/main/java/ru/magistu/siegemachines/block/ModBlocks.java b/src/main/java/ru/magistu/siegemachines/block/ModBlocks.java new file mode 100644 index 0000000..29dfc2d --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/block/ModBlocks.java @@ -0,0 +1,50 @@ +package ru.magistu.siegemachines.block; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.*; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.function.Supplier; + +public class ModBlocks +{ + public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, SiegeMachines.ID); + + public static final RegistryObject<SiegeWorkbench> SIEGE_WORKBENCH = registerBlock("siege_workbench", () -> new SiegeWorkbench(BlockBehaviour.Properties.copy(Blocks.CRAFTING_TABLE).noOcclusion()), ModItems.GROUP_SM); + + private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab, String tooltipKey) { + return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), + new Item.Properties().tab(tab)) { + @Override + public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltip, TooltipFlag pFlag) { + pTooltip.add(Component.translatable(tooltipKey)); + } + }); + } + + private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block, CreativeModeTab tab) { + RegistryObject<T> toReturn = BLOCKS.register(name, block); + registerBlockItem(name, toReturn, tab); + return toReturn; + } + + private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab) { + return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), + new Item.Properties().tab(tab))); + } + + public static void register(IEventBus eventBus) { + BLOCKS.register(eventBus); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/block/SiegeWorkbench.java b/src/main/java/ru/magistu/siegemachines/block/SiegeWorkbench.java new file mode 100644 index 0000000..3650ae3 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/block/SiegeWorkbench.java @@ -0,0 +1,51 @@ +package ru.magistu.siegemachines.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.CraftingTableBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraftforge.network.NetworkHooks; +import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.NotNull; +import ru.magistu.siegemachines.gui.workbench.SiegeWorkbenchContainer; + +public class SiegeWorkbench extends CraftingTableBlock +{ + private static final Component CONTAINER_TITLE = Component.translatable("container.crafting"); + + public SiegeWorkbench(Properties p_i48422_1_) + { + super(p_i48422_1_); + } + + public @NotNull InteractionResult use(@NotNull BlockState blockstate, Level level, @NotNull BlockPos blockpos, @NotNull Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult result) + { + if (level.isClientSide) + { + return InteractionResult.SUCCESS; + } + else + { + NetworkHooks.openScreen((ServerPlayer) player, this.getMenuProvider(blockstate, level, blockpos)); + return InteractionResult.CONSUME; + } + } + + @Override + public MenuProvider getMenuProvider(@NotNull BlockState blockstate, @NotNull Level level, @NotNull BlockPos blockpos) + { + return new SimpleMenuProvider((p_220270_2_, p_220270_3_, p_220270_4_) -> + new SiegeWorkbenchContainer(p_220270_2_, p_220270_3_, ContainerLevelAccess.create(level, blockpos)), CONTAINER_TITLE); + } + + +} diff --git a/src/main/java/ru/magistu/siegemachines/client/ClientListener.java b/src/main/java/ru/magistu/siegemachines/client/ClientListener.java new file mode 100644 index 0000000..6a8bdf6 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/ClientListener.java @@ -0,0 +1,28 @@ +package ru.magistu.siegemachines.client; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.renderer.*; +import ru.magistu.siegemachines.entity.EntityTypes; +import net.minecraft.client.renderer.entity.ThrownItemRenderer; +import net.minecraftforge.client.event.EntityRenderersEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = SiegeMachines.ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class ClientListener +{ + @SubscribeEvent + public static void registerRenderers(final EntityRenderersEvent.RegisterRenderers event) + { + event.registerEntityRenderer(EntityTypes.MORTAR.get(), MortarGeoRenderer::new); + event.registerEntityRenderer(EntityTypes.CULVERIN.get(), CulverinGeoRenderer::new); + event.registerEntityRenderer(EntityTypes.TREBUCHET.get(), TrebuchetGeoRenderer::new); + event.registerEntityRenderer(EntityTypes.CATAPULT.get(), CatapultGeoRenderer::new); + event.registerEntityRenderer(EntityTypes.BALLISTA.get(), BallistaGeoRenderer::new); + event.registerEntityRenderer(EntityTypes.BATTERING_RAM.get(), BatteringRamGeoRenderer::new); + + event.registerEntityRenderer(EntityTypes.CANNONBALL.get(), ThrownItemRenderer::new); + event.registerEntityRenderer(EntityTypes.STONE.get(), ThrownItemRenderer::new); + event.registerEntityRenderer(EntityTypes.GIANT_ARROW.get(), GiantArrowRenderer::new); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/ClientProxy.java b/src/main/java/ru/magistu/siegemachines/client/ClientProxy.java new file mode 100644 index 0000000..3bb1843 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/ClientProxy.java @@ -0,0 +1,25 @@ +package ru.magistu.siegemachines.client; + +import ru.magistu.siegemachines.gui.ModMenuTypes; +import ru.magistu.siegemachines.gui.workbench.SiegeWorkbenchScreen; +import ru.magistu.siegemachines.gui.machine.MachineInventoryScreen; +import ru.magistu.siegemachines.proxy.IProxy; +import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; + +public class ClientProxy implements IProxy +{ + public void setup(IEventBus modEventBus, IEventBus forgeEventBus) + { + modEventBus.addListener(this::clientSetup); + } + + public void clientSetup(FMLClientSetupEvent event) + { + MenuScreens.register(ModMenuTypes.MACHINE_CONTAINER.get(), MachineInventoryScreen::new); + MenuScreens.register(ModMenuTypes.SIEGE_WORKBENCH_CONTAINER.get(), SiegeWorkbenchScreen::new); + } + + public void onPreInit() {} +} diff --git a/src/main/java/ru/magistu/siegemachines/client/KeyBindings.java b/src/main/java/ru/magistu/siegemachines/client/KeyBindings.java new file mode 100644 index 0000000..2c70709 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/KeyBindings.java @@ -0,0 +1,10 @@ +package ru.magistu.siegemachines.client; + +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.client.KeyMapping; + +public class KeyBindings +{ + public static KeyMapping MACHINE_USE = new KeyMapping(SiegeMachines.ID + ".machine_use", 70, SiegeMachines.ID + ".category"); + public static KeyMapping MACHINE_INVENTORY = new KeyMapping(SiegeMachines.ID + ".machine_inventory", 73, SiegeMachines.ID + ".category"); +} diff --git a/src/main/java/ru/magistu/siegemachines/client/SoundTypes.java b/src/main/java/ru/magistu/siegemachines/client/SoundTypes.java new file mode 100644 index 0000000..e6962d4 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/SoundTypes.java @@ -0,0 +1,43 @@ +package ru.magistu.siegemachines.client; + +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class SoundTypes +{ + public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, + SiegeMachines.ID); + + public static RegistryObject<SoundEvent> TREBUCHET_SHOOTING = SOUNDS.register("trebuchet_shooting", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "trebuchet_shooting"))); + public static RegistryObject<SoundEvent> TREBUCHET_RELOADING = SOUNDS.register("trebuchet_reloading", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "trebuchet_reloading"))); + public static RegistryObject<SoundEvent> CATAPULT_SHOOTING = SOUNDS.register("catapult_shooting", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "catapult_shooting"))); + public static RegistryObject<SoundEvent> CATAPULT_RELOADING = SOUNDS.register("catapult_reloading", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "catapult_reloading"))); + public static RegistryObject<SoundEvent> BALLISTA_SHOOTING = SOUNDS.register("ballista_shooting", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "ballista_shooting"))); + public static RegistryObject<SoundEvent> BALLISTA_RELOADING = SOUNDS.register("ballista_reloading", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "ballista_reloading"))); + public static RegistryObject<SoundEvent> MORTAR_SHOOTING = SOUNDS.register("mortar_shooting", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "mortar_shooting"))); + public static RegistryObject<SoundEvent> FUSE = SOUNDS.register("fuse", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "fuse"))); + public static RegistryObject<SoundEvent> CANNON_WHEELS = SOUNDS.register("cannon_wheels", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "cannon_wheels"))); + public static RegistryObject<SoundEvent> RAM_WHEELS = SOUNDS.register("ram_wheels", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "ram_wheels"))); + public static RegistryObject<SoundEvent> RAM_HITTING = SOUNDS.register("ram_hitting", + () -> new SoundEvent(new ResourceLocation(SiegeMachines.ID, "ram_hitting"))); + + public static void register(IEventBus eventBus) + { + SOUNDS.register(eventBus); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/BallistaGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/BallistaGeoRenderer.java new file mode 100644 index 0000000..16c0a0a --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/BallistaGeoRenderer.java @@ -0,0 +1,52 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.client.renderer.model.MachineModel; +import ru.magistu.siegemachines.entity.machine.Ballista; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib3.geo.render.built.GeoBone; +import software.bernie.geckolib3.geo.render.built.GeoModel; +import software.bernie.geckolib3.model.provider.GeoModelProvider; + +import java.util.Optional; + +public class BallistaGeoRenderer extends MachineGeoRenderer<Ballista> { + public BallistaGeoRenderer(EntityRendererProvider.Context renderManager) + { + super(renderManager, new MachineModel<>("ballista")); + } + + @Override + public RenderType getRenderType(Ballista animatable, float partialTicks, PoseStack stack, + MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, + ResourceLocation textureLocation) + { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } + + @Override + public void renderEarly(Ballista animatable, PoseStack stackIn, float ticks, MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float partialTicks) + { + GeoModelProvider<Ballista> modelProvider = this.getGeoModelProvider(); + GeoModel model = modelProvider.getModel(modelProvider.getModelResource(animatable)); + + Optional<GeoBone> turret = model.getBone("Balliste"); + turret.ifPresent(bone -> bone.setRotationX(-animatable.getTurretPitch() * (float) Math.PI / 180.0f)); + turret.ifPresent(bone -> bone.setRotationY(-animatable.getTurretYaw() * (float) Math.PI / 180.0f)); + + Optional<GeoBone> projectile = model.getBone("BallistaArrow"); + projectile.ifPresent(bone -> bone.setRotationX(-animatable.getTurretPitch() * (float) Math.PI / 180.0f)); + projectile.ifPresent(bone -> bone.setRotationY(-animatable.getTurretYaw() * (float) Math.PI / 180.0f)); + boolean shouldrender = ((animatable.useticks <= 0 && animatable.shootingticks <= 0) || (animatable.useticks > 0 && animatable.shootingticks > 0)) && animatable.delayticks <= 0; + int projectilesize = shouldrender && animatable.hasAmmo() ? 1 : 0; + projectile.ifPresent(bone -> bone.setScaleX(projectilesize)); + projectile.ifPresent(bone -> bone.setScaleY(projectilesize)); + projectile.ifPresent(bone -> bone.setScaleZ(projectilesize)); + + super.renderEarly(animatable, stackIn, ticks, renderTypeBuffer, vertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, partialTicks); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/BallistaItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/BallistaItemGeoRenderer.java new file mode 100644 index 0000000..db6a893 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/BallistaItemGeoRenderer.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; + +public class BallistaItemGeoRenderer extends MachineItemGeoRenderer +{ + public BallistaItemGeoRenderer() + { + super(new MachineItemModel<>("ballista")); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/BatteringRamGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/BatteringRamGeoRenderer.java new file mode 100644 index 0000000..4d1fa9d --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/BatteringRamGeoRenderer.java @@ -0,0 +1,26 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.client.renderer.model.MachineModel; +import ru.magistu.siegemachines.entity.machine.BatteringRam; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; + +public class BatteringRamGeoRenderer extends MachineGeoRenderer<BatteringRam> +{ + public BatteringRamGeoRenderer(EntityRendererProvider.Context renderManager) + { + super(renderManager, new MachineModel<>("battering_ram")); + } + + @Override + public RenderType getRenderType(BatteringRam animatable, float partialTicks, PoseStack stack, + MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, + ResourceLocation textureLocation) + { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/BatteringRamItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/BatteringRamItemGeoRenderer.java new file mode 100644 index 0000000..87c9d91 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/BatteringRamItemGeoRenderer.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; + +public class BatteringRamItemGeoRenderer extends MachineItemGeoRenderer +{ + public BatteringRamItemGeoRenderer() + { + super(new MachineItemModel<>("battering_ram")); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/CatapultGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/CatapultGeoRenderer.java new file mode 100644 index 0000000..23a36be --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/CatapultGeoRenderer.java @@ -0,0 +1,26 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.client.renderer.model.MachineModel; +import ru.magistu.siegemachines.entity.machine.Catapult; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; + +public class CatapultGeoRenderer extends MachineGeoRenderer<Catapult> +{ + public CatapultGeoRenderer(EntityRendererProvider.Context renderManager) + { + super(renderManager, new MachineModel<>("catapult")); + } + + @Override + public RenderType getRenderType(Catapult animatable, float partialTicks, PoseStack stack, + MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, + ResourceLocation textureLocation) + { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/CatapultItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/CatapultItemGeoRenderer.java new file mode 100644 index 0000000..2124f54 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/CatapultItemGeoRenderer.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; + +public class CatapultItemGeoRenderer extends MachineItemGeoRenderer +{ + public CatapultItemGeoRenderer() + { + super(new MachineItemModel<>("catapult")); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/CulverinGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/CulverinGeoRenderer.java new file mode 100644 index 0000000..c8cc7d2 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/CulverinGeoRenderer.java @@ -0,0 +1,26 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.client.renderer.model.MachineModel; +import ru.magistu.siegemachines.entity.machine.Culverin; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; + +public class CulverinGeoRenderer extends MachineGeoRenderer<Culverin> +{ + public CulverinGeoRenderer(EntityRendererProvider.Context renderManager) + { + super(renderManager, new MachineModel<>("culverin")); + } + + @Override + public RenderType getRenderType(Culverin animatable, float partialTicks, PoseStack stack, + MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, + ResourceLocation textureLocation) + { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/CulverinItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/CulverinItemGeoRenderer.java new file mode 100644 index 0000000..e6a181b --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/CulverinItemGeoRenderer.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; + +public class CulverinItemGeoRenderer extends MachineItemGeoRenderer +{ + public CulverinItemGeoRenderer() + { + super(new MachineItemModel<>("culverin")); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/GiantArrowRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/GiantArrowRenderer.java new file mode 100644 index 0000000..3536be3 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/GiantArrowRenderer.java @@ -0,0 +1,54 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.renderer.model.GiantArrowModel; +import ru.magistu.siegemachines.entity.projectile.GiantArrow; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import org.jetbrains.annotations.NotNull; + +@OnlyIn(Dist.CLIENT) +public class GiantArrowRenderer extends EntityRenderer<GiantArrow> +{ + public static final ResourceLocation TEXTURE_LOCATION = new ResourceLocation(SiegeMachines.ID, "textures/entity/giant_arrow.png"); +// public static final ResourceLocation TEXTURE_LOCATION = new ResourceLocation("textures/entity/projectiles/arrow.png"); + + public GiantArrowModel model = new GiantArrowModel(GiantArrowModel.createModel()); + + public GiantArrowRenderer(EntityRendererProvider.Context p_i46547_1_) + { + super(p_i46547_1_); + } + + @Override + public @NotNull ResourceLocation getTextureLocation(@NotNull GiantArrow p_110775_1_) + { + return TEXTURE_LOCATION; + } + + public void render(@NotNull GiantArrow giantarrow, float p_225623_2_, float p_225623_3_, @NotNull PoseStack matrixstack, @NotNull MultiBufferSource buffer, int n) + { + matrixstack.pushPose(); + matrixstack.scale(-1.0F, -1.0F, -1.0F); + float f = Mth.lerp(p_225623_3_, giantarrow.yRotO, giantarrow.getYRot()); + float f1 = -Mth.lerp(p_225623_3_, giantarrow.xRotO, giantarrow.getXRot()); + float f2 = (float) giantarrow.shakeTime - p_225623_3_; + if (f2 > 0.0F) + { + f1 -= Mth.sin(f2 * 3.0F) * f2; + } + VertexConsumer ivertexbuilder = buffer.getBuffer(this.model.renderType(this.getTextureLocation(giantarrow))); + this.model.setupAnim(0.0F, f, f1); + this.model.renderToBuffer(matrixstack, ivertexbuilder, n, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + matrixstack.popPose(); + super.render(giantarrow, p_225623_2_, p_225623_3_, matrixstack, buffer, n); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/MachineGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/MachineGeoRenderer.java new file mode 100644 index 0000000..e21ba44 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/MachineGeoRenderer.java @@ -0,0 +1,21 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; + +public abstract class MachineGeoRenderer<T extends Machine & IAnimatable> extends GeoEntityRenderer<T> +{ + protected MachineGeoRenderer(EntityRendererProvider.Context rendermanager, AnimatedGeoModel<T> model) + { + super(rendermanager, model); + } + + @Override + protected float getDeathMaxRotation(T entity) + { + return 0.0F; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/MachineItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/MachineItemGeoRenderer.java new file mode 100644 index 0000000..4a4efb4 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/MachineItemGeoRenderer.java @@ -0,0 +1,12 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import ru.magistu.siegemachines.item.MachineItem; +import software.bernie.geckolib3.renderers.geo.GeoItemRenderer; + +public class MachineItemGeoRenderer extends GeoItemRenderer<MachineItem> { + public MachineItemGeoRenderer(MachineItemModel<MachineItem> model) + { + super(model); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/MortarGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/MortarGeoRenderer.java new file mode 100644 index 0000000..74ef898 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/MortarGeoRenderer.java @@ -0,0 +1,44 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.client.renderer.model.MachineModel; +import ru.magistu.siegemachines.entity.machine.Mortar; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib3.geo.render.built.GeoBone; +import software.bernie.geckolib3.geo.render.built.GeoModel; +import software.bernie.geckolib3.model.provider.GeoModelProvider; + +import java.util.Optional; + +public class MortarGeoRenderer extends MachineGeoRenderer<Mortar> +{ + public MortarGeoRenderer(EntityRendererProvider.Context renderManager) + { + super(renderManager, new MachineModel<>("mortar")); + } + + @Override + public RenderType getRenderType(Mortar animatable, float partialTicks, PoseStack stack, + MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, + ResourceLocation textureLocation) + { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } + + @Override + public void renderEarly(Mortar animatable, PoseStack stackIn, float ticks, MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float partialTicks) + { + GeoModelProvider<Mortar> modelProvider = this.getGeoModelProvider(); + GeoModel model = modelProvider.getModel(modelProvider.getModelResource(animatable)); + + Optional<GeoBone> bone0 = model.getBone("Barrel"); + bone0.ifPresent(bone -> bone.setRotationX(-animatable.getTurretPitch() * (float) Math.PI / 180.0f)); + bone0.ifPresent(bone -> bone.setRotationY(-animatable.getTurretYaw() * (float) Math.PI / 180.0f)); + + super.renderEarly(animatable, stackIn, ticks, renderTypeBuffer, vertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, partialTicks); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/MortarItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/MortarItemGeoRenderer.java new file mode 100644 index 0000000..0db8564 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/MortarItemGeoRenderer.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; + +public class MortarItemGeoRenderer extends MachineItemGeoRenderer +{ + public MortarItemGeoRenderer() + { + super(new MachineItemModel<>("mortar")); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/TrebuchetGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/TrebuchetGeoRenderer.java new file mode 100644 index 0000000..0745925 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/TrebuchetGeoRenderer.java @@ -0,0 +1,46 @@ +package ru.magistu.siegemachines.client.renderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import ru.magistu.siegemachines.client.renderer.model.MachineModel; +import ru.magistu.siegemachines.entity.machine.Trebuchet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib3.geo.render.built.GeoBone; +import software.bernie.geckolib3.geo.render.built.GeoModel; +import software.bernie.geckolib3.model.provider.GeoModelProvider; + +import java.util.Optional; + +public class TrebuchetGeoRenderer extends MachineGeoRenderer<Trebuchet> +{ + public TrebuchetGeoRenderer(EntityRendererProvider.Context renderManager) + { + super(renderManager, new MachineModel<>("trebuchet")); + } + + @Override + public RenderType getRenderType(Trebuchet animatable, float partialTicks, PoseStack stack, + MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, + ResourceLocation textureLocation) + { + return RenderType.entityTranslucent(getTextureLocation(animatable)); + } + + @Override + public void renderEarly(Trebuchet animatable, PoseStack stackIn, float ticks, MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float partialTicks) + { + GeoModelProvider<Trebuchet> modelProvider = this.getGeoModelProvider(); + GeoModel model = modelProvider.getModel(modelProvider.getModelResource(animatable)); + + Optional<GeoBone> projectile = model.getBone("Cobblestone"); + int projectilesize = (animatable.state == Trebuchet.State.IDLE_RELOADED || animatable.shootingticks > 0) && animatable.hasAmmo() ? 1 : 0; + projectile.ifPresent(bone -> bone.setScaleX(projectilesize)); + projectile.ifPresent(bone -> bone.setScaleY(projectilesize)); + projectile.ifPresent(bone -> bone.setScaleZ(projectilesize)); + + super.renderEarly(animatable, stackIn, ticks, renderTypeBuffer, vertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, partialTicks); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/TrebuchetItemGeoRenderer.java b/src/main/java/ru/magistu/siegemachines/client/renderer/TrebuchetItemGeoRenderer.java new file mode 100644 index 0000000..ae1271e --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/TrebuchetItemGeoRenderer.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.client.renderer; + +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; + +public class TrebuchetItemGeoRenderer extends MachineItemGeoRenderer +{ + public TrebuchetItemGeoRenderer() + { + super(new MachineItemModel<>("trebuchet")); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java b/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java new file mode 100644 index 0000000..036c5a7 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java @@ -0,0 +1,45 @@ +package ru.magistu.siegemachines.client.renderer.model; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.Model; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.*; +import net.minecraft.client.renderer.RenderType; + +public class GiantArrowModel extends Model +{ + protected final ModelPart cube_r0; + protected final ModelPart cube_r1; + protected final ModelPart cube_r2; + + public GiantArrowModel(ModelPart p_170945_) + { + super(RenderType::entityTranslucent); + this.cube_r0 = p_170945_; + this.cube_r1 = p_170945_.getChild("cube_r1"); + this.cube_r2 = p_170945_.getChild("cube_r2"); + } + + public static ModelPart createModel() + { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + partdefinition.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(15, 0).addBox(-2.0F, 0.0F, -10.0F, 4.0F, 0.0F, 4.0F).texOffs(-34, 0).addBox(-2.5F, 0.0F, -7.0F, 5.0F, 0.0F, 34.0F), PartPose.rotation(0.0F, 0.0F, -0.7854F)); + partdefinition.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(7, 0).addBox(-2.0F, 0.0F, -10.0F, 4.0F, 0.0F, 4.0F).texOffs(-34, 0).addBox(-2.5F, 0.0F, -7.0F, 5.0F, 0.0F, 34.0F), PartPose.rotation(0.0F, 0.0F, 0.7854F)); + + return meshdefinition.getRoot().bake(64, 64); + } + + public void setupAnim(float p_103811_, float p_103812_, float p_103813_) + { + this.cube_r0.yRot = p_103812_ * ((float)Math.PI / 180F); + this.cube_r0.xRot = p_103813_ * ((float)Math.PI / 180F); + } + + public void renderToBuffer(PoseStack p_103815_, VertexConsumer p_103816_, int p_103817_, int p_103818_, float p_103819_, float p_103820_, float p_103821_, float p_103822_) + { + this.cube_r0.render(p_103815_, p_103816_, p_103817_, p_103818_, p_103819_, p_103820_, p_103821_, p_103822_); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java new file mode 100644 index 0000000..55fac2c --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java @@ -0,0 +1,42 @@ +package ru.magistu.siegemachines.client.renderer.model; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.item.MachineItem; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.model.AnimatedGeoModel; + + +public class MachineItemModel<T extends MachineItem & IAnimatable> extends AnimatedGeoModel<T> +{ + public final String name; + public final ResourceLocation animationlocation; + public final ResourceLocation modellocation; + public final ResourceLocation texturelocation; + + public MachineItemModel(String name) + { + this.name = name; + this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/none.animation.json"); + this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + "_item.geo.json"); + this.texturelocation = new ResourceLocation(SiegeMachines.ID, "textures/entity/" + this.name + ".png"); + } + + @Override + public ResourceLocation getAnimationResource(T entity) + { + return this.animationlocation; + } + + @Override + public ResourceLocation getModelResource(T entity) + { + return this.modellocation; + } + + @Override + public ResourceLocation getTextureResource(T entity) + { + return this.texturelocation; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java new file mode 100644 index 0000000..6464eeb --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java @@ -0,0 +1,42 @@ +package ru.magistu.siegemachines.client.renderer.model; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.model.AnimatedGeoModel; + + +public class MachineModel<T extends Machine & IAnimatable> extends AnimatedGeoModel<T> +{ + public final String name; + public final ResourceLocation animationlocation; + public final ResourceLocation modellocation; + public final ResourceLocation texturelocation; + + public MachineModel(String name) + { + this.name = name; + this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/" + this.name + ".animation.json"); + this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + ".geo.json"); + this.texturelocation = new ResourceLocation(SiegeMachines.ID, "textures/entity/" + this.name + ".png"); + } + + @Override + public ResourceLocation getAnimationResource(T entity) + { + return this.animationlocation; + } + + @Override + public ResourceLocation getModelResource(T entity) + { + return this.modellocation; + } + + @Override + public ResourceLocation getTextureResource(T entity) + { + return this.texturelocation; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/data/recipes/CountIngredient.java b/src/main/java/ru/magistu/siegemachines/data/recipes/CountIngredient.java new file mode 100644 index 0000000..fe6d818 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/data/recipes/CountIngredient.java @@ -0,0 +1,116 @@ +package ru.magistu.siegemachines.data.recipes; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.Validate; + +import com.google.gson.JsonObject; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.util.Lazy; + +/** + * The CountIngredient is a special kind of ingredient which supports addition of a count field. + * This also includes lazy-wrapping to support new 1.18.2 delayed tag setup, as well as empty-tag validation from JSON for + * inter-mod compat recipes. + * @author Hayden Belanger + * + */ +public class CountIngredient +{ + private final int count; + private final Lazy<Ingredient> ingredient; + + private CountIngredient(Lazy<Ingredient> ingredient, int count) { + Validate.isTrue(count > 0, "count must be greater than 0 for CountIngredients."); + this.count = count; + this.ingredient = ingredient; + } + + public boolean test(ItemStack stack) { + return test(stack, false); + } + + public boolean test(ItemStack stack, boolean ignoreCount) + { + if (stack == null) + { + return false; + } + + if (get().getItems().length == 0) + { + return stack.isEmpty(); + } + + for (ItemStack itemstack : get().getItems()) + { + if (itemstack.getItem() == stack.getItem() && getCount() == stack.getCount()) + { + return true; + } + } + + return false; + } + + public int getCount() { + return count; + } + + public boolean isEmpty() { + return ingredient.get().isEmpty(); + } + + public List<ItemStack> getCountModifiedItemStacks() + { + return Arrays.asList(ingredient.get().getItems()).stream().map((is) -> { + ItemStack cs = is.copy(); + cs.setCount(count); + return cs; + }).collect(Collectors.toList()); + } + + public static CountIngredient fromNetwork(FriendlyByteBuf buffer) { + Ingredient ingredient = Ingredient.fromNetwork(buffer); + int count = buffer.readInt(); + return new CountIngredient(Lazy.of(() -> ingredient), count); + } + + public void toNetwork(FriendlyByteBuf buffer) { + ingredient.get().toNetwork(buffer); + buffer.writeInt(count); + } + + public static CountIngredient fromJson(JsonObject json) { + Lazy<Ingredient> ingredient = Lazy.of(() -> Ingredient.fromJson(json)); + int count = GsonHelper.isValidNode(json, "count") ? GsonHelper.getAsInt(json, "count") : 1; + return new CountIngredient(ingredient, count); + } + + public JsonObject toJson() { + JsonObject ingJson = ingredient.get().toJson().getAsJsonObject(); + if(count > 1) { + ingJson.addProperty("count", count); + } + return ingJson; + } + + public static CountIngredient of(Ingredient ingredient) { + return of(ingredient, 1); + } + + public static CountIngredient of(Ingredient ingredient, int count) { + return new CountIngredient(Lazy.of(() -> ingredient), count); + } + + public Ingredient get() + { + return this.ingredient.get(); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/data/recipes/ModRecipes.java b/src/main/java/ru/magistu/siegemachines/data/recipes/ModRecipes.java new file mode 100644 index 0000000..2cb20bd --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/data/recipes/ModRecipes.java @@ -0,0 +1,21 @@ +package ru.magistu.siegemachines.data.recipes; + +import net.minecraft.world.item.crafting.RecipeType; +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class ModRecipes +{ + public static final DeferredRegister<RecipeSerializer<?>> SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, SiegeMachines.ID); + public static final RegistryObject<RecipeSerializer<SiegeWorkbenchRecipe>> SIEGE_WORKBENCH_SERIALIZER = SERIALIZERS.register("siege_workbench", () -> SiegeWorkbenchRecipe.Serializer.INSTANCE); + + public static RecipeType<SiegeWorkbenchRecipe> SIEGE_WORKBENCH_RECIPE = SiegeWorkbenchRecipe.Type.INSTANCE; + + public static void register(IEventBus eventBus) { + SERIALIZERS.register(eventBus); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/data/recipes/SiegeWorkbenchRecipe.java b/src/main/java/ru/magistu/siegemachines/data/recipes/SiegeWorkbenchRecipe.java new file mode 100644 index 0000000..344e6f7 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/data/recipes/SiegeWorkbenchRecipe.java @@ -0,0 +1,437 @@ +package ru.magistu.siegemachines.data.recipes; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.*; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.common.crafting.IShapedRecipe; +import org.jetbrains.annotations.NotNull; +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.core.NonNullList; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.*; +import net.minecraft.world.level.Level; +import ru.magistu.siegemachines.block.ModBlocks; + +import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer> +{ + static ResourceLocation TYPE_ID = new ResourceLocation(SiegeMachines.ID, "siege_workbench"); + + static int MAX_WIDTH = 3; + static int MAX_HEIGHT = 3; + + private final ResourceLocation id; + private final ItemStack result; + private final List<CountIngredient> recipeitems; + + final int width; + final int height; + + public SiegeWorkbenchRecipe(ResourceLocation id, int width, int height, List<CountIngredient> recipeitems, ItemStack result) { + this.id = id; + this.width = width; + this.height = height; + this.recipeitems = recipeitems; + this.result = result; + } + + public static class Type implements RecipeType<SiegeWorkbenchRecipe> + { + public static final Type INSTANCE = new Type(); + + @Override + public String toString() + { + return SiegeWorkbenchRecipe.TYPE_ID.toString(); + } + } + + @NotNull + public ResourceLocation getId() { + return this.id; + } + + @NotNull + public RecipeSerializer<?> getSerializer() { + return Serializer.INSTANCE; + } + + @Override + @NotNull + public RecipeType<?> getType() + { + return Type.INSTANCE; + } + + @Override + @NotNull + public ItemStack getToastSymbol() { + return new ItemStack(ModBlocks.SIEGE_WORKBENCH.get()); + } + + @Override + public boolean isSpecial() { + return true; + } + + /** + * Get the result of this recipe, usually for display purposes (e.g. recipe book). If your recipe has more than one + * possible result (e.g. it's dynamic and depends on its inputs), then return an empty stack. + */ + @Override + public ItemStack getResultItem() { + return this.result; + } + + public List<CountIngredient> getRecipeItems() + { + return this.recipeitems; + } + + @Override + public NonNullList<Ingredient> getIngredients() + { + NonNullList<Ingredient> list = NonNullList.create(); + for (CountIngredient ingredient : this.recipeitems) + list.add(ingredient.get()); + return list; + } + + /** + * Used to determine if this recipe can fit in a grid of the given width/height + */ + public boolean canCraftInDimensions(int width, int height) { + return width >= this.width && height >= this.height; + } + + @NotNull + @Override + public NonNullList<ItemStack> getRemainingItems(CraftingContainer container) { + for(int i = 0; i <= container.getWidth() - this.width; ++i) { + for(int j = 0; j <= container.getHeight() - this.height; ++j) { + if (this.matches(container, i, j, true)) { + return getRemainingItems(container, i, j, true); + } + + if (this.matches(container, i, j, false)) { + return getRemainingItems(container, i, j, true); + } + } + } + + return NonNullList.withSize(container.getContainerSize(), ItemStack.EMPTY); + } + + private NonNullList<ItemStack> getRemainingItems(CraftingContainer container, int width, int height, boolean mirrored) + { + NonNullList<ItemStack> nonnulllist = NonNullList.withSize(container.getContainerSize(), ItemStack.EMPTY); + + for(int i = 0; i < container.getWidth(); ++i) { + for(int j = 0; j < container.getHeight(); ++j) { + int k = i - width; + int l = j - height; + CountIngredient ingredient = CountIngredient.of(Ingredient.EMPTY); + if (k >= 0 && l >= 0 && k < this.width && l < this.height) { + if (mirrored) { + ingredient = this.recipeitems.get(this.width - k - 1 + l * this.width); + } else { + ingredient = this.recipeitems.get(k + l * this.width); + } + } + + int index = i + j * container.getWidth(); + ItemStack stack = container.getItem(index); + stack.setCount(ingredient.getCount()); + nonnulllist.set(index, stack); + } + } + + return nonnulllist; + } + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(CraftingContainer container, Level level) { + for(int i = 0; i <= container.getWidth() - this.width; ++i) { + for(int j = 0; j <= container.getHeight() - this.height; ++j) { + if (this.matches(container, i, j, true)) { + return true; + } + + if (this.matches(container, i, j, false)) { + return true; + } + } + } + + return false; + } + + /** + * Checks if the region of a crafting inventory is match for the recipe. + */ + private boolean matches(CraftingContainer container, int width, int height, boolean mirrored) { + for(int i = 0; i < container.getWidth(); ++i) { + for(int j = 0; j < container.getHeight(); ++j) { + int k = i - width; + int l = j - height; + CountIngredient ingredient = CountIngredient.of(Ingredient.EMPTY); + if (k >= 0 && l >= 0 && k < this.width && l < this.height) { + if (mirrored) { + ingredient = this.recipeitems.get(this.width - k - 1 + l * this.width); + } else { + ingredient = this.recipeitems.get(k + l * this.width); + } + } + + if (!ingredient.test(container.getItem(i + j * container.getWidth()))) { + return false; + } + } + } + + return true; + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack assemble(CraftingContainer container) { + return this.getResultItem().copy(); + } + + public int getWidth() { + return this.width; + } + + @Override + public int getRecipeWidth() { + return getWidth(); + } + + public int getHeight() { + return this.height; + } + + @Override + public int getRecipeHeight() { + return getHeight(); + } + + static NonNullList<CountIngredient> dissolvePattern(String[] pattern, Map<String, CountIngredient> keys, int patternwidth, int patternHeight) { + NonNullList<CountIngredient> list = NonNullList.withSize(patternwidth * patternHeight, CountIngredient.of(Ingredient.EMPTY)); + Set<String> set = Sets.newHashSet(keys.keySet()); + set.remove(" "); + + for(int i = 0; i < pattern.length; ++i) { + for(int j = 0; j < pattern[i].length(); ++j) { + String s = pattern[i].substring(j, j + 1); + CountIngredient ingredient = keys.get(s); + if (ingredient == null) + { + throw new JsonSyntaxException("Pattern references symbol '" + s + "' but it's not defined in the key"); + } + + set.remove(s); + list.set(j + patternwidth * i, ingredient); + } + } + + if (!set.isEmpty()) { + throw new JsonSyntaxException("Key defines symbols that aren't used in pattern: " + set); + } else { + return list; + } + } + + @VisibleForTesting + static String[] shrink(String... toshrink) { + int i = Integer.MAX_VALUE; + int j = 0; + int k = 0; + int l = 0; + + for(int i1 = 0; i1 < toshrink.length; ++i1) { + String s = toshrink[i1]; + i = Math.min(i, firstNonSpace(s)); + int j1 = lastNonSpace(s); + j = Math.max(j, j1); + if (j1 < 0) { + if (k == i1) { + ++k; + } + + ++l; + } else { + l = 0; + } + } + + if (toshrink.length == l) { + return new String[0]; + } else { + String[] astring = new String[toshrink.length - l - k]; + + for(int k1 = 0; k1 < astring.length; ++k1) { + astring[k1] = toshrink[k1 + k].substring(i, j + 1); + } + + return astring; + } + } + + public boolean isIncomplete() { + NonNullList<Ingredient> list = this.getIngredients(); + return list.isEmpty() || list.stream().filter((ingredient) -> { + return !ingredient.isEmpty(); + }).anyMatch(ForgeHooks::hasNoElements); + } + + private static int firstNonSpace(String entry) { + int i; + for(i = 0; i < entry.length() && entry.charAt(i) == ' '; ++i) { + } + + return i; + } + + private static int lastNonSpace(String entry) { + int i; + for(i = entry.length() - 1; i >= 0 && entry.charAt(i) == ' '; --i) {} + + return i; + } + + static String[] patternFromJson(JsonArray patternarray) { + String[] astring = new String[patternarray.size()]; + if (astring.length > MAX_HEIGHT) { + throw new JsonSyntaxException("Invalid pattern: too many rows, " + MAX_HEIGHT + " is maximum"); + } else if (astring.length == 0) { + throw new JsonSyntaxException("Invalid pattern: empty pattern not allowed"); + } else { + for(int i = 0; i < astring.length; ++i) { + String s = GsonHelper.convertToString(patternarray.get(i), "pattern[" + i + "]"); + if (s.length() > MAX_WIDTH) { + throw new JsonSyntaxException("Invalid pattern: too many columns, " + MAX_WIDTH + " is maximum"); + } + + if (i > 0 && astring[0].length() != s.length()) { + throw new JsonSyntaxException("Invalid pattern: each row must be the same width"); + } + + astring[i] = s; + } + + return astring; + } + } + + /** + * Returns a key json object as a Java HashMap. + */ + static Map<String, CountIngredient> keyFromJson(JsonObject keyentry) { + Map<String, CountIngredient> map = Maps.newHashMap(); + + for(Map.Entry<String, JsonElement> entry : keyentry.entrySet()) { + if (entry.getKey().length() != 1) { + throw new JsonSyntaxException("Invalid key entry: '" + entry.getKey() + "' is an invalid symbol (must be 1 character only)."); + } + + if (" ".equals(entry.getKey())) { + throw new JsonSyntaxException("Invalid key entry: ' ' is a reserved symbol."); + } + + map.put(entry.getKey(), CountIngredient.fromJson(entry.getValue().getAsJsonObject())); + } + + map.put(" ", CountIngredient.of(Ingredient.EMPTY)); + return map; + } + + public static ItemStack itemStackFromJson(JsonObject stackobject) + { + return CraftingHelper.getItemStack(stackobject, true, true); + } + + public static class Serializer implements RecipeSerializer<SiegeWorkbenchRecipe> + { + public static final Serializer INSTANCE = new Serializer(); + public static final ResourceLocation ID = new ResourceLocation(SiegeMachines.ID,"siege_workbench"); + + @Override + public SiegeWorkbenchRecipe fromJson(ResourceLocation recipeid, JsonObject json) + { + Map<String, CountIngredient> map = SiegeWorkbenchRecipe.keyFromJson(GsonHelper.getAsJsonObject(json, "key")); + String[] astring = SiegeWorkbenchRecipe.shrink(SiegeWorkbenchRecipe.patternFromJson(GsonHelper.getAsJsonArray(json, "pattern"))); + + int i = astring[0].length(); + int j = astring.length; + + List<CountIngredient> list = SiegeWorkbenchRecipe.dissolvePattern(astring, map, i, j); + ItemStack result = SiegeWorkbenchRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(json, "result")); + + return new SiegeWorkbenchRecipe(recipeid, i, j, list, result); + } + + @Override + public SiegeWorkbenchRecipe fromNetwork(ResourceLocation recipeid, FriendlyByteBuf buffer) { + int i = buffer.readVarInt(); + int j = buffer.readVarInt(); + NonNullList<CountIngredient> list = NonNullList.withSize(i * j, CountIngredient.of(Ingredient.EMPTY)); + + for(int k = 0; k < list.size(); ++k) { + list.set(k, CountIngredient.fromNetwork(buffer)); + } + + ItemStack itemstack = buffer.readItem(); + return new SiegeWorkbenchRecipe(recipeid, i, j, list, itemstack); + } + + @Override + public void toNetwork(FriendlyByteBuf buffer, SiegeWorkbenchRecipe pRecipe) { + buffer.writeVarInt(pRecipe.width); + buffer.writeVarInt(pRecipe.height); + + for(CountIngredient ingredient : pRecipe.recipeitems) { + ingredient.toNetwork(buffer); + } + + buffer.writeItem(pRecipe.result); + } + +// @Override +// public RecipeSerializer<?> setRegistryName(ResourceLocation name) { +// return INSTANCE; +// } +// +// @Nullable +// @Override +// public ResourceLocation getRegistryName() { +// return ID; +// } +// +// @Override +// public Class<RecipeSerializer<?>> getRegistryType() { +// return Serializer.castClass(RecipeSerializer.class); +// } +// +// @SuppressWarnings("unchecked") // Need this wrapper, because generics +// private static <G> Class<G> castClass(Class<?> cls) { +// return (Class<G>)cls; +// } + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/Breakdown.java b/src/main/java/ru/magistu/siegemachines/entity/Breakdown.java new file mode 100644 index 0000000..bcf29a3 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/Breakdown.java @@ -0,0 +1,329 @@ +package ru.magistu.siegemachines.entity; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + +import java.util.*; +import javax.annotation.Nullable; + +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.item.PrimedTnt; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.ProtectionEnchantment; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.FireBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; + +public class Breakdown +{ + private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator(); + private final boolean fire; + private final Explosion.BlockInteraction blockInteraction; + private final RandomSource random = RandomSource.create(); + private final Level level; + private final double x; + private final double y; + private final double z; + @Nullable + private final Entity source; + private final float radius; + private final DamageSource damageSource; + private final ExplosionDamageCalculator damageCalculator; + private final ObjectArrayList<BlockPos> toBlow = new ObjectArrayList<>(); + private final Map<Player, Vec3> hitPlayers = Maps.newHashMap(); + private final Vec3 position; + private final Explosion explosion; + private final Entity machine; + private final float power; + + public Breakdown(Level p_i50007_1_, @Nullable Entity machine, @Nullable Entity p_i50007_2_, double p_i50007_3_, double p_i50007_5_, double p_i50007_7_, float p_i50007_9_, boolean p_i50007_10_, float power, Explosion.BlockInteraction p_i50007_11_) { + this(p_i50007_1_, p_i50007_2_, machine, (DamageSource)null, (ExplosionDamageCalculator)null, p_i50007_3_, p_i50007_5_, p_i50007_7_, p_i50007_9_, p_i50007_10_, power, p_i50007_11_); + } + + public Breakdown(Level p_i231610_1_, @Nullable Entity machine, @Nullable Entity p_i231610_2_, @Nullable DamageSource p_i231610_3_, @Nullable ExplosionDamageCalculator p_i231610_4_, double p_i231610_5_, double p_i231610_7_, double p_i231610_9_, float p_i231610_11_, boolean p_i231610_12_, float power, Explosion.BlockInteraction p_i231610_13_) { + this.explosion = new Explosion(p_i231610_1_, p_i231610_2_, p_i231610_3_, p_i231610_4_, p_i231610_5_, p_i231610_7_, p_i231610_9_, p_i231610_11_, p_i231610_12_, p_i231610_13_); + this.level = p_i231610_1_; + this.machine = machine; + this.source = p_i231610_2_; + this.radius = p_i231610_11_; + this.x = p_i231610_5_; + this.y = p_i231610_7_; + this.z = p_i231610_9_; + this.fire = p_i231610_12_; + this.power = power; + this.blockInteraction = p_i231610_13_; + this.damageSource = p_i231610_3_ == null && p_i231610_2_ instanceof LivingEntity ? DamageSource.explosion((LivingEntity) p_i231610_2_) : p_i231610_3_; + this.damageCalculator = p_i231610_4_ == null ? this.makeDamageCalculator(p_i231610_2_) : p_i231610_4_; + this.position = new Vec3(this.x, this.y, this.z); + } + + private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity p_234894_1_) { + return (p_234894_1_ == null ? EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(p_234894_1_)); + } + + public static float getSeenPercent(Vec3 p_222259_0_, Entity p_222259_1_) { + AABB axisalignedbb = p_222259_1_.getBoundingBox(); + double d0 = 1.0D / ((axisalignedbb.maxX - axisalignedbb.minX) * 2.0D + 1.0D); + double d1 = 1.0D / ((axisalignedbb.maxY - axisalignedbb.minY) * 2.0D + 1.0D); + double d2 = 1.0D / ((axisalignedbb.maxZ - axisalignedbb.minZ) * 2.0D + 1.0D); + double d3 = (1.0D - Math.floor(1.0D / d0) * d0) / 2.0D; + double d4 = (1.0D - Math.floor(1.0D / d2) * d2) / 2.0D; + if (!(d0 < 0.0D) && !(d1 < 0.0D) && !(d2 < 0.0D)) { + int i = 0; + int j = 0; + + for(float f = 0.0F; f <= 1.0F; f = (float)((double)f + d0)) { + for(float f1 = 0.0F; f1 <= 1.0F; f1 = (float)((double)f1 + d1)) { + for(float f2 = 0.0F; f2 <= 1.0F; f2 = (float)((double)f2 + d2)) { + double d5 = Mth.lerp((double)f, axisalignedbb.minX, axisalignedbb.maxX); + double d6 = Mth.lerp((double)f1, axisalignedbb.minY, axisalignedbb.maxY); + double d7 = Mth.lerp((double)f2, axisalignedbb.minZ, axisalignedbb.maxZ); + Vec3 vector3d = new Vec3(d5 + d3, d6, d7 + d4); + if (p_222259_1_.level.clip(new ClipContext(vector3d, p_222259_0_, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, p_222259_1_)).getType() == HitResult.Type.MISS) { + ++i; + } + + ++j; + } + } + } + + return (float)i / (float)j; + } else { + return 0.0F; + } + } + + public void explode() + { + Set<BlockPos> set = Sets.newHashSet(); + int i = 16; + + for(int j = 0; j < 16; ++j) { + for(int k = 0; k < 16; ++k) { + for(int l = 0; l < 16; ++l) { + if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) { + double d0 = (double)((float)j / 15.0F * 2.0F - 1.0F); + double d1 = (double)((float)k / 15.0F * 2.0F - 1.0F); + double d2 = (double)((float)l / 15.0F * 2.0F - 1.0F); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + d0 = d0 / d3; + d1 = d1 / d3; + d2 = d2 / d3; + float f = this.power * this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); + double d4 = this.x; + double d6 = this.y; + double d8 = this.z; + + for(float f1 = 0.3F; f > 0.0F; f -= this.power * 0.5F) { + BlockPos blockpos = new BlockPos(d4, d6, d8); + BlockState blockstate = this.level.getBlockState(blockpos); + FluidState fluidstate = this.level.getFluidState(blockpos); + Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this.explosion, this.level, blockpos, blockstate, fluidstate); + if (optional.isPresent()) { + f -= (optional.get() + 0.3F) * 0.3F; + } + + if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this.explosion, this.level, blockpos, blockstate, f)) { + set.add(blockpos); + } + + d4 += d0 * (double)0.3F; + d6 += d1 * (double)0.3F; + d8 += d2 * (double)0.3F; + } + } + } + } + } + + this.toBlow.addAll(set); + float f2 = 1.5f * this.radius; + int k1 = Mth.floor(this.x - (double)f2 - 1.0D); + int l1 = Mth.floor(this.x + (double)f2 + 1.0D); + int i2 = Mth.floor(this.y - (double)f2 - 1.0D); + int i1 = Mth.floor(this.y + (double)f2 + 1.0D); + int j2 = Mth.floor(this.z - (double)f2 - 1.0D); + int j1 = Mth.floor(this.z + (double)f2 + 1.0D); + List<Entity> list = this.level.getEntities(this.source, new AABB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); + Vec3 vector3d = new Vec3(this.x, this.y, this.z); + + for(int k2 = 0; k2 < list.size(); ++k2) { + Entity entity = list.get(k2); + if (!entity.ignoreExplosion() && !entity.equals(this.machine) && !entity.equals(this.source)) { + double d12 = (Mth.sqrt((float) entity.distanceToSqr(vector3d)) / f2); + if (d12 <= 1.0D) { + double d5 = entity.getX() - this.x; + double d7 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.y; + double d9 = entity.getZ() - this.z; + double d13 = Mth.sqrt((float) (d5 * d5 + d7 * d7 + d9 * d9)); + if (d13 != 0.0D) { + d5 = d5 / d13; + d7 = d7 / d13; + d9 = d9 / d13; + double d14 = getSeenPercent(vector3d, entity); + double d10 = (1.0D - d12) * d14; + if (!(entity instanceof ItemEntity)) { + entity.hurt(this.getDamageSource(), (float) ((int) ((d10 * d10 + d10) / 2.0D * 7.0D * (double) f2 + 1.0D))); + } + double d11 = d10; + if (entity instanceof LivingEntity) { + d11 = ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity)entity, d10); + } + + entity.setDeltaMovement(entity.getDeltaMovement().add(d5 * d11, d7 * d11, d9 * d11)); + if (entity instanceof Player) { + Player playerentity = (Player)entity; + if (!playerentity.isSpectator() && (!playerentity.isCreative() || !playerentity.getAbilities().flying)) { + this.hitPlayers.put(playerentity, new Vec3(d5 * d10, d7 * d10, d9 * d10)); + } + } + } + } + } + } + + } + + public void finalizeExplosion(boolean p_77279_1_) { + if (this.level.isClientSide) { + //this.level.playLocalSound(this.x, this.y, this.z, SoundEvents.GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, false); + } + + boolean flag = this.blockInteraction != Explosion.BlockInteraction.NONE; + if (p_77279_1_) { + if (!(this.radius < 2.0F) && flag) { + this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D); + } else { + this.level.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D); + } + } + + if (flag) { + ObjectArrayList<Pair<ItemStack, BlockPos>> objectarraylist = new ObjectArrayList<>(); + Util.shuffle(this.toBlow, random); + + for(BlockPos blockpos : this.toBlow) { + BlockState blockstate = this.level.getBlockState(blockpos); + Block block = blockstate.getBlock(); + if (!blockstate.isAir()) { + BlockPos blockpos1 = blockpos.immutable(); + this.level.getProfiler().push("explosion_blocks"); + if (this.level instanceof ServerLevel) { + BlockEntity tileentity = blockstate.hasBlockEntity() ? this.level.getBlockEntity(blockpos) : null; + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.level)).withRandom(this.level.random).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockpos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParams.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParams.THIS_ENTITY, this.source); + if (this.blockInteraction == Explosion.BlockInteraction.DESTROY) { + lootcontext$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, this.radius); + } + + blockstate.getDrops(lootcontext$builder).forEach((p_229977_2_) -> { + addBlockDrops(objectarraylist, p_229977_2_, blockpos1); + }); + } + + this.level.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 3); + this.level.getProfiler().pop(); + } + } + + for(Pair<ItemStack, BlockPos> pair : objectarraylist) { + Block.popResource(this.level, pair.getSecond(), pair.getFirst()); + } + } + + if (this.fire) { + for(BlockPos blockpos2 : this.toBlow) { + if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockpos2).isAir() && this.level.getBlockState(blockpos2.below()).isSolidRender(this.level, blockpos2.below())) { + this.level.setBlockAndUpdate(blockpos2, FireBlock.getState(this.level, blockpos2)); + } + } + } + + } + + private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPos>> p_46068_, ItemStack p_46069_, BlockPos p_46070_) { + int i = p_46068_.size(); + + for(int j = 0; j < i; ++j) { + Pair<ItemStack, BlockPos> pair = p_46068_.get(j); + ItemStack itemstack = pair.getFirst(); + if (ItemEntity.areMergable(itemstack, p_46069_)) { + ItemStack itemstack1 = ItemEntity.merge(itemstack, p_46069_, 16); + p_46068_.set(j, Pair.of(itemstack1, pair.getSecond())); + if (p_46069_.isEmpty()) { + return; + } + } + } + + p_46068_.add(Pair.of(p_46069_, p_46070_)); + } + + public DamageSource getDamageSource() { + return this.damageSource; + } + + public Map<Player, Vec3> getHitPlayers() { + return this.hitPlayers; + } + + @Nullable + public LivingEntity getSourceMob() { + if (this.source == null) { + return null; + } else if (this.source instanceof PrimedTnt) { + return ((PrimedTnt)this.source).getOwner(); + } else if (this.source instanceof LivingEntity) { + return (LivingEntity)this.source; + } else { + if (this.source instanceof Projectile) { + Entity entity = ((Projectile)this.source).getOwner(); + if (entity instanceof LivingEntity) { + return (LivingEntity)entity; + } + } + + return null; + } + } + + public void clearToBlow() { + this.toBlow.clear(); + } + + public List<BlockPos> getToBlow() { + return this.toBlow; + } + + public Vec3 getPosition() { + return this.position; + } + + @Nullable + public Entity getExploder() { + return this.source; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/EntityTypes.java b/src/main/java/ru/magistu/siegemachines/entity/EntityTypes.java new file mode 100644 index 0000000..850cfb9 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/EntityTypes.java @@ -0,0 +1,41 @@ +package ru.magistu.siegemachines.entity; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.entity.machine.*; +import ru.magistu.siegemachines.entity.projectile.Cannonball; +import ru.magistu.siegemachines.entity.projectile.GiantArrow; +import ru.magistu.siegemachines.entity.projectile.Stone; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class EntityTypes +{ + public static final DeferredRegister<EntityType<?>> DEFERRED_REGISTER = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, SiegeMachines.ID); + + public static final RegistryObject<EntityType<Cannonball>> CANNONBALL = addRegistry("cannonball", Cannonball::new, 0.5f, 0.5f); + public static final RegistryObject<EntityType<Stone>> STONE = addRegistry("stone", Stone::new, 0.6f, 0.6f); + public static final RegistryObject<EntityType<GiantArrow>> GIANT_ARROW = DEFERRED_REGISTER.register("giant_arrow", () -> EntityType.Builder.<GiantArrow>of(GiantArrow::new, MobCategory.MISC).clientTrackingRange(4).updateInterval(20).sized(0.5f, 0.5f).build(new ResourceLocation(SiegeMachines.ID, "giant_arrow").toString())); + + public static final RegistryObject<EntityType<Mortar>> MORTAR = addRegistry("mortar", Mortar::new, 2.0f, 1.0f); + public static final RegistryObject<EntityType<Culverin>> CULVERIN = addRegistry("culverin", Culverin::new, 2.0f, 1.0f); + public static final RegistryObject<EntityType<Trebuchet>> TREBUCHET = addRegistry("trebuchet", Trebuchet::new, 5.0f, 9.0f); + public static final RegistryObject<EntityType<Catapult>> CATAPULT = addRegistry("catapult", Catapult::new, 3.0f, 3.0f); + public static final RegistryObject<EntityType<Ballista>> BALLISTA = addRegistry("ballista", Ballista::new, 1.5f, 1.5f); + public static final RegistryObject<EntityType<BatteringRam>> BATTERING_RAM = addRegistry("battering_ram", BatteringRam::new, 4.0f, 3.0f); + + public static <T extends Entity> RegistryObject<EntityType<T>> addRegistry(String name, EntityType.EntityFactory<T> constructor, float sizex, float sizey) + { + return DEFERRED_REGISTER.register(name, () -> EntityType.Builder.of(constructor, MobCategory.MISC).sized(sizex, sizey).build(new ResourceLocation(SiegeMachines.ID, name).toString())); + } + + public static void register(IEventBus eventBus) + { + DEFERRED_REGISTER.register(eventBus); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/IReloading.java b/src/main/java/ru/magistu/siegemachines/entity/IReloading.java new file mode 100644 index 0000000..5b223bb --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/IReloading.java @@ -0,0 +1,11 @@ +package ru.magistu.siegemachines.entity; + +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public interface IReloading +{ + @OnlyIn(Dist.CLIENT) + Crosshair createCrosshair(); +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/Ballista.java b/src/main/java/ru/magistu/siegemachines/entity/machine/Ballista.java new file mode 100644 index 0000000..a6a7eba --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/Ballista.java @@ -0,0 +1,211 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import ru.magistu.siegemachines.gui.machine.crosshair.ReloadingCrosshair; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.builder.ILoopType; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +public class Ballista extends ShootingMachine implements IAnimatable +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + static AnimationBuilder SHOOTING_ANIM = new AnimationBuilder().addAnimation("Shooting", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder RELOADING_ANIM = new AnimationBuilder().addAnimation("Reloading", ILoopType.EDefaultLoopTypes.LOOP); + + public enum State + { + SHOOTING, + RELOADING + } + public State state = State.RELOADING; + + public Ballista(EntityType<? extends Mob> entitytype, Level level) + { + super(entitytype, level, MachineType.BALLISTA); + } + + private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) + { + switch (state) { + case SHOOTING -> { + event.getController().setAnimation(SHOOTING_ANIM); + return PlayState.CONTINUE; + } + case RELOADING -> { + event.getController().setAnimation(RELOADING_ANIM); + return PlayState.CONTINUE; + } + } + return PlayState.CONTINUE; + } + + @Override + public void registerControllers(AnimationData data) + { + AnimationController<?> controller = new AnimationController<>(this, "controller", 1, (t) -> + { + if (this.state.equals(State.RELOADING)) + { + return (double) (this.type.delaytime - this.delayticks) / this.type.delaytime; + } + return t; + }, this::predicate); + data.addAnimationController(controller); + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + if (super.mobInteract(player, hand) == InteractionResult.SUCCESS) + { + return InteractionResult.SUCCESS; + } + if (!this.level.isClientSide() && !this.isVehicle()) + { + player.startRiding(this); + return InteractionResult.SUCCESS; + } + + return InteractionResult.PASS; + } + + public void startShooting(Player player) + { + if (this.delayticks <= 0 && this.useticks <= 0 && this.shootingticks <= 0) + { + this.state = State.SHOOTING; + this.useticks = this.type.usetime; + this.shootingticks = this.type.userealisetime; + + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.BALLISTA_SHOOTING.get(), SoundSource.BLOCKS, 1.4f, 1.0f, false); + } + } + + @Override + public void shoot() + { + if (!level.isClientSide()) + { + super.shoot(); + } + } + +// @Override +// public void travel(Vec3 pos) +// { +// if (this.isAlive()) +// { +// if (this.isVehicle()) +// { +// LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); +// +// this.setTurretRotationsDest(livingentity.getXRot(), livingentity.getYRot() - this.getYaw()); +// this.updateTurretRotations(); +// } +// super.travel(pos); +// } +// +// } + + @Override + public void travel(Vec3 pos) + { + if (this.isAlive()) + { + if (this.isVehicle() && this.useticks <= 0 && this.delayticks <= 0) + { + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + + this.setTurretRotations(livingentity.getXRot(), this.getTurretYaw()); + this.updateTurretRotations(); + + this.setYawDest(livingentity.getYRot()); + this.updateYaw(); + + } + super.travel(pos); + } + } + + @Override + public void tick() + { + if (this.useticks != 0 && --this.useticks <= 0) + { + this.state = State.RELOADING; + this.useticks = 0; + this.delayticks = this.type.delaytime; + } + + if (this.shootingticks != 0 && --this.shootingticks <= 0) + { + this.useRealise(); + this.shootingticks = 0; + } + + if (!level.isClientSide() && this.isOnGround()) + { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); + } + + if (this.delayticks > 0 && this.isVehicle()) + { + if (this.delayticks % 21 == 0) + { + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.BALLISTA_RELOADING.get(), SoundSource.BLOCKS, 1.0f, 1.0f, false); + } + --this.delayticks; + } + + if (this.renderupdateticks-- <= 0) + { + this.updateMachineRender(); + this.renderupdateticks = SiegeMachines.RENDER_UPDATE_TIME; + } + + super.tick(); + } + + @Override + @OnlyIn(Dist.CLIENT) + public Crosshair createCrosshair() + { + return new ReloadingCrosshair(); + } + + @Override + public Item getMachineItem() + { + return ModItems.BALLISTA.get(); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/BatteringRam.java b/src/main/java/ru/magistu/siegemachines/entity/machine/BatteringRam.java new file mode 100644 index 0000000..558dd43 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/BatteringRam.java @@ -0,0 +1,256 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.entity.Breakdown; +import ru.magistu.siegemachines.item.ModItems; +import ru.magistu.siegemachines.network.PacketHandler; +import ru.magistu.siegemachines.network.PacketMachineUse; +import ru.magistu.siegemachines.network.PacketMachineUseRealise; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.builder.ILoopType; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + + +public class BatteringRam extends Machine implements IAnimatable +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + static AnimationBuilder MOVING_ANIM = new AnimationBuilder().addAnimation("Moving", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder HITTING_ANIM = new AnimationBuilder().addAnimation("Hitting", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder RELOADING_ANIM = new AnimationBuilder().addAnimation("Reloading", ILoopType.EDefaultLoopTypes.LOOP); + + public int hittingticks = 0; + private int wheelssoundticks = 10; + + public enum State + { + HITTING, + RELOADING + } + public State state = State.RELOADING; + + private double wheelspitch = 0.0; + private double wheelsspeed = 0.0; + + public BatteringRam(EntityType<? extends Mob> entitytype, Level level) + { + super(entitytype, level, MachineType.BATTERING_RAM); + } + + private <E extends IAnimatable> PlayState wheels_predicate(AnimationEvent<E> event) + { + event.getController().setAnimation(MOVING_ANIM); + + return PlayState.CONTINUE; + } + + private <E extends IAnimatable> PlayState reloading_predicate(AnimationEvent<E> event) + { + switch (state) + { + case HITTING: + event.getController().setAnimation(HITTING_ANIM); + return PlayState.CONTINUE; + case RELOADING: + event.getController().setAnimation(RELOADING_ANIM); + return PlayState.CONTINUE; + } + return PlayState.CONTINUE; + } + + @Override + public void registerControllers(AnimationData data) + { + AnimationController<?> wheels_controller = new AnimationController<>(this, "wheels_controller", 1, (t) -> { + double d = this.getWheelsSpeed(); + this.wheelsspeed = d > 0 ? Math.min(d, 1.0) : Math.max(d, -1.0); + return wheelspitch += 0.015 * this.wheelsspeed; + }, this::wheels_predicate); + data.addAnimationController(wheels_controller); + + AnimationController<?> reloading_controller = new AnimationController<>(this, "controller", 1, (t) -> + { + if (this.state.equals(State.RELOADING)) + { + return (double) (this.type.delaytime - this.delayticks) / this.type.delaytime; + } + return t; + }, this::reloading_predicate); + data.addAnimationController(reloading_controller); + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + if (!this.level.isClientSide() && !this.isVehicle()) + { + player.startRiding(this); + return InteractionResult.SUCCESS; + } + + return InteractionResult.PASS; + } + + @Override + public void travel(Vec3 pos) + { + if (this.isAlive()) + { + if (this.isVehicle()) + { + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + + this.setYawDest(livingentity.getYRot()); + + this.updateYaw(); + + float f1 = livingentity.zza; + if (f1 <= 0.0f) + { + f1 *= 0.25f; + } + this.setSpeed(0.04f); + + pos = new Vec3(0.0f, pos.y, f1); + } + super.travel(pos); + } + } + + @Override + public void tick() + { + if (this.useticks != 0 && --this.useticks <= 0) + { + this.state = State.RELOADING; + this.useticks = 0; + this.delayticks = this.type.delaytime; + } + + if (this.hittingticks != 0 && --this.hittingticks <= 0) + { + this.useRealise(); + this.hittingticks = 0; + } + + if (!level.isClientSide() && this.isOnGround()) + { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); + } + + if (this.delayticks > 0 && this.isVehicle()) + { + --this.delayticks; + } + + if (this.renderupdateticks-- <= 0) + { + this.updateMachineRender(); + this.renderupdateticks = SiegeMachines.RENDER_UPDATE_TIME; + } + +// if (this.getWheelsSpeed() > 0.0081 && this.wheelssoundticks-- <= 0) +// { +// this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundTypes.RAM_WHEELS.get(), SoundCategory.NEUTRAL, 0.6f, 1.0f, true); +// this.wheelssoundticks = 20; +// } + + super.tick(); + } + + @Override + public void use(Player player) + { + if (!this.level.isClientSide()) + { + PacketHandler.sendPacketToAllInArea(new PacketMachineUse(this.getId()), this.blockPosition(), SiegeMachines.RENDER_UPDATE_RANGE_SQR); + } + + if (this.delayticks <= 0 && this.useticks <= 0 && this.hittingticks <= 0) + { + this.state = State.HITTING; + this.useticks = this.type.usetime; + this.hittingticks = this.type.userealisetime; + + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.RAM_HITTING.get(), SoundSource.BLOCKS, 0.5f, 0.9f, false); + } + } + + public void ramHit(BlockPos blockpos) + { + if (!this.level.isClientSide()) + { + Breakdown breakdown = new Breakdown(this.level, this, this.getControllingPassenger(), blockpos.getX(), blockpos.getY(), blockpos.getZ(), 2, false, 3.0f, Explosion.BlockInteraction.BREAK); + breakdown.explode(); + breakdown.finalizeExplosion(true); + } + } + + @Override + public void useRealise() + { + if (!this.level.isClientSide()) + { + PacketHandler.sendPacketToAllInArea(new PacketMachineUseRealise(this.getId()), this.blockPosition(), SiegeMachines.RENDER_UPDATE_RANGE_SQR); + + BlockPos blockpos = new BlockPos(this.getHitPos()); + this.ramHit(blockpos); + } + } + + public double getWheelsSpeed() + { + if (this.isOnGround()) + { + return this.getViewVector(5.0f).multiply(1, 0, 1).dot(this.getDeltaMovement()); + } + + return 0.0; + } + + @Override + public void push(double p_70024_1_, double p_70024_3_, double p_70024_5_) { +// this.setDeltaMovement(this.getDeltaMovement().add(p_70024_1_, p_70024_3_, p_70024_5_)); +// this.hasImpulse = true; + } + + @Override + public Item getMachineItem() + { + return ModItems.BATTERING_RAM.get(); + } + + protected Vec3 getHitPos() + { + double pitch = this.getTurretPitch() * Math.PI / 180.0; + double yaw = (this.getViewYRot(0.5f) + this.getTurretYaw()) * Math.PI / 180.0; + + return this.position().add(applyRotations(this.type.turretpivot, 0.0, yaw).add(applyRotations(this.type.turretvector, pitch, yaw))); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/Catapult.java b/src/main/java/ru/magistu/siegemachines/entity/machine/Catapult.java new file mode 100644 index 0000000..2f80eba --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/Catapult.java @@ -0,0 +1,212 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import ru.magistu.siegemachines.gui.machine.crosshair.ReloadingCrosshair; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.builder.ILoopType; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +public class Catapult extends ShootingMachine implements IAnimatable +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + static AnimationBuilder SHOOTING_ANIM = new AnimationBuilder().addAnimation("Shooting", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder RELOADING_ANIM = new AnimationBuilder().addAnimation("Reloading", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder IDLE_RELOADED_ANIM = new AnimationBuilder().addAnimation("IdleReloaded", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder IDLE_NOT_RELOADED_ANIM = new AnimationBuilder().addAnimation("IdleNotReloaded", ILoopType.EDefaultLoopTypes.LOOP); + + public enum State + { + SHOOTING, + RELOADING, + IDLE_RELOADED, + IDLE_NOT_RELOADED + } + public State state = State.RELOADING; + + public Catapult(EntityType<? extends Mob> entitytype, Level level) + { + super(entitytype, level, MachineType.CATAPULT); + } + + private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) + { + switch (state) { + case SHOOTING -> { + event.getController().setAnimation(SHOOTING_ANIM); + return PlayState.CONTINUE; + } + case IDLE_RELOADED -> { + event.getController().setAnimation(IDLE_RELOADED_ANIM); + return PlayState.CONTINUE; + } + case RELOADING -> { + event.getController().setAnimation(RELOADING_ANIM); + return PlayState.CONTINUE; + } + case IDLE_NOT_RELOADED -> { + event.getController().setAnimation(IDLE_NOT_RELOADED_ANIM); + return PlayState.CONTINUE; + } + } + + return PlayState.CONTINUE; + } + + @Override + public void registerControllers(AnimationData data) + { + AnimationController<?> controller = new AnimationController<>(this, "controller", 1, (t) -> + { + if (this.state.equals(State.RELOADING)) + { + return (double) (this.type.delaytime - this.delayticks) / this.type.delaytime; + } + return t; + }, this::predicate); + data.addAnimationController(controller); + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + ItemStack stack = player.getItemInHand(hand); + + if (super.mobInteract(player, hand) == InteractionResult.SUCCESS) + { + return InteractionResult.SUCCESS; + } + if (!this.level.isClientSide() && !this.isVehicle()) + { + player.startRiding(this); + return InteractionResult.SUCCESS; + } + + return InteractionResult.PASS; + } + + public void startShooting(Player player) + { + if (this.delayticks <= 0 && this.useticks <= 0 && this.shootingticks <= 0) + { + this.state = State.SHOOTING; + this.useticks = this.type.usetime; + this.shootingticks = this.type.userealisetime; + + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.CATAPULT_SHOOTING.get(), SoundSource.BLOCKS, 1.5f, 1.0f, false); + } + } + + @Override + public void shoot() + { + if (!level.isClientSide()) + { + super.shoot(); + } + } + + @Override + public void travel(Vec3 pos) + { + if (this.isAlive()) + { + if (this.isVehicle() && this.useticks <= 0 && this.delayticks <= 0) + { + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + + this.setTurretRotations(livingentity.getXRot(), this.getTurretYaw()); + this.updateTurretRotations(); + + this.setYawDest(livingentity.getYRot()); + this.updateYaw(); + } + super.travel(pos); + } + } + + @Override + public void tick() + { + if (this.useticks != 0 && --this.useticks <= 0) + { + this.state = State.RELOADING; + this.useticks = 0; + this.delayticks = this.type.delaytime; + } + + if (this.shootingticks != 0 && --this.shootingticks <= 0) + { + this.useRealise(); + this.shootingticks = 0; + } + + if (!level.isClientSide() && this.isOnGround()) + { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); + } + + if (this.delayticks > 0 && this.isVehicle()) + { + if (this.delayticks % 20 == 0) + { + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.CATAPULT_RELOADING.get(), SoundSource.BLOCKS, 1.0f, 1.0f, false); + } + if (--this.delayticks <= 0) + { + this.state = State.IDLE_RELOADED; + } + } + + if (this.renderupdateticks-- <= 0) + { + this.updateMachineRender(); + this.renderupdateticks = SiegeMachines.RENDER_UPDATE_TIME; + } + + super.tick(); + } + + @Override + @OnlyIn(Dist.CLIENT) + public Crosshair createCrosshair() + { + return new ReloadingCrosshair(); + } + + @Override + public Item getMachineItem() + { + return ModItems.CATAPULT.get(); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/Culverin.java b/src/main/java/ru/magistu/siegemachines/entity/machine/Culverin.java new file mode 100644 index 0000000..56568d5 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/Culverin.java @@ -0,0 +1,273 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.entity.IReloading; +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import ru.magistu.siegemachines.gui.machine.crosshair.ReloadingCrosshair; +import net.minecraft.ChatFormatting; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.builder.ILoopType; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +public class Culverin extends ShootingMachine implements IAnimatable, IReloading +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + static AnimationBuilder MOVING_ANIM = new AnimationBuilder().addAnimation("Moving", ILoopType.EDefaultLoopTypes.LOOP); + + private double wheelspitch = 0.0; + private double wheelsspeed = 0.0; + private int wheelssoundticks = 10; + + public Culverin(EntityType<? extends Mob> entitytype, Level level) + { + super(entitytype, level, MachineType.CULVERIN); + } + + private <E extends IAnimatable> PlayState wheels_predicate(AnimationEvent<E> event) + { + event.getController().setAnimation(MOVING_ANIM); + + return PlayState.CONTINUE; + } + + @Override + public void registerControllers(AnimationData data) + { + AnimationController<?> wheels_controller = new AnimationController<>(this, "wheels_controller", 1, (t) -> { + double d = this.getWheelsSpeed(); + this.wheelsspeed = d > 0 ? Math.min(d, 1.0) : Math.max(d, -1.0); + return wheelspitch += 0.013 * this.wheelsspeed; + }, this::wheels_predicate); + data.addAnimationController(wheels_controller); + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + ItemStack stack = player.getItemInHand(hand); + + if (stack.getItem().equals(Items.FLINT_AND_STEEL)) + { + if (this.useticks <= 0 && this.shootingticks <= 0) + { + stack.hurtAndBreak(1, player, (p_213833_1_) -> + { + p_213833_1_.broadcastBreakEvent(hand); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, this.useItem, hand); + }); + this.startShooting(player); + } + return InteractionResult.SUCCESS; + } + if (stack.getItem().equals(Items.GUNPOWDER)) + { + if (!this.inventory.containsItem(Items.GUNPOWDER)) + { + if (!player.isCreative()) + { + stack.shrink(1); + } + this.inventory.putItem(Items.GUNPOWDER); + } + return InteractionResult.SUCCESS; + } + if (super.mobInteract(player, hand) == InteractionResult.SUCCESS) + { + return InteractionResult.SUCCESS; + } + if (!this.level.isClientSide() && !this.isVehicle()) + { + player.startRiding(this); + return InteractionResult.SUCCESS; + } + + return InteractionResult.PASS; + } + + @Override + public void travel(Vec3 pos) + { + if (this.isAlive()) + { + if (this.isVehicle()) + { + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + + this.setTurretRotationsDest(livingentity.getXRot(), livingentity.getYRot() - this.getYaw()); + this.setYawDest(livingentity.getYRot()); + + this.updateYaw(); + this.updateTurretRotations(); + + float f0 = livingentity.xxa * 0.2f; + float f1 = livingentity.zza; + if (f1 <= 0.0f) + { + f1 *= 0.5f; + } + this.setSpeed(0.04f); + + pos = new Vec3(f0, pos.y, f1); + } + super.travel(pos); + } + } + + @Override + public void tick() + { + if (this.useticks != 0 && --this.useticks <= 0) + { + this.useticks = 0; + this.delayticks = this.type.delaytime; + } + + if (this.shootingticks != 0 && --this.shootingticks <= 0) + { + if (this.inventory.containsItem(Items.GUNPOWDER)) + { + this.useRealise(); + } + else if (!this.level.isClientSide()) + { + Entity passenger = this.getControllingPassenger(); + if (passenger instanceof Player) + { + passenger.sendSystemMessage(Component.translatable(SiegeMachines.ID + ".no_gunpowder").withStyle(ChatFormatting.RED)); + } + } + this.shootingticks = 0; + } + + if (!level.isClientSide() && this.isOnGround()) + { + this.setDeltaMovement(this.getWheelsDeltaMovement()); + } + + if (this.delayticks > 0 && this.isVehicle()) + { + --this.delayticks; + } + + if (this.renderupdateticks-- <= 0) + { + this.updateMachineRender(); + this.renderupdateticks = SiegeMachines.RENDER_UPDATE_TIME; + } + + if (this.getWheelsSpeed() > 0.0081 && this.wheelssoundticks-- <= 0) + { + this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundTypes.CANNON_WHEELS.get(), SoundSource.NEUTRAL, 0.3f, 1.0f, true); + this.wheelssoundticks = 20; + } + + super.tick(); + } + + @Override + public void startShooting(Player player) + { + if (this.delayticks <= 0 && this.useticks <= 0 && this.shootingticks <= 0) + { + if (!this.level.isClientSide()) + { + this.level.playSound(null, this.getX(), this.getY(), this.getZ(), SoundTypes.FUSE.get(), SoundSource.BLOCKS, this.getVolumeFromDist(this.distanceTo(player)), 0.8f); + } + this.useticks = this.type.usetime; + this.shootingticks = this.type.userealisetime; + } + } + + @Override + public void shoot() + { + if (!level.isClientSide()) + { + super.shoot(); + this.setDeltaMovement(this.getDeltaMovement().subtract(this.getShotView().scale(0.25))); + this.hasImpulse = true; + this.inventory.shrinkItem(Items.GUNPOWDER); + } + else + { + this.blowParticles(ParticleTypes.FLAME, 0.035, 25); + this.blowParticles(ParticleTypes.CLOUD, 0.2, 60); + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.MORTAR_SHOOTING.get(), SoundSource.BLOCKS, 1.5f/*this.getVolumeFromDist(1.5f, 64.0f, this.distanceTo(player))*/, 0.85f + this.level.random.nextFloat() * 0.3f, false); + } + } + + public double getWheelsSpeed() + { + if (this.isOnGround()) + { + return this.getViewVector(5.0f).multiply(1, 0, 1).dot(this.getDeltaMovement()); + } + + return 0.0; + } + + public Vec3 getWheelsDeltaMovement() + { + if (this.isOnGround()) + { + Vec3 view = this.getViewVector(1.0f); + Vec3 movement = this.getDeltaMovement(); + + double d0 = movement.x * view.x + movement.z * view.z; + + double d1 = d0 * view.x; + double d2 = 0.0; + double d3 = d0 * view.z; + + return new Vec3(d1, d2, d3); + } + + return Vec3.ZERO; + } + + @Override + @OnlyIn(Dist.CLIENT) + public Crosshair createCrosshair() + { + return new ReloadingCrosshair(); + } + + @Override + public Item getMachineItem() + { + return null; +// return ModItems.CULVERIN.get(); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/Machine.java b/src/main/java/ru/magistu/siegemachines/entity/machine/Machine.java new file mode 100644 index 0000000..b9a594e --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/Machine.java @@ -0,0 +1,714 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.gui.machine.MachineContainer; +import ru.magistu.siegemachines.network.PacketHandler; +import ru.magistu.siegemachines.network.PacketMachine; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.NonNullList; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.world.Container; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.Nameable; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.EntityDamageSource; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.HoneyBlock; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.network.NetworkHooks; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nullable; + +public abstract class Machine extends Mob implements MenuProvider +{ + public MachineInventory inventory = new MachineInventory(); + + public static int rows = 1; + + public final MachineType type; + + private float turretpitch = -25.0f; + private float turretpitchprev = this.turretpitch; + protected float turretpitchdest = this.turretpitch; + private float turretyaw = 0.0f; + private float turretyawprev = this.turretyaw; + protected float turretyawdest = this.turretyaw; + protected float yawdest = this.getYRot(); + + public int useticks = -1; + public int delayticks; + protected int renderupdateticks = 0; + public int deploymentticks = 0; + + protected Machine(EntityType<? extends Mob> entitytype, Level level, MachineType type) + { + super(entitytype, level); + this.type = type; + this.delayticks = this.type.delaytime; + rows = this.type.rows; + } + + public static AttributeSupplier.Builder setEntityAttributes(MachineType type) { + return Mob.createMobAttributes() + .add(Attributes.MAX_HEALTH, type.health) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.5F) + .add(Attributes.MOVEMENT_SPEED, 0.0D) + .add(Attributes.ATTACK_DAMAGE, 0.0D) + .add(Attributes.FOLLOW_RANGE, 0.0D); + } + + public ItemStack getMachineItemWithData() { + ItemStack stack = new ItemStack(this.getMachineItem()); + CompoundTag nbt = this.saveWithoutId(new CompoundTag()); + nbt.remove("Pos"); + nbt.remove("Motion"); + nbt.remove("FallDistance"); + nbt.remove("Fire"); + nbt.remove("Air"); + nbt.remove("OnGround"); + nbt.remove("Invulnerable"); + nbt.remove("PortalCooldown"); + nbt.remove("UUID"); + nbt.remove("Passengers"); + nbt.remove("DelayTicks"); + nbt.remove("UseTicks"); + stack.addTagElement("EntityTag", nbt); + return stack; + } + + @Override + public boolean isInvulnerableTo(DamageSource damagesource) { + return damagesource == DamageSource.CACTUS || + damagesource == DamageSource.WITHER || + damagesource == DamageSource.MAGIC || + damagesource == DamageSource.DROWN || + damagesource == DamageSource.STARVE || + super.isInvulnerableTo(damagesource); + } + + public float adjustDamage(DamageSource damagesource, float f) { + if (damagesource.isFire()) { + f *= 1.5f; + } + + if (damagesource.isExplosion()) { + f *= 1.25f; + } + + if (damagesource.isCreativePlayer()) { + f *= 2; + } + + if (damagesource.getEntity() instanceof AbstractArrow) { + f *= 0.5f; + } + + return f; + } + + public abstract Item getMachineItem(); + + @Override + public void tick() { + if (this.deploymentticks > 0) { + this.deploymentticks--; + } + super.tick(); + } + + @Override + public boolean hurt(@NotNull DamageSource damagesource, float f) { + if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, damagesource, f)) return false; + if (damagesource.getEntity() instanceof Player + && !damagesource.isProjectile() + && !damagesource.isExplosion() + && !damagesource.isMagic() + && this.getPassengers().isEmpty()) { + this.spawnAtLocation(this.getMachineItemWithData()); + this.remove(); + + return false; + } + + if (this.isInvulnerableTo(damagesource)) { + return false; + } else if (this.level.isClientSide) { + return false; + } else if (this.isDeadOrDying()) { + return false; + } else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { + return false; + } else { + f = adjustDamage(damagesource, f); + + this.noActionTime = 0; + + this.animationSpeed = 1.5F; + boolean flag1 = true; + if ((float) this.invulnerableTime > 10.0F) + { + if (f <= this.lastHurt) + { + return false; + } + + this.actuallyHurt(damagesource, f - this.lastHurt); + this.lastHurt = f; + flag1 = false; + } + else + { + this.lastHurt = f; + this.invulnerableTime = 20; + this.actuallyHurt(damagesource, f); + this.hurtDuration = 10; + this.hurtTime = this.hurtDuration; + } + + this.hurtDir = 0.0F; + Entity entity1 = damagesource.getEntity(); + if (entity1 != null) + { + if (entity1 instanceof LivingEntity) + { + this.setLastHurtByMob((LivingEntity) entity1); + } + + if (entity1 instanceof Player) + { + this.lastHurtByPlayerTime = 1; + this.lastHurtByPlayer = (Player) entity1; + } + + else if (entity1 instanceof TamableAnimal wolfEntity) { + if (wolfEntity.isTame()) { + this.lastHurtByPlayerTime = 100; + LivingEntity livingentity = wolfEntity.getOwner(); + + if (livingentity != null && livingentity.getType() == EntityType.PLAYER) { + this.lastHurtByPlayer = (Player) livingentity; + } + + else { + this.lastHurtByPlayer = null; + } + } + } + } + + if (flag1) { + if (damagesource instanceof EntityDamageSource && ((EntityDamageSource) damagesource).isThorns()) { + this.level.broadcastEntityEvent(this, (byte) 33); + } + + else { + byte b0; + + if (damagesource.isFire()) { + b0 = 37; + } + + else if (damagesource == DamageSource.SWEET_BERRY_BUSH) { + b0 = 44; + } + + else { + b0 = 2; + } + + this.level.broadcastEntityEvent(this, b0); + } + + this.markHurt(); + + if (entity1 != null) + { + double d1 = entity1.getX() - this.getX(); + + double d0; + for (d0 = entity1.getZ() - this.getZ(); d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) + { + d1 = (Math.random() - Math.random()) * 0.01D; + } + + this.hurtDir = (float) (Mth.atan2(d0, d1) * (double) (180F / (float) Math.PI) - (double) this.getYRot()); + } + else + { + this.hurtDir = (float) ((int) (Math.random() * 2.0D) * 180); + } + } + + if (this.isDeadOrDying()) + { + SoundEvent soundevent = this.getDeathSound(); + if (flag1 && soundevent != null) + { + this.playSound(soundevent, this.getSoundVolume(), this.getVoicePitch()); + } + + this.die(damagesource); + } + else if (flag1) + { + this.playHurtSound(damagesource); + } + + if (entity1 instanceof ServerPlayer) + { + CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer) entity1, this, damagesource, f, f, false); + } + + return true; + } + } + + @Override + @Nullable + protected SoundEvent getHurtSound(@NotNull DamageSource p_184601_1_) + { + return null; + } + + @Override + @Nullable + protected SoundEvent getDeathSound() + { + return null; + } + + @Override + public boolean removeWhenFarAway(double p_213397_1_) + { + return false; + } + + @Nullable + @Override + public Entity getControllingPassenger() + { + return this.getPassengers().isEmpty() ? null : this.getPassengers().get(0); + } + + @Override + public boolean canRiderInteract() + { + return true; + } + + @Override + public void addAdditionalSaveData(@NotNull CompoundTag nbt) + { + super.addAdditionalSaveData(nbt); + + ListTag listnbt = new ListTag(); + for(ItemStack itemstack : this.inventory.items) + { + CompoundTag compoundnbt = new CompoundTag(); + if (!itemstack.isEmpty()) + { + itemstack.save(compoundnbt); + } + listnbt.add(compoundnbt); + } + nbt.put("Items", listnbt); + nbt.put("TurretRotations", this.newFloatList(this.turretpitch, this.turretyaw)); + nbt.putInt("DealyTicks", this.delayticks); + nbt.putInt("UseTicks", this.useticks); + } + + @Override + protected void dropCustomDeathLoot(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) + { + super.dropCustomDeathLoot(p_213333_1_, p_213333_2_, p_213333_3_); + this.inventory.items.forEach(this::spawnAtLocation); + this.inventory.clearContent(); + } + + public void remove() + { + if (!this.dead) + { + this.dead = true; + this.level.broadcastEntityEvent(this, (byte)3); + } + super.remove(RemovalReason.DISCARDED); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void handleEntityEvent(byte b) { + switch (b) { + case 2, 33, 36, 37, 44 -> { + boolean flag1 = b == 33; + boolean flag2 = b == 36; + boolean flag3 = b == 37; + boolean flag = b == 44; + this.animationSpeed = 1.5F; + this.invulnerableTime = 20; + this.hurtDuration = 10; + this.hurtTime = this.hurtDuration; + this.hurtDir = 0.0F; + if (flag1) { + this.playSound(SoundEvents.THORNS_HIT, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + } + DamageSource damagesource; + if (flag3) { + damagesource = DamageSource.ON_FIRE; + } else if (flag2) { + damagesource = DamageSource.DROWN; + } else if (flag) { + damagesource = DamageSource.SWEET_BERRY_BUSH; + } else { + damagesource = DamageSource.GENERIC; + } + SoundEvent soundevent1 = this.getHurtSound(damagesource); + if (soundevent1 != null) { + this.playSound(soundevent1, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + } + this.hurt(DamageSource.GENERIC, 0.0F); + } + case 3 -> { + SoundEvent soundevent = this.getDeathSound(); + if (soundevent != null) { + this.playSound(soundevent, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + } + this.setHealth(0.0F); + this.remove(); + } + case 29, 30, 46 -> { + for (int j = 0; j < 128; ++j) { + double d0 = (double) j / 127.0D; + float f = (this.random.nextFloat() - 0.5F) * 0.2F; + float f1 = (this.random.nextFloat() - 0.5F) * 0.2F; + float f2 = (this.random.nextFloat() - 0.5F) * 0.2F; + double d1 = Mth.lerp(d0, this.xo, this.getX()) + (this.random.nextDouble() - 0.5D) * (double) this.getBbWidth() * 2.0D; + double d2 = Mth.lerp(d0, this.yo, this.getY()) + this.random.nextDouble() * (double) this.getBbHeight(); + double d3 = Mth.lerp(d0, this.zo, this.getZ()) + (this.random.nextDouble() - 0.5D) * (double) this.getBbWidth() * 2.0D; + this.level.addParticle(ParticleTypes.PORTAL, d1, d2, d3, f, f1, f2); + } + } + case 54 -> HoneyBlock.showJumpParticles(this); + default -> super.handleEntityEvent(b); + } + } + + @Override + public void readAdditionalSaveData(@NotNull CompoundTag nbt) + { + super.readAdditionalSaveData(nbt); + if (nbt.contains("Items", 9)) + { + ListTag listnbt = nbt.getList("Items", 10); + + for(int i = 0; i < this.inventory.items.size(); ++i) + { + this.inventory.items.set(i, ItemStack.of(listnbt.getCompound(i))); + } + } + if (nbt.contains("TurretRotations", 5)) + { + ListTag turretrotations = nbt.getList("TurretRotations", 5); + setTurretRotations(turretrotations.getFloat(0), turretrotations.getFloat(1)); + } + if (nbt.contains("DealyTicks")) + { + this.delayticks = nbt.getInt("DealyTicks"); + } + if (nbt.contains("UseTicks")) + { + this.useticks = nbt.getInt("UseTicks"); + } + } + + public float getGlobalTurretYaw() + { + return Mth.lerp(0.5f, this.yRotO, this.getYRot()) + Mth.lerp(0.5f, this.turretyawprev, this.turretyaw); + } + + public float getYaw() + { + return this.getYRot(); + } + + public void setYaw(float yaw) + { + this.setYRot(yaw); + this.yRotO = this.getYRot(); + this.yBodyRot = this.getYRot(); + this.yHeadRot = this.yBodyRot; + } + + public float getYawDest() + { + return this.yawdest; + } + + public void setYawDest(float yaw) + { + this.yawdest = yaw; + } + + public float getTurretPitch(float f) + { + return Mth.lerp(f, this.turretpitchprev, this.turretpitch); + } + + public float getTurretYaw(float f) + { + return Mth.lerp(f, this.turretyawprev, this.turretyaw); + } + + public float getTurretPitch() + { + return this.getTurretPitch(0.5f); + } + + public float getTurretYaw() + { + return this.getTurretYaw(0.5f); + } + + public void setTurretRotations(float pitch, float yaw) + { + this.turretpitchprev = this.turretpitch; + this.turretyawprev = this.turretyaw; + this.turretpitch = pitch; + this.turretyaw = yaw; + } + + public float getTurretPitchDest() + { + return this.turretpitchdest; + } + + public float getTurretYawDest() + { + return this.turretyawdest; + } + + public void setTurretRotationsDest(float pitch, float yaw) + { + this.turretpitchdest = pitch; + this.turretyawdest = yaw; + } + + public void updateMachineRender() + { + if (!this.level.isClientSide()) + { + PacketHandler.sendPacketToAllInArea(new PacketMachine( + this.getId(), + this.delayticks, + this.useticks, + this.turretpitch, + this.turretyaw), this.blockPosition(), SiegeMachines.RENDER_UPDATE_RANGE_SQR); + } + } + + public void updateYaw() + { + float newyaw = this.turn(this.getYaw(), this.getYawDest(), this.type.rotationspeed); + + if (this.getYaw() != newyaw) + this.setYaw(newyaw); + } + + public void updateTurretRotations() + { + float newyaw = this.turn(this.getTurretYaw(), this.getTurretYawDest(), this.type.turretspeed, this.type.turretminyaw, this.type.turretmaxyaw); + boolean shouldrotate = this.checkYaw(newyaw, this.getTurretYaw(), this.type.turretspeed); + float newpitch = shouldrotate ? this.turn(this.getTurretPitch(), this.getTurretPitchDest(), this.type.turretspeed, this.type.turretminpitch, this.type.turretmaxpitch) : this.getTurretPitch(); + + if (this.turretpitch != newpitch || this.turretyaw != newyaw) + this.setTurretRotations(newpitch, newyaw); + } + + public boolean checkYaw(float yaw, float currentYaw, float speed) { + return !this.type.yawfirst || Math.abs(yaw - currentYaw) <= speed / 2 || yaw <= this.type.turretminyaw || yaw >= this.type.turretmaxyaw; + } + + public float turn(float rotation, float rotationDest, float speed) { + return this.turn(rotation, rotationDest, speed, -180, 180); + } + + public float turn(float rotation, float rotationDest, float speed, float minRotation, float maxRotation) + { + boolean hasLimit = maxRotation - minRotation < 360; + + float deltaRotation = rotationDest - rotation; + deltaRotation = Mth.wrapDegrees(deltaRotation); + + float newRotation; + if (deltaRotation > speed / 2) { + newRotation = rotation + speed; + } + else if (deltaRotation < -speed / 2) { + newRotation = rotation - speed; + } + else { + newRotation = rotation + deltaRotation / 2; + } + + if (hasLimit) { + if (newRotation > -minRotation) { + newRotation = -minRotation; + } + if (newRotation < -maxRotation) { + newRotation = -maxRotation; + } + } + + return newRotation; + } + + protected static Vec3 applyRotations(Vec3 vec, double pitch, double yaw) { + double d0 = vec.x * Math.cos(yaw) - vec.y * Math.sin(pitch) * Math.sin(yaw) - vec.z * Math.sin(yaw) * Math.cos(pitch); + double d1 = vec.y * Math.cos(pitch) - vec.z * Math.sin(pitch); + double d2 = vec.x * Math.sin(yaw) + vec.y * Math.sin(pitch) * Math.cos(yaw) + vec.z * Math.cos(yaw) * Math.cos(pitch); + return new Vec3(d0, d1, d2); + } + + protected float getVolumeFromDist(float dist) { + return (float) 0.5 * Math.max((float) 6.0 - dist, 0.0f) / (float) 6.0; + } + + public abstract void use(Player player); + + public abstract void useRealise(); + + @Override + public MachineContainer createMenu(int id, @NotNull Inventory inv, @NotNull Player player) { + return new MachineContainer(id, inv, this); + } + + public void openInventoryGui() { + Entity passenger = this.getControllingPassenger(); + if (passenger instanceof ServerPlayer) { + this.stopRiding(); + NetworkHooks.openScreen((ServerPlayer) passenger, this, this.blockPosition()); + } + } + + @Override + public Vec3 getDismountLocationForPassenger(LivingEntity entity) { + double yaw = (this.getGlobalTurretYaw()) * Math.PI / 180.0; + + return this.position().add(applyRotations(this.type.passengerpos, 0.0, yaw)); + } + + @Override + public boolean shouldRiderSit() { + return false; + } + + @Override + public void positionRider(@NotNull Entity entity) { + MoveFunction setPos = Entity::setPos; + if (this.hasPassenger(entity)) { + double yaw = (this.getGlobalTurretYaw()) * Math.PI / 180.0; + Vec3 pos = this.position().add(applyRotations(this.type.passengerpos, 0.0, yaw)); + setPos.accept(entity, pos.x, pos.y, pos.z); + } + } + + + public static class MachineInventory implements Container, Nameable { + public NonNullList<ItemStack> items = NonNullList.withSize(9 * rows, ItemStack.EMPTY); + + @Override + public int getContainerSize() { + return 9 * rows; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public @NotNull ItemStack getItem(int id) { + return this.items.get(id); + } + + @Override + public @NotNull ItemStack removeItem(int id, int p_70298_2_) { + return this.items.set(id, ItemStack.EMPTY); + } + + @Override + public @NotNull ItemStack removeItemNoUpdate(int id) { + return this.items.remove(id); + } + + @Override + public void setItem(int id, @NotNull ItemStack item) { + this.items.set(id, item); + } + + @Override + public void setChanged() {} + + @Override + public boolean stillValid(@NotNull Player player) + { + return true; + } + + @Override + public void clearContent() { + this.items = NonNullList.withSize(9 * rows, ItemStack.EMPTY); + } + + public boolean containsItem(Item item) { + return this.items.stream().anyMatch(itemStack -> itemStack.getItem().equals(item)); + } + + public void putItem(Item item) { + for (int i = 0; i < this.items.size(); ++i) { + ItemStack itemstack = this.items.get(i); + if (itemstack.isEmpty()) { + this.items.set(i, new ItemStack(item)); + break; + } + if (itemstack.getItem().equals(item) && itemstack.getCount() < itemstack.getMaxStackSize()) { + itemstack.setCount(itemstack.getCount() + 1); + break; + } + } + } + + public void shrinkItem(Item item) { + for (ItemStack itemstack : this.items) { + if (itemstack.getItem().equals(item)) { + itemstack.shrink(1); + break; + } + } + } + + @Override + public Component getName() { + return this.getName(); + } + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/MachinePartEntity.java b/src/main/java/ru/magistu/siegemachines/entity/machine/MachinePartEntity.java new file mode 100644 index 0000000..33533d2 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/MachinePartEntity.java @@ -0,0 +1,50 @@ +package ru.magistu.siegemachines.entity.machine; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.Pose; +import org.jetbrains.annotations.NotNull; + +public class MachinePartEntity extends net.minecraftforge.entity.PartEntity<Machine> +{ + public final Machine parentmob; + public final String name; + private final EntityDimensions size; + + public MachinePartEntity(Machine parent, String name, float width, float height) + { + super(parent); + this.size = EntityDimensions.scalable(width, height); + this.refreshDimensions(); + this.parentmob = parent; + this.name = name; + } + + @Override + protected void defineSynchedData() {} + + @Override + protected void readAdditionalSaveData(@NotNull CompoundTag p_70037_1_) {} + + @Override + protected void addAdditionalSaveData(@NotNull CompoundTag p_213281_1_) {} + + public boolean hurt(@NotNull DamageSource source, float value) { + return !this.isInvulnerableTo(source) && this.parentmob.hurt(source, value); + } + + public boolean is(@NotNull Entity entity) { + return this == entity || this.parentmob == entity; + } + + public Packet<?> getAddEntityPacket() { + throw new UnsupportedOperationException(); + } + + public @NotNull EntityDimensions getDimensions(@NotNull Pose pose) { + return this.size; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/MachineType.java b/src/main/java/ru/magistu/siegemachines/entity/machine/MachineType.java new file mode 100644 index 0000000..c5d8711 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/MachineType.java @@ -0,0 +1,87 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.entity.projectile.ProjectileBuilder; +import net.minecraft.world.phys.Vec3; + +public enum MachineType { + MORTAR(80, 1, 0.0f, 85.0f, 0.0f, 0.0f, 0.5f, 0.5f, true, 10, 10, 200, + new Vec3(17.0, 0.0, -10.0).scale(1 / 16.0), new Vec3(0.0, 17.0, 7.0).scale(1 / 16.0), new Vec3(0.0, 0.0, 12.0).scale(1 / 16.0), + 2.5f, 0.2f, ProjectileBuilder.CANNON_AMMO, true), + CULVERIN(80, 1, 0.0f, 85.0f, 0.0f, 0.0f, 0.5f, 0.5f, true, 10, 10, 200, + new Vec3(30.0, 0.0, -40.0).scale(1 / 16.0), new Vec3(0.0, 17.0, 7.0).scale(1 / 16.0), new Vec3(0.0, 0.0, 12.0).scale(1 / 16.0), + 3.0f, 0.2f, ProjectileBuilder.CANNON_AMMO, true), + TREBUCHET(300, 1, -45.0f, 75.0f, 0.0f, 0.0f, 0.1f, 0.5f, true, 38, 137, 400, + new Vec3(40.0, 0.0, -60.0).scale(1 / 16.0), new Vec3(0.0, 19.0, -3.0), new Vec3(0.0, 10.0, -1.0), + 2.8f, 0.2f, ProjectileBuilder.THROWING_AMMO, false), + CATAPULT(100, 1, 0.0f, 75.0f, 0.0f, 0.0f, 0.2f, 1.0f, true, 2, 10, 200, + new Vec3(30.0, 0.0, -40.0).scale(1 / 16.0), new Vec3(0.0, 51.0, -5.0).scale(1 / 16.0), new Vec3(0.0, 0.0, 0.0), + 2.0f, 0.2f, ProjectileBuilder.THROWING_AMMO, false), + BALLISTA(50, 1, -30.0f, 60.0f, -180.0f, 180.0f, 4.5f, 0.0f, false, 1, 20, 120, + new Vec3(0.0, 0.0, -30.0).scale(1 / 16.0), new Vec3(0.0, 22.5, 0.0).scale(1 / 16.0), new Vec3(0.0, 0.0, 17.0).scale(1 / 16.0), + 4.5f, 0.04f, ProjectileBuilder.BALLISTA_AMMO, false), + BATTERING_RAM(250, 1, 0.0f, 0.0f, 0.0f, 0.0f, 0.1f, 0.0f, false, 5, 5, 100, + new Vec3(12.0, 0.0, -48.0).scale(1 / 16.0), new Vec3(0.0, 26.0, 36.0).scale(1 / 16.0), new Vec3(0.0, 0.0, 32.0).scale(1 / 16.0), + 0.0f, 0.5f, ProjectileBuilder.NO_AMMO, false); + + public final int health; + public final int rows; + public final float turretminpitch; + public final float turretmaxpitch; + public final float turretminyaw; + public final float turretmaxyaw; + public final float rotationspeed; + public final float turretspeed; + public final boolean yawfirst; + public final int userealisetime; + public final int usetime; + public final int delaytime; + public final Vec3 passengerpos; + public final Vec3 turretpivot; + public final Vec3 turretvector; + public final float projectilespeed; + public final float inaccuracy; + public final ProjectileBuilder[] ammo; + public final boolean usesgunpowder; + + MachineType( + int health, + int rows, + float turretminpitch, + float turretmaxpitch, + float turretminyaw, + float turretmaxyaw, + float rotationspeed, + float turretspeed, + boolean yawfirst, + int shootingtime, + int usetime, + int delaytime, + Vec3 passengerpos, + Vec3 turretpivot, + Vec3 turretvector, + float projectilespeed, + float inaccuracy, + ProjectileBuilder[] ammo, + boolean usesgunpowder) + { + this.health = health; + this.rows = rows; + this.turretminpitch = turretminpitch; + this.turretmaxpitch = turretmaxpitch; + this.turretminyaw = turretminyaw; + this.turretmaxyaw = turretmaxyaw; + this.rotationspeed = rotationspeed; + this.turretspeed = turretspeed; + this.yawfirst = yawfirst; + this.userealisetime = shootingtime; + this.usetime = usetime; + this.delaytime = delaytime; + this.passengerpos = passengerpos; + this.turretpivot = turretpivot; + this.turretvector = turretvector; + this.projectilespeed = projectilespeed; + this.inaccuracy = inaccuracy; + this.ammo = ammo; + this.usesgunpowder = usesgunpowder; + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/Mortar.java b/src/main/java/ru/magistu/siegemachines/entity/machine/Mortar.java new file mode 100644 index 0000000..ad4c395 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/Mortar.java @@ -0,0 +1,275 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.entity.IReloading; +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import ru.magistu.siegemachines.gui.machine.crosshair.ReloadingCrosshair; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.ChatFormatting; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.builder.ILoopType; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +public class Mortar extends ShootingMachine implements IAnimatable, IReloading +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + static AnimationBuilder MOVING_ANIM = new AnimationBuilder().addAnimation("Moving", ILoopType.EDefaultLoopTypes.LOOP); + + public int shootingticks = 0; + + private double wheelspitch = 0.0; + private double wheelsspeed = 0.0; + private int wheelssoundticks = 10; + + public Mortar(EntityType<? extends Mob> entitytype, Level level) + { + super(entitytype, level, MachineType.MORTAR); + } + + private <E extends IAnimatable> PlayState wheels_predicate(AnimationEvent<E> event) + { + event.getController().setAnimation(MOVING_ANIM); + + return PlayState.CONTINUE; + } + + @Override + public void registerControllers(AnimationData data) + { + AnimationController<?> wheels_controller = new AnimationController<>(this, "wheels_controller", 1, (t) -> { + double d = this.getWheelsSpeed(); + this.wheelsspeed = d > 0 ? Math.min(d, 1.0) : Math.max(d, -1.0); + return wheelspitch += 0.013 * this.wheelsspeed; + }, this::wheels_predicate); + data.addAnimationController(wheels_controller); + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + ItemStack stack = player.getItemInHand(hand); + + if (stack.getItem().equals(Items.FLINT_AND_STEEL)) + { + if (this.useticks <= 0 && this.shootingticks <= 0) + { + stack.hurtAndBreak(1, player, (p_213833_1_) -> + { + p_213833_1_.broadcastBreakEvent(hand); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, this.useItem, hand); + }); + this.startShooting(player); + } + return InteractionResult.SUCCESS; + } + if (stack.getItem().equals(Items.GUNPOWDER)) + { + if (!this.inventory.containsItem(Items.GUNPOWDER)) + { + if (!player.isCreative()) + { + stack.shrink(1); + } + this.inventory.putItem(Items.GUNPOWDER); + } + return InteractionResult.SUCCESS; + } + if (super.mobInteract(player, hand) == InteractionResult.SUCCESS) + { + return InteractionResult.SUCCESS; + } + if (!this.level.isClientSide() && !this.isVehicle()) + { + player.startRiding(this); + return InteractionResult.SUCCESS; + } + + return InteractionResult.PASS; + } + + @Override + public void travel(Vec3 pos) + { + if (this.isAlive()) + { + if (this.isVehicle()) + { + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + + this.setTurretRotationsDest(livingentity.getXRot(), livingentity.getYRot() - this.getYaw()); + this.setYawDest(livingentity.getYRot()); + + this.updateYaw(); + this.updateTurretRotations(); + + float f0 = livingentity.xxa * 0.2f; + float f1 = livingentity.zza; + if (f1 <= 0.0f) + { + f1 *= 0.5f; + } + this.setSpeed(0.04f); + + pos = new Vec3(f0, pos.y, f1); + } + super.travel(pos); + } + } + + @Override + public void tick() + { + if (this.useticks != 0 && --this.useticks <= 0) + { + this.useticks = 0; + this.delayticks = this.type.delaytime; + } + + if (this.shootingticks != 0 && --this.shootingticks <= 0) + { + if (this.inventory.containsItem(Items.GUNPOWDER)) + { + this.useRealise(); + } + else if (!this.level.isClientSide()) + { + Entity passenger = this.getControllingPassenger(); + if (passenger instanceof Player) + { + passenger.sendSystemMessage(Component.translatable(SiegeMachines.ID + ".no_gunpowder").withStyle(ChatFormatting.RED)); + } + } + this.shootingticks = 0; + } + + if (!level.isClientSide() && this.isOnGround()) + { + this.setDeltaMovement(this.getWheelsDeltaMovement()); + } + + if (this.delayticks > 0 && this.isVehicle()) + { + --this.delayticks; + } + + if (this.renderupdateticks-- <= 0) + { + this.updateMachineRender(); + this.renderupdateticks = SiegeMachines.RENDER_UPDATE_TIME; + } + + if (this.getWheelsSpeed() > 0.0081 && this.wheelssoundticks-- <= 0) + { + this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundTypes.CANNON_WHEELS.get(), SoundSource.NEUTRAL, 0.3f, 1.0f, true); + this.wheelssoundticks = 20; + } + + super.tick(); + } + + @Override + public void startShooting(Player player) + { + if (this.delayticks <= 0 && this.useticks <= 0 && this.shootingticks <= 0) + { + if (!this.level.isClientSide()) + { + this.level.playSound(null, this.getX(), this.getY(), this.getZ(), SoundTypes.FUSE.get(), SoundSource.BLOCKS, this.getVolumeFromDist(this.distanceTo(player)), 0.8f); + } + this.useticks = this.type.usetime; + this.shootingticks = this.type.userealisetime; + } + } + + @Override + public void shoot() + { + if (!level.isClientSide()) + { + super.shoot(); + this.setDeltaMovement(this.getDeltaMovement().subtract(this.getShotView().scale(0.25))); + this.hasImpulse = true; + this.inventory.shrinkItem(Items.GUNPOWDER); + } + else + { + this.blowParticles(ParticleTypes.FLAME, 0.035, 25); + this.blowParticles(ParticleTypes.CLOUD, 0.2, 60); + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.MORTAR_SHOOTING.get(), SoundSource.BLOCKS, 1.5f/*this.getVolumeFromDist(1.5f, 64.0f, this.distanceTo(player))*/, 0.85f + this.level.random.nextFloat() * 0.3f, false); + } + } + + public double getWheelsSpeed() + { + if (this.isOnGround()) + { + return this.getViewVector(5.0f).multiply(1, 0, 1).dot(this.getDeltaMovement()); + } + + return 0.0; + } + + public Vec3 getWheelsDeltaMovement() + { + if (this.isOnGround()) + { + Vec3 view = this.getViewVector(1.0f); + Vec3 movement = this.getDeltaMovement(); + + double d0 = movement.x * view.x + movement.z * view.z; + + double d1 = d0 * view.x; + double d2 = 0.0; + double d3 = d0 * view.z; + + return new Vec3(d1, d2, d3); + } + + return Vec3.ZERO; + } + + @Override + @OnlyIn(Dist.CLIENT) + public Crosshair createCrosshair() + { + return new ReloadingCrosshair(); + } + + @Override + public Item getMachineItem() + { + return ModItems.MORTAR.get(); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/ShootingMachine.java b/src/main/java/ru/magistu/siegemachines/entity/machine/ShootingMachine.java new file mode 100644 index 0000000..66342a6 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/ShootingMachine.java @@ -0,0 +1,190 @@ +package ru.magistu.siegemachines.entity.machine; + +import com.mojang.math.Vector3d; +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.entity.IReloading; +import ru.magistu.siegemachines.entity.projectile.Missile; +import ru.magistu.siegemachines.entity.projectile.ProjectileBuilder; +import ru.magistu.siegemachines.network.*; +import net.minecraft.ChatFormatting; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +import java.util.Arrays; +import java.util.Random; + +public abstract class ShootingMachine extends Machine implements IReloading +{ + public int shootingticks = 0; + + protected ShootingMachine(EntityType<? extends Mob> entitytype, Level level, MachineType type) + { + super(entitytype, level, type); + } + + public abstract void startShooting(Player player); + + public void shoot() + { + if (this.type.ammo.length == 0) + { + return; + } + ProjectileBuilder projectilebuilder = this.getProjectileBuilder(); + if (projectilebuilder.equals(ProjectileBuilder.NONE)) + { + Entity passenger = this.getControllingPassenger(); + if (passenger instanceof Player) + { + passenger.sendSystemMessage(Component.translatable(SiegeMachines.ID + ".no_ammo").withStyle(ChatFormatting.RED)); + } + return; + } + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + Projectile projectile = projectilebuilder.factory.create(projectilebuilder.entitytype, this.level, new Vector3d(this.getShotPos().x, this.getShotPos().y, this.getShotPos().z), livingentity == null ? this : livingentity, projectilebuilder.projectilitem); + if (projectile instanceof Missile) + { + Missile missile = (Missile) projectile; + missile.setItem(new ItemStack(missile.getDefaultItem())); + } + projectile.shootFromRotation(this, this.getTurretPitch(), this.getGlobalTurretYaw(), 0.0f, this.type.projectilespeed, this.type.inaccuracy); + this.level.addFreshEntity(projectile); + this.inventory.shrinkItem(projectilebuilder.item); + } + + @Override + public void use(Player player) + { + if (!this.level.isClientSide()) + { + PacketHandler.sendPacketToAllInArea(new PacketMachineUse(this.getId()), this.blockPosition(), SiegeMachines.RENDER_UPDATE_RANGE_SQR); + } + + this.startShooting(player); + } + + @Override + public void useRealise() + { + if (!this.level.isClientSide()) + { + PacketHandler.sendPacketToAllInArea(new PacketMachineUseRealise(this.getId()), this.blockPosition(), SiegeMachines.RENDER_UPDATE_RANGE_SQR); + } + this.shoot(); + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + ItemStack stack = player.getItemInHand(hand); + + if (this.isValidAmmo(stack)) + { + if (!this.hasAmmo()) + { + if (!player.isCreative()) + { + stack.shrink(1); + } + this.inventory.putItem(stack.getItem()); + } + return InteractionResult.SUCCESS; + } + return InteractionResult.PASS; + } + + protected Vec3 getShotPos() + { + double pitch = this.getTurretPitch() * Math.PI / 180.0; + double yaw = (this.getViewYRot(0.5f) + this.getTurretYaw()) * Math.PI / 180.0; + + return this.position().add(applyRotations(this.type.turretpivot, 0.0, yaw).add(applyRotations(this.type.turretvector, pitch, yaw))); + } + + protected Vec3 getShotView() + { + double pitch = this.getTurretPitch() * Math.PI / 180.0; + double yaw = this.getGlobalTurretYaw() * Math.PI / 180.0; + + double d0 = -Math.sin(yaw) * Math.cos(pitch); + double d1 = -Math.sin(pitch); + double d2 = Math.cos(yaw) * Math.cos(pitch); + + return new Vec3(d0, d1, d2).normalize(); + } + + protected void blowParticles(ParticleOptions particle, double speed, int amount) + { + for (int i = 0; i < amount; ++i) + { + Vec3 pos = this.getShotPos(); + Vec3 inaccuracy = new Vec3(new Random().nextGaussian() * 0.2, + new Random().nextGaussian() * 0.2, + new Random().nextGaussian() * 0.2); + Vec3 velocity = this.getShotView().add(inaccuracy).scale(speed); + + this.level.addParticle(particle, pos.x, pos.y, pos.z, velocity.x, velocity.y, velocity.z); + } + } + + @Override + public void updateMachineRender() + { + super.updateMachineRender(); + if (!this.level.isClientSide()) + { + for (int i = 0; i < rows * 9; ++i) + { + if (this.isValidAmmo(this.inventory.getItem(i))) + { + PacketHandler.sendPacketToAllInArea( + new PacketMachineInventorySlot(this.getId(), i, this.inventory.getItem(i)), + this.blockPosition(), + SiegeMachines.RENDER_UPDATE_RANGE_SQR); + } + } + } + } + + public boolean isValidAmmo(ItemStack stack) + { + return this.isValidAmmo(stack.getItem()); + } + + public boolean isValidAmmo(Item entry) + { + return Arrays.stream(this.type.ammo).anyMatch(builder -> builder.item.equals(entry)); + } + + public ItemStack getAmmo() + { + return this.inventory.items.stream().filter(this::isValidAmmo).findFirst().orElse(ItemStack.EMPTY); + } + + public boolean hasAmmo() + { + return this.inventory.items.stream().anyMatch(this::isValidAmmo); + } + + public ProjectileBuilder getProjectileBuilder() + { + ItemStack ammo = this.getAmmo(); + if (ammo.equals(ItemStack.EMPTY)) + { + return ProjectileBuilder.NONE; + } + return Arrays.stream(this.type.ammo).filter(builder -> builder.item.equals(ammo.getItem())).findFirst().orElse(ProjectileBuilder.NONE); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/machine/Trebuchet.java b/src/main/java/ru/magistu/siegemachines/entity/machine/Trebuchet.java new file mode 100644 index 0000000..dfa9600 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/machine/Trebuchet.java @@ -0,0 +1,261 @@ +package ru.magistu.siegemachines.entity.machine; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.SoundTypes; +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import ru.magistu.siegemachines.gui.machine.crosshair.ReloadingCrosshair; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.PlayState; +import software.bernie.geckolib3.core.builder.AnimationBuilder; +import software.bernie.geckolib3.core.builder.ILoopType; +import software.bernie.geckolib3.core.controller.AnimationController; +import software.bernie.geckolib3.core.event.predicate.AnimationEvent; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +public class Trebuchet extends ShootingMachine implements IAnimatable +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + static AnimationBuilder SHOOTING_ANIM = new AnimationBuilder().addAnimation("Shooting", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder RELOADING_ANIM = new AnimationBuilder().addAnimation("Reloading", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder IDLE_RELOADED_ANIM = new AnimationBuilder().addAnimation("IdleReloaded", ILoopType.EDefaultLoopTypes.LOOP); + static AnimationBuilder IDLE_NOT_RELOADED_ANIM = new AnimationBuilder().addAnimation("IdleNotReloaded", ILoopType.EDefaultLoopTypes.LOOP); + + private final MachinePartEntity[] subentities; + private final MachinePartEntity backside; + + private final Vec3 backsidepos; + + public enum State + { + SHOOTING, + RELOADING, + IDLE_RELOADED, + IDLE_NOT_RELOADED + } + public State state = State.RELOADING; + + public Trebuchet(EntityType<? extends Mob> entitytype, Level level) + { + super(entitytype, level, MachineType.TREBUCHET); + this.backside = new MachinePartEntity(this, "backside", 5.0F, 2.0F); + this.backsidepos = new Vec3(0.0, 0.0, -85.0).scale(1.0 / 16.0); + this.subentities = new MachinePartEntity[] { this.backside }; + } + + private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) + { + switch (state) { + case SHOOTING -> { + event.getController().setAnimation(SHOOTING_ANIM); + return PlayState.CONTINUE; + } + case IDLE_RELOADED -> { + event.getController().setAnimation(IDLE_RELOADED_ANIM); + return PlayState.CONTINUE; + } + case RELOADING -> { + event.getController().setAnimation(RELOADING_ANIM); + return PlayState.CONTINUE; + } + case IDLE_NOT_RELOADED -> { + event.getController().setAnimation(IDLE_NOT_RELOADED_ANIM); + return PlayState.CONTINUE; + } + } + + return PlayState.CONTINUE; + } + + private void tickPart(MachinePartEntity subentity, double p_226526_2_, double p_226526_4_, double p_226526_6_) + { + subentity.setPos(this.getX() + p_226526_2_, this.getY() + p_226526_4_, this.getZ() + p_226526_6_); + } + + @Override + public void aiStep() + { + Vec3[] avector3d = new Vec3[this.subentities.length]; + + Vec3 pos = this.position().add(applyRotations(this.backsidepos, 0.0, this.getYaw())); + this.tickPart(this.backside, pos.x, pos.y, pos.z); + + for(int i = 0; i < this.subentities.length; ++i) + { + avector3d[i] = new Vec3(this.subentities[i].getX(), this.subentities[i].getY(), this.subentities[i].getZ()); + } + + for(int i = 0; i < this.subentities.length; ++i) + { + this.subentities[i].xo = avector3d[i].x; + this.subentities[i].yo = avector3d[i].y; + this.subentities[i].zo = avector3d[i].z; + this.subentities[i].xOld = avector3d[i].x; + this.subentities[i].yOld = avector3d[i].y; + this.subentities[i].zOld = avector3d[i].z; + } + + super.aiStep(); + } + + public MachinePartEntity[] getSubEntities() { + return this.subentities; + } + + @Override + public net.minecraftforge.entity.PartEntity<?>[] getParts() + { + return this.subentities; + } + + @Override + public void registerControllers(AnimationData data) + { + AnimationController<?> controller = new AnimationController<>(this, "controller", 1, (t) -> + { + if (this.state.equals(State.RELOADING)) + { + return (double) (this.type.delaytime - this.delayticks) / this.type.delaytime; + } + return t; + }, this::predicate); + data.addAnimationController(controller); + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) + { + ItemStack stack = player.getItemInHand(hand); + + if (super.mobInteract(player, hand) == InteractionResult.SUCCESS) + { + return InteractionResult.SUCCESS; + } + if (!this.level.isClientSide() && !this.isVehicle()) + { + player.startRiding(this); + return InteractionResult.SUCCESS; + } + + return InteractionResult.PASS; + } + + public void startShooting(Player player) + { + if (this.delayticks <= 0 && this.useticks <= 0 && this.shootingticks <= 0) + { + this.state = State.SHOOTING; + this.useticks = this.type.usetime; + this.shootingticks = this.type.userealisetime; + + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.TREBUCHET_SHOOTING.get(), SoundSource.BLOCKS, 1.0f, 1.0f, false); + } + } + + @Override + public void shoot() + { + if (!level.isClientSide()) + { + super.shoot(); + } + } + + @Override + public void travel(Vec3 pos) + { + if (this.isAlive()) + { + if (this.isVehicle() && this.useticks <= 0 && this.delayticks <= 0) + { + LivingEntity livingentity = (LivingEntity) this.getControllingPassenger(); + + this.setTurretRotations(livingentity.getXRot(), this.getTurretYaw()); + this.updateTurretRotations(); + + this.setYawDest(livingentity.getYRot()); + this.updateYaw(); + } + super.travel(pos); + } + } + + @Override + public void tick() + { + if (this.useticks != 0 && --this.useticks <= 0) + { + this.state = State.RELOADING; + this.useticks = 0; + this.delayticks = this.type.delaytime; + } + + if (this.shootingticks != 0 && --this.shootingticks <= 0) + { + this.useRealise(); + this.shootingticks = 0; + } + + if (!level.isClientSide() && this.isOnGround()) + { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); + } + + if (this.delayticks > 0 && this.isVehicle()) + { + if (this.delayticks % 40 == 0) + { + Vec3 pos = this.position(); + this.level.playLocalSound(pos.x, pos.y, pos.z, SoundTypes.TREBUCHET_RELOADING.get(), SoundSource.BLOCKS, 1.0f, 1.0f, false); + } + if (--this.delayticks <= 0) + { + this.state = State.IDLE_RELOADED; + } + } + + if (this.renderupdateticks-- <= 0) + { + this.updateMachineRender(); + this.renderupdateticks = SiegeMachines.RENDER_UPDATE_TIME; + } + + super.tick(); + } + + @Override + @OnlyIn(Dist.CLIENT) + public Crosshair createCrosshair() + { + return new ReloadingCrosshair(); + } + + @Override + public Item getMachineItem() + { + return ModItems.TREBUCHET.get(); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/Cannonball.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/Cannonball.java new file mode 100644 index 0000000..d6f2ef7 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/Cannonball.java @@ -0,0 +1,22 @@ +package ru.magistu.siegemachines.entity.projectile; + +import com.mojang.math.Vector3d; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public class Cannonball extends Missile +{ + public Cannonball(EntityType<Cannonball> type, Level level) + { + super(type, level); + this.item = ModItems.CANNONBALL.get(); + } + + public Cannonball(EntityType<Stone> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item) + { + super(entitytype, level, pos, entity, MissileType.CANNONBALL, item); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/FlightType.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/FlightType.java new file mode 100644 index 0000000..6049d04 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/FlightType.java @@ -0,0 +1,8 @@ +package ru.magistu.siegemachines.entity.projectile; + +public enum FlightType +{ + NONE, + AHEAD, + SPINNING +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/GiantArrow.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/GiantArrow.java new file mode 100644 index 0000000..d8a6970 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/GiantArrow.java @@ -0,0 +1,42 @@ +package ru.magistu.siegemachines.entity.projectile; + +import com.mojang.math.Vector3d; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.network.protocol.Packet; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraftforge.network.NetworkHooks; +import org.jetbrains.annotations.NotNull; + +public class GiantArrow extends AbstractArrow +{ + private final Packet<?> spawningpacket = NetworkHooks.getEntitySpawningPacket(this); + + public GiantArrow(EntityType<GiantArrow> type, Level level) + { + super(type, level); + } + + public GiantArrow(EntityType<GiantArrow> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item) + { + super(entitytype, entity, level); + this.setPos(pos.x, pos.y, pos.z); + this.setBaseDamage(5.0F); + } + + @Override + protected @NotNull ItemStack getPickupItem() + { + return new ItemStack(ModItems.GIANT_ARROW.get()); + } + + @Override + public @NotNull Packet<?> getAddEntityPacket() + { + return spawningpacket; + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/IProjectileFactory.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/IProjectileFactory.java new file mode 100644 index 0000000..7c09aea --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/IProjectileFactory.java @@ -0,0 +1,13 @@ +package ru.magistu.siegemachines.entity.projectile; + +import com.mojang.math.Vector3d; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public interface IProjectileFactory<T extends Projectile> +{ + T create(EntityType<T> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item); +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/Missile.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/Missile.java new file mode 100644 index 0000000..d58573f --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/Missile.java @@ -0,0 +1,200 @@ +package ru.magistu.siegemachines.entity.projectile; + +import com.mojang.math.Vector3d; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.protocol.Packet; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.CombatRules; +import net.minecraft.world.damagesource.DamageSource; +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.ThrowableItemProjectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.ShieldItem; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.NetworkHooks; +import org.jetbrains.annotations.NotNull; + +public abstract class Missile extends ThrowableItemProjectile +{ + public MissileType type = MissileType.STONE; + public Item item = ModItems.STONE.get(); + + public Missile(EntityType<? extends Missile> entitytype, Level level) + { + super(entitytype, level); + } + + public Missile(EntityType<? extends Missile> entitytype, Level level, Vector3d pos, LivingEntity entity, MissileType type, Item item) + { + super(entitytype, entity, level); + this.type = type; + this.item = item; + this.setPos(pos.x, pos.y, pos.z); + } + + @Override + public @NotNull Item getDefaultItem() + { + return this.item; + } + + @Override + public @NotNull Packet<?> getAddEntityPacket() + { + return NetworkHooks.getEntitySpawningPacket(this); + } + + @Override + public void onHit(HitResult result) + { + float f = 2.0F; + if (result.getType() == HitResult.Type.ENTITY) + { + EntityHitResult entityRTR = (EntityHitResult)result; + Vec3 pos = entityRTR.getLocation(); + Entity entity = entityRTR.getEntity(); + float damage = this.type.mass * (float) this.getDeltaMovement().length(); + + DamageSource damagesource = DamageSource.thrown(this, this.getOwner()); + if (this.type.armorpiercing >= 1.0f) + { + damagesource = damagesource.bypassArmor(); + } + else if (this.type.armorpiercing > 0.0f && entity instanceof LivingEntity livingentity) + { + if(livingentity instanceof Player player) { + if(player.isBlocking() && (item == ModItems.GIANT_ARROW.get() || item == Items.ARROW) && (player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ShieldItem || player.isBlocking() && player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ShieldItem)) { + return; + } + } + damage -= (1.0f - this.type.armorpiercing) * (damage - CombatRules.getDamageAfterAbsorb(damage, 0, 0)); + damagesource = damagesource.bypassArmor(); + } + + if (!this.level.isClientSide() && this.type.explosive) + { + this.level.explode(this.getOwner(), pos.x, pos.y, pos.z, 3.0F, Explosion.BlockInteraction.NONE); + this.remove(RemovalReason.KILLED); + } + + entity.hurt(damagesource, damage); + Vec3 vector3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) this.type.knockback * 0.6D); + if (vector3d.lengthSqr() > 0.0D) + { + entity.push(vector3d.x, 0.1D, vector3d.z); + } + } + + if (result.getType() == HitResult.Type.BLOCK) + { + BlockHitResult blockRTR = (BlockHitResult)result; + BlockPos blockpos = blockRTR.getBlockPos(); + BlockState blockstate = this.level.getBlockState(blockpos); + boolean smoothimpact = (blockstate == Blocks.SAND.defaultBlockState() || + blockstate == Blocks.RED_SAND.defaultBlockState() || + blockstate == Blocks.DIRT.defaultBlockState() || + blockstate == Blocks.GRASS_BLOCK.defaultBlockState() || + blockstate == Blocks.DIRT_PATH.defaultBlockState() || + blockstate == Blocks.COARSE_DIRT.defaultBlockState() || + blockstate == Blocks.SNOW_BLOCK.defaultBlockState()) && + blockRTR.getDirection() == Direction.UP; + + if (blockRTR.getDirection() == Direction.UP) + { + if (this.type.explosive) + { + for (int r = 0; r < this.type.explosionradius; ++r) + { + for (float a = 0; a < 2 * Math.PI; a += Math.PI / 4) + { + BlockPos pos = blockRTR.getBlockPos().offset(r * Math.cos(a), 0, -r * Math.sin(a)); + if (this.level.getBlockState(pos) == Blocks.GRASS_BLOCK.defaultBlockState()) + { + this.level.setBlockAndUpdate(pos, Blocks.DIRT.defaultBlockState()); + } + } + } + } + if (!this.level.isClientSide()) + { + this.remove(RemovalReason.KILLED); + if (smoothimpact && this.type.explosive) + { + + this.level.explode(this.getOwner(), blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.type.explosionradius * f, Explosion.BlockInteraction.NONE); + } + } + else if (smoothimpact) + { + this.dustExplosion(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(blockpos), blockpos, this.type.explosionradius / 2, 50); + } + } + if (!this.level.isClientSide() && !smoothimpact && this.type.explosive) + { + this.level.explode(this.getOwner(), blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.type.explosionradius * f, Explosion.BlockInteraction.BREAK); + } + } + + if (result.getType() == HitResult.Type.MISS) + { + this.level.playSound((Player)this.getOwner(), this.getOnPos(), SoundEvents.ANVIL_BREAK, SoundSource.AMBIENT, 1.0f, 1.0f); + if(!this.level.isClientSide()) + { + this.remove(RemovalReason.KILLED); + } + } + if (!this.level.isClientSide()) + { + this.remove(RemovalReason.KILLED); + } + } + + private void dustExplosion(ParticleOptions particle, BlockPos blockpos, double speed, int amount) + { + this.dustExplosion(particle, blockpos.getX(), blockpos.getY(), blockpos.getZ(), speed, amount); + } + + private void dustExplosion(ParticleOptions particle, double x, double y, double z, double speed, int amount) + { + for (int i = 0; i < amount; ++i) + { + Vec3 movement = this.getDeltaMovement(); + double d0 = x - 0.05 + this.level.random.nextDouble() * 0.3; + double d1 = y + 1.0; + double d2 = z - 0.05 + this.level.random.nextDouble() * 0.3; + double d3 = movement.x * this.level.random.nextDouble() * speed; + double d4 = -movement.y * this.level.random.nextDouble() * speed * 10.0f; + double d5 = movement.z * this.level.random.nextDouble() * speed; + this.level.addParticle(particle, d0, d1, d2, d3, d4, d5); + } + } + + @Override + public void tick() + { + if (this.type.flighttype == FlightType.SPINNING) + { + this.setXRot(this.getXRot() + 0.5f); + } + + super.tick(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/MissileType.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/MissileType.java new file mode 100644 index 0000000..975faab --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/MissileType.java @@ -0,0 +1,25 @@ +package ru.magistu.siegemachines.entity.projectile; + +public enum MissileType +{ + CANNONBALL(15.0f, 1.5f, true, 3.0f, FlightType.SPINNING, 1.0f), + STONE(50.0f, 1.5f, true, 3.0f, FlightType.SPINNING, 1.0f), + GIANT_ARROW(5.0f, 1.5f, false, 0.0f, FlightType.AHEAD, 0.5f); + + public final float mass; + public final float knockback; + public final boolean explosive; + public final float explosionradius; + public final FlightType flighttype; + public final float armorpiercing; + + MissileType(float mass, float knockback, boolean explosive, float explosionradius, FlightType headingtype, float armorpiercing) + { + this.mass = mass; + this.knockback = knockback; + this.explosive = explosive; + this.explosionradius = explosionradius; + this.flighttype = headingtype; + this.armorpiercing = armorpiercing; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/ProjectileBuilder.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/ProjectileBuilder.java new file mode 100644 index 0000000..e67d6c9 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/ProjectileBuilder.java @@ -0,0 +1,49 @@ +package ru.magistu.siegemachines.entity.projectile; + +import ru.magistu.siegemachines.entity.EntityTypes; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.projectile.Arrow; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; + + +public class ProjectileBuilder<T extends Projectile> +{ + public final static ProjectileBuilder<Stone> NONE = new ProjectileBuilder<>(Items.AIR, EntityTypes.STONE.get(), Stone::new); + + public final static ProjectileBuilder[] NO_AMMO = new ProjectileBuilder[]{}; + public final static ProjectileBuilder[] CANNON_AMMO = new ProjectileBuilder[]{ + new ProjectileBuilder(ModItems.CANNONBALL.get(), EntityTypes.CANNONBALL.get(), Cannonball::new)}; + public final static ProjectileBuilder[] THROWING_AMMO = new ProjectileBuilder[]{ + new ProjectileBuilder(Items.COBBLESTONE, ModItems.STONE.get(), EntityTypes.STONE.get(), Stone::new)}; + public final static ProjectileBuilder[] BALLISTA_AMMO = new ProjectileBuilder[]{ + new ProjectileBuilder(ModItems.GIANT_ARROW.get(), EntityTypes.GIANT_ARROW.get(), GiantArrow::new), + new ProjectileBuilder(Items.ARROW, EntityType.ARROW, (entitytype, level, pos, entity, item) -> + { + Arrow arrow = new Arrow(level, entity); + arrow.setPos(pos.x, pos.y, pos.z); + return arrow; + })}; + + public final Item item; + public final Item projectilitem; + public final EntityType<T> entitytype; + public final IProjectileFactory<T> factory; + + public ProjectileBuilder(Item item, EntityType<T> entitytype, IProjectileFactory<T> factory) + { + this(item, item, entitytype, factory); + } + + public ProjectileBuilder(Item item, Item projectilitem, EntityType<T> entitytype, IProjectileFactory<T> factory) + { + this.item = item; + this.projectilitem = projectilitem; + this.entitytype = entitytype; + this.factory = factory; + } + + +} diff --git a/src/main/java/ru/magistu/siegemachines/entity/projectile/Stone.java b/src/main/java/ru/magistu/siegemachines/entity/projectile/Stone.java new file mode 100644 index 0000000..5912d2f --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/entity/projectile/Stone.java @@ -0,0 +1,22 @@ +package ru.magistu.siegemachines.entity.projectile; + +import com.mojang.math.Vector3d; +import ru.magistu.siegemachines.item.ModItems; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public class Stone extends Missile +{ + public Stone(EntityType<Stone> entitytype, Level level) + { + super(entitytype, level); + this.item = ModItems.STONE.get(); + } + + public Stone(EntityType<Stone> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item) + { + super(entitytype, level, pos, entity, MissileType.STONE, item); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/event/ClientEvents.java b/src/main/java/ru/magistu/siegemachines/event/ClientEvents.java new file mode 100644 index 0000000..90d1a89 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/event/ClientEvents.java @@ -0,0 +1,84 @@ +package ru.magistu.siegemachines.event; + +import net.minecraftforge.client.event.RegisterKeyMappingsEvent; +import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.client.KeyBindings; +import ru.magistu.siegemachines.entity.IReloading; +import ru.magistu.siegemachines.entity.machine.Machine; +import ru.magistu.siegemachines.gui.machine.crosshair.Crosshair; +import ru.magistu.siegemachines.network.PacketHandler; +import ru.magistu.siegemachines.network.PacketOpenMachineInventory; +import ru.magistu.siegemachines.network.PacketMachineUse; +import net.minecraft.client.CameraType; +import net.minecraft.client.Minecraft; +import net.minecraft.client.Options; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.InputEvent; +import net.minecraftforge.client.event.RenderGuiOverlayEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + + +public class ClientEvents +{ + @Mod.EventBusSubscriber(modid = SiegeMachines.ID, value = Dist.CLIENT) + public static class ClientForgeEvents + { + public static Crosshair CROSSHAIR = null; + //public static final NamedGuiOverlay CROSSHAIR_OVERLAY = GuiOverlayManager.findOverlay(VanillaGuiOverlay.CROSSHAIR.id()); + + @SubscribeEvent + public static void onKeyPressedEvent(InputEvent.Key ev) { + if (KeyBindings.MACHINE_USE.isDown()) { + LocalPlayer player = Minecraft.getInstance().player; + if (player != null && player.isPassenger() && player.getVehicle() instanceof Machine) { + PacketHandler.sendToServer(new PacketMachineUse(player.getVehicle().getId())); + } + } + + if (KeyBindings.MACHINE_INVENTORY.isDown()) { + LocalPlayer player = Minecraft.getInstance().player; + if (player != null && player.isPassenger() && player.getVehicle() instanceof Machine) { + PacketHandler.sendToServer(new PacketOpenMachineInventory()); + } + } + } + + @SubscribeEvent + public static void onRenderOverlayPre(RenderGuiOverlayEvent.Pre ev) { + if (ev.getOverlay().id() == VanillaGuiOverlay.CROSSHAIR.id()) { + Minecraft mc = Minecraft.getInstance(); + Options settings = mc.options; + LocalPlayer player = mc.player; + + if ((settings.renderDebug && !settings.hideGui && !player.isReducedDebugInfo() && !settings.reducedDebugInfo().get()) || settings.getCameraType().compareTo(CameraType.FIRST_PERSON) != 0) { + return; + } + + if (player.isPassenger()) { + Entity entity = player.getVehicle(); + if (entity instanceof IReloading) { + if (CROSSHAIR == null) { + CROSSHAIR = ((IReloading) entity).createCrosshair(); + } + CROSSHAIR.render(ev.getPoseStack(), ev.getPartialTick(), mc, player); + ev.setCanceled(true); + } + } + } + } + } + + @Mod.EventBusSubscriber(modid = SiegeMachines.ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) + public static class ClientModBusEvents + { + @SubscribeEvent + public static void onKeyRegister(RegisterKeyMappingsEvent ev) { + ev.register(KeyBindings.MACHINE_USE); + ev.register(KeyBindings.MACHINE_INVENTORY); + } + } +} diff --git a/src/main/java/ru/magistu/siegemachines/event/ModEventBusEvents.java b/src/main/java/ru/magistu/siegemachines/event/ModEventBusEvents.java new file mode 100644 index 0000000..f8c6ad5 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/event/ModEventBusEvents.java @@ -0,0 +1,21 @@ +package ru.magistu.siegemachines.event; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.entity.EntityTypes; +import ru.magistu.siegemachines.entity.machine.*; +import net.minecraftforge.event.entity.EntityAttributeCreationEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = SiegeMachines.ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class ModEventBusEvents { + @SubscribeEvent + public static void addEntityAttributes(EntityAttributeCreationEvent event) { + event.put(EntityTypes.MORTAR.get(), Mortar.setEntityAttributes(MachineType.MORTAR).build()); + event.put(EntityTypes.CULVERIN.get(), Mortar.setEntityAttributes(MachineType.CULVERIN).build()); + event.put(EntityTypes.TREBUCHET.get(), Trebuchet.setEntityAttributes(MachineType.TREBUCHET).build()); + event.put(EntityTypes.CATAPULT.get(), Catapult.setEntityAttributes(MachineType.CATAPULT).build()); + event.put(EntityTypes.BALLISTA.get(), Ballista.setEntityAttributes(MachineType.BALLISTA).build()); + event.put(EntityTypes.BATTERING_RAM.get(), Ballista.setEntityAttributes(MachineType.BATTERING_RAM).build()); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/gui/ModMenuTypes.java b/src/main/java/ru/magistu/siegemachines/gui/ModMenuTypes.java new file mode 100644 index 0000000..9979f21 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/ModMenuTypes.java @@ -0,0 +1,28 @@ +package ru.magistu.siegemachines.gui; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.gui.machine.MachineContainer; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraftforge.common.extensions.IForgeMenuType; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.network.IContainerFactory; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; +import ru.magistu.siegemachines.gui.workbench.SiegeWorkbenchContainer; + +public class ModMenuTypes { + public static final DeferredRegister<MenuType<?>> MENUS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, SiegeMachines.ID); + + public static final RegistryObject<MenuType<MachineContainer>> MACHINE_CONTAINER = MENUS.register("machine", () -> IForgeMenuType.create(MachineContainer::new)); + public static final RegistryObject<MenuType<SiegeWorkbenchContainer>> SIEGE_WORKBENCH_CONTAINER = registerMenuType(SiegeWorkbenchContainer::new, "siege_workbench"); + + private static <T extends AbstractContainerMenu> RegistryObject<MenuType<T>> registerMenuType(IContainerFactory<T> factory, String name) { + return MENUS.register(name, () -> IForgeMenuType.create(factory)); + } + + public static void register(IEventBus eventBus) { + MENUS.register(eventBus); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/gui/machine/MachineContainer.java b/src/main/java/ru/magistu/siegemachines/gui/machine/MachineContainer.java new file mode 100644 index 0000000..3deda79 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/machine/MachineContainer.java @@ -0,0 +1,136 @@ +package ru.magistu.siegemachines.gui.machine; + +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Inventory; +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.items.IItemHandler; +import org.jetbrains.annotations.NotNull; +import ru.magistu.siegemachines.gui.ModMenuTypes; + +import java.util.Objects; + +public class MachineContainer extends AbstractContainerMenu +{ + private Player player; + private Machine machine; + int x, y, z; + private IItemHandler internal; + private boolean bound = false; + + + public MachineContainer(final int id, final Inventory inv, final Machine machine) + { + super(ModMenuTypes.MACHINE_CONTAINER.get(), id); + if (machine == null) + { + return; + } + this.machine = machine; + + for (int row = 0; row < 3; row++) + { + for (int col = 0; col < 9; col++) + { + this.addSlot(new Slot(inv, col + row * 9 + 9, 8 + col * 18, 166 - (4 - row) * 18 - 10)); + } + } + + for (int col = 0; col < 9; col++) + { + this.addSlot(new Slot(inv, col, 8 + col * 18, 142)); + } + + for (int row = 0; row < 1; row++) + { + for (int col = 0; col < 9; col++) + { + this.addSlot(new Slot(machine.inventory, col + row * 9, 8 + col * 18, 18 + row * 18)); + } + } + } + + public MachineContainer(final int id, final Inventory inv, final FriendlyByteBuf data) + { + this(id, inv, getMachine(inv)); + } + + private static Machine getMachine(final Inventory inv) + { + Objects.requireNonNull(inv, "Player Inventory Cannot Be Null."); + Player player = inv.player; + Entity entity; + if (player.isPassenger()) + { + entity = player.getVehicle(); + if (entity instanceof Machine) + { + return (Machine) player.getVehicle(); + } + } + + throw new IllegalStateException("Entity Is Not Correct."); + } + + @Override + public boolean stillValid(Player player) + { + return machine.inventory.stillValid(player); + } + + @Override + public @NotNull ItemStack quickMoveStack(@NotNull Player player, int index) + { + ItemStack itemstack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + if (slot != null && slot.hasItem()) + { + ItemStack itemstack1 = slot.getItem(); + itemstack = itemstack1.copy(); + if (index < 9) + { + if (!this.moveItemStackTo(itemstack1, 9, this.slots.size(), true)) + { + return ItemStack.EMPTY; + } + slot.onQuickCraft(itemstack1, itemstack); + } + else if (!this.moveItemStackTo(itemstack1, 0, 9, false)) + { + if (index < 9 + 27) + { + if (!this.moveItemStackTo(itemstack1, 9 + 27, this.slots.size(), true)) + { + return ItemStack.EMPTY; + } + } + else + { + if (!this.moveItemStackTo(itemstack1, 9, 9 + 27, false)) + { + return ItemStack.EMPTY; + } + } + return ItemStack.EMPTY; + } + if (itemstack1.getCount() == 0) + { + slot.set(ItemStack.EMPTY); + } + else + { + slot.setChanged(); + } + if (itemstack1.getCount() == itemstack.getCount()) + { + return ItemStack.EMPTY; + } + slot.onTake(player, itemstack1); + } + return itemstack; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/gui/machine/MachineInventoryScreen.java b/src/main/java/ru/magistu/siegemachines/gui/machine/MachineInventoryScreen.java new file mode 100644 index 0000000..5670af3 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/machine/MachineInventoryScreen.java @@ -0,0 +1,71 @@ +package ru.magistu.siegemachines.gui.machine; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import org.jetbrains.annotations.NotNull; + +@OnlyIn(Dist.CLIENT) +public class MachineInventoryScreen extends AbstractContainerScreen<MachineContainer> +{ + private static final ResourceLocation DISPLAY_CASE_GUI = new ResourceLocation(SiegeMachines.ID, + "textures/gui/machine_inventory.png"); + + public MachineInventoryScreen(MachineContainer screenContainer, Inventory inv, Component titleIn) + { + super(screenContainer, inv, titleIn); + + this.leftPos = 0; + this.topPos = 0; + this.imageWidth = 176; + this.imageHeight = 166; + } + + @Override + 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 renderTooltip(@NotNull PoseStack matrixStack, int x, int y) + { + if (this.minecraft.player.getInventory().getSelected().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) + { + this.renderTooltip(matrixStack, this.hoveredSlot.getItem(), x, y); + } + } + + @Override + protected void renderBg(@NotNull PoseStack matrixStack, float partialTicks, int mouseX, int mouseY) + { + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, DISPLAY_CASE_GUI); + int x = (this.width - this.imageWidth) / 2; + int y = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, x, y, 0, 0, this.imageWidth, this.imageHeight); + } + + @Override + public boolean keyPressed(int key, int b, int c) + { + assert this.minecraft != null; + if (key == 256) + { + assert this.minecraft.player != null; + this.minecraft.player.closeContainer(); + return true; + } + return super.keyPressed(key, b, c); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/AlignmentHelper.java b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/AlignmentHelper.java new file mode 100644 index 0000000..747784c --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/AlignmentHelper.java @@ -0,0 +1,31 @@ +package ru.magistu.siegemachines.gui.machine.crosshair; + +import java.util.Arrays; +import java.util.List; + +public class AlignmentHelper +{ + public static final List<String> validAlignmentValues = Arrays.asList(new String[] { "top_left", "top_center", "top_right", "center_left", "center", "center_right", "bottom_left", "bottom_center", "bottom_right" }); + + public enum Alignment + { + TOP_LEFT, + TOP_CENTER, + TOP_RIGHT, + CENTER_LEFT, + CENTER, + CENTER_RIGHT, + BOTTOM_LEFT, + BOTTOM_CENTER, + BOTTOM_RIGHT; + + + public static Alignment fromString(String align) { + int idx = AlignmentHelper.validAlignmentValues.indexOf(align); + if (idx != -1) { + return values()[idx]; + } + return CENTER; + } + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/Crosshair.java b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/Crosshair.java new file mode 100644 index 0000000..772a359 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/Crosshair.java @@ -0,0 +1,25 @@ +package ru.magistu.siegemachines.gui.machine.crosshair; + +import com.mojang.blaze3d.vertex.PoseStack; +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + + +@OnlyIn(Dist.CLIENT) +public abstract class Crosshair extends HudElement +{ + protected static final ResourceLocation CROSSHAIR_TEXTURES = new ResourceLocation(SiegeMachines.ID, "textures/gui/crosshairs.png"); + + public Crosshair(int width, int height) + { + super(width, height); + } + + public final void render(PoseStack matrixstack, float partialticks) {} + + public abstract void render(PoseStack matrixstack, float ticks, Minecraft mc, Player player); +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/HudElement.java b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/HudElement.java new file mode 100644 index 0000000..904e16c --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/HudElement.java @@ -0,0 +1,73 @@ +package ru.magistu.siegemachines.gui.machine.crosshair; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + + +@OnlyIn(Dist.CLIENT) +public abstract class HudElement +{ + protected int width; + protected int height; + + public int getAlignedX(AlignmentHelper.Alignment align, int offset) + { + switch (align) + { + case TOP_LEFT: + case CENTER_LEFT: + case BOTTOM_LEFT: + return 5 + offset; + case TOP_CENTER: + case CENTER: + case BOTTOM_CENTER: + return Minecraft.getInstance().getWindow().getGuiScaledWidth() / 2 - this.width / 2 + offset; + case TOP_RIGHT: + case CENTER_RIGHT: + case BOTTOM_RIGHT: + return Minecraft.getInstance().getWindow().getGuiScaledWidth() - this.width - 5 + offset; + } + return 0; + } + + public int getAlignedY(AlignmentHelper.Alignment align, int offset) + { + switch (align) + { + case TOP_LEFT: + case TOP_CENTER: + case TOP_RIGHT: + return 5 + offset; + case CENTER_LEFT: + case CENTER: + case CENTER_RIGHT: + return Minecraft.getInstance().getWindow().getGuiScaledHeight() / 2 - this.height / 2 + 16 + offset; + case BOTTOM_CENTER: + return Minecraft.getInstance().getWindow().getGuiScaledHeight() - this.height - 65 + offset; + case BOTTOM_LEFT: + case BOTTOM_RIGHT: + return Minecraft.getInstance().getWindow().getGuiScaledHeight() - this.height - 5 + offset; + } + return 0; + } + + public HudElement(int elementWidth, int elementHeight) + { + this.width = elementWidth; + this.height = elementHeight; + } + + public int getWidth() + { + return this.width; + } + + public int getHeight() + { + return this.height; + } + + public abstract void render(PoseStack paramMatrixStack, float paramFloat); +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/ReloadingCrosshair.java b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/ReloadingCrosshair.java new file mode 100644 index 0000000..3cd547d --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/machine/crosshair/ReloadingCrosshair.java @@ -0,0 +1,68 @@ +package ru.magistu.siegemachines.gui.machine.crosshair; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class ReloadingCrosshair extends Crosshair +{ + //public static ResourceLocation TYPE = new ResourceLocation(SiegeMachines.ID, "siege_machine"); + public int x; + public int y; + + public ReloadingCrosshair() + { + super(9, 9); + this.x = Minecraft.getInstance().getWindow().getGuiScaledWidth() / 2; + this.y = Minecraft.getInstance().getWindow().getGuiScaledHeight() / 2; + } + + public void render(PoseStack matrixstack, float ticks, Minecraft mc, Player player) + { + RenderSystem.assertOnRenderThread(); + + if (!player.isPassenger()) + { + return; + } + Entity entity = player.getVehicle(); + + if (entity instanceof Machine) + { + Machine machine = (Machine) entity; + + int width = 11; + int height = 11; + int imagex = 0; + int imagey = 0; + int originx = (mc.getWindow().getGuiScaledWidth() - width) / 2; + int originy = (mc.getWindow().getGuiScaledHeight() - height) / 2; + int animationsize = 23; + if (machine.useticks > 0) + { + imagey = height; + } + else if (machine.delayticks > 0) + { + int number = (int) (((double) animationsize) * ((double) (machine.type.delaytime - machine.delayticks) / (double) machine.type.delaytime)); + imagex = width; + imagey = height * number; + } + + RenderSystem.applyModelViewMatrix(); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderTexture(0, CROSSHAIR_TEXTURES); + + mc.gui.blit(matrixstack, originx, originy, imagex, imagey, width, height); + + RenderSystem.backupProjectionMatrix(); + } + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchContainer.java b/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchContainer.java new file mode 100644 index 0000000..d32918a --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchContainer.java @@ -0,0 +1,196 @@ +package ru.magistu.siegemachines.gui.workbench; + +import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.StackedContents; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.*; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.level.Level; +import ru.magistu.siegemachines.block.ModBlocks; +import ru.magistu.siegemachines.data.recipes.ModRecipes; +import ru.magistu.siegemachines.data.recipes.SiegeWorkbenchRecipe; +import ru.magistu.siegemachines.gui.ModMenuTypes; + +import java.util.Optional; + +public class SiegeWorkbenchContainer extends AbstractContainerMenu +{ + private final CraftingContainer craftSlots = new CraftingContainer(this, 3, 3); + private final ResultContainer resultSlots = new ResultContainer(); + private final ContainerLevelAccess access; + private final Player player; + + public SiegeWorkbenchContainer(int id, Inventory inventory, FriendlyByteBuf buffer) + { + this(id, inventory, ContainerLevelAccess.NULL); + } + + public SiegeWorkbenchContainer(int id, Inventory inventory, ContainerLevelAccess access) + { + super(ModMenuTypes.SIEGE_WORKBENCH_CONTAINER.get(), id); + this.access = access; + this.player = inventory.player; + this.addSlot(new SiegeWorkbenchResultSlot(inventory.player, this.craftSlots, this.resultSlots, 0, 124, 35)); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) + { + this.addSlot(new Slot(this.craftSlots, j + i * 3, 30 + j * 18, 17 + i * 18)); + } + } + + for (int k = 0; k < 3; ++k) + { + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlot(new Slot(inventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18)); + } + } + + for (int l = 0; l < 9; ++l) + { + this.addSlot(new Slot(inventory, l, 8 + l * 18, 142)); + } + + } + + // to create resulting item + protected static void slotChangedCraftingGrid(AbstractContainerMenu menu, Level level, Player player, CraftingContainer craftingcontainer, ResultContainer resultcontainer) { + if (!level.isClientSide) { + ServerPlayer serverplayer = (ServerPlayer)player; + ItemStack itemstack = ItemStack.EMPTY; + Optional<SiegeWorkbenchRecipe> optional = level.getServer().getRecipeManager().getRecipeFor(ModRecipes.SIEGE_WORKBENCH_RECIPE, craftingcontainer, level); + if (optional.isPresent()) { + SiegeWorkbenchRecipe craftingrecipe = optional.get(); + if (resultcontainer.setRecipeUsed(level, serverplayer, craftingrecipe)) { + itemstack = craftingrecipe.assemble(craftingcontainer); + } + } + + resultcontainer.setItem(0, itemstack); + //menu.setRemoteSlot(0, itemstack); + serverplayer.connection.send(new ClientboundContainerSetSlotPacket(menu.containerId, menu.incrementStateId(), 0, itemstack)); + } + } + + @Override + public void slotsChanged(Container inventory) { + this.access.execute((level, blockpos) -> slotChangedCraftingGrid(this, level, this.player, this.craftSlots, this.resultSlots)); + } + + public void fillCraftSlotsStackedContents(StackedContents itemhelper) { + this.craftSlots.fillStackedContents(itemhelper); + } + + public void clearCraftingContent() { + this.craftSlots.clearContent(); + this.resultSlots.clearContent(); + } + + public boolean recipeMatches(Recipe<? super CraftingContainer> recipe) { + return recipe.matches(this.craftSlots, this.player.level); + } + + /** + * Called when the container is closed. + */ + public void removed(Player player) { + super.removed(player); + this.access.execute((p_39371_, p_39372_) -> { + this.clearContainer(player, this.craftSlots); + }); + } + + /** + * Determines whether supplied player can use this container + */ + public boolean stillValid(Player player) { + return stillValid(this.access, player, ModBlocks.SIEGE_WORKBENCH.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 quickMoveStack(Player player, int index) { + ItemStack itemstack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + if (slot != null && slot.hasItem()) { + ItemStack itemstack1 = slot.getItem(); + itemstack = itemstack1.copy(); + if (index == 0) { + this.access.execute((p_39378_, p_39379_) -> { + itemstack1.getItem().onCraftedBy(itemstack1, p_39378_, player); + }); + if (!this.moveItemStackTo(itemstack1, 10, 46, true)) { + return ItemStack.EMPTY; + } + + slot.onQuickCraft(itemstack1, itemstack); + } else if (index >= 10 && index < 46) { + if (!this.moveItemStackTo(itemstack1, 1, 10, false)) { + if (index < 37) { + if (!this.moveItemStackTo(itemstack1, 37, 46, false)) { + return ItemStack.EMPTY; + } + } else if (!this.moveItemStackTo(itemstack1, 10, 37, false)) { + return ItemStack.EMPTY; + } + } + } else if (!this.moveItemStackTo(itemstack1, 10, 46, false)) { + return ItemStack.EMPTY; + } + + if (itemstack1.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (itemstack1.getCount() == itemstack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(player, itemstack1); + if (index == 0) { + player.drop(itemstack1, false); + } + } + + return itemstack; + } + + /** + * Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in is + * null for the initial slot that was double-clicked. + */ + public boolean canTakeItemForPickAll(ItemStack stack, Slot slot) { + return slot.container != this.resultSlots && super.canTakeItemForPickAll(stack, slot); + } + + public int getResultSlotIndex() { + return 0; + } + + public int getGridWidth() { + return this.craftSlots.getWidth(); + } + + public int getGridHeight() { + return this.craftSlots.getHeight(); + } + + public int getSize() { + return 10; + } + + public boolean shouldMoveToInventory(int p_150553_) { + return p_150553_ != this.getResultSlotIndex(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchResultSlot.java b/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchResultSlot.java new file mode 100644 index 0000000..3936106 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchResultSlot.java @@ -0,0 +1,103 @@ +package ru.magistu.siegemachines.gui.workbench; + +import net.minecraft.core.NonNullList; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.inventory.RecipeHolder; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeType; +import ru.magistu.siegemachines.data.recipes.CountIngredient; +import ru.magistu.siegemachines.data.recipes.ModRecipes; +import ru.magistu.siegemachines.data.recipes.SiegeWorkbenchRecipe; + +import java.util.List; +import java.util.Optional; + +public class SiegeWorkbenchResultSlot extends Slot { + private final CraftingContainer craftSlots; + private final Player player; + private int removeCount; + + public SiegeWorkbenchResultSlot(Player player, CraftingContainer craftingcontainer, Container container, int index, int x, int y) { + super(container, index, x, y); + this.player = player; + this.craftSlots = craftingcontainer; + } + + /** + * Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace fuel. + */ + public boolean mayPlace(ItemStack stack) { + return false; + } + + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new stack. + */ + public ItemStack remove(int amount) { + if (this.hasItem()) { + this.removeCount += Math.min(amount, this.getItem().getCount()); + } + + return super.remove(amount); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + protected void onQuickCraft(ItemStack stack, int amount) { + this.removeCount += amount; + this.checkTakeAchievements(stack); + } + + protected void onSwapCraft(int pNumItemsCrafted) { + this.removeCount += pNumItemsCrafted; + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + protected void checkTakeAchievements(ItemStack stack) { + if (this.removeCount > 0) { + stack.onCraftedBy(this.player.level, this.player, this.removeCount); + net.minecraftforge.event.ForgeEventFactory.firePlayerCraftingEvent(this.player, stack, this.craftSlots); + } + + if (this.container instanceof RecipeHolder) { + ((RecipeHolder)this.container).awardUsedRecipes(this.player); + } + + this.removeCount = 0; + } + + public void onTake(Player player, ItemStack stack) { + this.checkTakeAchievements(stack); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(player); + RecipeManager manager = player.level.getRecipeManager(); + NonNullList<ItemStack> nonnulllist = manager.getRemainingItemsFor(ModRecipes.SIEGE_WORKBENCH_RECIPE, craftSlots, player.level); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); + for (int i = 0; i < nonnulllist.size(); ++i) { + ItemStack itemstack = this.craftSlots.getItem(i); + ItemStack itemstack1 = nonnulllist.get(i); + if (!itemstack.isEmpty()) { + this.craftSlots.removeItem(i, itemstack1.getCount()); + itemstack = this.craftSlots.getItem(i); + } + + if (!itemstack1.isEmpty()) { + if (itemstack.isEmpty()) { + this.craftSlots.setItem(i, itemstack1); + } else if (ItemStack.isSame(itemstack, itemstack1) && ItemStack.tagMatches(itemstack, itemstack1)) { + itemstack1.grow(itemstack.getCount()); + this.craftSlots.setItem(i, itemstack1); + } else if (!this.player.getInventory().add(itemstack1)) { + this.player.drop(itemstack1, false); + } + } + } + } +} diff --git a/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchScreen.java b/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchScreen.java new file mode 100644 index 0000000..81e7fc7 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/gui/workbench/SiegeWorkbenchScreen.java @@ -0,0 +1,72 @@ +package ru.magistu.siegemachines.gui.workbench; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import org.jetbrains.annotations.NotNull; +import ru.magistu.siegemachines.SiegeMachines; + +@OnlyIn(Dist.CLIENT) +public class SiegeWorkbenchScreen extends AbstractContainerScreen<SiegeWorkbenchContainer> +{ + private static final ResourceLocation DISPLAY_CASE_GUI = new ResourceLocation(SiegeMachines.ID, "textures/gui/siege_workbench.png"); + + public SiegeWorkbenchScreen(SiegeWorkbenchContainer screenContainer, Inventory inv, Component titleIn) + { + super(screenContainer, inv, titleIn); + } + + @Override + 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 renderTooltip(@NotNull PoseStack matrixStack, int x, int y) + { + if (this.minecraft.player.getInventory().getSelected().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) + { + this.renderTooltip(matrixStack, this.hoveredSlot.getItem(), x, y); + } + } + + @Override + protected void init() + { + super.init(); + this.titleLabelX = 29; + } + + @Override + protected void renderBg(@NotNull PoseStack matrixStack, float partialTicks, int mouseX, int mouseY) + { + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderTexture(0, DISPLAY_CASE_GUI); + int i = this.leftPos; + int j = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight); + } + + @Override + public boolean keyPressed(int key, int b, int c) + { + assert this.minecraft != null; + if (key == 256) + { + assert this.minecraft.player != null; + this.minecraft.player.closeContainer(); + return true; + } + return super.keyPressed(key, b, c); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/BallistaItem.java b/src/main/java/ru/magistu/siegemachines/item/BallistaItem.java new file mode 100644 index 0000000..1fc564a --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/BallistaItem.java @@ -0,0 +1,36 @@ +package ru.magistu.siegemachines.item; + +import net.minecraft.world.entity.EntityType; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer; +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import ru.magistu.siegemachines.entity.EntityTypes; + +import java.util.function.Consumer; + +public class BallistaItem extends MachineItem +{ + public BallistaItem() + { + super(new Properties().tab(ModItems.GROUP_SM), "ballista", "BALLISTA"); + } + + @Override + public void initializeClient(Consumer<IClientItemExtensions> consumer) { + super.initializeClient(consumer); + consumer.accept(new IClientItemExtensions() { + private final BlockEntityWithoutLevelRenderer renderer = new MachineItemGeoRenderer(new MachineItemModel<>("ballista")); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return renderer; + } + }); + } + + @Override + public EntityType<?> getType() { + return EntityTypes.BALLISTA.get(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/BatteringRamItem.java b/src/main/java/ru/magistu/siegemachines/item/BatteringRamItem.java new file mode 100644 index 0000000..897e4e0 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/BatteringRamItem.java @@ -0,0 +1,36 @@ +package ru.magistu.siegemachines.item; + +import net.minecraft.world.entity.EntityType; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer; +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import ru.magistu.siegemachines.entity.EntityTypes; + +import java.util.function.Consumer; + +public class BatteringRamItem extends MachineItem +{ + public BatteringRamItem() + { + super(new Properties().tab(ModItems.GROUP_SM), "battering_ram", "BATTERING_RAM"); + } + + @Override + public void initializeClient(Consumer<IClientItemExtensions> consumer) { + super.initializeClient(consumer); + consumer.accept(new IClientItemExtensions() { + private final BlockEntityWithoutLevelRenderer renderer = new MachineItemGeoRenderer(new MachineItemModel<>("battering_ram")); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return renderer; + } + }); + } + + @Override + public EntityType<?> getType() { + return EntityTypes.BATTERING_RAM.get(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/CatapultItem.java b/src/main/java/ru/magistu/siegemachines/item/CatapultItem.java new file mode 100644 index 0000000..792668a --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/CatapultItem.java @@ -0,0 +1,36 @@ +package ru.magistu.siegemachines.item; + +import net.minecraft.world.entity.EntityType; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer; +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import ru.magistu.siegemachines.entity.EntityTypes; + +import java.util.function.Consumer; + +public class CatapultItem extends MachineItem +{ + public CatapultItem() + { + super(new Properties().tab(ModItems.GROUP_SM), "catapult", "CATAPULT"); + } + + @Override + public void initializeClient(Consumer<IClientItemExtensions> consumer) { + super.initializeClient(consumer); + consumer.accept(new IClientItemExtensions() { + private final BlockEntityWithoutLevelRenderer renderer = new MachineItemGeoRenderer(new MachineItemModel<>("catapult")); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return renderer; + } + }); + } + + @Override + public EntityType<?> getType() { + return EntityTypes.CATAPULT.get(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/CulverinItem.java b/src/main/java/ru/magistu/siegemachines/item/CulverinItem.java new file mode 100644 index 0000000..262671d --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/CulverinItem.java @@ -0,0 +1,36 @@ +package ru.magistu.siegemachines.item; + +import net.minecraft.world.entity.EntityType; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer; +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import ru.magistu.siegemachines.entity.EntityTypes; + +import java.util.function.Consumer; + +public class CulverinItem extends MachineItem +{ + public CulverinItem() + { + super(new Properties().tab(ModItems.GROUP_SM), "culverin", "CULVERIN"); + } + + @Override + public void initializeClient(Consumer<IClientItemExtensions> consumer) { + super.initializeClient(consumer); + consumer.accept(new IClientItemExtensions() { + private final BlockEntityWithoutLevelRenderer renderer = new MachineItemGeoRenderer(new MachineItemModel<>("culverin")); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return renderer; + } + }); + } + + @Override + public EntityType<?> getType() { + return EntityTypes.CULVERIN.get(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/MachineItem.java b/src/main/java/ru/magistu/siegemachines/item/MachineItem.java new file mode 100644 index 0000000..57cf443 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/MachineItem.java @@ -0,0 +1,272 @@ +package ru.magistu.siegemachines.item; + +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.entity.EntityTypes; +import ru.magistu.siegemachines.entity.machine.Machine; +import ru.magistu.siegemachines.entity.machine.MachineType; +import ru.magistu.siegemachines.entity.projectile.ProjectileBuilder; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.stats.Stats; +import net.minecraft.util.Mth; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.SpawnerBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.fluids.IFluidBlock; +import org.jetbrains.annotations.NotNull; +import software.bernie.geckolib3.core.IAnimatable; +import software.bernie.geckolib3.core.manager.AnimationData; +import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib3.util.GeckoLibUtil; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.Objects; + +public abstract class MachineItem extends Item implements IAnimatable +{ + private final AnimationFactory factory = GeckoLibUtil.createFactory(this); + + private final String entitykey; + private final String typekey; + + public MachineItem(Properties prop, String entitykey, String typekey) + { + super(prop.stacksTo(1)); + this.entitykey = entitykey; + this.typekey = typekey; + } + + @Override + public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> tooltip, TooltipFlag p_41424_) + { + ProjectileBuilder[] ammo = MachineType.valueOf(this.typekey).ammo; + if (ammo.length > 0) + { + tooltip.add(Component.translatable(SiegeMachines.ID + ".ammo").withStyle(ChatFormatting.BLUE)); + for (ProjectileBuilder builder : ammo) + { + if (MachineType.valueOf(this.typekey).usesgunpowder) + { + tooltip.add(Component.translatable(SiegeMachines.ID + ".uses_gunpowder").withStyle(ChatFormatting.BLUE)); + } + tooltip.add(Component.literal(" ").append(Component.translatable(builder.item.getDescriptionId())).withStyle(ChatFormatting.BLUE)); + } + } + } + + @Override + public @NotNull InteractionResult useOn(UseOnContext p_195939_1_) + { + Level world = p_195939_1_.getLevel(); + if (!(world instanceof ServerLevel)) + { + return InteractionResult.SUCCESS; + } + else + { + ItemStack itemstack = p_195939_1_.getItemInHand(); + BlockPos blockpos = p_195939_1_.getClickedPos(); + Direction direction = p_195939_1_.getClickedFace(); + BlockState blockstate = world.getBlockState(blockpos); + if (blockstate.is(Blocks.SPAWNER)) + { + BlockEntity tileentity = world.getBlockEntity(blockpos); + if (tileentity instanceof SpawnerBlockEntity) + { + BaseSpawner abstractspawner = ((SpawnerBlockEntity)tileentity).getSpawner(); + EntityType<?> entitytype1 = this.getType(itemstack.getTag()); + abstractspawner.setEntityId(entitytype1); + tileentity.setChanged(); + world.sendBlockUpdated(blockpos, blockstate, blockstate, 3); + itemstack.shrink(1); + return InteractionResult.CONSUME; + } + } + + BlockPos blockpos1; + if (blockstate.getCollisionShape(world, blockpos).isEmpty()) + { + blockpos1 = blockpos; + } + else + { + blockpos1 = blockpos.relative(direction); + } + + EntityType<?> entitytype = this.getType(itemstack.getTag()); + Entity entity = this.spawn(entitytype, (ServerLevel)world, itemstack, p_195939_1_.getPlayer(), blockpos1, MobSpawnType.SPAWN_EGG, true, !Objects.equals(blockpos, blockpos1) && direction == Direction.UP, p_195939_1_.getRotation()); + + if (entity instanceof Machine) + { + ((Machine)entity).deploymentticks = 200; + } + if (entity != null) + { + itemstack.shrink(1); + } + + return InteractionResult.CONSUME; + } + } + + protected static double getYOffset(LevelReader p_208051_0_, BlockPos p_208051_1_, boolean p_208051_2_, AABB p_208051_3_) + { + AABB axisalignedbb = new AABB(p_208051_1_); + if (p_208051_2_) + { + axisalignedbb = axisalignedbb.expandTowards(0.0D, -1.0D, 0.0D); + } + + Iterable<VoxelShape> iterable = p_208051_0_.getCollisions(null, axisalignedbb); + return 1.0D + Shapes.collide(Direction.Axis.Y, p_208051_3_, iterable, p_208051_2_ ? -2.0D : -1.0D); + } + + @Nullable + public Entity spawn(EntityType<?> entitytype, ServerLevel p_220331_1_, @Nullable ItemStack p_220331_2_, @Nullable Player p_220331_3_, BlockPos p_220331_4_, MobSpawnType p_220331_5_, boolean p_220331_6_, boolean p_220331_7_, float yaw) { + return this.spawn(entitytype, p_220331_1_, p_220331_2_ == null ? null : p_220331_2_.getTag(), p_220331_2_ != null && p_220331_2_.hasCustomHoverName() ? p_220331_2_.getHoverName() : null, p_220331_3_, p_220331_4_, p_220331_5_, p_220331_6_, p_220331_7_, yaw); + } + + @Nullable + public Entity spawn(EntityType<?> entitytype, ServerLevel p_20601_, @Nullable CompoundTag p_20602_, @Nullable Component p_20603_, @Nullable Player p_20604_, BlockPos p_20605_, MobSpawnType p_20606_, boolean p_20607_, boolean p_20608_, float yaw) { + Entity t = this.create(entitytype, p_20601_, p_20602_, p_20603_, p_20604_, p_20605_, p_20606_, p_20607_, p_20608_, yaw); + if (t != null) + { + if (t instanceof Mob && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((Mob) t, (LevelAccessor)p_20601_, p_20605_.getX(), p_20605_.getY(), p_20605_.getZ(), null, p_20606_)) return null; + p_20601_.addFreshEntityWithPassengers(t); + } + + return t; + } + + @Nullable + public Entity create(EntityType<?> entitytype, ServerLevel p_20656_, @Nullable CompoundTag p_20657_, @Nullable Component p_20658_, @Nullable Player p_20659_, BlockPos p_20660_, MobSpawnType p_20661_, boolean p_20662_, boolean p_20663_, float yaw) + { + Entity t = entitytype.create(p_20656_); + if (t == null) { + return null; + } else { + double d0; + if (p_20662_) + { + t.setPos((double)p_20660_.getX() + 0.5D, (double)(p_20660_.getY() + 1), (double)p_20660_.getZ() + 0.5D); + d0 = getYOffset(p_20656_, p_20660_, p_20663_, t.getBoundingBox()); + } + else + { + d0 = 0.0D; + } + + t.moveTo((double)p_20660_.getX() + 0.5D, (double)p_20660_.getY() + d0, (double)p_20660_.getZ() + 0.5D, Mth.wrapDegrees(yaw), 0.0F); + if (t instanceof Mob) { + Mob mobentity = (Mob)t; + mobentity.yHeadRot = mobentity.getYRot(); + mobentity.yBodyRot = mobentity.getYRot(); + mobentity.finalizeSpawn(p_20656_, p_20656_.getCurrentDifficultyAt(mobentity.blockPosition()), p_20661_, (SpawnGroupData)null, p_20657_); + mobentity.playAmbientSound(); + } + + return t; + } + } + + @Override + public @NotNull InteractionResultHolder<ItemStack> use(@NotNull Level level, Player player, @NotNull InteractionHand hand) + { + ItemStack itemstack = player.getItemInHand(hand); + BlockHitResult raytraceresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY); + if (raytraceresult.getType() != HitResult.Type.BLOCK) + { + return InteractionResultHolder.pass(itemstack); + } + else if (!(level instanceof ServerLevel)) + { + return InteractionResultHolder.success(itemstack); + } + else + { + BlockPos blockpos = raytraceresult.getBlockPos(); + if (!(level.getBlockState(blockpos).getBlock() instanceof IFluidBlock)) + { + return InteractionResultHolder.pass(itemstack); + } + else if (level.mayInteract(player, blockpos) && player.mayUseItemAt(blockpos, raytraceresult.getDirection(), itemstack)) + { + EntityType<?> entitytype = this.getType(itemstack.getTag()); + Entity entity = this.spawn(entitytype, (ServerLevel) level, itemstack, player, blockpos, MobSpawnType.SPAWN_EGG, false, false, player.getYRot()); + if (entity instanceof Machine) + { + ((Machine)entity).deploymentticks = 200; + } + if (entity != null) + { + if (!player.isCreative()) + { + itemstack.shrink(1); + } + player.awardStat(Stats.ITEM_USED.get(this)); + return InteractionResultHolder.consume(itemstack); + } + else + { + return InteractionResultHolder.pass(itemstack); + } + + } + else + { + return InteractionResultHolder.fail(itemstack); + } + } + } + + public abstract EntityType<?> getType(); + + public EntityType<?> getType(@Nullable CompoundTag nbt) + { + EntityType<?> defaulttype = this.getType(); + + if (nbt != null && nbt.contains("EntityTag", 10)) + { + CompoundTag compoundnbt = nbt.getCompound("EntityTag"); + if (compoundnbt.contains("id", 8)) + { + return EntityType.byString(compoundnbt.getString("id")).orElse(defaulttype); + } + } + + return defaulttype; + } + + @Override + public void registerControllers(AnimationData data) + { + + } + + @Override + public AnimationFactory getFactory() + { + return this.factory; + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/ModItems.java b/src/main/java/ru/magistu/siegemachines/item/ModItems.java new file mode 100644 index 0000000..cf8af8c --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/ModItems.java @@ -0,0 +1,46 @@ +package ru.magistu.siegemachines.item; + +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) +public class ModItems +{ + public static final CreativeModeTab GROUP_SM = new CreativeModeTab(SiegeMachines.ID + ".medieval_siege_machines") { + @Override + public ItemStack makeIcon() { + return new ItemStack(ModItems.MORTAR.get()); + } + }; + + public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SiegeMachines.ID); + + public static final RegistryObject<MachineItem> MORTAR = ITEMS.register("mortar", MortarItem::new); + //public static final RegistryObject<MachineItem> CULVERIN = ITEMS.register("culverin", CulverinItem::new); + public static final RegistryObject<MachineItem> CATAPULT = ITEMS.register("catapult", CatapultItem::new); + public static final RegistryObject<MachineItem> TREBUCHET = ITEMS.register("trebuchet", TrebuchetItem::new); + public static final RegistryObject<MachineItem> BALLISTA = ITEMS.register("ballista", BallistaItem::new); + public static final RegistryObject<MachineItem> BATTERING_RAM = ITEMS.register("battering_ram", BatteringRamItem::new); + + public static final RegistryObject<Item> CANNONBALL = ITEMS.register("cannonball", () -> new Item(new Item.Properties().stacksTo(16).tab(ModItems.GROUP_SM))); + public static final RegistryObject<Item> STONE = ITEMS.register("stone", () -> new Item(new Item.Properties().stacksTo(16))); + public static final RegistryObject<Item> GIANT_ARROW = ITEMS.register("giant_arrow", () -> new Item(new Item.Properties().stacksTo(16).tab(ModItems.GROUP_SM))); + + public static final RegistryObject<Item> TURRET_BASE = ITEMS.register("turret_base", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM))); + public static final RegistryObject<Item> BEAM = ITEMS.register("beam", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM))); + public static final RegistryObject<Item> COUNTERWEIGHT = ITEMS.register("counterweight", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM))); + public static final RegistryObject<Item> BARREL = ITEMS.register("barrel", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM))); + public static final RegistryObject<Item> WHEEL = ITEMS.register("wheel", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM))); + + public static void register(IEventBus eventBus) + { + ITEMS.register(eventBus); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/MortarItem.java b/src/main/java/ru/magistu/siegemachines/item/MortarItem.java new file mode 100644 index 0000000..18b8e20 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/MortarItem.java @@ -0,0 +1,36 @@ +package ru.magistu.siegemachines.item; + +import net.minecraft.world.entity.EntityType; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer; +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import ru.magistu.siegemachines.entity.EntityTypes; + +import java.util.function.Consumer; + +public class MortarItem extends MachineItem +{ + public MortarItem() + { + super(new Properties().tab(ModItems.GROUP_SM), "mortar", "MORTAR"); + } + + @Override + public void initializeClient(Consumer<IClientItemExtensions> consumer) { + super.initializeClient(consumer); + consumer.accept(new IClientItemExtensions() { + private final BlockEntityWithoutLevelRenderer renderer = new MachineItemGeoRenderer(new MachineItemModel<>("mortar")); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return renderer; + } + }); + } + + @Override + public EntityType<?> getType() { + return EntityTypes.MORTAR.get(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/item/TrebuchetItem.java b/src/main/java/ru/magistu/siegemachines/item/TrebuchetItem.java new file mode 100644 index 0000000..c1e23fa --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/item/TrebuchetItem.java @@ -0,0 +1,36 @@ +package ru.magistu.siegemachines.item; + +import net.minecraft.world.entity.EntityType; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer; +import ru.magistu.siegemachines.client.renderer.model.MachineItemModel; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import ru.magistu.siegemachines.entity.EntityTypes; + +import java.util.function.Consumer; + +public class TrebuchetItem extends MachineItem +{ + public TrebuchetItem() + { + super(new Properties().tab(ModItems.GROUP_SM), "trebuchet", "TREBUCHET"); + } + + @Override + public void initializeClient(Consumer<IClientItemExtensions> consumer) { + super.initializeClient(consumer); + consumer.accept(new IClientItemExtensions() { + private final BlockEntityWithoutLevelRenderer renderer = new MachineItemGeoRenderer(new MachineItemModel<>("trebuchet")); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return renderer; + } + }); + } + + @Override + public EntityType<?> getType() { + return EntityTypes.TREBUCHET.get(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketHandler.java b/src/main/java/ru/magistu/siegemachines/network/PacketHandler.java new file mode 100644 index 0000000..e9b9a99 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketHandler.java @@ -0,0 +1,66 @@ +package ru.magistu.siegemachines.network; + +import ru.magistu.siegemachines.SiegeMachines; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkRegistry; +import net.minecraftforge.network.simple.SimpleChannel; +import net.minecraftforge.server.ServerLifecycleHooks; + +public class PacketHandler +{ + private static final String PROTOCOL_VERSION = "1"; + + public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(new ResourceLocation(SiegeMachines.ID, "main"), () -> "1", "1"::equals, "1"::equals); + + protected static int currentId = 0; + + public static void init() + { + INSTANCE.registerMessage(getNextId(), PacketMachine.class, PacketMachine::write, PacketMachine::read, PacketMachine.Handler::handle); + INSTANCE.registerMessage(getNextId(), PacketMachineControl.class, PacketMachineControl::write, PacketMachineControl::read, PacketMachineControl.Handler::handle); + INSTANCE.registerMessage(getNextId(), PacketMachineUse.class, PacketMachineUse::write, PacketMachineUse::read, PacketMachineUse.Handler::handle); + INSTANCE.registerMessage(getNextId(), PacketMachineUseRealise.class, PacketMachineUseRealise::write, PacketMachineUseRealise::read, PacketMachineUseRealise.Handler::handle); + INSTANCE.registerMessage(getNextId(), PacketOpenMachineInventory.class, PacketOpenMachineInventory::write, PacketOpenMachineInventory::read, PacketOpenMachineInventory.Handler::handle); + INSTANCE.registerMessage(getNextId(), PacketMachineInventorySlot.class, PacketMachineInventorySlot::write, PacketMachineInventorySlot::read, PacketMachineInventorySlot.Handler::handle); + + } + + public static int getNextId() + { + int id = currentId; + currentId++; + return id; + } + + public static void sendToServer(Object packet) { + INSTANCE.sendToServer(packet); + } + + public static void sendTo(Object packet, ServerPlayer player) + { + if (!(player instanceof net.minecraftforge.common.util.FakePlayer)) + INSTANCE.sendTo(packet, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); + } + + public static void sendPacketToAllInArea(Object packet, BlockPos center, int rangesqr) + { + for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) + { + if (player.distanceToSqr(center.getX(), center.getY(), center.getZ()) < rangesqr) + { + sendTo(packet, player); + } + } + } + + public static void sendPacketToAll(Object packet) + { + for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) + { + sendTo(packet, player); + } + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketMachine.java b/src/main/java/ru/magistu/siegemachines/network/PacketMachine.java new file mode 100644 index 0000000..b4f7596 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketMachine.java @@ -0,0 +1,81 @@ +package ru.magistu.siegemachines.network; + +import io.netty.channel.ChannelHandler; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +@ChannelHandler.Sharable +public class PacketMachine +{ + private final int entityid; + private final int delayticks; + private final int useticks; + private final float turretyaw; + private final float turretpitch; + + public PacketMachine(int entityid, int delayticks, int useticks, float turretpitch, float turretyaw) + { + this.entityid = entityid; + this.delayticks = delayticks; + this.useticks = useticks; + this.turretpitch = turretpitch; + this.turretyaw = turretyaw; + } + + public static PacketMachine read(FriendlyByteBuf buf) + { + return new PacketMachine(buf.readInt(), buf.readInt(), buf.readInt(), buf.readFloat(), buf.readFloat()); + } + + public static void write(PacketMachine message, FriendlyByteBuf buf) + { + buf.writeInt(message.entityid); + buf.writeInt(message.delayticks); + buf.writeInt(message.useticks); + buf.writeFloat(message.turretpitch); + buf.writeFloat(message.turretyaw); + } + + public static class Handler + { + public static void handle(PacketMachine packet, Supplier<NetworkEvent.Context> ctx) + { + NetworkEvent.Context context = ctx.get(); + if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) + { + context.enqueueWork(() -> PacketMachine.handleClientSide(packet)); + } + context.setPacketHandled(true); + } + } + + @OnlyIn(Dist.CLIENT) + public static void handleClientSide(PacketMachine packet) + { + LocalPlayer player = Minecraft.getInstance().player; + if(packet == null || player == null || player.level == null) + { + return; + } + + Entity entity = player.level.getEntity(packet.entityid); + if (!(entity instanceof Machine)) + { + return; + } + Machine machine = (Machine) entity; + + machine.delayticks = packet.delayticks; + machine.useticks = packet.useticks; + machine.setTurretRotations(packet.turretpitch, packet.turretyaw); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketMachineControl.java b/src/main/java/ru/magistu/siegemachines/network/PacketMachineControl.java new file mode 100644 index 0000000..0060e0a --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketMachineControl.java @@ -0,0 +1,54 @@ +package ru.magistu.siegemachines.network; + +import io.netty.channel.ChannelHandler; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +@ChannelHandler.Sharable +public class PacketMachineControl +{ + public PacketMachineControl() {} + + public static PacketMachineControl read(FriendlyByteBuf buf) + { + return new PacketMachineControl(); + } + + public static void write(PacketMachineControl message, FriendlyByteBuf buf) {} + + public static class Handler + { + public static void handle(PacketMachineControl packet, Supplier<NetworkEvent.Context> ctx) + { + NetworkEvent.Context context = ctx.get(); + if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) + { + context.enqueueWork(() -> PacketMachineControl.handleServerSide(packet, context.getSender())); + } + context.setPacketHandled(true); + } + } + + public static void handleServerSide(PacketMachineControl packet, ServerPlayer player) + { + if(packet == null || player == null || !player.isPassenger()) + { + return; + } + + Entity entity = player.getVehicle(); + if (!(entity instanceof Machine)) + { + return; + } + Machine machine = (Machine) entity; + + machine.setTurretRotations(player.getXRot(), player.getYRot()); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketMachineInventorySlot.java b/src/main/java/ru/magistu/siegemachines/network/PacketMachineInventorySlot.java new file mode 100644 index 0000000..c7c8dc1 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketMachineInventorySlot.java @@ -0,0 +1,74 @@ +package ru.magistu.siegemachines.network; + +import io.netty.channel.ChannelHandler; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +@ChannelHandler.Sharable +public class PacketMachineInventorySlot +{ + private final int entityid; + private final int slot; + private ItemStack itemstack = ItemStack.EMPTY; + + public PacketMachineInventorySlot(int entityid, int slot, ItemStack itemstack) + { + this.entityid = entityid; + this.slot = slot; + this.itemstack = itemstack.copy(); + } + + public static PacketMachineInventorySlot read(FriendlyByteBuf buf) + { + return new PacketMachineInventorySlot(buf.readInt(), buf.readInt(), buf.readItem()); + } + + public static void write(PacketMachineInventorySlot message, FriendlyByteBuf buf) + { + buf.writeInt(message.entityid); + buf.writeInt(message.slot); + buf.writeItemStack(message.itemstack, false); + } + + public static class Handler + { + public static void handle(PacketMachineInventorySlot packet, Supplier<NetworkEvent.Context> ctx) + { + NetworkEvent.Context context = ctx.get(); + if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) + { + context.enqueueWork(() -> PacketMachineInventorySlot.handleClientSide(packet)); + } + context.setPacketHandled(true); + } + } + + @OnlyIn(Dist.CLIENT) + public static void handleClientSide(PacketMachineInventorySlot packet) + { + LocalPlayer player = Minecraft.getInstance().player; + if(packet == null || player == null || player.level == null) + { + return; + } + + Entity entity = player.level.getEntity(packet.entityid); + if (!(entity instanceof Machine)) + { + return; + } + Machine machine = (Machine) entity; + + machine.inventory.setItem(packet.slot, packet.itemstack); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketMachineUse.java b/src/main/java/ru/magistu/siegemachines/network/PacketMachineUse.java new file mode 100644 index 0000000..ab193f7 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketMachineUse.java @@ -0,0 +1,75 @@ +package ru.magistu.siegemachines.network; + +import io.netty.channel.ChannelHandler; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.client.Minecraft; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +@ChannelHandler.Sharable +public class PacketMachineUse +{ + private final int entityid; + + public PacketMachineUse(int entityid) + { + this.entityid = entityid; + } + + public static PacketMachineUse read(FriendlyByteBuf buf) + { + return new PacketMachineUse(buf.readInt()); + } + + public static void write(PacketMachineUse message, FriendlyByteBuf buf) + { + buf.writeInt(message.entityid); + } + + public static class Handler + { + public static void handle(PacketMachineUse packet, Supplier<NetworkEvent.Context> ctx) + { + NetworkEvent.Context context = ctx.get(); + if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) + { + context.enqueueWork(() -> PacketMachineUse.handleEachSide(packet, context.getSender())); + } + else if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) + { + context.enqueueWork(() -> PacketMachineUse.handleClientSide(packet)); + } + context.setPacketHandled(true); + } + } + + @OnlyIn(Dist.CLIENT) + public static void handleClientSide(PacketMachineUse packet) + { + handleEachSide(packet, Minecraft.getInstance().player); + } + + public static void handleEachSide(PacketMachineUse packet, Player player) + { + if(packet == null || player == null || player.level == null) + { + return; + } + + Entity entity = player.level.getEntity(packet.entityid); + if (!(entity instanceof Machine)) + { + return; + } + Machine machine = (Machine) entity; + + machine.use(player); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketMachineUseRealise.java b/src/main/java/ru/magistu/siegemachines/network/PacketMachineUseRealise.java new file mode 100644 index 0000000..5901084 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketMachineUseRealise.java @@ -0,0 +1,75 @@ +package ru.magistu.siegemachines.network; + +import io.netty.channel.ChannelHandler; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.client.Minecraft; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +@ChannelHandler.Sharable +public class PacketMachineUseRealise +{ + private final int entityid; + + public PacketMachineUseRealise(int entityid) + { + this.entityid = entityid; + } + + public static PacketMachineUseRealise read(FriendlyByteBuf buf) + { + return new PacketMachineUseRealise(buf.readInt()); + } + + public static void write(PacketMachineUseRealise message, FriendlyByteBuf buf) + { + buf.writeInt(message.entityid); + } + + public static class Handler + { + public static void handle(PacketMachineUseRealise packet, Supplier<NetworkEvent.Context> ctx) + { + NetworkEvent.Context context = ctx.get(); + if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) + { + context.enqueueWork(() -> PacketMachineUseRealise.handleEachSide(packet, context.getSender())); + } + else if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) + { + context.enqueueWork(() -> PacketMachineUseRealise.handleClientSide(packet)); + } + context.setPacketHandled(true); + } + } + + @OnlyIn(Dist.CLIENT) + public static void handleClientSide(PacketMachineUseRealise packet) + { + handleEachSide(packet, Minecraft.getInstance().player); + } + + public static void handleEachSide(PacketMachineUseRealise packet, Player player) + { + if(packet == null || player == null || player.level == null) + { + return; + } + + Entity entity = player.level.getEntity(packet.entityid); + if (!(entity instanceof Machine)) + { + return; + } + Machine machine = (Machine) entity; + + machine.useRealise(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/network/PacketOpenMachineInventory.java b/src/main/java/ru/magistu/siegemachines/network/PacketOpenMachineInventory.java new file mode 100644 index 0000000..289ae20 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/network/PacketOpenMachineInventory.java @@ -0,0 +1,54 @@ +package ru.magistu.siegemachines.network; + +import io.netty.channel.ChannelHandler; +import ru.magistu.siegemachines.entity.machine.Machine; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +@ChannelHandler.Sharable +public class PacketOpenMachineInventory +{ + public PacketOpenMachineInventory() {} + + public static PacketOpenMachineInventory read(FriendlyByteBuf buf) + { + return new PacketOpenMachineInventory(); + } + + public static void write(PacketOpenMachineInventory message, FriendlyByteBuf buf) {} + + public static class Handler + { + public static void handle(PacketOpenMachineInventory packet, Supplier<NetworkEvent.Context> ctx) + { + NetworkEvent.Context context = ctx.get(); + if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) + { + context.enqueueWork(() -> PacketOpenMachineInventory.handleServerSide(packet, context.getSender())); + } + context.setPacketHandled(true); + } + } + + public static void handleServerSide(PacketOpenMachineInventory packet, ServerPlayer player) + { + if(packet == null || player == null || !player.isPassenger()) + { + return; + } + + Entity entity = player.getVehicle(); + if (!(entity instanceof Machine)) + { + return; + } + Machine machine = (Machine) entity; + + machine.openInventoryGui(); + } +} diff --git a/src/main/java/ru/magistu/siegemachines/plugins/jei/JeiSupport.java b/src/main/java/ru/magistu/siegemachines/plugins/jei/JeiSupport.java new file mode 100644 index 0000000..73a2aae --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/plugins/jei/JeiSupport.java @@ -0,0 +1,37 @@ +package ru.magistu.siegemachines.plugins.jei; + +import mezz.jei.api.IModPlugin; +import mezz.jei.api.JeiPlugin; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.registration.IRecipeCategoryRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeManager; +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.data.recipes.ModRecipes; +import ru.magistu.siegemachines.data.recipes.SiegeWorkbenchRecipe; + +import java.util.List; +import java.util.Objects; + +@JeiPlugin +public class JeiSupport implements IModPlugin { + @Override + public ResourceLocation getPluginUid() { + return new ResourceLocation(SiegeMachines.ID, "jei_plugin"); + } + + @Override + public void registerCategories(IRecipeCategoryRegistration registration) { + registration.addRecipeCategories(new + SiegeWorkbenchRecipeCategory(registration.getJeiHelpers().getGuiHelper())); + } + + @Override + public void registerRecipes(IRecipeRegistration registration) { + RecipeManager rm = Objects.requireNonNull(Minecraft.getInstance().level).getRecipeManager(); + List<SiegeWorkbenchRecipe> recipes = rm.getAllRecipesFor(ModRecipes.SIEGE_WORKBENCH_RECIPE); + registration.addRecipes(new RecipeType<>(SiegeWorkbenchRecipeCategory.UID, SiegeWorkbenchRecipe.class), recipes); + } +} \ No newline at end of file diff --git a/src/main/java/ru/magistu/siegemachines/plugins/jei/SiegeWorkbenchRecipeCategory.java b/src/main/java/ru/magistu/siegemachines/plugins/jei/SiegeWorkbenchRecipeCategory.java new file mode 100644 index 0000000..eb03e19 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/plugins/jei/SiegeWorkbenchRecipeCategory.java @@ -0,0 +1,74 @@ +package ru.magistu.siegemachines.plugins.jei; + +import com.mojang.datafixers.kinds.IdF; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import ru.magistu.siegemachines.SiegeMachines; +import ru.magistu.siegemachines.block.ModBlocks; +import ru.magistu.siegemachines.data.recipes.ModRecipes; +import ru.magistu.siegemachines.data.recipes.SiegeWorkbenchRecipe; + +import javax.annotation.Nonnull; + +public class SiegeWorkbenchRecipeCategory implements IRecipeCategory<SiegeWorkbenchRecipe> { + public final static ResourceLocation TEXTURE = new ResourceLocation(SiegeMachines.ID, "textures/gui/siege_workbench.png"); + public final static ResourceLocation UID = new ResourceLocation(SiegeMachines.ID, "siege_workbench_recipe_category"); + public final static RecipeType<SiegeWorkbenchRecipe> RECIPE_TYPE = new RecipeType<>(UID, SiegeWorkbenchRecipe.class); + + private final IDrawable background; + private final IDrawable icon; + + public SiegeWorkbenchRecipeCategory(IGuiHelper helper) { + this.background = helper.createDrawable(TEXTURE, 29, 16, 116, 54); + this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(ModBlocks.SIEGE_WORKBENCH.get())); + } + + @Override + @NotNull + public RecipeType<SiegeWorkbenchRecipe> getRecipeType() { + return RECIPE_TYPE; + } + + @Override + @NotNull + public Component getTitle() { + return Component.translatable("category." + SiegeMachines.ID + ".siege_workbench_crafting"); + } + + @Override + @NotNull + public IDrawable getBackground() { + return this.background; + } + + @Override + @NotNull + public IDrawable getIcon() { + return this.icon; + } + + @Override + public void setRecipe(@Nonnull IRecipeLayoutBuilder builder, @Nonnull SiegeWorkbenchRecipe recipe, @Nonnull IFocusGroup focusGroup) + { + builder.addSlot(RecipeIngredientRole.OUTPUT, 94, 18).addItemStack(recipe.getResultItem()); + + for (int i = 0; i < recipe.getWidth(); ++i) + { + for (int j = 0; j < recipe.getHeight(); ++j) + { + builder.addSlot(RecipeIngredientRole.INPUT, j * 18, i * 18).addItemStacks(recipe.getRecipeItems().get(j + recipe.getWidth() * i).getCountModifiedItemStacks()); + } + } + } +} diff --git a/src/main/java/ru/magistu/siegemachines/proxy/IProxy.java b/src/main/java/ru/magistu/siegemachines/proxy/IProxy.java new file mode 100644 index 0000000..bc2b811 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/proxy/IProxy.java @@ -0,0 +1,14 @@ +package ru.magistu.siegemachines.proxy; + +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; + +public interface IProxy +{ + void setup(IEventBus paramIEventBus1, IEventBus paramIEventBus2); + + public void clientSetup(FMLClientSetupEvent event); + + public void onPreInit(); +} diff --git a/src/main/java/ru/magistu/siegemachines/server/ServerProxy.java b/src/main/java/ru/magistu/siegemachines/server/ServerProxy.java new file mode 100644 index 0000000..aa8d2b0 --- /dev/null +++ b/src/main/java/ru/magistu/siegemachines/server/ServerProxy.java @@ -0,0 +1,15 @@ +package ru.magistu.siegemachines.server; + +import ru.magistu.siegemachines.proxy.IProxy; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; + +public class ServerProxy implements IProxy +{ + public void setup(IEventBus modEventBus, IEventBus forgeEventBus) {} + + public void clientSetup(FMLClientSetupEvent event) {} + + public void onPreInit() {} +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..69245af --- /dev/null +++ b/src/main/resources/META-INF/mods.toml @@ -0,0 +1,19 @@ +modLoader="javafml" #mandatory +loaderVersion="[41,)" #mandatory +license="All rights reserved" +[[mods]] #mandatory +modId="siegemachines" #mandatory +version="${file.jarVersion}" #mandatory +# A display name for the mod +displayName="Medieval Siege Machines" #mandatory +# logoFile="siegemachines.png" #optional // TODO Logo +credits="Lexiolty, itzme1on, Sahgar" +authors="Magistu" #optional +description='''Adds medieval siege machines''' +# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. +[[dependencies.siegemachines]] + modId="geckolib3" + mandatory=true + versionRange="[3.00,]" + ordering="NONE" + side="BOTH" \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/animations/ballista.animation.json b/src/main/resources/assets/siegemachines/animations/ballista.animation.json new file mode 100644 index 0000000..368cde3 --- /dev/null +++ b/src/main/resources/assets/siegemachines/animations/ballista.animation.json @@ -0,0 +1,195 @@ +{ + "format_version": "1.8.0", + "animations": { + "Reloading": { + "animation_length": 5.0, + "bones": { + "ArcDroit": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [0, 20, 0] + } + } + }, + "ArcGauche": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [0, -20, 0] + } + } + }, + "Manivelles": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [-720, 0, 0] + } + } + }, + "CordeGuide": { + "position": { + "0.0": { + "vector": [0, 0, 1] + }, + "5.0": { + "vector": [0, 0, 17] + } + }, + "scale": { + "0.0": { + "vector": [1, 1, 1] + }, + "5.0": { + "vector": [1, 1, 0.2] + } + } + }, + "Guide": { + "position": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [0, 0, 17] + } + } + }, + "CordeDroite": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [0, -42.5, 0] + } + }, + "position": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [4.4, 0, 5] + } + } + }, + "CordeGauche": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [0, 42.5, 0] + } + }, + "position": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [-4.4, 0, 5] + } + } + } + } + }, + "Shooting": { + "loop": true, + "animation_length": 1.0, + "bones": { + "ArcDroit": { + "rotation": { + "0.0": { + "vector": [0, 20, 0] + }, + "0.05": { + "vector": [0, 0, 0] + } + } + }, + "ArcGauche": { + "rotation": { + "0.0": { + "vector": [0, -20, 0] + }, + "0.05": { + "vector": [0, 0, 0] + } + } + }, + "Guide": { + "position": { + "0.0": { + "vector": [0, 0, 17] + }, + "0.05": { + "vector": [0, 0, 0] + } + } + }, + "CordeDroite": { + "rotation": { + "0.0": { + "vector": [0, -42.5, 0] + }, + "0.05": { + "vector": [0, 0, 0] + } + }, + "position": { + "0.0": { + "vector": [4.4, 0, 5] + }, + "0.05": { + "vector": [0, 0, 0] + } + } + }, + "CordeGauche": { + "rotation": { + "0.0": { + "vector": [0, 42.5, 0] + }, + "0.05": { + "vector": [0, 0, 0] + } + }, + "position": { + "0.0": { + "vector": [-4.4, 0, 5] + }, + "0.05": { + "vector": [0, 0, 0] + } + } + }, + "CordeGuide": { + "position": { + "0.0": { + "vector": [0, 0, 17] + }, + "0.05": { + "vector": [0, 0, 1] + } + }, + "scale": { + "0.0": { + "vector": [1, 1, "0.2+0.9s"] + }, + "0.05": { + "vector": [1, 1, 1] + } + } + } + } + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/animations/battering_ram.animation.json b/src/main/resources/assets/siegemachines/animations/battering_ram.animation.json new file mode 100644 index 0000000..acab657 --- /dev/null +++ b/src/main/resources/assets/siegemachines/animations/battering_ram.animation.json @@ -0,0 +1,443 @@ +{ + "format_version": "1.8.0", + "animations": { + "Moving": { + "loop": true, + "animation_length": 4, + "bones": { + "Wheel1": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel2": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel3": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel4": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel5": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel6": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + } + } + }, + "TurningRight": { + "loop": true, + "animation_length": 2, + "bones": { + "Wheel1": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [90, 0, 0] + }, + "1.0": { + "vector": [180, 0, 0] + }, + "1.5": { + "vector": [270, 0, 0] + }, + "2.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel2": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [90, 0, 0] + }, + "1.0": { + "vector": [180, 0, 0] + }, + "1.5": { + "vector": [270, 0, 0] + }, + "2.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel3": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [90, 0, 0] + }, + "1.0": { + "vector": [180, 0, 0] + }, + "1.5": { + "vector": [270, 0, 0] + }, + "2.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel4": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [-90, 0, 0] + }, + "1.0": { + "vector": [-180, 0, 0] + }, + "1.5": { + "vector": [-270, 0, 0] + }, + "2.0": { + "vector": [-360, 0, 0] + } + } + }, + "Wheel5": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [-90, 0, 0] + }, + "1.0": { + "vector": [-180, 0, 0] + }, + "1.5": { + "vector": [-270, 0, 0] + }, + "2.0": { + "vector": [-360, 0, 0] + } + } + }, + "Wheel6": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [-90, 0, 0] + }, + "1.0": { + "vector": [-180, 0, 0] + }, + "1.5": { + "vector": [-270, 0, 0] + }, + "2.0": { + "vector": [-360, 0, 0] + } + } + } + } + }, + "TurningLeft": { + "loop": true, + "animation_length": 2, + "bones": { + "Wheel1": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [-90, 0, 0] + }, + "1.0": { + "vector": [-180, 0, 0] + }, + "1.5": { + "vector": [-270, 0, 0] + }, + "2.0": { + "vector": [-360, 0, 0] + } + } + }, + "Wheel2": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [-90, 0, 0] + }, + "1.0": { + "vector": [-180, 0, 0] + }, + "1.5": { + "vector": [-270, 0, 0] + }, + "2.0": { + "vector": [-360, 0, 0] + } + } + }, + "Wheel3": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [-90, 0, 0] + }, + "1.0": { + "vector": [-180, 0, 0] + }, + "1.5": { + "vector": [-270, 0, 0] + }, + "2.0": { + "vector": [-360, 0, 0] + } + } + }, + "Wheel4": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [90, 0, 0] + }, + "1.0": { + "vector": [180, 0, 0] + }, + "1.5": { + "vector": [270, 0, 0] + }, + "2.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel5": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [90, 0, 0] + }, + "1.0": { + "vector": [180, 0, 0] + }, + "1.5": { + "vector": [270, 0, 0] + }, + "2.0": { + "vector": [360, 0, 0] + } + } + }, + "Wheel6": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.5": { + "vector": [90, 0, 0] + }, + "1.0": { + "vector": [180, 0, 0] + }, + "1.5": { + "vector": [270, 0, 0] + }, + "2.0": { + "vector": [360, 0, 0] + } + } + } + } + }, + "Reloading": { + "animation_length": 5, + "bones": { + "Ram": { + "position": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [0, 3.7, 12], + "easing": "linear" + } + } + }, + "FirstDuoRopes": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [45, 0, 0] + } + } + }, + "SecondDuoRopes": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [45, 0, 0] + } + } + }, + "ThirdDuoRopes": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "5.0": { + "vector": [45, 0, 0] + } + } + } + } + }, + "ReloadedIdle": { + "animation_length": 5, + "bones": { + "Ram": { + "position": { + "vector": [0, 3.7, 12], + "easing": "linear" + } + }, + "FirstDuoRopes": { + "rotation": { + "vector": [45, 0, 0] + } + }, + "SecondDuoRopes": { + "rotation": { + "vector": [45, 0, 0] + } + }, + "ThirdDuoRopes": { + "rotation": { + "vector": [45, 0, 0] + } + } + } + }, + "Hitting": { + "loop": true, + "animation_length": 0.25, + "bones": { + "Ram": { + "position": { + "0.0": { + "vector": [0, 3.7, 12], + "easing": "linear" + }, + "0.15": { + "vector": [0, 0, 0] + }, + "0.25": { + "vector": [0, 3, -10] + } + } + }, + "FirstDuoRopes": { + "rotation": { + "0.0": { + "vector": [45, 0, 0] + }, + "0.15": { + "vector": [0, 0, 0] + }, + "0.25": { + "vector": [-40, 0, 0] + } + } + }, + "SecondDuoRopes": { + "rotation": { + "0.0": { + "vector": [45, 0, 0] + }, + "0.15": { + "vector": [0, 0, 0] + }, + "0.25": { + "vector": [-40, 0, 0] + } + } + }, + "ThirdDuoRopes": { + "rotation": { + "0.0": { + "vector": [45, 0, 0] + }, + "0.15": { + "vector": [0, 0, 0] + }, + "0.25": { + "vector": [-40, 0, 0] + } + } + } + } + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/animations/catapult.animation.json b/src/main/resources/assets/siegemachines/animations/catapult.animation.json new file mode 100644 index 0000000..e70994c --- /dev/null +++ b/src/main/resources/assets/siegemachines/animations/catapult.animation.json @@ -0,0 +1,119 @@ +{ + "format_version": "1.8.0", + "animations": { + "Reloading": { + "animation_length": 10.0, + "bones": { + "Lever": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "10.0": { + "vector": [-67.5, 0, 0] + } + } + }, + "Crank": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "10.0": { + "vector": [-360, 0, 0] + } + } + }, + "LittleLevers": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.8333": { + "vector": [15, 0, 0] + }, + "1.0": { + "vector": [0, 0, 0] + }, + "2.2": { + "vector": [15, 0, 0] + }, + "2.3": { + "vector": [0, 0, 0] + }, + "3.5": { + "vector": [15, 0, 0] + }, + "3.7": { + "vector": [0, 0, 0] + }, + "4.8": { + "vector": [15, 0, 0] + }, + "5.0": { + "vector": [0, 0, 0] + }, + "6.1": { + "vector": [15, 0, 0] + }, + "6.3": { + "vector": [0, 0, 0] + }, + "7.5": { + "vector": [15, 0, 0] + }, + "7.6": { + "vector": [0, 0, 0] + }, + "8.8": { + "vector": [15, 0, 0] + }, + "8.9": { + "vector": [0, 0, 0] + } + } + } + } + }, + "IdleReloaded": { + "loop": true, + "bones": { + "Lever": { + "rotation": { + "vector": [-67.5, 0, 0] + } + }, + "Rope": { + "scale": { + "vector": [0, 0, 0] + } + }, + "Crank": { + "rotation": { + "vector": [-360, 0, 0] + } + } + } + }, + "IdleNotReloaded": { + "loop": true + }, + "Shooting": { + "loop": true, + "animation_length": 0.4, + "bones": { + "Lever": { + "rotation": { + "0.0": { + "vector": [-67.5, 0, 0] + }, + "0.1": { + "vector": [0, 0, 0] + } + } + } + } + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/animations/mortar.animation.json b/src/main/resources/assets/siegemachines/animations/mortar.animation.json new file mode 100644 index 0000000..ac2dae2 --- /dev/null +++ b/src/main/resources/assets/siegemachines/animations/mortar.animation.json @@ -0,0 +1,38 @@ +{ + "format_version": "1.8.0", + "animations": { + "Tilting": { + "loop": true, + "animation_length": 4, + "bones": { + "Barrel": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + } + } + }, + "Moving": { + "loop": true, + "animation_length": 4, + "bones": { + "Wheels": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "4.0": { + "vector": [360, 0, 0] + } + } + } + } + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/animations/none.animation.json b/src/main/resources/assets/siegemachines/animations/none.animation.json new file mode 100644 index 0000000..5ac4bc1 --- /dev/null +++ b/src/main/resources/assets/siegemachines/animations/none.animation.json @@ -0,0 +1,5 @@ +{ + "format_version": "1.8.0", + "animations": {}, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/animations/trebuchet.animation.json b/src/main/resources/assets/siegemachines/animations/trebuchet.animation.json new file mode 100644 index 0000000..d4b72ae --- /dev/null +++ b/src/main/resources/assets/siegemachines/animations/trebuchet.animation.json @@ -0,0 +1,210 @@ +{ + "format_version": "1.8.0", + "animations": { + "Shooting": { + "loop": "hold_on_last_frame", + "animation_length": 6.83333, + "bones": { + "Lever": { + "rotation": { + "0.0": { + "vector": [-120, 0, 0] + }, + "2.0417": { + "vector": [37.2, 0, 0], + "easing": "easeInExpo" + }, + "2.25": { + "vector": [34.83, 0, 0] + }, + "2.3333": { + "vector": [32.56, 0, 0] + }, + "2.4167": { + "vector": [29.53, 0, 0] + }, + "2.5": { + "vector": [25.74, 0, 0] + }, + "2.5833": { + "vector": [21.19, 0, 0] + }, + "2.6667": { + "vector": [15.89, 0, 0] + }, + "2.75": { + "vector": [9.82, 0, 0] + }, + "2.8333": { + "vector": [3, 0, 0] + }, + "2.9167": { + "vector": [-4.57, 0, 0] + }, + "3.0": { + "vector": [-12.91, 0, 0] + }, + "3.0833": { + "vector": [-22, 0, 0], + "easing": "easeInQuad" + }, + "3.9583": { + "vector": [27, 0, 0], + "easing": "easeInSine" + }, + "5.1667": { + "vector": [-14.5, 0, 0], + "easing": "easeInSine" + }, + "6.8333": { + "vector": [0, 0, 0] + } + } + }, + "CounterWeight": { + "rotation": { + "0.0": { + "vector": [120, 0, 0] + }, + "2.0417": { + "vector": [-31.96, 0, 0], + "easing": "easeInExpo" + }, + "2.75": { + "vector": [7.19, 0, 0], + "easing": "easeOutQuad" + }, + "3.0833": { + "vector": [27.74, 0, 0] + }, + "3.9583": { + "vector": [-24.38, 0, 0] + }, + "5.1667": { + "vector": [13.12, 0, 0] + }, + "6.8333": { + "vector": [0, 0, 0] + } + } + }, + "Rope_Projectile": { + "rotation": { + "0.0": { + "vector": [35, 0, 0] + }, + "1.5833": { + "vector": [57.5, 0, 0], + "easing": "easeInExpo" + }, + "3.0833": { + "vector": [386.91598, 0, 0], + "easing": "easeOutQuad" + }, + "3.9583": { + "vector": [359.87276, 0, 0], + "easing": "easeInQuad" + }, + "5.1667": { + "vector": [375.39, 0, 0], + "easing": "easeInQuad" + }, + "6.8333": { + "vector": [360, 0, 0], + "easing": "easeInQuad" + } + } + } + } + }, + "Reloading": { + "loop": "hold_on_last_frame", + "animation_length": 20, + "bones": { + "Crank": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "20.0": { + "vector": [-720, 0, 0] + } + } + }, + "Lever": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "20.0": { + "vector": [-120, 0, 0] + } + } + }, + "CounterWeight": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "20.0": { + "vector": [120, 0, 0] + } + } + }, + "Rope_Projectile": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "20.0": { + "vector": [35, 0, 0] + } + } + } + } + }, + "IdleReloaded": { + "loop": "hold_on_last_frame", + "animation_length": 6.83333, + "bones": { + "Rope_Projectile": { + "rotation": { + "vector": [35, 0, 0] + } + }, + "Lever": { + "rotation": { + "vector": [-122.5, 0, 0] + } + }, + "CounterWeight": { + "rotation": { + "vector": [122.5, 0, 0] + } + } + } + }, + "IdleNotReloaded": { + "loop": "hold_on_last_frame", + "animation_length": 20, + "bones": { + "CounterWeight": { + "rotation": { + "vector": [0, 0, 0] + } + }, + "Lever": { + "rotation": { + "vector": [0, 0, 0] + } + }, + "Rope_Projectile": { + "rotation": { + "vector": [0, 0, 0] + } + } + } + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/blockstates/siege_workbench.json b/src/main/resources/assets/siegemachines/blockstates/siege_workbench.json new file mode 100644 index 0000000..63f5426 --- /dev/null +++ b/src/main/resources/assets/siegemachines/blockstates/siege_workbench.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "siegemachines:block/siege_workbench" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/ballista.geo.json b/src/main/resources/assets/siegemachines/geo/ballista.geo.json new file mode 100644 index 0000000..570e535 --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/ballista.geo.json @@ -0,0 +1,139 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 128, + "texture_height": 128, + "visible_bounds_width": 5, + "visible_bounds_height": 4, + "visible_bounds_offset": [0, 1, 0] + }, + "bones": [ + { + "name": "bb_main", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [0, 3, 30], "size": [0, 0, 1], "uv": [0, 0]} + ] + }, + { + "name": "Structure", + "pivot": [0, 4.18198, -8.1], + "cubes": [ + {"origin": [-1.5, 0, -1.4], "size": [3, 13, 3], "uv": [44, 0]}, + {"origin": [-8.90381, 1.28198, -4.4], "size": [1, 2, 11], "pivot": [-7.40381, 4.28198, -0.9], "rotation": [0, 90, -45], "uv": [0, 0]}, + {"origin": [-0.5, -0.81802, 0.83223], "size": [1, 2, 11], "pivot": [-4, 4.18198, 10.33223], "rotation": [-45, 0, 0], "uv": [0, 39]}, + {"origin": [-1.5, -1, -11.9], "size": [3, 2, 24], "uv": [44, 0]}, + {"origin": [7.90381, 1.28198, -4.4], "size": [1, 2, 11], "pivot": [7.40381, 4.28198, -0.9], "rotation": [0, -90, 45], "uv": [33, 40]}, + {"origin": [-12, -0.9, -1.4], "size": [24, 2, 3], "uv": [44, 27]}, + {"origin": [-0.5, 6.41726, -8.63528], "size": [1, 2, 11], "pivot": [0, 4.18198, 0.1], "rotation": [45, 0, 0], "uv": [0, 13]} + ] + }, + { + "name": "Balliste", + "pivot": [0, 20, 0], + "cubes": [ + {"origin": [-2.4, 12, -1.9], "size": [5, 1, 4], "uv": [12, 52]}, + {"origin": [-0.4, 11.8, -0.4], "size": [1, 2, 1], "uv": [0, 5]}, + {"origin": [2, 12.3, -1.4], "size": [1, 4, 3], "uv": [13, 13]}, + {"origin": [-2.8, 12.3, -1.4], "size": [1, 4, 3], "uv": [0, 13]}, + {"origin": [-2.9, 8.3, -7.3], "size": [2, 13, 1], "uv": [31, 0]}, + {"origin": [-5.9, 9.3, -7.3], "size": [2, 11, 1], "pivot": [-4.9, 22.8, -6.8], "rotation": [0, 45, 0], "uv": [55, 53]}, + {"origin": [1.1, 8.3, -7.3], "size": [2, 13, 1], "uv": [31, 14]}, + {"origin": [4.1, 9.3, -7.3], "size": [2, 11, 1], "pivot": [5.1, 22.8, -6.8], "rotation": [0, -45, 0], "uv": [23, 12]}, + {"origin": [-5.9, 18.3, -7.6], "size": [12, 1, 1], "uv": [0, 33]}, + {"origin": [-5.9, 10.3, -7.6], "size": [12, 1, 1], "uv": [0, 26]}, + {"origin": [-1.4, 13.5, -12.4], "size": [3, 1, 38], "uv": [0, 0]}, + {"origin": [0.7, 12.4, 17.6], "size": [1, 2, 10], "uv": [33, 53]}, + {"origin": [-1.9, 13.4, 26.1], "size": [4, 2, 1], "uv": [0, 8]}, + {"origin": [-1.5, 12.4, 17.6], "size": [1, 2, 10], "uv": [0, 52]}, + {"origin": [0.8, 14, -12.5], "size": [1, 1, 31], "uv": [33, 40]}, + {"origin": [0.8, 14, 18.5], "size": [1, 1, 8], "uv": [46, 40]}, + {"origin": [-1.6, 14, 18.5], "size": [1, 1, 8], "uv": [13, 39]}, + {"origin": [-1.6, 14, -12.5], "size": [1, 1, 31], "uv": [0, 39]} + ] + }, + { + "name": "ArcDroit", + "parent": "Balliste", + "pivot": [-1.07597, 23.3, -6.48107], + "cubes": [ + {"origin": [-11.1, 14, -5.9], "size": [10, 2, 1], "pivot": [-5.1, 23, -6.4], "rotation": [0, 20, 0], "uv": [0, 35]}, + {"origin": [-19.07597, 14.5, -0.78107], "size": [10, 1, 1], "pivot": [-14.07597, 23, -0.28107], "rotation": [0, 40, 0], "uv": [44, 35]} + ] + }, + { + "name": "ArcGauche", + "parent": "Balliste", + "pivot": [1.07597, 23.3, -6.48107], + "cubes": [ + {"origin": [1.1, 14, -5.9], "size": [10, 2, 1], "pivot": [5.1, 23, -6.4], "rotation": [0, -20, 0], "uv": [44, 32]}, + {"origin": [9.07597, 14.5, -0.78107], "size": [10, 1, 1], "pivot": [14.07597, 23, -0.28107], "rotation": [0, -40, 0], "uv": [0, 64]} + ] + }, + { + "name": "Manivelles", + "parent": "Balliste", + "pivot": [0.14545, 13.9, 24.6], + "cubes": [ + {"origin": [-2.9, 13.4, 24.1], "size": [6, 1, 1], "uv": [13, 8]}, + {"origin": [-3.7, 13.4, 36.1], "size": [1, 4, 1], "pivot": [-3.2, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [0, 39]}, + {"origin": [-4.1, 12.9, 23.6], "size": [1, 2, 2], "uv": [21, 0]}, + {"origin": [-3.7, 14.4, 24.1], "size": [1, 4, 1], "uv": [17, 39]}, + {"origin": [-3.7, 9.4, 24.1], "size": [1, 4, 1], "uv": [13, 39]}, + {"origin": [-3.7, 18.4, 36.1], "size": [1, 4, 1], "pivot": [-3.2, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [4, 39]}, + {"origin": [3, 13.4, 36.1], "size": [1, 4, 1], "pivot": [3.5, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [30, 33]}, + {"origin": [3.4, 12.9, 23.6], "size": [1, 2, 2], "uv": [13, 20]}, + {"origin": [3, 18.4, 36.1], "size": [1, 4, 1], "pivot": [3.5, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [34, 33]}, + {"origin": [3, 9.4, 24.1], "size": [1, 4, 1], "uv": [0, 0]}, + {"origin": [3, 14.4, 24.1], "size": [1, 4, 1], "uv": [26, 33]} + ] + }, + { + "name": "CordeGuide", + "parent": "Balliste", + "pivot": [0, 0, 5.2], + "cubes": [ + {"origin": [0.07, 14, 5.2], "size": [0.03, 1, 21], "uv": [44, 5]} + ] + }, + { + "name": "Guide", + "parent": "Balliste", + "pivot": [0, 0, -3], + "cubes": [ + {"origin": [-0.9, 14.4, 3.4], "size": [2, 1, 3], "uv": [0, 20]} + ] + }, + { + "name": "CordeDroite", + "parent": "Balliste", + "pivot": [-17.5, 23, 3.3], + "cubes": [ + {"origin": [-17.5848, 14.5, 3.31489], "size": [18, 1, 0.03], "uv": [0, 32]} + ] + }, + { + "name": "CordeGauche", + "parent": "Balliste", + "pivot": [17.6, 22.5, 3.3], + "cubes": [ + {"origin": [-0.4152, 14.5, 3.31489], "size": [18, 1, 0.03], "uv": [0, 31]} + ] + }, + { + "name": "BallistaArrow", + "pivot": [0, 20, 0], + "cubes": [ + {"origin": [-31.4, 15.5, 22.2], "size": [34, 5, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, -45], "uv": [0, 72]}, + {"origin": [-31.4, 15.5, 12.2], "size": [34, 5, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, 45], "uv": [0, 72]}, + {"origin": [-34.4, 16, 12.2], "size": [4, 4, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, 45], "uv": [76, 72]}, + {"origin": [-34.4, 16, 22.2], "size": [4, 4, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, -45], "uv": [68, 72]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/ballista_item.geo.json b/src/main/resources/assets/siegemachines/geo/ballista_item.geo.json new file mode 100644 index 0000000..a1b8814 --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/ballista_item.geo.json @@ -0,0 +1,139 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 128, + "texture_height": 128, + "visible_bounds_width": 5, + "visible_bounds_height": 4, + "visible_bounds_offset": [0, 1, 0] + }, + "bones": [ + { + "name": "bb_main", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [0, 3, 30], "size": [0, 0, 1], "uv": [0, 0]} + ] + }, + { + "name": "Structure", + "pivot": [0, 4.18198, -8.1], + "cubes": [ + {"origin": [-1.5, 0, -1.4], "size": [3, 20, 3], "uv": [44, 0]}, + {"origin": [-8.90381, 1.28198, -4.4], "size": [1, 2, 11], "pivot": [-7.40381, 4.28198, -0.9], "rotation": [0, 90, -45], "uv": [0, 0]}, + {"origin": [-0.5, -0.81802, 0.83223], "size": [1, 2, 11], "pivot": [-4, 4.18198, 10.33223], "rotation": [-45, 0, 0], "uv": [0, 39]}, + {"origin": [-1.5, -1, -11.9], "size": [3, 2, 24], "uv": [44, 0]}, + {"origin": [7.90381, 1.28198, -4.4], "size": [1, 2, 11], "pivot": [7.40381, 4.28198, -0.9], "rotation": [0, -90, 45], "uv": [33, 40]}, + {"origin": [-12, -0.9, -1.4], "size": [24, 2, 3], "uv": [44, 27]}, + {"origin": [-0.5, 6.41726, -8.63528], "size": [1, 2, 11], "pivot": [0, 4.18198, 0.1], "rotation": [45, 0, 0], "uv": [0, 13]} + ] + }, + { + "name": "Balliste", + "pivot": [0, 20, 0], + "cubes": [ + {"origin": [-2.4, 20, -1.9], "size": [5, 1, 4], "uv": [12, 52]}, + {"origin": [-0.4, 19.8, -0.4], "size": [1, 2, 1], "uv": [0, 5]}, + {"origin": [2, 20.3, -1.4], "size": [1, 4, 3], "uv": [13, 13]}, + {"origin": [-2.8, 20.3, -1.4], "size": [1, 4, 3], "uv": [0, 13]}, + {"origin": [-2.9, 16.3, -7.3], "size": [2, 13, 1], "uv": [31, 0]}, + {"origin": [-5.9, 17.3, -7.3], "size": [2, 11, 1], "pivot": [-4.9, 22.8, -6.8], "rotation": [0, 45, 0], "uv": [55, 53]}, + {"origin": [1.1, 16.3, -7.3], "size": [2, 13, 1], "uv": [31, 14]}, + {"origin": [4.1, 17.3, -7.3], "size": [2, 11, 1], "pivot": [5.1, 22.8, -6.8], "rotation": [0, -45, 0], "uv": [23, 12]}, + {"origin": [-5.9, 26.3, -7.6], "size": [12, 1, 1], "uv": [0, 33]}, + {"origin": [-5.9, 18.3, -7.6], "size": [12, 1, 1], "uv": [0, 26]}, + {"origin": [-1.4, 21.5, -12.4], "size": [3, 1, 38], "uv": [0, 0]}, + {"origin": [0.7, 20.4, 17.6], "size": [1, 2, 10], "uv": [33, 53]}, + {"origin": [-1.9, 21.4, 26.1], "size": [4, 2, 1], "uv": [0, 8]}, + {"origin": [-1.5, 20.4, 17.6], "size": [1, 2, 10], "uv": [0, 52]}, + {"origin": [0.8, 22, -12.5], "size": [1, 1, 31], "uv": [33, 40]}, + {"origin": [0.8, 22, 18.5], "size": [1, 1, 8], "uv": [46, 40]}, + {"origin": [-1.6, 22, 18.5], "size": [1, 1, 8], "uv": [13, 39]}, + {"origin": [-1.6, 22, -12.5], "size": [1, 1, 31], "uv": [0, 39]} + ] + }, + { + "name": "ArcDroit", + "parent": "Balliste", + "pivot": [-1.07597, 23.3, -6.48107], + "cubes": [ + {"origin": [-11.1, 22, -5.9], "size": [10, 2, 1], "pivot": [-5.1, 23, -6.4], "rotation": [0, 20, 0], "uv": [0, 35]}, + {"origin": [-19.07597, 22.5, -0.78107], "size": [10, 1, 1], "pivot": [-14.07597, 23, -0.28107], "rotation": [0, 40, 0], "uv": [44, 35]} + ] + }, + { + "name": "ArcGauche", + "parent": "Balliste", + "pivot": [1.07597, 23.3, -6.48107], + "cubes": [ + {"origin": [1.1, 22, -5.9], "size": [10, 2, 1], "pivot": [5.1, 23, -6.4], "rotation": [0, -20, 0], "uv": [44, 32]}, + {"origin": [9.07597, 22.5, -0.78107], "size": [10, 1, 1], "pivot": [14.07597, 23, -0.28107], "rotation": [0, -40, 0], "uv": [0, 64]} + ] + }, + { + "name": "Manivelles", + "parent": "Balliste", + "pivot": [0.14545, 21.9, 24.6], + "cubes": [ + {"origin": [-2.9, 21.4, 24.1], "size": [6, 1, 1], "uv": [13, 8]}, + {"origin": [-3.7, 13.4, 28.1], "size": [1, 4, 1], "pivot": [-3.2, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [0, 39]}, + {"origin": [-4.1, 20.9, 23.6], "size": [1, 2, 2], "uv": [21, 0]}, + {"origin": [-3.7, 22.4, 24.1], "size": [1, 4, 1], "uv": [17, 39]}, + {"origin": [-3.7, 17.4, 24.1], "size": [1, 4, 1], "uv": [13, 39]}, + {"origin": [-3.7, 18.4, 28.1], "size": [1, 4, 1], "pivot": [-3.2, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [4, 39]}, + {"origin": [3, 13.4, 28.1], "size": [1, 4, 1], "pivot": [3.5, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [30, 33]}, + {"origin": [3.4, 20.9, 23.6], "size": [1, 2, 2], "uv": [13, 20]}, + {"origin": [3, 18.4, 28.1], "size": [1, 4, 1], "pivot": [3.5, 21.9, 28.6], "rotation": [-90, 0, 0], "uv": [34, 33]}, + {"origin": [3, 17.4, 24.1], "size": [1, 4, 1], "uv": [0, 0]}, + {"origin": [3, 22.4, 24.1], "size": [1, 4, 1], "uv": [26, 33]} + ] + }, + { + "name": "CordeGuide", + "parent": "Balliste", + "pivot": [0, 0, 5.2], + "cubes": [ + {"origin": [0.07, 22, 5.2], "size": [0.03, 1, 21], "uv": [44, 5]} + ] + }, + { + "name": "Guide", + "parent": "Balliste", + "pivot": [0, 0, -3], + "cubes": [ + {"origin": [-0.9, 22.4, 3.4], "size": [2, 1, 3], "uv": [0, 20]} + ] + }, + { + "name": "CordeDroite", + "parent": "Balliste", + "pivot": [-17.5, 23, 3.3], + "cubes": [ + {"origin": [-17.5848, 22.5, 3.31489], "size": [18, 1, 0.03], "uv": [0, 32]} + ] + }, + { + "name": "CordeGauche", + "parent": "Balliste", + "pivot": [17.6, 22.5, 3.3], + "cubes": [ + {"origin": [-0.4152, 22.5, 3.31489], "size": [18, 1, 0.03], "uv": [0, 31]} + ] + }, + { + "name": "BallistaArrow", + "pivot": [0, 20, 0], + "cubes": [ + {"origin": [-31.4, 20.5, 17.2], "size": [34, 5, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, -45], "uv": [0, 72]}, + {"origin": [-31.4, 20.5, 17.2], "size": [34, 5, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, 45], "uv": [0, 72]}, + {"origin": [-34.4, 21, 17.2], "size": [4, 4, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, 45], "uv": [76, 72]}, + {"origin": [-34.4, 21, 17.2], "size": [4, 4, 0.03], "pivot": [0.1, 23, 17.2], "rotation": [0, -90, -45], "uv": [68, 72]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/battering_ram.geo.json b/src/main/resources/assets/siegemachines/geo/battering_ram.geo.json new file mode 100644 index 0000000..e5e483a --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/battering_ram.geo.json @@ -0,0 +1,294 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 512, + "texture_height": 512, + "visible_bounds_width": 7, + "visible_bounds_height": 4.5, + "visible_bounds_offset": [0, 1.75, 0] + }, + "bones": [ + { + "name": "Structure", + "pivot": [-0.51631, 26.92321, 0.01667], + "cubes": [ + {"origin": [-24.5, 5.5, -37.4], "size": [2, 2, 2], "uv": [44, 112]}, + {"origin": [21.5, 5.5, -37.4], "size": [2, 2, 2], "uv": [152, 0]}, + {"origin": [21.5, 5.5, -1], "size": [2, 2, 2], "uv": [40, 149]}, + {"origin": [21.5, 5.5, 35.6], "size": [2, 2, 2], "uv": [59, 112]}, + {"origin": [-24.5, 5.5, -1], "size": [2, 2, 2], "uv": [32, 112]}, + {"origin": [-24.5, 5.5, 35.6], "size": [2, 2, 2], "uv": [20, 112]}, + {"origin": [17, 4, -40], "size": [4, 5, 80], "uv": [168, 256]}, + {"origin": [-18, 4.5, -1.5], "size": [35, 4, 3], "uv": [0, 41]}, + {"origin": [-18, 4.6, -38], "size": [35, 4, 3], "uv": [0, 27]}, + {"origin": [-18, 4.5, 35], "size": [35, 4, 3], "uv": [0, 34]}, + {"origin": [-18, 32.5, 33], "size": [35, 4, 5], "uv": [0, 18]}, + {"origin": [-18, 32.5, -38], "size": [35, 4, 5], "uv": [0, 9]}, + {"origin": [-18, 32.5, -2.5], "size": [35, 4, 5], "uv": [0, 0]}, + {"origin": [-28.5, 46.5, -1], "size": [32, 4, 2], "pivot": [-1, 38.5, 0], "rotation": [0, 0, -30], "uv": [0, 106]}, + {"origin": [-4.5, 46.5, -1], "size": [32, 4, 2], "pivot": [0, 38.5, 0], "rotation": [0, 0, 30], "uv": [0, 100]}, + {"origin": [-4.5, 46.5, -36.5], "size": [32, 4, 2], "pivot": [0, 38.5, -35.5], "rotation": [0, 0, 30], "uv": [0, 88]}, + {"origin": [-28.5, 46.5, -36.5], "size": [32, 4, 2], "pivot": [-1, 38.5, -35.5], "rotation": [0, 0, -30], "uv": [0, 94]}, + {"origin": [-4.5, 46.5, 34.5], "size": [32, 4, 2], "pivot": [0, 38.5, 35.5], "rotation": [0, 0, 30], "uv": [0, 72]}, + {"origin": [-28.5, 46.5, 34.5], "size": [32, 4, 2], "pivot": [-1, 38.5, 35.5], "rotation": [0, 0, -30], "uv": [0, 82]}, + {"origin": [-26.5, 49, -40.5], "size": [30, 1, 81], "pivot": [-1, 38.5, 35.5], "rotation": [0, 0, -30], "uv": [0, 82]}, + {"origin": [-4.5, 49, -40.5], "size": [30, 1, 81], "pivot": [0, 38.5, 35.5], "rotation": [0, 0, 30], "uv": [0, 0]}, + {"origin": [-4.5, 46.5, 17], "size": [32, 4, 2], "pivot": [0, 38.5, 18], "rotation": [0, 0, 30], "uv": [0, 60]}, + {"origin": [-28.5, 46.5, 17], "size": [32, 4, 2], "pivot": [-1, 38.5, 18], "rotation": [0, 0, -30], "uv": [0, 66]}, + {"origin": [-4.5, 46.5, -19], "size": [32, 4, 2], "pivot": [0, 38.5, -18], "rotation": [0, 0, 30], "uv": [0, 48]}, + {"origin": [-28.5, 46.5, -19], "size": [32, 4, 2], "pivot": [-1, 38.5, -18], "rotation": [0, 0, -30], "uv": [0, 54]}, + {"origin": [17, 32, -40], "size": [4, 5, 80], "uv": [236, 0]}, + {"origin": [-22, 32, -40], "size": [4, 5, 80], "uv": [172, 171]}, + {"origin": [-2.5, 47, -41], "size": [4, 7, 82], "uv": [0, 164]}, + {"origin": [-2.5, 36, -37.5], "size": [4, 11, 4], "uv": [157, 35]}, + {"origin": [-2.5, 36, 33.5], "size": [4, 11, 4], "uv": [157, 20]}, + {"origin": [-2.5, 36, -2], "size": [4, 11, 4], "uv": [62, 147]}, + {"origin": [-22, 4, -40], "size": [4, 5, 80], "uv": [0, 253]}, + {"origin": [-21.5, 9, 34], "size": [3, 23, 5], "uv": [141, 110]}, + {"origin": [17.5, 9, 34], "size": [3, 23, 5], "uv": [141, 82]}, + {"origin": [18, 9.7868, 11.95837], "size": [2, 33, 4], "pivot": [1, 10.7868, 9.95837], "rotation": [-45, 0, 0], "uv": [36, 112]}, + {"origin": [-21, 9.7868, 11.95837], "size": [2, 33, 4], "pivot": [1, 10.7868, 9.95837], "rotation": [-45, 0, 0], "uv": [24, 112]}, + {"origin": [18, -4.94975, -35.43554], "size": [2, 33, 4], "pivot": [1.5, 27.05025, -37.43554], "rotation": [45, 0, 0], "uv": [0, 112]}, + {"origin": [-21, -4.94975, -35.43554], "size": [2, 33, 4], "pivot": [1.5, 27.05025, -37.43554], "rotation": [45, 0, 0], "uv": [68, 82]}, + {"origin": [17.5, 9, -2.5], "size": [3, 23, 5], "uv": [141, 0]}, + {"origin": [-21.5, 9, -2.5], "size": [3, 23, 5], "uv": [141, 28]}, + {"origin": [17.5, 9, -38.9], "size": [3, 23, 5], "uv": [48, 112]}, + {"origin": [-21.5, 9, -38.9], "size": [3, 23, 5], "uv": [64, 119]}, + {"origin": [-23.5, 21, -36.5], "size": [3, 13, 2], "pivot": [-17, 20.5, -35.5], "rotation": [0, 0, 45], "uv": [20, 164]}, + {"origin": [-23.5, 21, -1], "size": [3, 13, 2], "pivot": [-17, 20.5, -35.5], "rotation": [0, 0, 45], "uv": [10, 164]}, + {"origin": [-23.5, 21, 34.5], "size": [3, 13, 2], "pivot": [-17, 20.5, -35.5], "rotation": [0, 0, 45], "uv": [0, 164]}, + {"origin": [38.8, -13.9, 34.5], "size": [3, 13, 2], "pivot": [-17, -20.4, -35.5], "rotation": [0, 0, -45], "uv": [68, 48]}, + {"origin": [38.8, -13.9, -1], "size": [3, 13, 2], "pivot": [-17, -20.4, -35.5], "rotation": [0, 0, -45], "uv": [68, 48]}, + {"origin": [38.8, -13.9, -36.5], "size": [3, 13, 2], "pivot": [-17, -20.4, -35.5], "rotation": [0, 0, -45], "uv": [68, 63]} + ] + }, + { + "name": "Ram", + "pivot": [-0.47327, 15.57665, -1.94129], + "cubes": [ + {"origin": [-4, 12.2, -48], "size": [7, 7, 85], "uv": [137, 79]}, + {"origin": [-4.5, 11.7, -34.5], "size": [8, 8, 2], "uv": [157, 92]}, + {"origin": [-4.5, 11.7, -47], "size": [8, 8, 2], "uv": [0, 149]}, + {"origin": [-4.5, 11.7, 3.5], "size": [8, 8, 2], "uv": [157, 82]}, + {"origin": [-4.5, 11.7, -16.5], "size": [8, 8, 2], "uv": [20, 149]}, + {"origin": [-4.5, 11.7, 20.5], "size": [8, 8, 2], "uv": [155, 153]}, + {"origin": [-4.5, 11.7, 32], "size": [8, 8, 2], "uv": [155, 71]}, + {"origin": [-5.75, 16.85, 21], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, 21.5], "rotation": [0, 0, -22.5], "uv": [6, 78]}, + {"origin": [-6.27846, 13.0441, 20.999], "size": [1, 5, 1], "uv": [64, 116]}, + {"origin": [-5.20971, 13.17119, 21], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, 21.5], "rotation": [0, 0, 22.5], "uv": [12, 78]}, + {"origin": [-5.20971, 13.17119, 4], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, 4.5], "rotation": [0, 0, 22.5], "uv": [54, 78]}, + {"origin": [-6.27846, 13.0441, 3.999], "size": [1, 5, 1], "uv": [171, 124]}, + {"origin": [-5.75, 16.85, 4], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, 4.5], "rotation": [0, 0, -22.5], "uv": [60, 78]}, + {"origin": [-5.75, 16.85, -16], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, -15.5], "rotation": [0, 0, -22.5], "uv": [48, 78]}, + {"origin": [-6.37846, 13.0441, -16.001], "size": [1, 5, 1], "uv": [164, 132]}, + {"origin": [-5.20971, 13.17119, -16], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, -15.5], "rotation": [0, 0, 22.5], "uv": [42, 78]}, + {"origin": [-5.75, 16.85, -34], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, -33.5], "rotation": [0, 0, -22.5], "uv": [66, 78]}, + {"origin": [-6.37846, 13.0441, -34.001], "size": [1, 5, 1], "uv": [179, 26]}, + {"origin": [-5.20971, 13.17119, -34], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, -33.5], "rotation": [0, 0, 22.5], "uv": [72, 78]}, + {"origin": [2.2, 12.9, -34], "size": [2, 1, 1], "pivot": [4, 14.5, -33.5], "rotation": [0, 0, -22.5], "uv": [28, 159]}, + {"origin": [4.43126, 13.04405, -34.001], "size": [1, 5, 1], "uv": [179, 32]}, + {"origin": [1.45, 17, -34], "size": [2, 1, 1], "pivot": [4, 14.5, -33.5], "rotation": [0, 0, 22.5], "uv": [22, 159]}, + {"origin": [1.45, 17, -16], "size": [2, 1, 1], "pivot": [4, 14.5, -15.5], "rotation": [0, 0, 22.5], "uv": [36, 78]}, + {"origin": [4.43126, 13.04405, -16.001], "size": [1, 5, 1], "uv": [164, 50]}, + {"origin": [2.2, 12.9, -16], "size": [2, 1, 1], "pivot": [4, 14.5, -15.5], "rotation": [0, 0, -22.5], "uv": [30, 78]}, + {"origin": [1.45, 17, 4], "size": [2, 1, 1], "pivot": [4, 14.5, 4.5], "rotation": [0, 0, 22.5], "uv": [152, 82]}, + {"origin": [4.43126, 13.04405, 4.001], "size": [1, 5, 1], "uv": [30, 179]}, + {"origin": [2.2, 12.9, 4], "size": [2, 1, 1], "pivot": [4, 14.5, 4.5], "rotation": [0, 0, -22.5], "uv": [66, 82]}, + {"origin": [1.45, 17, 21], "size": [2, 1, 1], "pivot": [4, 14.5, 21.5], "rotation": [0, 0, 22.5], "uv": [18, 78]}, + {"origin": [4.43126, 13.04405, 21.001], "size": [1, 5, 1], "uv": [44, 153]}, + {"origin": [2.2, 12.9, 21], "size": [2, 1, 1], "pivot": [4, 14.5, 21.5], "rotation": [0, 0, -22.5], "uv": [24, 78]}, + {"origin": [-1, 16.7, 37], "size": [1, 2, 1], "uv": [48, 140]}, + {"origin": [-1, 13.7, 38], "size": [1, 4, 1], "uv": [0, 0]}, + {"origin": [-1, 12.7, 37], "size": [1, 2, 1], "uv": [141, 0]} + ] + }, + { + "name": "RamHead", + "parent": "Ram", + "pivot": [-0.5, 15.7, -48.5], + "cubes": [ + {"origin": [-3.5, 12.7, -49], "size": [6, 6, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [169, 132]}, + {"origin": [-3, 13.2, -50], "size": [5, 5, 2], "uv": [167, 102]}, + {"origin": [-2.5, 14.6, -53], "size": [4, 4, 5], "uv": [157, 115]}, + {"origin": [-3, 14.7, -57], "size": [5, 5, 4], "uv": [153, 106]}, + {"origin": [-2, 11.68577, -56.55346], "size": [3, 4, 4], "pivot": [-2, 14.18577, -54.55346], "rotation": [25, 0, 0], "uv": [157, 124]}, + {"origin": [-3.5, 17.9802, -56.97694], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [0, 0, 0], "uv": [18, 159]}, + {"origin": [-3.8, 25.75482, -53.19506], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [40, 0, 0], "uv": [12, 159]}, + {"origin": [-4.3, 27.90091, -46.10157], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [80, 0, 0], "uv": [6, 159]}, + {"origin": [-4.5, 23.04473, -52.89218], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [32.5, 0, 0], "uv": [0, 159]}, + {"origin": [-4.7, 8.59591, -48.77453], "size": [1, 2, 1], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-51, 0, 0], "uv": [0, 112]}, + {"origin": [-4.5, 7.79591, -49.17453], "size": [1, 2, 1], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-51, 0, 0], "uv": [76, 82]}, + {"origin": [-4.7, 15.75231, -54.13208], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-9.5, 0, 0], "uv": [147, 158]}, + {"origin": [-4.6, 11.41741, -52.67737], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-29.5, 0, 0], "uv": [141, 158]}, + {"origin": [2.5, 14.07813, -55.42837], "size": [1, 2, 1], "pivot": [3.15, 15.47813, -54.17837], "rotation": [-51, 0, 0], "uv": [0, 18]}, + {"origin": [2.7, 14.87813, -55.02837], "size": [1, 2, 1], "pivot": [3.15, 15.47813, -54.17837], "rotation": [-51, 0, 0], "uv": [0, 9]}, + {"origin": [2.6, 15.71199, -54.1665], "size": [1, 2, 2], "pivot": [3.2, 18.21199, -53.3665], "rotation": [-29.5, 0, 0], "uv": [157, 102]}, + {"origin": [2.7, 17.24779, -54.19734], "size": [1, 2, 2], "pivot": [3, 19.24779, -53.49734], "rotation": [-9.5, 0, 0], "uv": [57, 140]}, + {"origin": [2.5, 17.4864, -53.10952], "size": [1, 2, 2], "pivot": [3, 16.4864, -54.10952], "rotation": [32.5, 0, 0], "uv": [75, 119]}, + {"origin": [2.3, 19.08734, -55.33398], "size": [1, 2, 2], "pivot": [2.9, 19.98734, -54.33398], "rotation": [80, 0, 0], "uv": [75, 18]}, + {"origin": [1.8, 18.79545, -54.33116], "size": [1, 2, 2], "pivot": [2.78333, 16.97378, -54.59438], "rotation": [40, 0, 0], "uv": [75, 9]}, + {"origin": [1.5, 17.9802, -56.97694], "size": [1, 2, 2], "pivot": [2.78333, 16.97378, -54.59438], "rotation": [0, 0, 0], "uv": [75, 0]}, + {"origin": [-3.2, 14.4, -50], "size": [4, 4, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [141, 76]}, + {"origin": [-1.5, 14, -53], "size": [2, 1, 5], "pivot": [-0.5, 15.1, -50.5], "rotation": [-22.5, 0, 0], "uv": [35, 155]}, + {"origin": [-2.9, 15.1, -51], "size": [3, 3, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [8, 112]}, + {"origin": [-2.7, 15.9, -52], "size": [2, 2, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [0, 78]} + ] + }, + { + "name": "FirstDuoRopes", + "pivot": [-0.4, 34, -35] + }, + { + "name": "Rope1", + "parent": "FirstDuoRopes", + "pivot": [-12.05025, 22.62132, -1], + "cubes": [ + {"origin": [-6.61724, 17.23735, -35.3], "size": [1, 17, 0], "pivot": [-6.11724, 26.23735, -35.3], "rotation": [0, 0, -22.5], "uv": [76, 27]} + ] + }, + { + "name": "Rope4", + "parent": "FirstDuoRopes", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [4.70405, 17.41619, -35.5], "size": [1, 16, 0], "pivot": [5.20405, 25.41619, -35.5], "rotation": [0, 0, 22.5], "uv": [78, 61]} + ] + }, + { + "name": "SecondDuoRopes", + "pivot": [-0.4, 34, 0] + }, + { + "name": "Rope2", + "parent": "SecondDuoRopes", + "pivot": [-12.05025, 22.62132, -1], + "cubes": [ + {"origin": [-6.61724, 17.23735, 0.2], "size": [1, 17, 0], "pivot": [-6.11724, 26.23735, 0.2], "rotation": [0, 0, -22.5], "uv": [78, 27]} + ] + }, + { + "name": "Rope5", + "parent": "SecondDuoRopes", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [4.70405, 17.41619, -0.2], "size": [1, 16, 0], "pivot": [5.20405, 25.41619, -0.2], "rotation": [0, 0, 22.5], "uv": [78, 147]} + ] + }, + { + "name": "ThirdDuoRopes", + "pivot": [-0.4, 34, 35] + }, + { + "name": "Rope3", + "parent": "ThirdDuoRopes", + "pivot": [-7.05025, 25.62132, 70], + "rotation": [0, 0, 40], + "cubes": [ + {"origin": [-0.44646, 20.25331, 35.5], "size": [1, 17, 0], "pivot": [-0.41995, 22.40128, -44.46597], "rotation": [0, 0, -60], "uv": [78, 44]} + ] + }, + { + "name": "Rope6", + "parent": "ThirdDuoRopes", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [4.87033, 17.90959, 35.3], "size": [1, 16, 0], "pivot": [5.37033, 25.90959, 35.3], "rotation": [0, 0, 22.5], "uv": [78, 164]} + ] + }, + { + "name": "Wheel1", + "pivot": [22, 6.5, 36.6], + "cubes": [ + {"origin": [21, 4, 29.1], "size": [2, 5, 1], "uv": [169, 65]}, + {"origin": [21, 2, 30.1], "size": [2, 9, 1], "uv": [171, 109]}, + {"origin": [21, 1, 31.1], "size": [2, 11, 1], "uv": [130, 164]}, + {"origin": [21, 0, 32.1], "size": [2, 13, 2], "uv": [30, 164]}, + {"origin": [21, -1, 34.1], "size": [2, 15, 5], "uv": [48, 140]}, + {"origin": [21, 0, 39.1], "size": [2, 13, 2], "uv": [38, 164]}, + {"origin": [21, 1, 41.1], "size": [2, 11, 1], "uv": [169, 139]}, + {"origin": [21, 2, 42.1], "size": [2, 9, 1], "uv": [173, 36]}, + {"origin": [21, 4, 43.1], "size": [2, 5, 1], "uv": [175, 75]} + ] + }, + { + "name": "Wheel2", + "pivot": [22, 6.5, 0], + "cubes": [ + {"origin": [21, 4, -7.5], "size": [2, 5, 1], "uv": [177, 56]}, + {"origin": [21, 2, -6.5], "size": [2, 9, 1], "uv": [175, 65]}, + {"origin": [21, 1, -5.5], "size": [2, 11, 1], "uv": [171, 0]}, + {"origin": [21, 0, -4.5], "size": [2, 13, 2], "uv": [46, 164]}, + {"origin": [21, -1, -2.5], "size": [2, 15, 5], "uv": [141, 56]}, + {"origin": [21, 0, 2.5], "size": [2, 13, 2], "uv": [54, 164]}, + {"origin": [21, 1, 4.5], "size": [2, 11, 1], "uv": [171, 12]}, + {"origin": [21, 2, 5.5], "size": [2, 9, 1], "uv": [175, 119]}, + {"origin": [21, 4, 6.5], "size": [2, 5, 1], "uv": [177, 109]} + ] + }, + { + "name": "Wheel3", + "pivot": [22, 6.5, -36.4], + "cubes": [ + {"origin": [21, 4, -29.9], "size": [2, 5, 1], "uv": [178, 171]}, + {"origin": [21, 2, -30.9], "size": [2, 9, 1], "uv": [175, 139]}, + {"origin": [21, 1, -31.9], "size": [2, 11, 1], "uv": [136, 171]}, + {"origin": [21, 0, -33.9], "size": [2, 13, 2], "uv": [62, 164]}, + {"origin": [21, -1, -38.9], "size": [2, 15, 5], "uv": [141, 138]}, + {"origin": [21, 0, -40.9], "size": [2, 13, 2], "uv": [70, 164]}, + {"origin": [21, 1, -41.9], "size": [2, 11, 1], "uv": [142, 171]}, + {"origin": [21, 2, -42.9], "size": [2, 9, 1], "uv": [175, 149]}, + {"origin": [21, 4, -43.9], "size": [2, 5, 1], "uv": [178, 177]} + ] + }, + { + "name": "Wheel4", + "pivot": [-23, 6.5, 36.6], + "cubes": [ + {"origin": [-24, 1, 41.1], "size": [2, 11, 1], "uv": [154, 171]}, + {"origin": [-24, 2, 42.1], "size": [2, 9, 1], "uv": [177, 0]}, + {"origin": [-24, 0, 39.1], "size": [2, 13, 2], "uv": [98, 164]}, + {"origin": [-24, -1, 34.1], "size": [2, 15, 5], "uv": [155, 51]}, + {"origin": [-24, 0, 32.1], "size": [2, 13, 2], "uv": [90, 164]}, + {"origin": [-24, 1, 31.1], "size": [2, 11, 1], "uv": [148, 171]}, + {"origin": [-24, 2, 30.1], "size": [2, 9, 1], "uv": [130, 176]}, + {"origin": [-24, 4, 29.1], "size": [2, 5, 1], "uv": [0, 179]}, + {"origin": [-24, 4, 43.1], "size": [2, 5, 1], "uv": [6, 179]} + ] + }, + { + "name": "Wheel5", + "pivot": [-23, 6.5, 0], + "cubes": [ + {"origin": [-24, 4, 6.5], "size": [2, 5, 1], "uv": [24, 179]}, + {"origin": [-24, 1, 4.5], "size": [2, 11, 1], "uv": [173, 24]}, + {"origin": [-24, 2, 5.5], "size": [2, 9, 1], "uv": [177, 82]}, + {"origin": [-24, 0, 2.5], "size": [2, 13, 2], "uv": [122, 164]}, + {"origin": [-24, -1, -2.5], "size": [2, 15, 5], "uv": [157, 0]}, + {"origin": [-24, 0, -4.5], "size": [2, 13, 2], "uv": [169, 50]}, + {"origin": [-24, 1, -5.5], "size": [2, 11, 1], "uv": [172, 171]}, + {"origin": [-24, 2, -6.5], "size": [2, 9, 1], "uv": [177, 92]}, + {"origin": [-24, 4, -7.5], "size": [2, 5, 1], "uv": [179, 20]} + ] + }, + { + "name": "Wheel6", + "pivot": [-23, 6.5, -36.4], + "cubes": [ + {"origin": [-24, 4, -29.9], "size": [2, 5, 1], "uv": [18, 179]}, + {"origin": [-24, 2, -30.9], "size": [2, 9, 1], "uv": [177, 46]}, + {"origin": [-24, 1, -31.9], "size": [2, 11, 1], "uv": [166, 171]}, + {"origin": [-24, 0, -33.9], "size": [2, 13, 2], "uv": [114, 164]}, + {"origin": [-24, -1, -38.9], "size": [2, 15, 5], "uv": [155, 133]}, + {"origin": [-24, 0, -40.9], "size": [2, 13, 2], "uv": [106, 164]}, + {"origin": [-24, 1, -41.9], "size": [2, 11, 1], "uv": [160, 171]}, + {"origin": [-24, 2, -42.9], "size": [2, 9, 1], "uv": [177, 10]}, + {"origin": [-24, 4, -43.9], "size": [2, 5, 1], "uv": [12, 179]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/battering_ram_item.geo.json b/src/main/resources/assets/siegemachines/geo/battering_ram_item.geo.json new file mode 100644 index 0000000..e5e483a --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/battering_ram_item.geo.json @@ -0,0 +1,294 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 512, + "texture_height": 512, + "visible_bounds_width": 7, + "visible_bounds_height": 4.5, + "visible_bounds_offset": [0, 1.75, 0] + }, + "bones": [ + { + "name": "Structure", + "pivot": [-0.51631, 26.92321, 0.01667], + "cubes": [ + {"origin": [-24.5, 5.5, -37.4], "size": [2, 2, 2], "uv": [44, 112]}, + {"origin": [21.5, 5.5, -37.4], "size": [2, 2, 2], "uv": [152, 0]}, + {"origin": [21.5, 5.5, -1], "size": [2, 2, 2], "uv": [40, 149]}, + {"origin": [21.5, 5.5, 35.6], "size": [2, 2, 2], "uv": [59, 112]}, + {"origin": [-24.5, 5.5, -1], "size": [2, 2, 2], "uv": [32, 112]}, + {"origin": [-24.5, 5.5, 35.6], "size": [2, 2, 2], "uv": [20, 112]}, + {"origin": [17, 4, -40], "size": [4, 5, 80], "uv": [168, 256]}, + {"origin": [-18, 4.5, -1.5], "size": [35, 4, 3], "uv": [0, 41]}, + {"origin": [-18, 4.6, -38], "size": [35, 4, 3], "uv": [0, 27]}, + {"origin": [-18, 4.5, 35], "size": [35, 4, 3], "uv": [0, 34]}, + {"origin": [-18, 32.5, 33], "size": [35, 4, 5], "uv": [0, 18]}, + {"origin": [-18, 32.5, -38], "size": [35, 4, 5], "uv": [0, 9]}, + {"origin": [-18, 32.5, -2.5], "size": [35, 4, 5], "uv": [0, 0]}, + {"origin": [-28.5, 46.5, -1], "size": [32, 4, 2], "pivot": [-1, 38.5, 0], "rotation": [0, 0, -30], "uv": [0, 106]}, + {"origin": [-4.5, 46.5, -1], "size": [32, 4, 2], "pivot": [0, 38.5, 0], "rotation": [0, 0, 30], "uv": [0, 100]}, + {"origin": [-4.5, 46.5, -36.5], "size": [32, 4, 2], "pivot": [0, 38.5, -35.5], "rotation": [0, 0, 30], "uv": [0, 88]}, + {"origin": [-28.5, 46.5, -36.5], "size": [32, 4, 2], "pivot": [-1, 38.5, -35.5], "rotation": [0, 0, -30], "uv": [0, 94]}, + {"origin": [-4.5, 46.5, 34.5], "size": [32, 4, 2], "pivot": [0, 38.5, 35.5], "rotation": [0, 0, 30], "uv": [0, 72]}, + {"origin": [-28.5, 46.5, 34.5], "size": [32, 4, 2], "pivot": [-1, 38.5, 35.5], "rotation": [0, 0, -30], "uv": [0, 82]}, + {"origin": [-26.5, 49, -40.5], "size": [30, 1, 81], "pivot": [-1, 38.5, 35.5], "rotation": [0, 0, -30], "uv": [0, 82]}, + {"origin": [-4.5, 49, -40.5], "size": [30, 1, 81], "pivot": [0, 38.5, 35.5], "rotation": [0, 0, 30], "uv": [0, 0]}, + {"origin": [-4.5, 46.5, 17], "size": [32, 4, 2], "pivot": [0, 38.5, 18], "rotation": [0, 0, 30], "uv": [0, 60]}, + {"origin": [-28.5, 46.5, 17], "size": [32, 4, 2], "pivot": [-1, 38.5, 18], "rotation": [0, 0, -30], "uv": [0, 66]}, + {"origin": [-4.5, 46.5, -19], "size": [32, 4, 2], "pivot": [0, 38.5, -18], "rotation": [0, 0, 30], "uv": [0, 48]}, + {"origin": [-28.5, 46.5, -19], "size": [32, 4, 2], "pivot": [-1, 38.5, -18], "rotation": [0, 0, -30], "uv": [0, 54]}, + {"origin": [17, 32, -40], "size": [4, 5, 80], "uv": [236, 0]}, + {"origin": [-22, 32, -40], "size": [4, 5, 80], "uv": [172, 171]}, + {"origin": [-2.5, 47, -41], "size": [4, 7, 82], "uv": [0, 164]}, + {"origin": [-2.5, 36, -37.5], "size": [4, 11, 4], "uv": [157, 35]}, + {"origin": [-2.5, 36, 33.5], "size": [4, 11, 4], "uv": [157, 20]}, + {"origin": [-2.5, 36, -2], "size": [4, 11, 4], "uv": [62, 147]}, + {"origin": [-22, 4, -40], "size": [4, 5, 80], "uv": [0, 253]}, + {"origin": [-21.5, 9, 34], "size": [3, 23, 5], "uv": [141, 110]}, + {"origin": [17.5, 9, 34], "size": [3, 23, 5], "uv": [141, 82]}, + {"origin": [18, 9.7868, 11.95837], "size": [2, 33, 4], "pivot": [1, 10.7868, 9.95837], "rotation": [-45, 0, 0], "uv": [36, 112]}, + {"origin": [-21, 9.7868, 11.95837], "size": [2, 33, 4], "pivot": [1, 10.7868, 9.95837], "rotation": [-45, 0, 0], "uv": [24, 112]}, + {"origin": [18, -4.94975, -35.43554], "size": [2, 33, 4], "pivot": [1.5, 27.05025, -37.43554], "rotation": [45, 0, 0], "uv": [0, 112]}, + {"origin": [-21, -4.94975, -35.43554], "size": [2, 33, 4], "pivot": [1.5, 27.05025, -37.43554], "rotation": [45, 0, 0], "uv": [68, 82]}, + {"origin": [17.5, 9, -2.5], "size": [3, 23, 5], "uv": [141, 0]}, + {"origin": [-21.5, 9, -2.5], "size": [3, 23, 5], "uv": [141, 28]}, + {"origin": [17.5, 9, -38.9], "size": [3, 23, 5], "uv": [48, 112]}, + {"origin": [-21.5, 9, -38.9], "size": [3, 23, 5], "uv": [64, 119]}, + {"origin": [-23.5, 21, -36.5], "size": [3, 13, 2], "pivot": [-17, 20.5, -35.5], "rotation": [0, 0, 45], "uv": [20, 164]}, + {"origin": [-23.5, 21, -1], "size": [3, 13, 2], "pivot": [-17, 20.5, -35.5], "rotation": [0, 0, 45], "uv": [10, 164]}, + {"origin": [-23.5, 21, 34.5], "size": [3, 13, 2], "pivot": [-17, 20.5, -35.5], "rotation": [0, 0, 45], "uv": [0, 164]}, + {"origin": [38.8, -13.9, 34.5], "size": [3, 13, 2], "pivot": [-17, -20.4, -35.5], "rotation": [0, 0, -45], "uv": [68, 48]}, + {"origin": [38.8, -13.9, -1], "size": [3, 13, 2], "pivot": [-17, -20.4, -35.5], "rotation": [0, 0, -45], "uv": [68, 48]}, + {"origin": [38.8, -13.9, -36.5], "size": [3, 13, 2], "pivot": [-17, -20.4, -35.5], "rotation": [0, 0, -45], "uv": [68, 63]} + ] + }, + { + "name": "Ram", + "pivot": [-0.47327, 15.57665, -1.94129], + "cubes": [ + {"origin": [-4, 12.2, -48], "size": [7, 7, 85], "uv": [137, 79]}, + {"origin": [-4.5, 11.7, -34.5], "size": [8, 8, 2], "uv": [157, 92]}, + {"origin": [-4.5, 11.7, -47], "size": [8, 8, 2], "uv": [0, 149]}, + {"origin": [-4.5, 11.7, 3.5], "size": [8, 8, 2], "uv": [157, 82]}, + {"origin": [-4.5, 11.7, -16.5], "size": [8, 8, 2], "uv": [20, 149]}, + {"origin": [-4.5, 11.7, 20.5], "size": [8, 8, 2], "uv": [155, 153]}, + {"origin": [-4.5, 11.7, 32], "size": [8, 8, 2], "uv": [155, 71]}, + {"origin": [-5.75, 16.85, 21], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, 21.5], "rotation": [0, 0, -22.5], "uv": [6, 78]}, + {"origin": [-6.27846, 13.0441, 20.999], "size": [1, 5, 1], "uv": [64, 116]}, + {"origin": [-5.20971, 13.17119, 21], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, 21.5], "rotation": [0, 0, 22.5], "uv": [12, 78]}, + {"origin": [-5.20971, 13.17119, 4], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, 4.5], "rotation": [0, 0, 22.5], "uv": [54, 78]}, + {"origin": [-6.27846, 13.0441, 3.999], "size": [1, 5, 1], "uv": [171, 124]}, + {"origin": [-5.75, 16.85, 4], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, 4.5], "rotation": [0, 0, -22.5], "uv": [60, 78]}, + {"origin": [-5.75, 16.85, -16], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, -15.5], "rotation": [0, 0, -22.5], "uv": [48, 78]}, + {"origin": [-6.37846, 13.0441, -16.001], "size": [1, 5, 1], "uv": [164, 132]}, + {"origin": [-5.20971, 13.17119, -16], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, -15.5], "rotation": [0, 0, 22.5], "uv": [42, 78]}, + {"origin": [-5.75, 16.85, -34], "size": [2, 1, 1], "pivot": [-5.89368, 17.83599, -33.5], "rotation": [0, 0, -22.5], "uv": [66, 78]}, + {"origin": [-6.37846, 13.0441, -34.001], "size": [1, 5, 1], "uv": [179, 26]}, + {"origin": [-5.20971, 13.17119, -34], "size": [2, 1, 1], "pivot": [-5.60971, 14.47119, -33.5], "rotation": [0, 0, 22.5], "uv": [72, 78]}, + {"origin": [2.2, 12.9, -34], "size": [2, 1, 1], "pivot": [4, 14.5, -33.5], "rotation": [0, 0, -22.5], "uv": [28, 159]}, + {"origin": [4.43126, 13.04405, -34.001], "size": [1, 5, 1], "uv": [179, 32]}, + {"origin": [1.45, 17, -34], "size": [2, 1, 1], "pivot": [4, 14.5, -33.5], "rotation": [0, 0, 22.5], "uv": [22, 159]}, + {"origin": [1.45, 17, -16], "size": [2, 1, 1], "pivot": [4, 14.5, -15.5], "rotation": [0, 0, 22.5], "uv": [36, 78]}, + {"origin": [4.43126, 13.04405, -16.001], "size": [1, 5, 1], "uv": [164, 50]}, + {"origin": [2.2, 12.9, -16], "size": [2, 1, 1], "pivot": [4, 14.5, -15.5], "rotation": [0, 0, -22.5], "uv": [30, 78]}, + {"origin": [1.45, 17, 4], "size": [2, 1, 1], "pivot": [4, 14.5, 4.5], "rotation": [0, 0, 22.5], "uv": [152, 82]}, + {"origin": [4.43126, 13.04405, 4.001], "size": [1, 5, 1], "uv": [30, 179]}, + {"origin": [2.2, 12.9, 4], "size": [2, 1, 1], "pivot": [4, 14.5, 4.5], "rotation": [0, 0, -22.5], "uv": [66, 82]}, + {"origin": [1.45, 17, 21], "size": [2, 1, 1], "pivot": [4, 14.5, 21.5], "rotation": [0, 0, 22.5], "uv": [18, 78]}, + {"origin": [4.43126, 13.04405, 21.001], "size": [1, 5, 1], "uv": [44, 153]}, + {"origin": [2.2, 12.9, 21], "size": [2, 1, 1], "pivot": [4, 14.5, 21.5], "rotation": [0, 0, -22.5], "uv": [24, 78]}, + {"origin": [-1, 16.7, 37], "size": [1, 2, 1], "uv": [48, 140]}, + {"origin": [-1, 13.7, 38], "size": [1, 4, 1], "uv": [0, 0]}, + {"origin": [-1, 12.7, 37], "size": [1, 2, 1], "uv": [141, 0]} + ] + }, + { + "name": "RamHead", + "parent": "Ram", + "pivot": [-0.5, 15.7, -48.5], + "cubes": [ + {"origin": [-3.5, 12.7, -49], "size": [6, 6, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [169, 132]}, + {"origin": [-3, 13.2, -50], "size": [5, 5, 2], "uv": [167, 102]}, + {"origin": [-2.5, 14.6, -53], "size": [4, 4, 5], "uv": [157, 115]}, + {"origin": [-3, 14.7, -57], "size": [5, 5, 4], "uv": [153, 106]}, + {"origin": [-2, 11.68577, -56.55346], "size": [3, 4, 4], "pivot": [-2, 14.18577, -54.55346], "rotation": [25, 0, 0], "uv": [157, 124]}, + {"origin": [-3.5, 17.9802, -56.97694], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [0, 0, 0], "uv": [18, 159]}, + {"origin": [-3.8, 25.75482, -53.19506], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [40, 0, 0], "uv": [12, 159]}, + {"origin": [-4.3, 27.90091, -46.10157], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [80, 0, 0], "uv": [6, 159]}, + {"origin": [-4.5, 23.04473, -52.89218], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [32.5, 0, 0], "uv": [0, 159]}, + {"origin": [-4.7, 8.59591, -48.77453], "size": [1, 2, 1], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-51, 0, 0], "uv": [0, 112]}, + {"origin": [-4.5, 7.79591, -49.17453], "size": [1, 2, 1], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-51, 0, 0], "uv": [76, 82]}, + {"origin": [-4.7, 15.75231, -54.13208], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-9.5, 0, 0], "uv": [147, 158]}, + {"origin": [-4.6, 11.41741, -52.67737], "size": [1, 2, 2], "pivot": [-4.04095, 18.89274, -44.46597], "rotation": [-29.5, 0, 0], "uv": [141, 158]}, + {"origin": [2.5, 14.07813, -55.42837], "size": [1, 2, 1], "pivot": [3.15, 15.47813, -54.17837], "rotation": [-51, 0, 0], "uv": [0, 18]}, + {"origin": [2.7, 14.87813, -55.02837], "size": [1, 2, 1], "pivot": [3.15, 15.47813, -54.17837], "rotation": [-51, 0, 0], "uv": [0, 9]}, + {"origin": [2.6, 15.71199, -54.1665], "size": [1, 2, 2], "pivot": [3.2, 18.21199, -53.3665], "rotation": [-29.5, 0, 0], "uv": [157, 102]}, + {"origin": [2.7, 17.24779, -54.19734], "size": [1, 2, 2], "pivot": [3, 19.24779, -53.49734], "rotation": [-9.5, 0, 0], "uv": [57, 140]}, + {"origin": [2.5, 17.4864, -53.10952], "size": [1, 2, 2], "pivot": [3, 16.4864, -54.10952], "rotation": [32.5, 0, 0], "uv": [75, 119]}, + {"origin": [2.3, 19.08734, -55.33398], "size": [1, 2, 2], "pivot": [2.9, 19.98734, -54.33398], "rotation": [80, 0, 0], "uv": [75, 18]}, + {"origin": [1.8, 18.79545, -54.33116], "size": [1, 2, 2], "pivot": [2.78333, 16.97378, -54.59438], "rotation": [40, 0, 0], "uv": [75, 9]}, + {"origin": [1.5, 17.9802, -56.97694], "size": [1, 2, 2], "pivot": [2.78333, 16.97378, -54.59438], "rotation": [0, 0, 0], "uv": [75, 0]}, + {"origin": [-3.2, 14.4, -50], "size": [4, 4, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [141, 76]}, + {"origin": [-1.5, 14, -53], "size": [2, 1, 5], "pivot": [-0.5, 15.1, -50.5], "rotation": [-22.5, 0, 0], "uv": [35, 155]}, + {"origin": [-2.9, 15.1, -51], "size": [3, 3, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [8, 112]}, + {"origin": [-2.7, 15.9, -52], "size": [2, 2, 1], "pivot": [-0.5, 15.7, -48.5], "rotation": [0, 0, 45], "uv": [0, 78]} + ] + }, + { + "name": "FirstDuoRopes", + "pivot": [-0.4, 34, -35] + }, + { + "name": "Rope1", + "parent": "FirstDuoRopes", + "pivot": [-12.05025, 22.62132, -1], + "cubes": [ + {"origin": [-6.61724, 17.23735, -35.3], "size": [1, 17, 0], "pivot": [-6.11724, 26.23735, -35.3], "rotation": [0, 0, -22.5], "uv": [76, 27]} + ] + }, + { + "name": "Rope4", + "parent": "FirstDuoRopes", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [4.70405, 17.41619, -35.5], "size": [1, 16, 0], "pivot": [5.20405, 25.41619, -35.5], "rotation": [0, 0, 22.5], "uv": [78, 61]} + ] + }, + { + "name": "SecondDuoRopes", + "pivot": [-0.4, 34, 0] + }, + { + "name": "Rope2", + "parent": "SecondDuoRopes", + "pivot": [-12.05025, 22.62132, -1], + "cubes": [ + {"origin": [-6.61724, 17.23735, 0.2], "size": [1, 17, 0], "pivot": [-6.11724, 26.23735, 0.2], "rotation": [0, 0, -22.5], "uv": [78, 27]} + ] + }, + { + "name": "Rope5", + "parent": "SecondDuoRopes", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [4.70405, 17.41619, -0.2], "size": [1, 16, 0], "pivot": [5.20405, 25.41619, -0.2], "rotation": [0, 0, 22.5], "uv": [78, 147]} + ] + }, + { + "name": "ThirdDuoRopes", + "pivot": [-0.4, 34, 35] + }, + { + "name": "Rope3", + "parent": "ThirdDuoRopes", + "pivot": [-7.05025, 25.62132, 70], + "rotation": [0, 0, 40], + "cubes": [ + {"origin": [-0.44646, 20.25331, 35.5], "size": [1, 17, 0], "pivot": [-0.41995, 22.40128, -44.46597], "rotation": [0, 0, -60], "uv": [78, 44]} + ] + }, + { + "name": "Rope6", + "parent": "ThirdDuoRopes", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [4.87033, 17.90959, 35.3], "size": [1, 16, 0], "pivot": [5.37033, 25.90959, 35.3], "rotation": [0, 0, 22.5], "uv": [78, 164]} + ] + }, + { + "name": "Wheel1", + "pivot": [22, 6.5, 36.6], + "cubes": [ + {"origin": [21, 4, 29.1], "size": [2, 5, 1], "uv": [169, 65]}, + {"origin": [21, 2, 30.1], "size": [2, 9, 1], "uv": [171, 109]}, + {"origin": [21, 1, 31.1], "size": [2, 11, 1], "uv": [130, 164]}, + {"origin": [21, 0, 32.1], "size": [2, 13, 2], "uv": [30, 164]}, + {"origin": [21, -1, 34.1], "size": [2, 15, 5], "uv": [48, 140]}, + {"origin": [21, 0, 39.1], "size": [2, 13, 2], "uv": [38, 164]}, + {"origin": [21, 1, 41.1], "size": [2, 11, 1], "uv": [169, 139]}, + {"origin": [21, 2, 42.1], "size": [2, 9, 1], "uv": [173, 36]}, + {"origin": [21, 4, 43.1], "size": [2, 5, 1], "uv": [175, 75]} + ] + }, + { + "name": "Wheel2", + "pivot": [22, 6.5, 0], + "cubes": [ + {"origin": [21, 4, -7.5], "size": [2, 5, 1], "uv": [177, 56]}, + {"origin": [21, 2, -6.5], "size": [2, 9, 1], "uv": [175, 65]}, + {"origin": [21, 1, -5.5], "size": [2, 11, 1], "uv": [171, 0]}, + {"origin": [21, 0, -4.5], "size": [2, 13, 2], "uv": [46, 164]}, + {"origin": [21, -1, -2.5], "size": [2, 15, 5], "uv": [141, 56]}, + {"origin": [21, 0, 2.5], "size": [2, 13, 2], "uv": [54, 164]}, + {"origin": [21, 1, 4.5], "size": [2, 11, 1], "uv": [171, 12]}, + {"origin": [21, 2, 5.5], "size": [2, 9, 1], "uv": [175, 119]}, + {"origin": [21, 4, 6.5], "size": [2, 5, 1], "uv": [177, 109]} + ] + }, + { + "name": "Wheel3", + "pivot": [22, 6.5, -36.4], + "cubes": [ + {"origin": [21, 4, -29.9], "size": [2, 5, 1], "uv": [178, 171]}, + {"origin": [21, 2, -30.9], "size": [2, 9, 1], "uv": [175, 139]}, + {"origin": [21, 1, -31.9], "size": [2, 11, 1], "uv": [136, 171]}, + {"origin": [21, 0, -33.9], "size": [2, 13, 2], "uv": [62, 164]}, + {"origin": [21, -1, -38.9], "size": [2, 15, 5], "uv": [141, 138]}, + {"origin": [21, 0, -40.9], "size": [2, 13, 2], "uv": [70, 164]}, + {"origin": [21, 1, -41.9], "size": [2, 11, 1], "uv": [142, 171]}, + {"origin": [21, 2, -42.9], "size": [2, 9, 1], "uv": [175, 149]}, + {"origin": [21, 4, -43.9], "size": [2, 5, 1], "uv": [178, 177]} + ] + }, + { + "name": "Wheel4", + "pivot": [-23, 6.5, 36.6], + "cubes": [ + {"origin": [-24, 1, 41.1], "size": [2, 11, 1], "uv": [154, 171]}, + {"origin": [-24, 2, 42.1], "size": [2, 9, 1], "uv": [177, 0]}, + {"origin": [-24, 0, 39.1], "size": [2, 13, 2], "uv": [98, 164]}, + {"origin": [-24, -1, 34.1], "size": [2, 15, 5], "uv": [155, 51]}, + {"origin": [-24, 0, 32.1], "size": [2, 13, 2], "uv": [90, 164]}, + {"origin": [-24, 1, 31.1], "size": [2, 11, 1], "uv": [148, 171]}, + {"origin": [-24, 2, 30.1], "size": [2, 9, 1], "uv": [130, 176]}, + {"origin": [-24, 4, 29.1], "size": [2, 5, 1], "uv": [0, 179]}, + {"origin": [-24, 4, 43.1], "size": [2, 5, 1], "uv": [6, 179]} + ] + }, + { + "name": "Wheel5", + "pivot": [-23, 6.5, 0], + "cubes": [ + {"origin": [-24, 4, 6.5], "size": [2, 5, 1], "uv": [24, 179]}, + {"origin": [-24, 1, 4.5], "size": [2, 11, 1], "uv": [173, 24]}, + {"origin": [-24, 2, 5.5], "size": [2, 9, 1], "uv": [177, 82]}, + {"origin": [-24, 0, 2.5], "size": [2, 13, 2], "uv": [122, 164]}, + {"origin": [-24, -1, -2.5], "size": [2, 15, 5], "uv": [157, 0]}, + {"origin": [-24, 0, -4.5], "size": [2, 13, 2], "uv": [169, 50]}, + {"origin": [-24, 1, -5.5], "size": [2, 11, 1], "uv": [172, 171]}, + {"origin": [-24, 2, -6.5], "size": [2, 9, 1], "uv": [177, 92]}, + {"origin": [-24, 4, -7.5], "size": [2, 5, 1], "uv": [179, 20]} + ] + }, + { + "name": "Wheel6", + "pivot": [-23, 6.5, -36.4], + "cubes": [ + {"origin": [-24, 4, -29.9], "size": [2, 5, 1], "uv": [18, 179]}, + {"origin": [-24, 2, -30.9], "size": [2, 9, 1], "uv": [177, 46]}, + {"origin": [-24, 1, -31.9], "size": [2, 11, 1], "uv": [166, 171]}, + {"origin": [-24, 0, -33.9], "size": [2, 13, 2], "uv": [114, 164]}, + {"origin": [-24, -1, -38.9], "size": [2, 15, 5], "uv": [155, 133]}, + {"origin": [-24, 0, -40.9], "size": [2, 13, 2], "uv": [106, 164]}, + {"origin": [-24, 1, -41.9], "size": [2, 11, 1], "uv": [160, 171]}, + {"origin": [-24, 2, -42.9], "size": [2, 9, 1], "uv": [177, 10]}, + {"origin": [-24, 4, -43.9], "size": [2, 5, 1], "uv": [12, 179]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/catapult.geo.json b/src/main/resources/assets/siegemachines/geo/catapult.geo.json new file mode 100644 index 0000000..a213da1 --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/catapult.geo.json @@ -0,0 +1,116 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 256, + "texture_height": 256, + "visible_bounds_width": 7, + "visible_bounds_height": 5.5, + "visible_bounds_offset": [0, 2.25, 0] + }, + "bones": [ + { + "name": "bb_main", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [0, 51, 5], "size": [0, 0, 0], "uv": [0, 0]} + ] + }, + { + "name": "Structure", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [15.9, 0, -27.4], "size": [7, 9, 69], "uv": [0, 78]}, + {"origin": [-23.1, 0, -27.4], "size": [7, 9, 69], "uv": [0, 0]}, + {"origin": [-22.1, 1, -3.5], "size": [7, 36, 7], "uv": [28, 0]}, + {"origin": [14.9, 1, -3.5], "size": [7, 36, 7], "uv": [0, 0]}, + {"origin": [18.9, 3, 9.7], "size": [2, 16, 5], "pivot": [16.9, 4, 7.6], "rotation": [45, 0, 0], "uv": [55, 38]}, + {"origin": [-21.1, 3, 9.7], "size": [2, 16, 5], "pivot": [6.9, 4, 7.6], "rotation": [45, 0, 0], "uv": [32, 78]}, + {"origin": [-21.1, -7.17193, -19.15751], "size": [3, 27, 5], "pivot": [8.4, 4.82807, -1.25751], "rotation": [-45, 0, 0], "uv": [0, 78]}, + {"origin": [17.9, -7.17193, -19.15751], "size": [3, 27, 5], "pivot": [19.9, 4.82807, -1.25751], "rotation": [-45, 0, 0], "uv": [16, 78]}, + {"origin": [-16.1, 2.8, 19.6], "size": [32, 5, 5], "pivot": [-0.1, 4.9, 22.1], "rotation": [15, 0, 0], "uv": [83, 57]}, + {"origin": [22, 2.4, 30.55], "size": [1, 5, 9], "uv": [83, 0]}, + {"origin": [-23.2, 2.4, 30.55], "size": [1, 5, 9], "uv": [46, 78]}, + {"origin": [-10.1, 29.9, -0.9], "size": [20, 7, 5], "uv": [0, 43]}, + {"origin": [-17.1, 30.9, -2.5], "size": [34, 5, 5], "uv": [83, 47]}, + {"origin": [-16.1, 2.4, -20.4], "size": [32, 5, 5], "uv": [83, 88]} + ] + }, + { + "name": "Rope", + "pivot": [-0.1, 5.9, 34.6] + }, + { + "name": "Lever", + "pivot": [0, 6, 0], + "rotation": [58.5, 0, 0], + "cubes": [ + {"origin": [-1.6, 1.72611, -3.53117], "size": [3, 4, 43], "pivot": [-12, 9.37606, -7.46607], "rotation": [20, 0, 0], "uv": [83, 0]}, + {"origin": [-1.6, 12.21129, 28.20686], "size": [3, 6, 1], "pivot": [-12, 22.59284, 33.09693], "rotation": [90, 0, 0], "uv": [60, 0]}, + {"origin": [-0.6, 19.43576, 30.09292], "size": [1, 6, 1], "pivot": [-12, 24.26847, 38.70068], "rotation": [130, 0, 0], "uv": [83, 0]}, + {"origin": [-2.1, 15.43297, 35.47561], "size": [4, 6, 1], "pivot": [-12, 25.08293, 31.54071], "rotation": [20, 0, 0], "uv": [57, 78]}, + {"origin": [-0.6, 15.43297, 45.47561], "size": [1, 6, 1], "pivot": [-12, 25.08293, 31.54071], "rotation": [20, 0, 0], "uv": [83, 21]}, + {"origin": [-1.1, 14.63297, 39.97561], "size": [2, 1, 2], "pivot": [-12, 25.08293, 31.54071], "rotation": [20, 0, 0], "uv": [60, 17]}, + {"origin": [-7.42323, 16.65448, 27.99163], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [92.66618, -69.09177, -93.29662], "uv": [64, 34]}, + {"origin": [-7.41281, 34.32762, 31.11341], "size": [1, 6, 1], "pivot": [-12, 24.62556, 35.96389], "rotation": [-157.33382, -69.09177, -93.29662], "uv": [64, 59]}, + {"origin": [-7.41281, 33.39717, 22.93366], "size": [1, 6, 1], "pivot": [-12, 24.62556, 35.96389], "rotation": [162.66618, -69.09177, -93.29662], "uv": [46, 78]}, + {"origin": [-7.42323, 16.65448, 17.99163], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [92.66618, -69.09177, -93.29662], "uv": [50, 78]}, + {"origin": [-16.83845, 16.65448, 27.69642], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.00855, -42.64975, -159.86565], "uv": [64, 20]}, + {"origin": [-16.83845, 16.65448, 17.69642], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.00855, -42.64975, -159.86565], "uv": [64, 27]}, + {"origin": [-24.56318, 16.65448, 44.80802], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.21351, 42.24362, 159.28371], "uv": [60, 20]}, + {"origin": [-23.11894, 15.31228, 35.05579], "size": [1, 1, 6], "pivot": [-10.56618, 22.84138, 35.18209], "rotation": [170.21351, 42.24362, 159.28371], "uv": [83, 14]}, + {"origin": [-18.35269, 21.01973, 18.90389], "size": [1, 1, 6], "pivot": [-13.42566, 22.79617, 35.20929], "rotation": [170.21351, -42.24362, -159.28371], "uv": [21, 0]}, + {"origin": [-24.56318, 16.65448, 34.80802], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.21351, 42.24362, 159.28371], "uv": [60, 27]}, + {"origin": [-25.97064, 28.15444, 42.00861], "size": [1, 6, 1], "pivot": [-13.41788, 23.75685, 37.76264], "rotation": [41.21351, 42.24362, 159.28371], "uv": [49, 0]}, + {"origin": [-15.48196, 12.15045, 47.87351], "size": [1, 6, 1], "pivot": [-10.55493, 23.76274, 37.75571], "rotation": [40.21351, -42.24362, -159.28371], "uv": [0, 0]}, + {"origin": [-0.6, 15.89855, 29.78131], "size": [1, 1, 3], "pivot": [-12, 17.72855, 23.51505], "rotation": [-15, 0, 0], "uv": [60, 13]}, + {"origin": [-0.6, 11.48751, 29.16706], "size": [1, 1, 2], "pivot": [-12, 18.1427, 25.02468], "rotation": [22, 0, 0], "uv": [27, 78]}, + {"origin": [-0.6, 11.53967, 21.06497], "size": [1, 1, 2], "pivot": [-12, 18.77575, 25.79499], "rotation": [85, 0, 0], "uv": [31, 79]}, + {"origin": [-16.1, 3.38599, -2.68452], "size": [32, 5, 5], "uv": [83, 78]} + ] + }, + { + "name": "Crank", + "pivot": [-0.1, 5, 37.05217], + "cubes": [ + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "uv": [60, 65]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [24, 65]}, + {"origin": [22.9, 3.4, 35.55], "size": [1, 3, 3], "uv": [60, 7]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [36, 65]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [48, 65]}, + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [18, 65]}, + {"origin": [10.1, 3.9, 36.05], "size": [14, 2, 2], "pivot": [21.9, 4.9, 37.05], "rotation": [-45, 0, 0], "uv": [32, 61]}, + {"origin": [23.8, 4.4, 36.55], "size": [1, 1, 1], "uv": [45, 45]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "uv": [54, 65]}, + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [30, 65]}, + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [42, 65]}, + {"origin": [-24.1, 3.4, 35.55], "size": [1, 3, 3], "uv": [47, 52]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [12, 65]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [6, 65]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "uv": [0, 65]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [50, 58]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [29, 3]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "uv": [21, 3]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [29, 0]}, + {"origin": [-24.3, 3.9, 36.05], "size": [14, 2, 2], "pivot": [-22.1, 4.9, 37.05], "rotation": [-45, 0, 0], "uv": [0, 61]}, + {"origin": [-25, 4.4, 36.55], "size": [1, 1, 1], "uv": [0, 45]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [21, 0]}, + {"origin": [-11.1, 3.4, 35.6], "size": [22, 3, 3], "uv": [0, 55]} + ] + }, + { + "name": "LittleLevers", + "pivot": [-0.1, 5, 32.86918], + "cubes": [ + {"origin": [23.1, 4.9, 31.25], "size": [1, 1, 4], "pivot": [23.5, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [11, 78]}, + {"origin": [23, 4.4, 31.6], "size": [1, 1, 1], "pivot": [23.5, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [45, 43]}, + {"origin": [-24.2, 4.4, 31.6], "size": [1, 1, 1], "pivot": [-23.7, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [0, 43]}, + {"origin": [-24.3, 4.9, 31.25], "size": [1, 1, 4], "pivot": [-23.7, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [45, 43]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/catapult_item.geo.json b/src/main/resources/assets/siegemachines/geo/catapult_item.geo.json new file mode 100644 index 0000000..a213da1 --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/catapult_item.geo.json @@ -0,0 +1,116 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 256, + "texture_height": 256, + "visible_bounds_width": 7, + "visible_bounds_height": 5.5, + "visible_bounds_offset": [0, 2.25, 0] + }, + "bones": [ + { + "name": "bb_main", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [0, 51, 5], "size": [0, 0, 0], "uv": [0, 0]} + ] + }, + { + "name": "Structure", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [15.9, 0, -27.4], "size": [7, 9, 69], "uv": [0, 78]}, + {"origin": [-23.1, 0, -27.4], "size": [7, 9, 69], "uv": [0, 0]}, + {"origin": [-22.1, 1, -3.5], "size": [7, 36, 7], "uv": [28, 0]}, + {"origin": [14.9, 1, -3.5], "size": [7, 36, 7], "uv": [0, 0]}, + {"origin": [18.9, 3, 9.7], "size": [2, 16, 5], "pivot": [16.9, 4, 7.6], "rotation": [45, 0, 0], "uv": [55, 38]}, + {"origin": [-21.1, 3, 9.7], "size": [2, 16, 5], "pivot": [6.9, 4, 7.6], "rotation": [45, 0, 0], "uv": [32, 78]}, + {"origin": [-21.1, -7.17193, -19.15751], "size": [3, 27, 5], "pivot": [8.4, 4.82807, -1.25751], "rotation": [-45, 0, 0], "uv": [0, 78]}, + {"origin": [17.9, -7.17193, -19.15751], "size": [3, 27, 5], "pivot": [19.9, 4.82807, -1.25751], "rotation": [-45, 0, 0], "uv": [16, 78]}, + {"origin": [-16.1, 2.8, 19.6], "size": [32, 5, 5], "pivot": [-0.1, 4.9, 22.1], "rotation": [15, 0, 0], "uv": [83, 57]}, + {"origin": [22, 2.4, 30.55], "size": [1, 5, 9], "uv": [83, 0]}, + {"origin": [-23.2, 2.4, 30.55], "size": [1, 5, 9], "uv": [46, 78]}, + {"origin": [-10.1, 29.9, -0.9], "size": [20, 7, 5], "uv": [0, 43]}, + {"origin": [-17.1, 30.9, -2.5], "size": [34, 5, 5], "uv": [83, 47]}, + {"origin": [-16.1, 2.4, -20.4], "size": [32, 5, 5], "uv": [83, 88]} + ] + }, + { + "name": "Rope", + "pivot": [-0.1, 5.9, 34.6] + }, + { + "name": "Lever", + "pivot": [0, 6, 0], + "rotation": [58.5, 0, 0], + "cubes": [ + {"origin": [-1.6, 1.72611, -3.53117], "size": [3, 4, 43], "pivot": [-12, 9.37606, -7.46607], "rotation": [20, 0, 0], "uv": [83, 0]}, + {"origin": [-1.6, 12.21129, 28.20686], "size": [3, 6, 1], "pivot": [-12, 22.59284, 33.09693], "rotation": [90, 0, 0], "uv": [60, 0]}, + {"origin": [-0.6, 19.43576, 30.09292], "size": [1, 6, 1], "pivot": [-12, 24.26847, 38.70068], "rotation": [130, 0, 0], "uv": [83, 0]}, + {"origin": [-2.1, 15.43297, 35.47561], "size": [4, 6, 1], "pivot": [-12, 25.08293, 31.54071], "rotation": [20, 0, 0], "uv": [57, 78]}, + {"origin": [-0.6, 15.43297, 45.47561], "size": [1, 6, 1], "pivot": [-12, 25.08293, 31.54071], "rotation": [20, 0, 0], "uv": [83, 21]}, + {"origin": [-1.1, 14.63297, 39.97561], "size": [2, 1, 2], "pivot": [-12, 25.08293, 31.54071], "rotation": [20, 0, 0], "uv": [60, 17]}, + {"origin": [-7.42323, 16.65448, 27.99163], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [92.66618, -69.09177, -93.29662], "uv": [64, 34]}, + {"origin": [-7.41281, 34.32762, 31.11341], "size": [1, 6, 1], "pivot": [-12, 24.62556, 35.96389], "rotation": [-157.33382, -69.09177, -93.29662], "uv": [64, 59]}, + {"origin": [-7.41281, 33.39717, 22.93366], "size": [1, 6, 1], "pivot": [-12, 24.62556, 35.96389], "rotation": [162.66618, -69.09177, -93.29662], "uv": [46, 78]}, + {"origin": [-7.42323, 16.65448, 17.99163], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [92.66618, -69.09177, -93.29662], "uv": [50, 78]}, + {"origin": [-16.83845, 16.65448, 27.69642], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.00855, -42.64975, -159.86565], "uv": [64, 20]}, + {"origin": [-16.83845, 16.65448, 17.69642], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.00855, -42.64975, -159.86565], "uv": [64, 27]}, + {"origin": [-24.56318, 16.65448, 44.80802], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.21351, 42.24362, 159.28371], "uv": [60, 20]}, + {"origin": [-23.11894, 15.31228, 35.05579], "size": [1, 1, 6], "pivot": [-10.56618, 22.84138, 35.18209], "rotation": [170.21351, 42.24362, 159.28371], "uv": [83, 14]}, + {"origin": [-18.35269, 21.01973, 18.90389], "size": [1, 1, 6], "pivot": [-13.42566, 22.79617, 35.20929], "rotation": [170.21351, -42.24362, -159.28371], "uv": [21, 0]}, + {"origin": [-24.56318, 16.65448, 34.80802], "size": [1, 6, 1], "pivot": [-12.01042, 25.97334, 35.44963], "rotation": [151.21351, 42.24362, 159.28371], "uv": [60, 27]}, + {"origin": [-25.97064, 28.15444, 42.00861], "size": [1, 6, 1], "pivot": [-13.41788, 23.75685, 37.76264], "rotation": [41.21351, 42.24362, 159.28371], "uv": [49, 0]}, + {"origin": [-15.48196, 12.15045, 47.87351], "size": [1, 6, 1], "pivot": [-10.55493, 23.76274, 37.75571], "rotation": [40.21351, -42.24362, -159.28371], "uv": [0, 0]}, + {"origin": [-0.6, 15.89855, 29.78131], "size": [1, 1, 3], "pivot": [-12, 17.72855, 23.51505], "rotation": [-15, 0, 0], "uv": [60, 13]}, + {"origin": [-0.6, 11.48751, 29.16706], "size": [1, 1, 2], "pivot": [-12, 18.1427, 25.02468], "rotation": [22, 0, 0], "uv": [27, 78]}, + {"origin": [-0.6, 11.53967, 21.06497], "size": [1, 1, 2], "pivot": [-12, 18.77575, 25.79499], "rotation": [85, 0, 0], "uv": [31, 79]}, + {"origin": [-16.1, 3.38599, -2.68452], "size": [32, 5, 5], "uv": [83, 78]} + ] + }, + { + "name": "Crank", + "pivot": [-0.1, 5, 37.05217], + "cubes": [ + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "uv": [60, 65]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [24, 65]}, + {"origin": [22.9, 3.4, 35.55], "size": [1, 3, 3], "uv": [60, 7]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [36, 65]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [48, 65]}, + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [18, 65]}, + {"origin": [10.1, 3.9, 36.05], "size": [14, 2, 2], "pivot": [21.9, 4.9, 37.05], "rotation": [-45, 0, 0], "uv": [32, 61]}, + {"origin": [23.8, 4.4, 36.55], "size": [1, 1, 1], "uv": [45, 45]}, + {"origin": [23, 4.4, 35], "size": [1, 1, 2], "uv": [54, 65]}, + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [30, 65]}, + {"origin": [23, 4.4, 37.1], "size": [1, 1, 2], "pivot": [23.5, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [42, 65]}, + {"origin": [-24.1, 3.4, 35.55], "size": [1, 3, 3], "uv": [47, 52]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [12, 65]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [6, 65]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "uv": [0, 65]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [50, 58]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [90, 0, 0], "uv": [29, 3]}, + {"origin": [-24.2, 4.4, 35], "size": [1, 1, 2], "uv": [21, 3]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [-135, 0, 0], "uv": [29, 0]}, + {"origin": [-24.3, 3.9, 36.05], "size": [14, 2, 2], "pivot": [-22.1, 4.9, 37.05], "rotation": [-45, 0, 0], "uv": [0, 61]}, + {"origin": [-25, 4.4, 36.55], "size": [1, 1, 1], "uv": [0, 45]}, + {"origin": [-24.2, 4.4, 37.1], "size": [1, 1, 2], "pivot": [-23.7, 4.9, 37.05], "rotation": [135, 0, 0], "uv": [21, 0]}, + {"origin": [-11.1, 3.4, 35.6], "size": [22, 3, 3], "uv": [0, 55]} + ] + }, + { + "name": "LittleLevers", + "pivot": [-0.1, 5, 32.86918], + "cubes": [ + {"origin": [23.1, 4.9, 31.25], "size": [1, 1, 4], "pivot": [23.5, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [11, 78]}, + {"origin": [23, 4.4, 31.6], "size": [1, 1, 1], "pivot": [23.5, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [45, 43]}, + {"origin": [-24.2, 4.4, 31.6], "size": [1, 1, 1], "pivot": [-23.7, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [0, 43]}, + {"origin": [-24.3, 4.9, 31.25], "size": [1, 1, 4], "pivot": [-23.7, 5.6, 33.55], "rotation": [19, 0, 0], "uv": [45, 43]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/mortar.geo.json b/src/main/resources/assets/siegemachines/geo/mortar.geo.json new file mode 100644 index 0000000..7c64f5e --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/mortar.geo.json @@ -0,0 +1,102 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.mortar", + "texture_width": 128, + "texture_height": 128, + "visible_bounds_width": 5, + "visible_bounds_height": 3.5, + "visible_bounds_offset": [0, 1.25, 0] + }, + "bones": [ + { + "name": "Wheels", + "pivot": [-6.6, 9.55433, -9.77039], + "cubes": [ + {"origin": [-16.1, 1.25433, -14.97039], "size": [31, 2, 2], "pivot": [6, -4.34567, 6.22961], "rotation": [-22.5, 0, 0], "uv": [39, 0]} + ] + }, + { + "name": "LeftWheel", + "parent": "Wheels", + "pivot": [-8, 8, -8], + "cubes": [ + {"origin": [10.9, -0.88545, -13.27201], "size": [2, 21, 7], "uv": [29, 74]}, + {"origin": [10.9, 0.11455, -15.27201], "size": [2, 19, 2], "uv": [63, 75]}, + {"origin": [10.9, 1.11455, -16.27201], "size": [2, 17, 1], "uv": [77, 83]}, + {"origin": [10.9, 1.11455, -4.27201], "size": [2, 17, 1], "uv": [71, 83]}, + {"origin": [10.9, 2.11455, -17.27201], "size": [2, 15, 1], "uv": [0, 87]}, + {"origin": [10.9, 2.11455, -3.27201], "size": [2, 15, 1], "uv": [83, 83]}, + {"origin": [10.9, 3.11455, -18.27201], "size": [2, 13, 1], "uv": [60, 55]}, + {"origin": [10.9, 3.11455, -2.27201], "size": [2, 13, 1], "uv": [54, 54]}, + {"origin": [10.9, 4.11455, -19.27201], "size": [2, 11, 1], "uv": [87, 35]}, + {"origin": [10.9, 4.11455, -1.27201], "size": [2, 11, 1], "uv": [87, 15]}, + {"origin": [10.9, 6.11455, -20.27201], "size": [2, 7, 1], "uv": [41, 58]}, + {"origin": [10.9, 6.11455, -0.27201], "size": [2, 7, 1], "uv": [45, 11]}, + {"origin": [10.9, 0.11455, -6.27201], "size": [2, 19, 2], "uv": [55, 75]} + ] + }, + { + "name": "RightWheel", + "parent": "Wheels", + "pivot": [-8, 8, -8], + "cubes": [ + {"origin": [-14.1, -0.88545, -13.27201], "size": [2, 21, 7], "uv": [0, 0]}, + {"origin": [-14.1, 0.11455, -15.27201], "size": [2, 19, 2], "uv": [47, 74]}, + {"origin": [-14.1, 1.11455, -16.27201], "size": [2, 17, 1], "uv": [22, 79]}, + {"origin": [-14.1, 1.11455, -4.27201], "size": [2, 17, 1], "uv": [16, 79]}, + {"origin": [-14.1, 2.11455, -17.27201], "size": [2, 15, 1], "uv": [6, 58]}, + {"origin": [-14.1, 2.11455, -3.27201], "size": [2, 15, 1], "uv": [0, 58]}, + {"origin": [-14.1, 3.11455, -18.27201], "size": [2, 13, 1], "uv": [6, 41]}, + {"origin": [-14.1, 3.11455, -2.27201], "size": [2, 13, 1], "uv": [0, 41]}, + {"origin": [-14.1, 4.11455, -19.27201], "size": [2, 11, 1], "uv": [6, 87]}, + {"origin": [-14.1, 4.11455, -1.27201], "size": [2, 11, 1], "uv": [70, 35]}, + {"origin": [-14.1, 6.11455, -20.27201], "size": [2, 7, 1], "uv": [33, 41]}, + {"origin": [-14.1, 6.11455, -0.27201], "size": [2, 7, 1], "uv": [45, 11]}, + {"origin": [-14.1, 0.11455, -6.27201], "size": [2, 19, 2], "uv": [47, 74]} + ] + }, + { + "name": "MortarBase", + "pivot": [-8, 8, -8], + "cubes": [ + {"origin": [-3.2, 1.6892, 15.73904], "size": [5.2, 3, 3.6], "pivot": [-0.6, 2.1892, 15.53904], "rotation": [-15, 0, 0], "uv": [79, 63]}, + {"origin": [-1.7, 3.23128, 8.45818], "size": [2.2, 2.2, 8], "pivot": [-0.6, 4.33128, 10.95818], "rotation": [-15, 0, 0], "uv": [10, 20]}, + {"origin": [5.9, 7.3, -20], "size": [4, 7, 31], "pivot": [7.9, 12.3, -4.5], "rotation": [-15, 0, 0], "uv": [0, 0], "mirror": true}, + {"origin": [-11.1, 7.3, -20], "size": [4, 7, 31], "pivot": [7.9, 12.3, -4.5], "rotation": [-15, 0, 0], "uv": [0, 0]}, + {"origin": [-7.1, 7.3, 1], "size": [13, 4, 9], "pivot": [7.9, 12.3, -4.5], "rotation": [-15, 0, 0], "uv": [33, 41]}, + {"origin": [-7.1, 10.24923, -19.40164], "size": [13, 4, 9], "pivot": [-0.6, 12.24923, -15.90164], "rotation": [-15, 0, 0], "uv": [33, 41]}, + {"origin": [-11.1, 13, -9], "size": [4, 5, 6], "inflate": 0.2, "pivot": [7.9, 19.3, -2.5], "rotation": [-15, 0, 0], "uv": [108, 0]}, + {"origin": [5.9, 13, -9], "size": [4, 5, 6], "inflate": 0.2, "pivot": [24.9, 19.3, -2.5], "rotation": [-15, 0, 0], "uv": [108, 0], "mirror": true} + ] + }, + { + "name": "Barrel", + "pivot": [-0.5, 16.8732, -6.8456], + "cubes": [ + {"origin": [-3.2, 22.1, -21], "size": [5, 1, 15], "uv": [62, 39]}, + {"origin": [-3.2, 12.1, -21], "size": [5, 1, 15], "uv": [54, 59]}, + {"origin": [-5.2, 20.1, -21], "size": [9, 2, 15], "uv": [0, 41]}, + {"origin": [-5.2, 13.1, -21], "size": [9, 2, 15], "uv": [39, 4]}, + {"origin": [1.8, 15.1, -21], "size": [3, 5, 15], "uv": [0, 59]}, + {"origin": [-6.2, 15.1, -21], "size": [3, 5, 15], "uv": [33, 54]}, + {"origin": [-11.5, 15.87318, -7.84558], "size": [22, 2, 2], "uv": [45, 0]}, + {"origin": [-4.2, 14.1, 1], "size": [7, 7, 0], "uv": [39, 4]}, + {"origin": [-5.2, 13.1, -19], "size": [9, 9, 0], "uv": [21, 58]}, + {"origin": [-3.2, 21.1, -6], "size": [5, 1, 7], "uv": [56, 22]}, + {"origin": [-3.2, 13.1, -6], "size": [5, 1, 7], "uv": [39, 21]}, + {"origin": [1.8, 14.1, -6], "size": [1, 1, 7], "uv": [79, 55]}, + {"origin": [-4.2, 14.1, -6], "size": [1, 1, 7], "uv": [0, 79]}, + {"origin": [1.8, 20.1, -6], "size": [1, 1, 7], "uv": [71, 75]}, + {"origin": [-2.2, 16.1, 1], "size": [3, 3, 2], "uv": [11, 0]}, + {"origin": [-4.2, 20.1, -6], "size": [1, 1, 7], "uv": [32, 60]}, + {"origin": [2.8, 15.1, -6], "size": [1, 5, 7], "uv": [73, 23]}, + {"origin": [-5.2, 15.1, -6], "size": [1, 5, 7], "uv": [72, 4]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/mortar_item.geo.json b/src/main/resources/assets/siegemachines/geo/mortar_item.geo.json new file mode 100644 index 0000000..094f8ff --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/mortar_item.geo.json @@ -0,0 +1,102 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.mortar", + "texture_width": 128, + "texture_height": 128, + "visible_bounds_width": 5, + "visible_bounds_height": 3.5, + "visible_bounds_offset": [0, 1.25, 0] + }, + "bones": [ + { + "name": "Wheels", + "pivot": [-6.6, 9.55433, -9.77039], + "cubes": [ + {"origin": [-16.1, 1.25433, -14.97039], "size": [31, 2, 2], "pivot": [6, -4.34567, 6.22961], "rotation": [-22.5, 0, 0], "uv": [39, 0]} + ] + }, + { + "name": "LeftWheel", + "parent": "Wheels", + "pivot": [-8, 8, -8], + "cubes": [ + {"origin": [10.9, -0.88545, -13.27201], "size": [2, 21, 7], "uv": [29, 74]}, + {"origin": [10.9, 0.11455, -15.27201], "size": [2, 19, 2], "uv": [63, 75]}, + {"origin": [10.9, 1.11455, -16.27201], "size": [2, 17, 1], "uv": [77, 83]}, + {"origin": [10.9, 1.11455, -4.27201], "size": [2, 17, 1], "uv": [71, 83]}, + {"origin": [10.9, 2.11455, -17.27201], "size": [2, 15, 1], "uv": [0, 87]}, + {"origin": [10.9, 2.11455, -3.27201], "size": [2, 15, 1], "uv": [83, 83]}, + {"origin": [10.9, 3.11455, -18.27201], "size": [2, 13, 1], "uv": [60, 55]}, + {"origin": [10.9, 3.11455, -2.27201], "size": [2, 13, 1], "uv": [54, 54]}, + {"origin": [10.9, 4.11455, -19.27201], "size": [2, 11, 1], "uv": [87, 35]}, + {"origin": [10.9, 4.11455, -1.27201], "size": [2, 11, 1], "uv": [87, 15]}, + {"origin": [10.9, 6.11455, -20.27201], "size": [2, 7, 1], "uv": [41, 58]}, + {"origin": [10.9, 6.11455, -0.27201], "size": [2, 7, 1], "uv": [45, 11]}, + {"origin": [10.9, 0.11455, -6.27201], "size": [2, 19, 2], "uv": [55, 75]} + ] + }, + { + "name": "RightWheel", + "parent": "Wheels", + "pivot": [-8, 8, -8], + "cubes": [ + {"origin": [-14.1, -0.88545, -13.27201], "size": [2, 21, 7], "uv": [0, 0]}, + {"origin": [-14.1, 0.11455, -15.27201], "size": [2, 19, 2], "uv": [47, 74]}, + {"origin": [-14.1, 1.11455, -16.27201], "size": [2, 17, 1], "uv": [22, 79]}, + {"origin": [-14.1, 1.11455, -4.27201], "size": [2, 17, 1], "uv": [16, 79]}, + {"origin": [-14.1, 2.11455, -17.27201], "size": [2, 15, 1], "uv": [6, 58]}, + {"origin": [-14.1, 2.11455, -3.27201], "size": [2, 15, 1], "uv": [0, 58]}, + {"origin": [-14.1, 3.11455, -18.27201], "size": [2, 13, 1], "uv": [6, 41]}, + {"origin": [-14.1, 3.11455, -2.27201], "size": [2, 13, 1], "uv": [0, 41]}, + {"origin": [-14.1, 4.11455, -19.27201], "size": [2, 11, 1], "uv": [6, 87]}, + {"origin": [-14.1, 4.11455, -1.27201], "size": [2, 11, 1], "uv": [70, 35]}, + {"origin": [-14.1, 6.11455, -20.27201], "size": [2, 7, 1], "uv": [33, 41]}, + {"origin": [-14.1, 6.11455, -0.27201], "size": [2, 7, 1], "uv": [45, 11]}, + {"origin": [-14.1, 0.11455, -6.27201], "size": [2, 19, 2], "uv": [47, 74]} + ] + }, + { + "name": "MortarBase", + "pivot": [-8, 8, -8], + "cubes": [ + {"origin": [-3.2, 1.6892, 15.73904], "size": [5.2, 3, 3.6], "pivot": [-0.6, 2.1892, 15.53904], "rotation": [-15, 0, 0], "uv": [79, 63]}, + {"origin": [-1.7, 3.23128, 8.45818], "size": [2.2, 2.2, 8], "pivot": [-0.6, 4.33128, 10.95818], "rotation": [-15, 0, 0], "uv": [10, 20]}, + {"origin": [5.9, 7.3, -20], "size": [4, 7, 31], "pivot": [7.9, 12.3, -4.5], "rotation": [-15, 0, 0], "uv": [0, 0], "mirror": true}, + {"origin": [-11.1, 7.3, -20], "size": [4, 7, 31], "pivot": [7.9, 12.3, -4.5], "rotation": [-15, 0, 0], "uv": [0, 0]}, + {"origin": [-7.1, 7.3, 1], "size": [13, 4, 9], "pivot": [7.9, 12.3, -4.5], "rotation": [-15, 0, 0], "uv": [33, 41]}, + {"origin": [-7.1, 10.24923, -19.40164], "size": [13, 4, 9], "pivot": [-0.6, 12.24923, -15.90164], "rotation": [-15, 0, 0], "uv": [33, 41]}, + {"origin": [-11.1, 13, -9], "size": [4, 5, 6], "inflate": 0.2, "pivot": [7.9, 19.3, -2.5], "rotation": [-15, 0, 0], "uv": [108, 0]}, + {"origin": [5.9, 13, -9], "size": [4, 5, 6], "inflate": 0.2, "pivot": [24.9, 19.3, -2.5], "rotation": [-15, 0, 0], "uv": [108, 0], "mirror": true} + ] + }, + { + "name": "Barrel", + "pivot": [-0.5, 16.8732, -6.8456], + "cubes": [ + {"origin": [-3.2, 22.1, -21], "size": [5, 1, 15], "uv": [62, 39]}, + {"origin": [-3.2, 12.1, -21], "size": [5, 1, 15], "uv": [54, 59]}, + {"origin": [-5.2, 20.1, -21], "size": [9, 2, 15], "uv": [0, 41]}, + {"origin": [-5.2, 13.1, -21], "size": [9, 2, 15], "uv": [39, 4]}, + {"origin": [1.8, 15.1, -21], "size": [3, 5, 15], "uv": [0, 59]}, + {"origin": [-6.2, 15.1, -21], "size": [3, 5, 15], "uv": [33, 54]}, + {"origin": [-11.5, 15.87318, -7.84558], "size": [22, 2, 2], "uv": [45, 0]}, + {"origin": [-4.2, 14.1, 0], "size": [7, 7, 1], "inflate": -0.01, "uv": [30, 3]}, + {"origin": [-5.2, 13.1, -19], "size": [9, 9, 0], "uv": [21, 58]}, + {"origin": [-3.2, 21.1, -6], "size": [5, 1, 7], "uv": [56, 22]}, + {"origin": [-3.2, 13.1, -6], "size": [5, 1, 7], "uv": [39, 21]}, + {"origin": [1.8, 14.1, -6], "size": [1, 1, 7], "uv": [79, 55]}, + {"origin": [-4.2, 14.1, -6], "size": [1, 1, 7], "uv": [0, 79]}, + {"origin": [1.8, 20.1, -6], "size": [1, 1, 7], "uv": [71, 75]}, + {"origin": [-2.2, 16.1, 1], "size": [3, 3, 2], "uv": [11, 0]}, + {"origin": [-4.2, 20.1, -6], "size": [1, 1, 7], "uv": [32, 60]}, + {"origin": [2.8, 15.1, -6], "size": [1, 5, 7], "uv": [73, 23]}, + {"origin": [-5.2, 15.1, -6], "size": [1, 5, 7], "uv": [72, 4]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/trebuchet.geo.json b/src/main/resources/assets/siegemachines/geo/trebuchet.geo.json new file mode 100644 index 0000000..8eb127f --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/trebuchet.geo.json @@ -0,0 +1,130 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 1024, + "texture_height": 1024, + "visible_bounds_width": 49, + "visible_bounds_height": 64, + "visible_bounds_offset": [0, 26, 0] + }, + "bones": [ + { + "name": "Structure", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [12, 8, -17], "size": [7, 121, 7], "uv": [168, 0]}, + {"origin": [-24, -1, -19], "size": [48, 12, 11], "uv": [321, 69]}, + {"origin": [-12, 0, -61], "size": [24, 7, 7], "uv": [201, 152]}, + {"origin": [-16, 0, 141], "size": [32, 7, 7], "uv": [201, 138]}, + {"origin": [-1, 5, -8], "size": [12, 1, 149], "pivot": [16, 6, -8], "rotation": [0, 0, -12.5], "uv": [510, 468]}, + {"origin": [-11, 5, -8], "size": [12, 1, 149], "pivot": [-16, 6, -8], "rotation": [0, 0, 12.5], "uv": [510, 268]}, + {"origin": [-24, 124, -15.6], "size": [48, 4, 4], "uv": [0, 167]}, + {"origin": [-64, -1, -17], "size": [45, 7, 7], "uv": [201, 88]}, + {"origin": [-129.52995, 227, -15], "size": [126, 5, 3], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [30, 745]}, + {"origin": [-112.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-100.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-88.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-76.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-64.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-52.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-40.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-28.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-16.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [19, -1, -17], "size": [45, 7, 7], "uv": [0, 175]}, + {"origin": [-19, -1, -62], "size": [7, 10, 48], "uv": [88, 311]}, + {"origin": [12, -1, -62], "size": [7, 10, 48], "uv": [194, 202]}, + {"origin": [-19, -1, -8.2], "size": [7, 10, 159], "uv": [362, 49]}, + {"origin": [12, -1, -8.2], "size": [7, 10, 159], "uv": [49, 360]}, + {"origin": [14, 9, 83.8], "size": [3, 22, 9], "uv": [24, 69]}, + {"origin": [-17, 9, 83.8], "size": [3, 22, 9], "uv": [0, 69]}, + {"origin": [48.3697, 0, -13.96784], "size": [5, 5, 103], "pivot": [50.8697, 2.5, -13.46784], "rotation": [0, -24, 0], "uv": [227, 709]}, + {"origin": [67.1887, 0, -16.71609], "size": [5, 5, 60], "pivot": [61, -1, -17], "rotation": [-180, -40, 180], "uv": [317, 4]}, + {"origin": [-53.36968, 0, -13.96785], "size": [5, 5, 103], "pivot": [-50.86968, 2.5, -13.46785], "rotation": [0, 24, 0], "uv": [25, 94]}, + {"origin": [-72.1887, 0, -14.71609], "size": [5, 5, 60], "pivot": [-61, -1, -17], "rotation": [-180, 40, 180], "uv": [6, 4]}, + {"origin": [-18, 0.1101, -57.2], "size": [5, 7, 129], "pivot": [-15.5, 3.1101, -56.95027], "rotation": [70, 0, 0], "uv": [31, 560], "mirror": true}, + {"origin": [13, 0.1101, -57.1], "size": [5, 7, 129], "pivot": [15.5, 3.1101, -56.95027], "rotation": [70, 0, 0], "uv": [31, 560]}, + {"origin": [-18, -0.24603, 30.29206], "size": [5, 7, 129], "pivot": [-15.5, 3.25397, 30.29206], "rotation": [-110, 0, 180], "uv": [31, 560], "mirror": true}, + {"origin": [13, -0.24603, 30.29206], "size": [5, 7, 129], "pivot": [15.5, 3.25397, 30.2921], "rotation": [-110, 0, 180], "uv": [31, 560]}, + {"origin": [14, 23.75906, 4.55558], "size": [3, 7, 69], "pivot": [15.5, 27.25906, 39.05558], "rotation": [-138, 0, 180], "uv": [13, 324]}, + {"origin": [-17, 23.75906, 4.55558], "size": [3, 7, 69], "pivot": [-15.5, 27.25906, 39.05558], "rotation": [-138, 0, 180], "uv": [119, 215]}, + {"origin": [-19, 8, -17], "size": [7, 121, 7], "uv": [140, 0]} + ] + }, + { + "name": "Crank", + "pivot": [0, 25.5, 88.3], + "cubes": [ + {"origin": [-27, 23, 85.8], "size": [54, 5, 5], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [0, 157]}, + {"origin": [-13, 21, 83.8], "size": [26, 9, 9], "pivot": [0, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [201, 102]}, + {"origin": [-25, 11, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [116, 69]}, + {"origin": [-25, 28, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [110, 69]}, + {"origin": [23, 11, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [62, 69]}, + {"origin": [23, 28, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [104, 69]}, + {"origin": [23, 11, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [58, 26]}, + {"origin": [23, 28, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [56, 69]}, + {"origin": [-25, 11, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [58, 0]}, + {"origin": [-25, 28, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [58, 13]} + ] + }, + { + "name": "Lever", + "pivot": [-8, 126, -14], + "cubes": [ + {"origin": [-11.7, 124, -45.9], "size": [23, 4, 4], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [56, 101]}, + {"origin": [-2.75, 121.4, 106.8], "size": [5, 8, 76], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [222, 311]}, + {"origin": [-4.75, 120.4, -50.2], "size": [9, 11, 90], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [340, 583]}, + {"origin": [-3.75, 121.4, 39.8], "size": [7, 9, 67], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [25, 227]}, + {"origin": [-0.75, 326, -9.7], "size": [1, 1, 3], "inflate": 0.2, "pivot": [-0.25, 326.5237, -9.28356], "rotation": [102.5, 0, 0], "uv": [16, 57]}, + {"origin": [-0.75, 323.94926, -11.32443], "size": [1, 1, 4], "inflate": 0.2, "pivot": [-0.25, 324.44926, -9.32443], "rotation": [82.5, 0, 0], "uv": [20, 57]} + ] + }, + { + "name": "CounterWeight", + "parent": "Lever", + "pivot": [-8.2, 95.99641, -13.89692], + "cubes": [ + {"origin": [8.8, 72, -16.9], "size": [2, 28, 6], "uv": [201, 0]}, + {"origin": [-11.2, 72, -16.9], "size": [2, 28, 6], "uv": [104, 109]}, + {"origin": [-11.2, 48, -38.9], "size": [22, 24, 4], "uv": [201, 166]}, + {"origin": [7.8, 32.1, -37.9], "size": [4, 40, 48], "uv": [201, 0]}, + {"origin": [-12.2, 32.1, -37.9], "size": [4, 40, 48], "uv": [0, 69]}, + {"origin": [-11.2, 48, 7.1], "size": [22, 24, 4], "uv": [138, 158]}, + {"origin": [-12.1, 49.73205, 7.8], "size": [23.8, 24, 4], "pivot": [-8.2, 49.73205, 10.1], "rotation": [120, 0, 0], "uv": [80, 0]}, + {"origin": [-11.5, 61.7, 12.054], "size": [23, 9, 4], "pivot": [-8.2, 38, 14.31539], "rotation": [90, 0, 0], "uv": [5, 44]}, + {"origin": [-8.2, 44.7, 40.31539], "size": [22, 43, 1], "pivot": [-8.2, 38, 14.31539], "rotation": [90, 0, 0], "uv": [0, 0]}, + {"origin": [-12.1, 49.73205, -39.6], "size": [23.8, 24, 4], "pivot": [-8.2, 49.73205, -37.9], "rotation": [-120, 0, 0], "uv": [80, 28]} + ] + }, + { + "name": "Rope_Projectile", + "parent": "Lever", + "pivot": [-8.25, 321.0872, -8.87572], + "rotation": [92.5, 0, 0], + "cubes": [ + {"origin": [-0.25, 315.0872, -137.87572], "size": [0, 2, 130], "pivot": [-8.2, 320.9872, 106.72428], "rotation": [-2.5, 0, 0], "uv": [222, 381]}, + {"origin": [-1.25, 316.0872, -137.87572], "size": [2, 0, 130], "pivot": [-8.2, 320.9872, 106.72428], "rotation": [-2.5, 0, 0], "uv": [179, 175]}, + {"origin": [-0.25, 325.02631, -137.48123], "size": [0, 2, 130], "pivot": [-8.2, 320.9872, 106.72428], "rotation": [3.5, 0, 0], "uv": [222, 381]}, + {"origin": [-1.25, 314.63912, -137.41784], "size": [2, 0, 130], "pivot": [-0.25, 316.04548, -85.81234], "rotation": [3.5, 0, 0], "uv": [178, 175]}, + {"origin": [-8.2, -317, 123.78511], "size": [16, 20, 16], "inflate": 0.3, "pivot": [-0.2, 142, 308.78511], "rotation": [-90, 0, 0], "uv": [387, 0]} + ] + }, + { + "name": "Cobblestone", + "parent": "Rope_Projectile", + "pivot": [-8.25, 321.0872, -8.87572], + "cubes": [ + {"origin": [-8.25, 311.0872, -149.87572], "size": [16, 16, 16], "uv": [0, 225]} + ] + }, + { + "name": "Rope_Lever", + "pivot": [-8.25, 26.66803, 103.76811], + "rotation": [90, 0, 0] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/geo/trebuchet_item.geo.json b/src/main/resources/assets/siegemachines/geo/trebuchet_item.geo.json new file mode 100644 index 0000000..8eb127f --- /dev/null +++ b/src/main/resources/assets/siegemachines/geo/trebuchet_item.geo.json @@ -0,0 +1,130 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 1024, + "texture_height": 1024, + "visible_bounds_width": 49, + "visible_bounds_height": 64, + "visible_bounds_offset": [0, 26, 0] + }, + "bones": [ + { + "name": "Structure", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [12, 8, -17], "size": [7, 121, 7], "uv": [168, 0]}, + {"origin": [-24, -1, -19], "size": [48, 12, 11], "uv": [321, 69]}, + {"origin": [-12, 0, -61], "size": [24, 7, 7], "uv": [201, 152]}, + {"origin": [-16, 0, 141], "size": [32, 7, 7], "uv": [201, 138]}, + {"origin": [-1, 5, -8], "size": [12, 1, 149], "pivot": [16, 6, -8], "rotation": [0, 0, -12.5], "uv": [510, 468]}, + {"origin": [-11, 5, -8], "size": [12, 1, 149], "pivot": [-16, 6, -8], "rotation": [0, 0, 12.5], "uv": [510, 268]}, + {"origin": [-24, 124, -15.6], "size": [48, 4, 4], "uv": [0, 167]}, + {"origin": [-64, -1, -17], "size": [45, 7, 7], "uv": [201, 88]}, + {"origin": [-129.52995, 227, -15], "size": [126, 5, 3], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [30, 745]}, + {"origin": [-112.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-100.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-88.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-76.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-64.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-52.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-40.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-28.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [-16.52995, 227, -23], "size": [3, 3, 19], "pivot": [64.77005, 165.36472, -20], "rotation": [0, 0, -73], "uv": [0, 203]}, + {"origin": [19, -1, -17], "size": [45, 7, 7], "uv": [0, 175]}, + {"origin": [-19, -1, -62], "size": [7, 10, 48], "uv": [88, 311]}, + {"origin": [12, -1, -62], "size": [7, 10, 48], "uv": [194, 202]}, + {"origin": [-19, -1, -8.2], "size": [7, 10, 159], "uv": [362, 49]}, + {"origin": [12, -1, -8.2], "size": [7, 10, 159], "uv": [49, 360]}, + {"origin": [14, 9, 83.8], "size": [3, 22, 9], "uv": [24, 69]}, + {"origin": [-17, 9, 83.8], "size": [3, 22, 9], "uv": [0, 69]}, + {"origin": [48.3697, 0, -13.96784], "size": [5, 5, 103], "pivot": [50.8697, 2.5, -13.46784], "rotation": [0, -24, 0], "uv": [227, 709]}, + {"origin": [67.1887, 0, -16.71609], "size": [5, 5, 60], "pivot": [61, -1, -17], "rotation": [-180, -40, 180], "uv": [317, 4]}, + {"origin": [-53.36968, 0, -13.96785], "size": [5, 5, 103], "pivot": [-50.86968, 2.5, -13.46785], "rotation": [0, 24, 0], "uv": [25, 94]}, + {"origin": [-72.1887, 0, -14.71609], "size": [5, 5, 60], "pivot": [-61, -1, -17], "rotation": [-180, 40, 180], "uv": [6, 4]}, + {"origin": [-18, 0.1101, -57.2], "size": [5, 7, 129], "pivot": [-15.5, 3.1101, -56.95027], "rotation": [70, 0, 0], "uv": [31, 560], "mirror": true}, + {"origin": [13, 0.1101, -57.1], "size": [5, 7, 129], "pivot": [15.5, 3.1101, -56.95027], "rotation": [70, 0, 0], "uv": [31, 560]}, + {"origin": [-18, -0.24603, 30.29206], "size": [5, 7, 129], "pivot": [-15.5, 3.25397, 30.29206], "rotation": [-110, 0, 180], "uv": [31, 560], "mirror": true}, + {"origin": [13, -0.24603, 30.29206], "size": [5, 7, 129], "pivot": [15.5, 3.25397, 30.2921], "rotation": [-110, 0, 180], "uv": [31, 560]}, + {"origin": [14, 23.75906, 4.55558], "size": [3, 7, 69], "pivot": [15.5, 27.25906, 39.05558], "rotation": [-138, 0, 180], "uv": [13, 324]}, + {"origin": [-17, 23.75906, 4.55558], "size": [3, 7, 69], "pivot": [-15.5, 27.25906, 39.05558], "rotation": [-138, 0, 180], "uv": [119, 215]}, + {"origin": [-19, 8, -17], "size": [7, 121, 7], "uv": [140, 0]} + ] + }, + { + "name": "Crank", + "pivot": [0, 25.5, 88.3], + "cubes": [ + {"origin": [-27, 23, 85.8], "size": [54, 5, 5], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [0, 157]}, + {"origin": [-13, 21, 83.8], "size": [26, 9, 9], "pivot": [0, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [201, 102]}, + {"origin": [-25, 11, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [116, 69]}, + {"origin": [-25, 28, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [110, 69]}, + {"origin": [23, 11, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [62, 69]}, + {"origin": [23, 28, 87.8], "size": [2, 12, 1], "pivot": [0.5, 25.5, 88.3], "rotation": [45, 0, 0], "uv": [104, 69]}, + {"origin": [23, 11, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [58, 26]}, + {"origin": [23, 28, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [56, 69]}, + {"origin": [-25, 11, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [58, 0]}, + {"origin": [-25, 28, 87.8], "size": [2, 12, 1], "pivot": [24, 25.5, 88.3], "rotation": [137.5, 0, 0], "uv": [58, 13]} + ] + }, + { + "name": "Lever", + "pivot": [-8, 126, -14], + "cubes": [ + {"origin": [-11.7, 124, -45.9], "size": [23, 4, 4], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [56, 101]}, + {"origin": [-2.75, 121.4, 106.8], "size": [5, 8, 76], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [222, 311]}, + {"origin": [-4.75, 120.4, -50.2], "size": [9, 11, 90], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [340, 583]}, + {"origin": [-3.75, 121.4, 39.8], "size": [7, 9, 67], "pivot": [-8, 126, -14], "rotation": [90, 0, 0], "uv": [25, 227]}, + {"origin": [-0.75, 326, -9.7], "size": [1, 1, 3], "inflate": 0.2, "pivot": [-0.25, 326.5237, -9.28356], "rotation": [102.5, 0, 0], "uv": [16, 57]}, + {"origin": [-0.75, 323.94926, -11.32443], "size": [1, 1, 4], "inflate": 0.2, "pivot": [-0.25, 324.44926, -9.32443], "rotation": [82.5, 0, 0], "uv": [20, 57]} + ] + }, + { + "name": "CounterWeight", + "parent": "Lever", + "pivot": [-8.2, 95.99641, -13.89692], + "cubes": [ + {"origin": [8.8, 72, -16.9], "size": [2, 28, 6], "uv": [201, 0]}, + {"origin": [-11.2, 72, -16.9], "size": [2, 28, 6], "uv": [104, 109]}, + {"origin": [-11.2, 48, -38.9], "size": [22, 24, 4], "uv": [201, 166]}, + {"origin": [7.8, 32.1, -37.9], "size": [4, 40, 48], "uv": [201, 0]}, + {"origin": [-12.2, 32.1, -37.9], "size": [4, 40, 48], "uv": [0, 69]}, + {"origin": [-11.2, 48, 7.1], "size": [22, 24, 4], "uv": [138, 158]}, + {"origin": [-12.1, 49.73205, 7.8], "size": [23.8, 24, 4], "pivot": [-8.2, 49.73205, 10.1], "rotation": [120, 0, 0], "uv": [80, 0]}, + {"origin": [-11.5, 61.7, 12.054], "size": [23, 9, 4], "pivot": [-8.2, 38, 14.31539], "rotation": [90, 0, 0], "uv": [5, 44]}, + {"origin": [-8.2, 44.7, 40.31539], "size": [22, 43, 1], "pivot": [-8.2, 38, 14.31539], "rotation": [90, 0, 0], "uv": [0, 0]}, + {"origin": [-12.1, 49.73205, -39.6], "size": [23.8, 24, 4], "pivot": [-8.2, 49.73205, -37.9], "rotation": [-120, 0, 0], "uv": [80, 28]} + ] + }, + { + "name": "Rope_Projectile", + "parent": "Lever", + "pivot": [-8.25, 321.0872, -8.87572], + "rotation": [92.5, 0, 0], + "cubes": [ + {"origin": [-0.25, 315.0872, -137.87572], "size": [0, 2, 130], "pivot": [-8.2, 320.9872, 106.72428], "rotation": [-2.5, 0, 0], "uv": [222, 381]}, + {"origin": [-1.25, 316.0872, -137.87572], "size": [2, 0, 130], "pivot": [-8.2, 320.9872, 106.72428], "rotation": [-2.5, 0, 0], "uv": [179, 175]}, + {"origin": [-0.25, 325.02631, -137.48123], "size": [0, 2, 130], "pivot": [-8.2, 320.9872, 106.72428], "rotation": [3.5, 0, 0], "uv": [222, 381]}, + {"origin": [-1.25, 314.63912, -137.41784], "size": [2, 0, 130], "pivot": [-0.25, 316.04548, -85.81234], "rotation": [3.5, 0, 0], "uv": [178, 175]}, + {"origin": [-8.2, -317, 123.78511], "size": [16, 20, 16], "inflate": 0.3, "pivot": [-0.2, 142, 308.78511], "rotation": [-90, 0, 0], "uv": [387, 0]} + ] + }, + { + "name": "Cobblestone", + "parent": "Rope_Projectile", + "pivot": [-8.25, 321.0872, -8.87572], + "cubes": [ + {"origin": [-8.25, 311.0872, -149.87572], "size": [16, 16, 16], "uv": [0, 225]} + ] + }, + { + "name": "Rope_Lever", + "pivot": [-8.25, 26.66803, 103.76811], + "rotation": [90, 0, 0] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/lang/en_us.json b/src/main/resources/assets/siegemachines/lang/en_us.json new file mode 100644 index 0000000..06a8f5f --- /dev/null +++ b/src/main/resources/assets/siegemachines/lang/en_us.json @@ -0,0 +1,38 @@ +{ + "item.siegemachines.mortar": "Mortar", + "item.siegemachines.culverin": "Culverin", + "item.siegemachines.trebuchet": "Trebuchet", + "item.siegemachines.catapult": "Catapult", + "item.siegemachines.ballista": "Ballista", + "item.siegemachines.battering_ram": "Battering Ram", + "item.siegemachines.cannonball": "Cannonball", + "item.siegemachines.giant_arrow": "Giant Arrow", + "item.siegemachines.stone": "Stone", + + "entity.siegemachines.mortar": "Mortar", + "entity.siegemachines.culverin": "Culverin", + "entity.siegemachines.trebuchet": "Trebuchet", + "entity.siegemachines.catapult": "Catapult", + "entity.siegemachines.ballista": "Ballista", + "entity.siegemachines.battering_ram": "Battering Ram", + + "item.siegemachines.turret_base": "Turret Base", + "item.siegemachines.beam": "Beam", + "item.siegemachines.counterweight": "Counterweight", + "item.siegemachines.barrel": "Barrel", + "item.siegemachines.wheel": "Wheel", + + "block.siegemachines.siege_workbench": "Siege Workbench", + + "itemGroup.siegemachines.medieval_siege_machines": "Medieval Siege Machines", + + "siegemachines.uses_gunpowder": "Uses Gunpowder", + "siegemachines.ammo": "Ammo:", + "siegemachines.category": "Medieval Siege Machines", + "siegemachines.machine_use": "Use Machine", + "siegemachines.machine_inventory": "Open Inventory", + "siegemachines.no_ammo": "No ammo!", + "siegemachines.no_gunpowder": "No gunpowder!", + + "category.siegemachines.siege_workbench_crafting": "Crafting" +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/lang/ru_ru.json b/src/main/resources/assets/siegemachines/lang/ru_ru.json new file mode 100644 index 0000000..3ff6f42 --- /dev/null +++ b/src/main/resources/assets/siegemachines/lang/ru_ru.json @@ -0,0 +1,36 @@ +{ + "item.siegemachines.mortar": "Мортира", + "item.siegemachines.culverin": "Кулеврина", + "item.siegemachines.trebuchet": "Требушет", + "item.siegemachines.catapult": "Катапульта", + "item.siegemachines.ballista": "Баллиста", + "item.siegemachines.battering_ram": "Таран", + "item.siegemachines.cannonball": "Пушечное ядро", + "item.siegemachines.giant_arrow": "Гигантская стрела", + "item.siegemachines.stone": "Валун", + + "entity.siegemachines.mortar": "Мортира", + "entity.siegemachines.culverin": "Кулеврина", + "entity.siegemachines.trebuchet": "Требушет", + "entity.siegemachines.catapult": "Катапульта", + "entity.siegemachines.ballista": "Баллиста", + "entity.siegemachines.battering_ram": "Таран", + + "item.siegemachines.turret_base": "Рама", + "item.siegemachines.beam": "Балка", + "item.siegemachines.counterweight": "Противовес", + "item.siegemachines.barrel": "Ствол", + "item.siegemachines.wheel": "Колесо", + + "block.siegemachines.siege_workbench": "Осадный верстак", + + "siegemachines.uses_gunpowder": "Требуется порох", + "siegemachines.ammo": "Боеприпасы:", + "siegemachines.category": "Medieval Siege Machines", + "siegemachines.machine_use": "Использовать машину", + "siegemachines.machine_inventory": "Открыть инвентарь", + "siegemachines.no_ammo": "Нет боеприпасов!", + "siegemachines.no_gunpowder":"Нет пороха!", + + "category.siegemachines.siege_workbench_crafting": "Крафт" +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/block/crafting_table.json b/src/main/resources/assets/siegemachines/models/block/crafting_table.json new file mode 100644 index 0000000..50ec456 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/block/crafting_table.json @@ -0,0 +1,12 @@ +{ + "parent": "siegemachines:block/cube", + "textures": { + "particle": "siegemachines:block/siege_workbench_front", + "north": "siegemachines:block/siege_workbench_front", + "south": "siegemachines:block/siege_workbench_side", + "east": "siegemachines:block/siege_workbench_side", + "west": "siegemachines:block/siege_workbench_front", + "up": "siegemachines:block/siege_workbench_top", + "down": "siegemachines:block/siege_workbench_bottom" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/block/siege_workbench.json b/src/main/resources/assets/siegemachines/models/block/siege_workbench.json new file mode 100644 index 0000000..9cb47f2 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/block/siege_workbench.json @@ -0,0 +1,12 @@ +{ + "parent": "minecraft:block/cube", + "textures": { + "particle": "siegemachines:block/siege_workbench_front", + "north": "siegemachines:block/siege_workbench_front", + "south": "siegemachines:block/siege_workbench_side", + "east": "siegemachines:block/siege_workbench_side", + "west": "siegemachines:block/siege_workbench_front", + "up": "siegemachines:block/siege_workbench_top", + "down": "siegemachines:block/siege_workbench_bottom" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/ballista.json b/src/main/resources/assets/siegemachines/models/item/ballista.json new file mode 100644 index 0000000..fcf8cc3 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/ballista.json @@ -0,0 +1,75 @@ +{ + "credit": "Made with Blockbench", + "gui_light": "side", + "parent": "builtin/entity", + "texture_size": [ + 128, + 128 + ], + "display": { + "thirdperson_righthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "thirdperson_lefthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "firstperson_righthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "firstperson_lefthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "ground": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "gui": { + "rotation": [ + 29, + 126, + 0 + ], + "translation": [ + -1.75, + -5, + 0 + ], + "scale": [ + 0.35, + 0.35, + 0.35 + ] + }, + "fixed": { + "translation": [ + 0, + -3, + 0 + ], + "scale": [ + 0.3, + 0.3, + 0.3 + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/barrel.json b/src/main/resources/assets/siegemachines/models/item/barrel.json new file mode 100644 index 0000000..be7c5a8 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/barrel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "siegemachines:item/barrel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/battering_ram.json b/src/main/resources/assets/siegemachines/models/item/battering_ram.json new file mode 100644 index 0000000..713f8ad --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/battering_ram.json @@ -0,0 +1,79 @@ +{ + "credit": "Made with Blockbench", + "parent": "builtin/entity", + "texture_size": [ + 512, + 512 + ], + "display": { + "thirdperson_righthand": { + "scale": [ + 0.1, + 0.1, + 0.1 + ] + }, + "thirdperson_lefthand": { + "scale": [ + 0.1, + 0.1, + 0.1 + ] + }, + "firstperson_righthand": { + "scale": [ + 0.1, + 0.1, + 0.1 + ] + }, + "firstperson_lefthand": { + "scale": [ + 0.1, + 0.1, + 0.1 + ] + }, + "ground": { + "scale": [ + 0.1, + 0.1, + 0.1 + ] + }, + "gui": { + "rotation": [ + 29, + 126, + 0 + ], + "translation": [ + 0.25, + -4, + 0 + ], + "scale": [ + 0.155, + 0.155, + 0.155 + ] + }, + "fixed": { + "rotation": [ + 0, + 90, + 0 + ], + "translation": [ + 0, + -3, + -2.25 + ], + "scale": [ + 0.1, + 0.1, + 0.1 + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/beam.json b/src/main/resources/assets/siegemachines/models/item/beam.json new file mode 100644 index 0000000..29bd83c --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/beam.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "siegemachines:item/beam" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/cannonball.json b/src/main/resources/assets/siegemachines/models/item/cannonball.json new file mode 100644 index 0000000..ce89e66 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/cannonball.json @@ -0,0 +1,39 @@ +{ + "credit": "Made with Blockbench", + "gui_light": "side", + "textures": { + "0": "siegemachines:entity/cannonball", + "particle": "siegemachines:entity/cannonball" + }, + "elements": [ + { + "from": [4, 4, 4], + "to": [12, 12, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "east": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "south": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "west": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [18, 0, 0], + "translation": [0, 0, -1.5] + }, + "thirdperson_lefthand": { + "rotation": [18, 0, 0], + "translation": [0, 0, -1.5] + }, + "ground": { + "scale": [0.6, 0.6, 0.6] + }, + "gui": { + "rotation": [45, -45, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/catapult.json b/src/main/resources/assets/siegemachines/models/item/catapult.json new file mode 100644 index 0000000..09603e0 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/catapult.json @@ -0,0 +1,75 @@ +{ + "credit": "Made with Blockbench", + "parent": "builtin/entity", + "gui_light": "side", + "texture_size": [ + 256, + 256 + ], + "display": { + "thirdperson_righthand": { + "scale": [ + 0.15, + 0.15, + 0.15 + ] + }, + "thirdperson_lefthand": { + "scale": [ + 0.15, + 0.15, + 0.15 + ] + }, + "firstperson_righthand": { + "scale": [ + 0.15, + 0.15, + 0.15 + ] + }, + "firstperson_lefthand": { + "scale": [ + 0.15, + 0.15, + 0.15 + ] + }, + "ground": { + "scale": [ + 0.15, + 0.15, + 0.15 + ] + }, + "gui": { + "rotation": [ + 29, + 126, + 0 + ], + "translation": [ + -1, + -3.25, + 0 + ], + "scale": [ + 0.18, + 0.18, + 0.18 + ] + }, + "fixed": { + "translation": [ + 0, + -3, + -2 + ], + "scale": [ + 0.15, + 0.15, + 0.15 + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/counterweight.json b/src/main/resources/assets/siegemachines/models/item/counterweight.json new file mode 100644 index 0000000..43d60d0 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/counterweight.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "siegemachines:item/counterweight" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/culverine.json b/src/main/resources/assets/siegemachines/models/item/culverine.json new file mode 100644 index 0000000..b0fda69 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/culverine.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "siegemachines:items/culverine" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/giant_arrow.json b/src/main/resources/assets/siegemachines/models/item/giant_arrow.json new file mode 100644 index 0000000..8f4325f --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/giant_arrow.json @@ -0,0 +1,103 @@ +{ + "credit": "Made with Blockbench", + "gui_light": "front", + "texture_size": [64, 64], + "textures": { + "0": "siegemachines:entity/giant_arrow" + }, + "elements": [ + { + "from": [5.5, 8, -10], + "to": [10.5, 8, 24], + "rotation": {"angle": 45, "axis": "z", "origin": [8, 8, 4]}, + "faces": { + "north": {"uv": [0, 8.5, 1.25, 8.5], "texture": "#0"}, + "east": {"uv": [-8.5, 8.5, 0, 8.5], "texture": "#0"}, + "south": {"uv": [9.75, 8.5, 11, 8.5], "texture": "#0"}, + "west": {"uv": [1.25, 8.5, 9.75, 8.5], "texture": "#0"}, + "up": {"uv": [1.25, 8.5, 0, 0], "texture": "#0"}, + "down": {"uv": [2.5, 0, 1.25, 8.5], "texture": "#0"} + } + }, + { + "from": [5.5, 8, -10], + "to": [10.5, 8, 24], + "rotation": {"angle": -45, "axis": "z", "origin": [8, 8, 4]}, + "faces": { + "north": {"uv": [0, 8.5, 1.25, 8.5], "texture": "#0"}, + "east": {"uv": [-8.5, 8.5, 0, 8.5], "texture": "#0"}, + "south": {"uv": [9.75, 8.5, 11, 8.5], "texture": "#0"}, + "west": {"uv": [1.25, 8.5, 9.75, 8.5], "texture": "#0"}, + "up": {"uv": [1.25, 8.5, 0, 0], "texture": "#0"}, + "down": {"uv": [2.5, 0, 1.25, 8.5], "texture": "#0"} + } + }, + { + "from": [6, 8, -13], + "to": [10, 8, -9], + "rotation": {"angle": 45, "axis": "z", "origin": [8, 8, 1]}, + "faces": { + "north": {"uv": [2.75, 1, 3.75, 1], "texture": "#0"}, + "east": {"uv": [1.75, 1, 2.75, 1], "texture": "#0"}, + "south": {"uv": [4.75, 1, 5.75, 1], "texture": "#0"}, + "west": {"uv": [3.75, 1, 4.75, 1], "texture": "#0"}, + "up": {"uv": [3.75, 1, 2.75, 0], "texture": "#0"}, + "down": {"uv": [4.75, 0, 3.75, 1], "texture": "#0"} + } + }, + { + "from": [6, 8, -13], + "to": [10, 8, -9], + "rotation": {"angle": -45, "axis": "z", "origin": [8, 8, 1]}, + "faces": { + "north": {"uv": [4.75, 1, 5.75, 1], "texture": "#0"}, + "east": {"uv": [3.75, 1, 4.75, 1], "texture": "#0"}, + "south": {"uv": [6.75, 1, 7.75, 1], "texture": "#0"}, + "west": {"uv": [5.75, 1, 6.75, 1], "texture": "#0"}, + "up": {"uv": [5.75, 1, 4.75, 0], "texture": "#0"}, + "down": {"uv": [6.75, 0, 5.75, 1], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [90, 0, 0], + "translation": [0, 0, 1] + }, + "thirdperson_lefthand": { + "rotation": [90, 0, 0], + "translation": [0, 0, 1] + }, + "firstperson_righthand": { + "rotation": [60, 0, 0] + }, + "firstperson_lefthand": { + "rotation": [60, 0, 0] + }, + "ground": { + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "rotation": [90, -45, -45], + "translation": [-0.75, -1, 0], + "scale": [0.6, 0.6, 0.6] + }, + "head": { + "rotation": [-180, 0, 0], + "translation": [0, 4.25, -11.75] + }, + "fixed": { + "rotation": [-180, 0, 0], + "translation": [0, 0, -37.25], + "scale": [2, 2, 2] + } + }, + "groups": [ + { + "name": "GiantArrow", + "origin": [0, 0, 4], + "color": 0, + "children": [0, 1, 2, 3] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/mortar.json b/src/main/resources/assets/siegemachines/models/item/mortar.json new file mode 100644 index 0000000..015a084 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/mortar.json @@ -0,0 +1,75 @@ +{ + "credit": "Made with Blockbench", + "parent": "builtin/entity", + "gui_light": "side", + "texture_size": [ + 128, + 128 + ], + "display": { + "thirdperson_righthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "thirdperson_lefthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "firstperson_righthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "firstperson_lefthand": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "ground": { + "scale": [ + 0.3, + 0.3, + 0.3 + ] + }, + "gui": { + "rotation": [ + 29, + 126, + 0 + ], + "translation": [ + 1.25, + -2.75, + 0 + ], + "scale": [ + 0.35, + 0.35, + 0.35 + ] + }, + "fixed": { + "translation": [ + 0, + -3, + 0 + ], + "scale": [ + 0.3, + 0.3, + 0.3 + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/siege_workbench.json b/src/main/resources/assets/siegemachines/models/item/siege_workbench.json new file mode 100644 index 0000000..87dedab --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/siege_workbench.json @@ -0,0 +1,3 @@ +{ + "parent": "siegemachines:block/siege_workbench" +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/stone.json b/src/main/resources/assets/siegemachines/models/item/stone.json new file mode 100644 index 0000000..23fa58f --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/stone.json @@ -0,0 +1,53 @@ +{ + "credit": "Made with Blockbench", + "gui_light": "side", + "textures": { + "0": "siegemachines:entity/stone", + "particle": "siegemachines:entity/stone" + }, + "elements": [ + { + "from": [-2, -2, -2], + "to": [18, 18, 18], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [18, 0, 0], + "translation": [-6, 5, 1], + "scale": [0.7, 0.7, 0.7] + }, + "thirdperson_lefthand": { + "rotation": [18, 0, 0], + "translation": [-6, 5, 1], + "scale": [0.7, 0.7, 0.7] + }, + "firstperson_righthand": { + "translation": [-9, 0, 0], + "scale": [0.7, 0.7, 0.7] + }, + "firstperson_lefthand": { + "translation": [-9, 0, 0], + "scale": [0.7, 0.7, 0.7] + }, + "ground": { + "scale": [0.3, 0.3, 0.3] + }, + "gui": { + "rotation": [45, -45, 0], + "scale": [0.5, 0.5, 0.5] + }, + "fixed": { + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/trebuchet.json b/src/main/resources/assets/siegemachines/models/item/trebuchet.json new file mode 100644 index 0000000..8c4f0cf --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/trebuchet.json @@ -0,0 +1,75 @@ +{ + "credit": "Made with Blockbench", + "parent": "builtin/entity", + "gui_light": "side", + "texture_size": [ + 1024, + 1024 + ], + "display": { + "thirdperson_righthand": { + "scale": [ + 0.05, + 0.05, + 0.05 + ] + }, + "thirdperson_lefthand": { + "scale": [ + 0.05, + 0.05, + 0.05 + ] + }, + "firstperson_righthand": { + "scale": [ + 0.05, + 0.05, + 0.05 + ] + }, + "firstperson_lefthand": { + "scale": [ + 0.05, + 0.05, + 0.05 + ] + }, + "ground": { + "scale": [ + 0.05, + 0.05, + 0.05 + ] + }, + "gui": { + "rotation": [ + 29, + 126, + 0 + ], + "translation": [ + -0.75, + -6.75, + 0 + ], + "scale": [ + 0.055, + 0.055, + 0.055 + ] + }, + "fixed": { + "translation": [ + 0, + -5.5, + -2 + ], + "scale": [ + 0.05, + 0.05, + 0.05 + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/turret_base.json b/src/main/resources/assets/siegemachines/models/item/turret_base.json new file mode 100644 index 0000000..9f870c5 --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/turret_base.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "siegemachines:item/turret_base" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/models/item/wheel.json b/src/main/resources/assets/siegemachines/models/item/wheel.json new file mode 100644 index 0000000..6120f6e --- /dev/null +++ b/src/main/resources/assets/siegemachines/models/item/wheel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "siegemachines:item/wheel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/sounds.json b/src/main/resources/assets/siegemachines/sounds.json new file mode 100644 index 0000000..a15263f --- /dev/null +++ b/src/main/resources/assets/siegemachines/sounds.json @@ -0,0 +1,197 @@ +{ + "trebuchet_shooting": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:trebuchet_shooting", + "stream": true + } + ] + }, + "trebuchet_reloading": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:trebuchet_reloading_1", + "stream": true + }, + { + "name": "siegemachines:trebuchet_reloading_2", + "stream": true + }, + { + "name": "siegemachines:trebuchet_reloading_3", + "stream": true + }, + { + "name": "siegemachines:trebuchet_reloading_4", + "stream": true + }, + { + "name": "siegemachines:trebuchet_reloading_5", + "stream": true + }, + { + "name": "siegemachines:trebuchet_reloading_6", + "stream": true + } + ] + }, + "catapult_shooting": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:catapult_shooting_0", + "stream": true + }, + { + "name": "siegemachines:catapult_shooting_1", + "stream": true + } + ] + }, + "catapult_reloading": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:catapult_reloading_0", + "stream": true + }, + { + "name": "siegemachines:catapult_reloading_1", + "stream": true + }, + { + "name": "siegemachines:catapult_reloading_2", + "stream": true + }, + { + "name": "siegemachines:catapult_reloading_3", + "stream": true + }, + { + "name": "siegemachines:catapult_reloading_4", + "stream": true + }, + { + "name": "siegemachines:catapult_reloading_5", + "stream": true + } + ] + }, + "ballista_shooting": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:ballista_shooting_0", + "stream": true + }, + { + "name": "siegemachines:ballista_shooting_1", + "stream": true + }, + { + "name": "siegemachines:ballista_shooting_2", + "stream": true + }, + { + "name": "siegemachines:ballista_shooting_3", + "stream": true + }, + { + "name": "siegemachines:ballista_shooting_4", + "stream": true + } + ] + }, + "ballista_reloading": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:ballista_reloading_0", + "stream": true + }, + { + "name": "siegemachines:ballista_reloading_1", + "stream": true + }, + { + "name": "siegemachines:ballista_reloading_2", + "stream": true + }, + { + "name": "siegemachines:ballista_reloading_3", + "stream": true + } + ] + }, + "mortar_shooting": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:mortar_shooting", + "stream": true + } + ] + }, + "fuse": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:fuse", + "stream": true + } + ] + }, + "cannon_wheels": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:cannon_wheels_0", + "stream": true + }, + { + "name": "siegemachines:cannon_wheels_1", + "stream": true + }, + { + "name": "siegemachines:cannon_wheels_2", + "stream": true + }, + { + "name": "siegemachines:cannon_wheels_3", + "stream": true + } + ] + }, + "ram_wheels": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:ram_wheels_0", + "stream": true + }, + { + "name": "siegemachines:ram_wheels_1", + "stream": true + }, + { + "name": "siegemachines:ram_wheels_2", + "stream": true + }, + { + "name": "siegemachines:ram_wheels_3", + "stream": true + } + ] + }, + "ram_hitting": { + "category": "record", + "sounds": [ + { + "name": "siegemachines:ram_hitting", + "stream": true + } + ] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_reloading_0.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_0.ogg new file mode 100644 index 0000000..d887b1f Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_0.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_reloading_1.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_1.ogg new file mode 100644 index 0000000..8b45d97 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_reloading_2.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_2.ogg new file mode 100644 index 0000000..bc44ace Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_2.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_reloading_3.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_3.ogg new file mode 100644 index 0000000..81e2f99 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_reloading_3.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_shooting_0.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_0.ogg new file mode 100644 index 0000000..297f8ef Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_0.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_shooting_1.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_1.ogg new file mode 100644 index 0000000..f6a45c7 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_shooting_2.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_2.ogg new file mode 100644 index 0000000..47d76e5 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_2.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_shooting_3.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_3.ogg new file mode 100644 index 0000000..9f45860 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_3.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ballista_shooting_4.ogg b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_4.ogg new file mode 100644 index 0000000..71040a7 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ballista_shooting_4.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/cannon_wheels_0.ogg b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_0.ogg new file mode 100644 index 0000000..1a18e97 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_0.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/cannon_wheels_1.ogg b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_1.ogg new file mode 100644 index 0000000..fbdcfbd Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/cannon_wheels_2.ogg b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_2.ogg new file mode 100644 index 0000000..7907d9b Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_2.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/cannon_wheels_3.ogg b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_3.ogg new file mode 100644 index 0000000..fa69091 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/cannon_wheels_3.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_reloading_0.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_0.ogg new file mode 100644 index 0000000..85e78e6 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_0.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_reloading_1.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_1.ogg new file mode 100644 index 0000000..edbd06c Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_reloading_2.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_2.ogg new file mode 100644 index 0000000..974c0c3 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_2.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_reloading_3.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_3.ogg new file mode 100644 index 0000000..86726f2 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_3.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_reloading_4.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_4.ogg new file mode 100644 index 0000000..e8e4897 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_4.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_reloading_5.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_5.ogg new file mode 100644 index 0000000..b8b438e Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_reloading_5.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_shooting_0.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_shooting_0.ogg new file mode 100644 index 0000000..0b72fb4 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_shooting_0.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/catapult_shooting_1.ogg b/src/main/resources/assets/siegemachines/sounds/catapult_shooting_1.ogg new file mode 100644 index 0000000..f93b05e Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/catapult_shooting_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/fuse.ogg b/src/main/resources/assets/siegemachines/sounds/fuse.ogg new file mode 100644 index 0000000..ca9818a Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/fuse.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/mortar_shooting.ogg b/src/main/resources/assets/siegemachines/sounds/mortar_shooting.ogg new file mode 100644 index 0000000..7cc148b Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/mortar_shooting.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ram_hitting.ogg b/src/main/resources/assets/siegemachines/sounds/ram_hitting.ogg new file mode 100644 index 0000000..8614d50 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ram_hitting.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ram_wheels_0.ogg b/src/main/resources/assets/siegemachines/sounds/ram_wheels_0.ogg new file mode 100644 index 0000000..1a18e97 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ram_wheels_0.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ram_wheels_1.ogg b/src/main/resources/assets/siegemachines/sounds/ram_wheels_1.ogg new file mode 100644 index 0000000..fbdcfbd Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ram_wheels_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ram_wheels_2.ogg b/src/main/resources/assets/siegemachines/sounds/ram_wheels_2.ogg new file mode 100644 index 0000000..7907d9b Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ram_wheels_2.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/ram_wheels_3.ogg b/src/main/resources/assets/siegemachines/sounds/ram_wheels_3.ogg new file mode 100644 index 0000000..fa69091 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/ram_wheels_3.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_1.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_1.ogg new file mode 100644 index 0000000..dd9438c Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_1.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_2.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_2.ogg new file mode 100644 index 0000000..ab343f7 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_2.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_3.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_3.ogg new file mode 100644 index 0000000..85d22c7 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_3.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_4.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_4.ogg new file mode 100644 index 0000000..1579729 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_4.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_5.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_5.ogg new file mode 100644 index 0000000..f234909 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_5.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_6.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_6.ogg new file mode 100644 index 0000000..0820edd Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_reloading_6.ogg differ diff --git a/src/main/resources/assets/siegemachines/sounds/trebuchet_shooting.ogg b/src/main/resources/assets/siegemachines/sounds/trebuchet_shooting.ogg new file mode 100644 index 0000000..fea1490 Binary files /dev/null and b/src/main/resources/assets/siegemachines/sounds/trebuchet_shooting.ogg differ diff --git a/src/main/resources/assets/siegemachines/textures/block/siege_workbench_bottom.png b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_bottom.png new file mode 100644 index 0000000..bc899fb Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_bottom.png differ diff --git a/src/main/resources/assets/siegemachines/textures/block/siege_workbench_front.png b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_front.png new file mode 100644 index 0000000..489c288 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_front.png differ diff --git a/src/main/resources/assets/siegemachines/textures/block/siege_workbench_side.png b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_side.png new file mode 100644 index 0000000..489c288 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_side.png differ diff --git a/src/main/resources/assets/siegemachines/textures/block/siege_workbench_top.png b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_top.png new file mode 100644 index 0000000..5ab880e Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/block/siege_workbench_top.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/ballista.png b/src/main/resources/assets/siegemachines/textures/entity/ballista.png new file mode 100644 index 0000000..91199e1 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/ballista.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/battering_ram.png b/src/main/resources/assets/siegemachines/textures/entity/battering_ram.png new file mode 100644 index 0000000..aeb3b1e Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/battering_ram.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/cannonball.png b/src/main/resources/assets/siegemachines/textures/entity/cannonball.png new file mode 100644 index 0000000..8e8c505 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/cannonball.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/catapult.png b/src/main/resources/assets/siegemachines/textures/entity/catapult.png new file mode 100644 index 0000000..9f27664 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/catapult.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/giant_arrow.png b/src/main/resources/assets/siegemachines/textures/entity/giant_arrow.png new file mode 100644 index 0000000..cdd30c1 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/giant_arrow.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/mortar.png b/src/main/resources/assets/siegemachines/textures/entity/mortar.png new file mode 100644 index 0000000..fa5f319 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/mortar.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/stone.png b/src/main/resources/assets/siegemachines/textures/entity/stone.png new file mode 100644 index 0000000..80fa3a8 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/stone.png differ diff --git a/src/main/resources/assets/siegemachines/textures/entity/trebuchet.png b/src/main/resources/assets/siegemachines/textures/entity/trebuchet.png new file mode 100644 index 0000000..4ee48b9 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/entity/trebuchet.png differ diff --git a/src/main/resources/assets/siegemachines/textures/gui/crosshairs.png b/src/main/resources/assets/siegemachines/textures/gui/crosshairs.png new file mode 100644 index 0000000..5e14b29 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/gui/crosshairs.png differ diff --git a/src/main/resources/assets/siegemachines/textures/gui/machine_inventory.png b/src/main/resources/assets/siegemachines/textures/gui/machine_inventory.png new file mode 100644 index 0000000..e71670e Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/gui/machine_inventory.png differ diff --git a/src/main/resources/assets/siegemachines/textures/gui/siege_workbench.png b/src/main/resources/assets/siegemachines/textures/gui/siege_workbench.png new file mode 100644 index 0000000..740cb89 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/gui/siege_workbench.png differ diff --git a/src/main/resources/assets/siegemachines/textures/item/barrel.png b/src/main/resources/assets/siegemachines/textures/item/barrel.png new file mode 100644 index 0000000..32e1727 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/item/barrel.png differ diff --git a/src/main/resources/assets/siegemachines/textures/item/beam.png b/src/main/resources/assets/siegemachines/textures/item/beam.png new file mode 100644 index 0000000..7733931 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/item/beam.png differ diff --git a/src/main/resources/assets/siegemachines/textures/item/counterweight.png b/src/main/resources/assets/siegemachines/textures/item/counterweight.png new file mode 100644 index 0000000..d9e7927 Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/item/counterweight.png differ diff --git a/src/main/resources/assets/siegemachines/textures/item/turret_base.png b/src/main/resources/assets/siegemachines/textures/item/turret_base.png new file mode 100644 index 0000000..efd0d4c Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/item/turret_base.png differ diff --git a/src/main/resources/assets/siegemachines/textures/item/wheel.png b/src/main/resources/assets/siegemachines/textures/item/wheel.png new file mode 100644 index 0000000..aaa767b Binary files /dev/null and b/src/main/resources/assets/siegemachines/textures/item/wheel.png differ diff --git a/src/main/resources/data/minecraft/tags/entity_types/arrows.json b/src/main/resources/data/minecraft/tags/entity_types/arrows.json new file mode 100644 index 0000000..f5c24db --- /dev/null +++ b/src/main/resources/data/minecraft/tags/entity_types/arrows.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "siegemachines:giant_arrow" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/advancements/siegemachines.json b/src/main/resources/data/siegemachines/advancements/siegemachines.json new file mode 100644 index 0000000..7ea7338 --- /dev/null +++ b/src/main/resources/data/siegemachines/advancements/siegemachines.json @@ -0,0 +1,27 @@ +{ + "display": { + "icon": { + "item": "siegemachines:siege_workbench" + }, + "title": "Medieval Siege Machines", + "description": "Learn full power of the STRONGEST weapon!", + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "background": "siegemachines:textures/block/siege_workbench_bottom.png" + }, + "criteria": { + "requirement": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "siegemachines:siege_workbench" + ] + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/ballista.json b/src/main/resources/data/siegemachines/recipes/ballista.json new file mode 100644 index 0000000..fb4e153 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/ballista.json @@ -0,0 +1,42 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + " bs", + "pBi", + "lr " + ], + "key": { + "B": { + "item": "siegemachines:turret_base", + "count": 5 + }, + "b": { + "item": "siegemachines:beam", + "count": 8 + }, + "p": { + "tag": "minecraft:planks", + "count": 2 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 8 + }, + "s": { + "item": "minecraft:string", + "count": 3 + }, + "l": { + "item": "minecraft:leather", + "count": 1 + }, + "r": { + "tag": "forge:rods/wooden", + "count": 4 + } + }, + "result": { + "item": "siegemachines:ballista", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/barrel.json b/src/main/resources/data/siegemachines/recipes/barrel.json new file mode 100644 index 0000000..cc39b51 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/barrel.json @@ -0,0 +1,26 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "i i", + "ioi", + " s " + ], + "key": { + "s": { + "item": "minecraft:string", + "count": 1 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 2 + }, + "o": { + "tag": "forge:ingots/iron", + "count": 1 + } + }, + "result": { + "item": "siegemachines:barrel", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/battering_ram.json b/src/main/resources/data/siegemachines/recipes/battering_ram.json new file mode 100644 index 0000000..9e75859 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/battering_ram.json @@ -0,0 +1,42 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + " bs", + "pBi", + "lw " + ], + "key": { + "s": { + "item": "minecraft:string", + "count": 12 + }, + "B": { + "item": "siegemachines:turret_base", + "count": 12 + }, + "b": { + "item": "siegemachines:beam", + "count": 22 + }, + "p": { + "tag": "minecraft:planks", + "count": 16 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 8 + }, + "l": { + "item": "minecraft:leather", + "count": 4 + }, + "w": { + "item": "siegemachines:wheel", + "count": 6 + } + }, + "result": { + "item": "siegemachines:battering_ram", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/beam.json b/src/main/resources/data/siegemachines/recipes/beam.json new file mode 100644 index 0000000..303ff57 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/beam.json @@ -0,0 +1,16 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "p" + ], + "key": { + "p": { + "tag": "minecraft:planks", + "count": 2 + } + }, + "result": { + "item": "siegemachines:beam", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/cannonball.json b/src/main/resources/data/siegemachines/recipes/cannonball.json new file mode 100644 index 0000000..42b69b9 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/cannonball.json @@ -0,0 +1,16 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "i" + ], + "key": { + "i": { + "tag": "forge:ingots/iron", + "count": 2 + } + }, + "result": { + "item": "siegemachines:cannonball", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/catapult.json b/src/main/resources/data/siegemachines/recipes/catapult.json new file mode 100644 index 0000000..19a2471 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/catapult.json @@ -0,0 +1,42 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + " bs", + "pBi", + "lr " + ], + "key": { + "B": { + "item": "siegemachines:turret_base", + "count": 10 + }, + "b": { + "item": "siegemachines:beam", + "count": 18 + }, + "p": { + "tag": "minecraft:planks", + "count": 12 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 14 + }, + "s": { + "item": "minecraft:string", + "count": 5 + }, + "l": { + "item": "minecraft:leather", + "count": 6 + }, + "r": { + "tag": "forge:rods/wooden", + "count": 6 + } + }, + "result": { + "item": "siegemachines:catapult", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/counterweight.json b/src/main/resources/data/siegemachines/recipes/counterweight.json new file mode 100644 index 0000000..362521d --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/counterweight.json @@ -0,0 +1,25 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "bsb", + "ibi" + ], + "key": { + "b": { + "item": "siegemachines:beam", + "count": 3 + }, + "s": { + "item": "minecraft:cobblestone", + "count": 4 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 2 + } + }, + "result": { + "item": "siegemachines:counterweight", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/giant_arrow.json b/src/main/resources/data/siegemachines/recipes/giant_arrow.json new file mode 100644 index 0000000..f552625 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/giant_arrow.json @@ -0,0 +1,26 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "i", + "s", + "f" + ], + "key": { + "i": { + "tag": "forge:ingots/iron", + "count": 1 + }, + "s": { + "tag": "forge:rods/wooden", + "count": 2 + }, + "f": { + "item": "minecraft:feather", + "count": 2 + } + }, + "result": { + "item": "siegemachines:giant_arrow", + "count": 4 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/mortar.json b/src/main/resources/data/siegemachines/recipes/mortar.json new file mode 100644 index 0000000..439a8b3 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/mortar.json @@ -0,0 +1,42 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "mb ", + "pBi", + "lw " + ], + "key": { + "m": { + "item": "siegemachines:barrel", + "count": 1 + }, + "B": { + "item": "siegemachines:turret_base", + "count": 4 + }, + "b": { + "item": "siegemachines:beam", + "count": 10 + }, + "p": { + "tag": "minecraft:planks", + "count": 1 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 12 + }, + "l": { + "item": "minecraft:leather", + "count": 2 + }, + "w": { + "item": "siegemachines:wheel", + "count": 2 + } + }, + "result": { + "item": "siegemachines:mortar", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/siege_workbench.json b/src/main/resources/data/siegemachines/recipes/siege_workbench.json new file mode 100644 index 0000000..e34f6d2 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/siege_workbench.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " c ", + "iti", + "ppp" + ], + "key": { + "c": { + "item": "minecraft:compass" + }, + "p": { + "tag": "minecraft:planks" + }, + "t": { + "item": "minecraft:crafting_table" + }, + "i": { + "tag": "forge:ingots/iron" + } + }, + "result": { + "item": "siegemachines:siege_workbench", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/trebuchet.json b/src/main/resources/data/siegemachines/recipes/trebuchet.json new file mode 100644 index 0000000..2b4ad7a --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/trebuchet.json @@ -0,0 +1,46 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "cbs", + "pBi", + "lr " + ], + "key": { + "B": { + "item": "siegemachines:turret_base", + "count": 16 + }, + "b": { + "item": "siegemachines:beam", + "count": 32 + }, + "p": { + "tag": "minecraft:planks", + "count": 24 + }, + "c": { + "item": "siegemachines:counterweight", + "count": 1 + }, + "i": { + "tag": "forge:ingots/iron", + "count": 32 + }, + "s": { + "item": "minecraft:string", + "count": 8 + }, + "l": { + "item": "minecraft:leather", + "count": 8 + }, + "r": { + "tag": "forge:rods/wooden", + "count": 16 + } + }, + "result": { + "item": "siegemachines:trebuchet", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/turret_base.json b/src/main/resources/data/siegemachines/recipes/turret_base.json new file mode 100644 index 0000000..78540a3 --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/turret_base.json @@ -0,0 +1,20 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + "bp" + ], + "key": { + "b": { + "item": "siegemachines:beam", + "count": 2 + }, + "p": { + "tag": "minecraft:planks", + "count": 2 + } + }, + "result": { + "item": "siegemachines:turret_base", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/siegemachines/recipes/wheel.json b/src/main/resources/data/siegemachines/recipes/wheel.json new file mode 100644 index 0000000..346db5d --- /dev/null +++ b/src/main/resources/data/siegemachines/recipes/wheel.json @@ -0,0 +1,22 @@ +{ + "type": "siegemachines:siege_workbench", + "pattern": [ + " b ", + "bob", + " b " + ], + "key": { + "b": { + "item": "siegemachines:beam", + "count": 1 + }, + "o": { + "tag": "forge:rods/wooden", + "count": 8 + } + }, + "result": { + "item": "siegemachines:wheel", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..4bc6cf6 --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,8 @@ +{ + "pack": { + "description": "resources of Medieval Siege Machines Mod", + "pack_format": 9, + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 + } +}