diff --git a/.gitignore b/.gitignore
index 05de45421..68123f687 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
-/build/build
-/build/.gradle
+build/build/*
+build/run/*
+build/.gradle/*
+*.ipr
+*.iml
+*.iws
.idea/**
diff --git a/COPYING b/COPYING
new file mode 100644
index 000000000..19d1fa01f
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, 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
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If 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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU 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
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.1996
diff --git a/COPYING.LESSER b/COPYING.LESSER
new file mode 100644
index 000000000..0a041280b
--- /dev/null
+++ b/COPYING.LESSER
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ 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 that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU 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 as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/LICENSE.txt b/LICENSE.txt
index bed16e88f..455a58d05 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,6 +1,45 @@
-The MIT License (MIT)
+GTNH Modifications:
-Copyright (c) 2014 ChickenBones
+Copyright (c) 2019 mitchej123
+
+GNU LESSER GENERAL PUBLIC LICENSE - See COPYING & COPYING.LESSER
+
+
+-----------------------------------------------------------------------------
+
+Parts inspired/borrowed/backported from JEI under the MIT License:
+
+ https://github.com/mezz/JustEnoughItems/tree/1.12
+
+ The MIT License (MIT)
+
+ Copyright (c) 2014-2015 mezz
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+-----------------------------------------------------------------------------
+
+Base NEI License:
+
+ The MIT License (MIT)
+
+ Copyright (c) 2014 ChickenBones
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/build/build.gradle b/build/build.gradle
index c6132db6f..86e493e53 100644
--- a/build/build.gradle
+++ b/build/build.gradle
@@ -45,6 +45,11 @@ dependencies {
version = "${project.config.mod_version}"
+sourceCompatibility = JavaVersion.VERSION_1_8
+targetCompatibility = JavaVersion.VERSION_1_8
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
println config.mc_version + "-" + config.forge_version
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
minecraft {
@@ -106,6 +111,10 @@ artifacts {
archives sourceJar, devJar
}
+sourceSets {
+ main { output.resourcesDir = output.classesDir }
+}
+
// Configure an upload task.
uploadArchives {
dependsOn 'reobf'
diff --git a/build/build.properties b/build/build.properties
index f272e0b9a..16dae7452 100644
--- a/build/build.properties
+++ b/build/build.properties
@@ -1,5 +1,5 @@
mc_version=1.7.10
-forge_version=10.13.4.1448-1.7.10
+forge_version=10.13.4.1614-1.7.10
ccl_version=1.1.3.138
ccc_version=1.0.7.+
-mod_version=1.0.6-GTNH
+mod_version=2.0.0-pre-8-GTNH
diff --git a/resources/assets/nei/lang/cs_CZ.lang b/resources/assets/nei/lang/cs_CZ.lang
index 298776dcd..0582d88b6 100644
--- a/resources/assets/nei/lang/cs_CZ.lang
+++ b/resources/assets/nei/lang/cs_CZ.lang
@@ -84,7 +84,6 @@ nei.options.inventory.widgetsenabled.false=NEI zakázáno
nei.options.inventory.cheatmode.0=Mód receptů
nei.options.inventory.cheatmode.1=Užitný mód
nei.options.inventory.cheatmode.2=Cheatovací mód
-nei.options.inventory.layoutstyle=Styl vzhledu
nei.options.inventory.profileRecipes=Profilové recepty
nei.options.inventory.profileRecipes.true=Povoleny
nei.options.inventory.profileRecipes.false=Nepovoleny
@@ -153,8 +152,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Staré TMI
+
+
nei.recipe.page=Strana %s/%s
nei.recipe.shaped=Výhodná výroba
diff --git a/resources/assets/nei/lang/de_DE.lang b/resources/assets/nei/lang/de_DE.lang
index 3b67e4047..1f9b78b6a 100644
--- a/resources/assets/nei/lang/de_DE.lang
+++ b/resources/assets/nei/lang/de_DE.lang
@@ -88,7 +88,6 @@ nei.options.inventory.widgetsenabled.false=NEI Deaktiviert
nei.options.inventory.cheatmode.0=Rezeptmodus
nei.options.inventory.cheatmode.1=Mehrzweckmodus
nei.options.inventory.cheatmode.2=Cheat-Modus
-nei.options.inventory.layoutstyle=Layout-Stil
nei.options.inventory.profileRecipes=Profil-Rezepte
nei.options.inventory.profileRecipes.true=Wahr
nei.options.inventory.profileRecipes.false=Falsch
@@ -161,8 +160,8 @@ nei.options.tools.dump.itempanel.mode.3=PNG
nei.options.tools.dump.itempanel.icon.dumped=Icons des Item-Panels wurden nach %s exportiert
nei.options.tools.dump.itempanel.icon.cancelled=Export abgebrochen
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Altes TMI
+
+
nei.recipe.page=Seite %s/%s
nei.recipe.tooltip=Rezepte
diff --git a/resources/assets/nei/lang/en_US.lang b/resources/assets/nei/lang/en_US.lang
index 428da3a58..48e60b6b1 100644
--- a/resources/assets/nei/lang/en_US.lang
+++ b/resources/assets/nei/lang/en_US.lang
@@ -1,5 +1,6 @@
nei.load=Load
nei.save=Save
+nei.bookmark.toggle=Bookmarks
nei.enchant=Enchant
nei.enchant.level=Level
@@ -59,6 +60,7 @@ nei.options.wbutton.tip.0=Using global settings
nei.options.wbutton.tip.1=Overriding global setting
nei.options.keys=KeyBindings
+nei.options.keys.showenchant=Show Enchant
nei.options.keys.gui=Inventory
nei.options.keys.gui.recipe=Recipe
nei.options.keys.gui.usage=Usage
@@ -69,6 +71,7 @@ nei.options.keys.gui.prev=Prev Page
nei.options.keys.gui.next=Next Page
nei.options.keys.gui.hide=Toggle NEI Visibility
nei.options.keys.gui.search=Focus Search Bar
+nei.options.keys.gui.bookmark=Add Bookmark
nei.options.keys.world=World
nei.options.keys.world.chunkoverlay=Chunk Boundary Overlay
nei.options.keys.world.moboverlay=Mob Spawn Overlay
@@ -88,7 +91,6 @@ nei.options.inventory.widgetsenabled.false=NEI Disabled
nei.options.inventory.cheatmode.0=Recipe Mode
nei.options.inventory.cheatmode.1=Utility Mode
nei.options.inventory.cheatmode.2=Cheat Mode
-nei.options.inventory.layoutstyle=Layout Style
nei.options.inventory.profileRecipes=Profile Recipes
nei.options.inventory.profileRecipes.true=True
nei.options.inventory.profileRecipes.false=False
@@ -161,8 +163,8 @@ nei.options.tools.dump.itempanel.mode.3=PNG
nei.options.tools.dump.itempanel.icon.dumped=Item Panel icons were dumped to %s
nei.options.tools.dump.itempanel.icon.cancelled=Dump cancelled
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Old TMI
+
+
nei.recipe.page=Page %s/%s
nei.recipe.tooltip=Recipes
diff --git a/resources/assets/nei/lang/et_EE.lang b/resources/assets/nei/lang/et_EE.lang
index 446d67438..78fddc640 100644
--- a/resources/assets/nei/lang/et_EE.lang
+++ b/resources/assets/nei/lang/et_EE.lang
@@ -87,7 +87,6 @@ nei.options.inventory.widgetsenabled.false=NEI keelatud
nei.options.inventory.cheatmode.0=Retsepti mood
nei.options.inventory.cheatmode.1=Utiliidi mood
nei.options.inventory.cheatmode.2=Petmis mood
-nei.options.inventory.layoutstyle=Layout Style
nei.options.inventory.profileRecipes=Profileeri retsepte
nei.options.inventory.profileRecipes.true=Tõene
nei.options.inventory.profileRecipes.false=Väär
@@ -156,8 +155,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Vana TMI
+
+
nei.recipe.page=Leht %s/%s
nei.recipe.shaped=Kujuga Valmistamine
diff --git a/resources/assets/nei/lang/fr_FR.lang b/resources/assets/nei/lang/fr_FR.lang
index 776effb3c..b84c781cb 100644
--- a/resources/assets/nei/lang/fr_FR.lang
+++ b/resources/assets/nei/lang/fr_FR.lang
@@ -85,7 +85,6 @@ nei.options.inventory.widgetsenabled.false=NEI désactivé
nei.options.inventory.cheatmode.0=Mode recette
nei.options.inventory.cheatmode.1=Mode utilitaire
nei.options.inventory.cheatmode.2=Mode triche
-nei.options.inventory.layoutstyle=Mise en page
nei.options.inventory.profileRecipes=Profil Recettes
nei.options.inventory.profileRecipes.true=Vrai
nei.options.inventory.profileRecipes.false=Faux
@@ -154,8 +153,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Ancien TMI
+
+
nei.recipe.page=Page %s/%s
nei.recipe.shaped=Modèle de recette
diff --git a/resources/assets/nei/lang/it_IT.lang b/resources/assets/nei/lang/it_IT.lang
index 63302230c..85a8576f1 100644
--- a/resources/assets/nei/lang/it_IT.lang
+++ b/resources/assets/nei/lang/it_IT.lang
@@ -88,7 +88,6 @@ nei.options.inventory.widgetsenabled.false=NEI Disattivato
nei.options.inventory.cheatmode.0=Modalità ricette
nei.options.inventory.cheatmode.1=Modalità utilità
nei.options.inventory.cheatmode.2=Modalità cheat
-nei.options.inventory.layoutstyle=Stile layout
nei.options.inventory.profileRecipes=Ricerca profilo
nei.options.inventory.profileRecipes.true=Vero
nei.options.inventory.profileRecipes.false=Falso
@@ -161,8 +160,8 @@ nei.options.tools.dump.itempanel.mode.3=PNG
nei.options.tools.dump.itempanel.icon.dumped=Le icone del Item Panel è stato scricato ino %s
nei.options.tools.dump.itempanel.icon.cancelled=File scaricati eliminati
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Vecchio TMI
+
+
nei.recipe.page=Pagina %s/%s
nei.recipe.tooltip=Ricette
diff --git a/resources/assets/nei/lang/ko_KR.lang b/resources/assets/nei/lang/ko_KR.lang
index f1d4d543a..b1b0fec7b 100644
--- a/resources/assets/nei/lang/ko_KR.lang
+++ b/resources/assets/nei/lang/ko_KR.lang
@@ -10,7 +10,6 @@ nei.inventory.options=옵션
nei.inventory.prev=이전
nei.inventory.next=다음
nei.inventory.item_subsets=아이템 하위집합
-nei.inventory.delete.all=현재의 화면에 있는 모든 항목을 삭제
nei.inventory.delete.one=%s 삭제
nei.inventory.delete.all=%s 모두삭제
nei.inventory.delete.enable=삭제모드 활성화
@@ -84,7 +83,6 @@ nei.options.inventory.widgetsenabled.false=NEI 비활성화
nei.options.inventory.cheatmode.0=레시피모드
nei.options.inventory.cheatmode.1=유틸리티모드
nei.options.inventory.cheatmode.2=치트모드
-nei.options.inventory.layoutstyle=레이아웃 스타일
nei.options.inventory.profileRecipes=프로파일 레시피
nei.options.inventory.profileRecipes.true=설정
nei.options.inventory.profileRecipes.false=비설정
@@ -153,9 +151,6 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-layoutstyle.minecraft=마인크래프트
-layoutstyle.oldtmi=투매니 아이템
-
nei.recipe.page=%s/%s 페이지
nei.recipe.shaped=무형 조합법
nei.recipe.shapeless=유형 조합법
diff --git a/resources/assets/nei/lang/pl_PL.lang b/resources/assets/nei/lang/pl_PL.lang
index fafa832fe..419036425 100644
--- a/resources/assets/nei/lang/pl_PL.lang
+++ b/resources/assets/nei/lang/pl_PL.lang
@@ -64,7 +64,6 @@ nei.options.keys.gui.back=Poprzednia recepta
nei.options.keys.gui.prev=Poprzednia strona
nei.options.keys.gui.next=Następna strona
nei.options.keys.gui.hide=Przełącz widzialność NEI
-nei.options.keys.gui.search=Focus Search Bar
nei.options.keys.gui.search=Ustaw ostrość na pasek wyszukiwania
nei.options.keys.world=Świat
nei.options.keys.world.chunkoverlay=Nakładka granic chunków
@@ -85,7 +84,7 @@ nei.options.inventory.widgetsenabled.false=NEI wyłączone
nei.options.inventory.cheatmode.0=Tryb recept
nei.options.inventory.cheatmode.1=Tryb użytku
nei.options.inventory.cheatmode.2=Tryb oszukiwania
-nei.options.inventory.layoutstyle=Styl układu
+
nei.options.inventory.profileRecipes=Profiluj recepty
nei.options.inventory.profileRecipes.true=Tak
nei.options.inventory.profileRecipes.false=Nie
@@ -99,7 +98,6 @@ nei.options.inventory.searchmode.0=Prosty
nei.options.inventory.searchmode.1=Rozszerzony
nei.options.inventory.searchmode.2=Wyrażenia regularne
nei.options.inventory.utilities=Narzędzia
-nei.options.inventory.utilities.tip=Select features for utility mode
nei.options.inventory.utilities.tip=Wybierz cechy trybu użytkowego
nei.options.inventory.utilities.time=Czas
nei.options.inventory.utilities.rain=Deszcz
@@ -158,8 +156,8 @@ nei.options.tools.dump.itempanel.mode.3=PNG
nei.options.tools.dump.itempanel.icon.dumped=Ikony panelu przedmiotów zrzucone do %s
nei.options.tools.dump.itempanel.icon.cancelled=Zrzut anulowany
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Stare TMI
+
+
nei.recipe.page=Strona %s/%s
nei.recipe.shaped=Kształtne wytwarzanie
diff --git a/resources/assets/nei/lang/pt_BR.lang b/resources/assets/nei/lang/pt_BR.lang
index f694bb4e9..eb6cb8592 100644
--- a/resources/assets/nei/lang/pt_BR.lang
+++ b/resources/assets/nei/lang/pt_BR.lang
@@ -84,7 +84,7 @@ nei.options.inventory.widgetsenabled.false=NEI Desativado
nei.options.inventory.cheatmode.0=Modo Receitas
nei.options.inventory.cheatmode.1=Modo Utilidade
nei.options.inventory.cheatmode.2=Modo Cheat
-nei.options.inventory.layoutstyle=Estilo de Layout
+
nei.options.inventory.profileRecAtivaripes=Perfilar Receitas
nei.options.inventory.profileRecipes.true=Verdadeiro
nei.options.inventory.profileRecipes.false=Falso
@@ -153,8 +153,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Velho TMI
+
+
nei.recipe.page=Página %s/%s
nei.recipe.shaped=Receita Exata
diff --git a/resources/assets/nei/lang/ru_RU.lang b/resources/assets/nei/lang/ru_RU.lang
index f879154d6..300bfa8b7 100644
--- a/resources/assets/nei/lang/ru_RU.lang
+++ b/resources/assets/nei/lang/ru_RU.lang
@@ -14,7 +14,6 @@ nei.inventory.options=Опции
nei.inventory.prev=Предыдущая
nei.inventory.next=Следующая
nei.inventory.item_subsets=Подмножества предметов
-nei.inventory.delete.all=УДАЛИТЬ ВСЕ ПРЕДМЕТЫ из текущего инвентаря
nei.inventory.delete.one=Удалить %s
nei.inventory.delete.all=Удалить ВСЕ %s
nei.inventory.delete.enable=Режим удаления
@@ -88,7 +87,7 @@ nei.options.inventory.widgetsenabled.false=NEI выключен
nei.options.inventory.cheatmode.0=Режим рецептов
nei.options.inventory.cheatmode.1=Режим полезностей
nei.options.inventory.cheatmode.2=Чит-режим
-nei.options.inventory.layoutstyle=Стиль расположения
+
nei.options.inventory.profileRecipes=Рецепты профиля
nei.options.inventory.profileRecipes.true=Да
nei.options.inventory.profileRecipes.false=Нет
@@ -161,8 +160,8 @@ nei.options.tools.dump.itempanel.mode.3=PNG
nei.options.tools.dump.itempanel.icon.dumped=Иконки панели предметов сохранены в %s
nei.options.tools.dump.itempanel.icon.cancelled=Дамп отменён
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Старый TMI
+
+
nei.recipe.page=Страница %s/%s
nei.recipe.tooltip=Рецепты
diff --git a/resources/assets/nei/lang/sk_SK.lang b/resources/assets/nei/lang/sk_SK.lang
index 825262439..fe119ecf3 100644
--- a/resources/assets/nei/lang/sk_SK.lang
+++ b/resources/assets/nei/lang/sk_SK.lang
@@ -84,7 +84,7 @@ nei.options.inventory.widgetsenabled.false=NEI zakázané
nei.options.inventory.cheatmode.0=Mód Receptov
nei.options.inventory.cheatmode.1=Úžitkový mód
nei.options.inventory.cheatmode.2=Čítovací mód
-nei.options.inventory.layoutstyle=Štýl rozmiestnenia
+
nei.options.inventory.profileRecipes=Profilovanie receptov
nei.options.inventory.profileRecipes.true=Áno
nei.options.inventory.profileRecipes.false=Nie
@@ -153,8 +153,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Staré TMI
+
+
nei.recipe.page=Strana %s/%s
nei.recipe.shaped=Tvarovaná výroba
diff --git a/resources/assets/nei/lang/tr_TR.lang b/resources/assets/nei/lang/tr_TR.lang
index 0f2027c82..05dd4ef56 100644
--- a/resources/assets/nei/lang/tr_TR.lang
+++ b/resources/assets/nei/lang/tr_TR.lang
@@ -84,7 +84,7 @@ nei.options.inventory.widgetsenabled.false=NEI Kapalı
nei.options.inventory.cheatmode.0=Tarif modu
nei.options.inventory.cheatmode.1=Yardımcı mod
nei.options.inventory.cheatmode.2=Hileli mod
-nei.options.inventory.layoutstyle=Tema
+
nei.options.inventory.profileRecipes=Profil tarifleri
nei.options.inventory.profileRecipes.true=Yazı
nei.options.inventory.profileRecipes.false=Şekil
@@ -153,8 +153,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft
-nei.layoutstyle.oldtmi=Eski TMI
+
+
nei.recipe.page=Sayfa %s/%s
nei.recipe.shaped=Üretim
diff --git a/resources/assets/nei/lang/zh_CN.lang b/resources/assets/nei/lang/zh_CN.lang
index 433d90030..484fd112c 100644
--- a/resources/assets/nei/lang/zh_CN.lang
+++ b/resources/assets/nei/lang/zh_CN.lang
@@ -84,7 +84,7 @@ nei.options.inventory.widgetsenabled.false=禁用NEI
nei.options.inventory.cheatmode.0=合成模式
nei.options.inventory.cheatmode.1=实用模式
nei.options.inventory.cheatmode.2=作弊模式
-nei.options.inventory.layoutstyle=界面风格
+
nei.options.inventory.profileRecipes=合成查阅性能分析
nei.options.inventory.profileRecipes.true=开启
nei.options.inventory.profileRecipes.false=关闭
@@ -153,8 +153,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft风格
-nei.layoutstyle.oldtmi=老式TMI风格
+
+
nei.recipe.page=页数 %s/%s
nei.recipe.shaped=有序合成
diff --git a/resources/assets/nei/lang/zh_TW.lang b/resources/assets/nei/lang/zh_TW.lang
index 0c8fe6084..5d86fdf2d 100644
--- a/resources/assets/nei/lang/zh_TW.lang
+++ b/resources/assets/nei/lang/zh_TW.lang
@@ -12,7 +12,6 @@ nei.inventory.next=下一頁
nei.inventory.item_subsets=物品分類表
nei.inventory.delete.all=刪除當前物品欄內所有物品
nei.inventory.delete.one=刪除 %s
-nei.inventory.delete.all=清空物品欄
nei.inventory.delete.enable=開啟刪除模式設定
nei.inventory.delete.1=開啟刪除模式
nei.inventory.delete.0=關閉刪除模式
@@ -84,7 +83,7 @@ nei.options.inventory.widgetsenabled.false=NEI關閉
nei.options.inventory.cheatmode.0=合成模式
nei.options.inventory.cheatmode.1=實用模式
nei.options.inventory.cheatmode.2=作弊模式
-nei.options.inventory.layoutstyle=界面風格
+
nei.options.inventory.profileRecipes=合成查詢
nei.options.inventory.profileRecipes.true=開啟
nei.options.inventory.profileRecipes.false=關閉
@@ -153,8 +152,8 @@ nei.options.tools.dump.itempanel.mode.0=CSV
nei.options.tools.dump.itempanel.mode.1=NBT
nei.options.tools.dump.itempanel.mode.2=Json
-nei.layoutstyle.minecraft=Minecraft風格
-nei.layoutstyle.oldtmi=舊TMI風格
+
+
nei.recipe.page=頁數 %s/%s
nei.recipe.shaped=成型工藝
diff --git a/resources/neimod.info b/resources/neimod.info
index 52307432d..c39152fc4 100644
--- a/resources/neimod.info
+++ b/resources/neimod.info
@@ -4,14 +4,16 @@
"name": "Not Enough Items",
"version": "${version}",
"mcversion": "${mc_version}",
- "description": "Recipe Viewer, Inventory Manager, Item Spawner, Cheats and more.
+ "description": "Recipe Viewer, Inventory Manager, Item Spawner, Cheats and more; GTNH Version
+
Supporters: EmuCraft Team, Victor Zimmer, lexi85, Ace_Trainer_Tullius, Bacon_Donut, Iarinu",
"url": "http://www.minecraftforum.net/topic/909223",
"credits": "Alexandria - original idea",
- "authorList": [ "ChickenBones" ],
+ "license": "LGPL-3.0",
+ "authorList": [ "ChickenBones", "mitchej123" ],
"dependencies": [
"CodeChickenCore"
]
diff --git a/src/codechicken/nei/BookmarkPanel.java b/src/codechicken/nei/BookmarkPanel.java
new file mode 100644
index 000000000..2da7d7285
--- /dev/null
+++ b/src/codechicken/nei/BookmarkPanel.java
@@ -0,0 +1,137 @@
+package codechicken.nei;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.JsonToNBT;
+import net.minecraft.nbt.NBTException;
+import net.minecraft.nbt.NBTTagCompound;
+import org.apache.commons.io.IOUtils;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * TODO:
+ * 1) Bookmark button to toggle visibility
+ */
+public class BookmarkPanel extends ItemPanel {
+
+ public void init() {
+ super.init();
+ }
+
+ public String getLabelText() {
+ return super.getLabelText() + " [" + items.size() + "]";
+ }
+
+ public void addOrRemoveItem(ItemStack item) {
+ ItemStack normalized = normalize(item);
+ if(!remove(normalized)) {
+ _items.add(normalized);
+ }
+ saveBookmarks();
+ }
+
+ public void saveBookmarks() {
+ List strings = new ArrayList<>();
+ for (ItemStack item:_items) {
+ strings.add(item.writeToNBT(new NBTTagCompound()).toString());
+ }
+ File file = NEIClientConfig.bookmarkFile;
+ if(file != null) {
+ try(FileWriter writer = new FileWriter(file)) {
+ IOUtils.writeLines(strings, "\n", writer);
+ } catch (IOException e) {
+ NEIClientConfig.logger.error("Filed to save bookmarks list to file {}", file, e);
+ }
+ }
+ }
+
+ public void loadBookmarks() {
+ File file = NEIClientConfig.bookmarkFile;
+ if (file == null || !file.exists()) {
+ return;
+ }
+ List itemStrings;
+ try (FileReader reader = new FileReader(file)) {
+ NEIClientConfig.logger.info("Loading bookmarks from file {}", file);
+ itemStrings = IOUtils.readLines(reader);
+ } catch (IOException e) {
+ NEIClientConfig.logger.error("Failed to load bookmarks from file {}", file, e);
+ return;
+ }
+ _items.clear();
+ for (String itemStr: itemStrings) {
+ try {
+ NBTTagCompound itemStackNBT = (NBTTagCompound)JsonToNBT.func_150315_a(itemStr);
+ ItemStack itemStack = ItemStack.loadItemStackFromNBT(itemStackNBT);
+ if (itemStack != null) {
+ _items.add(itemStack);
+ } else {
+ NEIClientConfig.logger.warn("Failed to load bookmarked ItemStack from json string, the item no longer exists:\n{}", itemStr);
+ }
+ } catch (NBTException e) {
+ NEIClientConfig.logger.error("Failed to load bookmarked ItemStack from json string:\n{}", itemStr, e);
+ }
+ }
+ }
+
+ protected ItemStack normalize(ItemStack item) {
+ ItemStack copy = item.copy();
+ copy.stackSize = 1;
+ return copy;
+ }
+ private boolean remove(ItemStack item) {
+ int i = 0;
+ for (ItemStack existing : _items) {
+ if (existing == item || existing.isItemEqual(item)) {
+ _items.remove(i);
+ return true;
+ }
+ i++;
+ }
+ return false;
+ }
+
+
+ @Override
+ public int getMarginLeft() {
+ return 5;
+ }
+
+
+ @Override
+ public int getButtonTop() {
+ LayoutStyleMinecraft layout = (LayoutStyleMinecraft)LayoutManager.getLayoutStyle();
+ return 2 + (((int)Math.ceil((double)layout.buttonCount / layout.numButtons)) * 18);
+ }
+
+ @Override
+ public int getNextX(GuiContainer gui) {
+ return gui.width - prev.w - 2 - ((gui.xSize + gui.width) /2 + 2);
+ }
+
+ @Override
+ public int getPrevX(GuiContainer gui) {
+ return 2;
+ }
+
+ @Override
+ public int getPageX(GuiContainer gui) {
+ return gui.guiLeft * 3 / 2 + gui.xSize + 1 - ((gui.xSize + gui.width) /2 + 2);
+ }
+
+ public int getHightAdjustment() {
+ return 0;
+ }
+
+ public int getWidth(GuiContainer gui) {
+ return LayoutManager.getLeftSize(gui) - x;
+
+ }
+
+}
diff --git a/src/codechicken/nei/Button.java b/src/codechicken/nei/Button.java
index 6a57e46f8..13e4dfb0b 100644
--- a/src/codechicken/nei/Button.java
+++ b/src/codechicken/nei/Button.java
@@ -56,7 +56,7 @@ public String getRenderLabel() {
return label;
}
- public String label;
+ public final String label;
public Image icon;
/**
diff --git a/src/codechicken/nei/ClientHandler.java b/src/codechicken/nei/ClientHandler.java
index 5428aa8ae..d2e27c312 100644
--- a/src/codechicken/nei/ClientHandler.java
+++ b/src/codechicken/nei/ClientHandler.java
@@ -12,7 +12,11 @@
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.*;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiErrorScreen;
+import net.minecraft.client.gui.GuiMainMenu;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.GuiSelectWorld;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@@ -28,14 +32,14 @@ public class ClientHandler
{
private static ClientHandler instance;
- private ArrayList SMPmagneticItems = new ArrayList();
+ private ArrayList SMPmagneticItems = new ArrayList<>();
private World lastworld;
private GuiScreen lastGui;
public void addSMPMagneticItem(int i, World world) {
WorldClient cworld = (WorldClient) world;
Entity e = cworld.getEntityByID(i);
- if (e == null || !(e instanceof EntityItem)) {
+ if (!(e instanceof EntityItem)) {
return;
}
SMPmagneticItems.add((EntityItem) e);
diff --git a/src/codechicken/nei/ContainerCreativeInv.java b/src/codechicken/nei/ContainerCreativeInv.java
index e528d7420..ab2c2b873 100644
--- a/src/codechicken/nei/ContainerCreativeInv.java
+++ b/src/codechicken/nei/ContainerCreativeInv.java
@@ -15,7 +15,7 @@ public class ContainerCreativeInv extends Container
{
private class SlotArmor extends Slot
{
- int armorType;
+ final int armorType;
public SlotArmor(IInventory inv, int x, int y, int slot, int armor) {
super(inv, x, y, slot);
diff --git a/src/codechicken/nei/ContainerEnchantmentModifier.java b/src/codechicken/nei/ContainerEnchantmentModifier.java
index 1e1696285..693def941 100644
--- a/src/codechicken/nei/ContainerEnchantmentModifier.java
+++ b/src/codechicken/nei/ContainerEnchantmentModifier.java
@@ -29,12 +29,12 @@ public EnchantmentHash(Enchantment e, int i, int l) {
level = l;
}
- Enchantment enchantment;
+ final Enchantment enchantment;
int state;
- int level;
+ final int level;
}
- public ArrayList slotEnchantment = new ArrayList();
+ public final ArrayList slotEnchantment = new ArrayList<>();
int level = 5;
public int scrollclicky = -1;
@@ -60,11 +60,7 @@ public int getScrollBarHeight() {
int sbarh = (int) ((height / (float) getContentHeight()) * height);
if (sbarh > height) {
return height;
- } else if (sbarh < height / 15) {
- return height / 15;
- } else {
- return sbarh;
- }
+ } else return Math.max(sbarh, height / 15);
}
public int getScrollBarWidth() {
@@ -237,7 +233,7 @@ public void updateEnchantmentOptions(boolean validate) {
public void drawSlots(GuiEnchantmentModifier gui) {
for (int slot = 0; slot < 3; slot++) {
- int shade = 0;
+ int shade;
String text = "";
int containerslot = slot + getScrolledSlots();
diff --git a/src/codechicken/nei/ContainerPotionCreator.java b/src/codechicken/nei/ContainerPotionCreator.java
index d89f82cb1..a1fb9cc90 100644
--- a/src/codechicken/nei/ContainerPotionCreator.java
+++ b/src/codechicken/nei/ContainerPotionCreator.java
@@ -1,9 +1,9 @@
package codechicken.nei;
import codechicken.lib.inventory.ContainerExtended;
-import codechicken.lib.inventory.SlotHandleClicks;
import codechicken.lib.inventory.InventoryNBT;
import codechicken.lib.inventory.InventoryUtils;
+import codechicken.lib.inventory.SlotHandleClicks;
import codechicken.lib.packet.PacketCustom;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -86,9 +86,9 @@ public void markDirty() {
}
}
- InventoryPlayer playerInv;
- InventoryBasic potionInv;
- IInventory potionStoreInv;
+ final InventoryPlayer playerInv;
+ final InventoryBasic potionInv;
+ final IInventory potionStoreInv;
public ContainerPotionCreator(InventoryPlayer inventoryPlayer, IInventory potionStoreInv) {
playerInv = inventoryPlayer;
diff --git a/src/codechicken/nei/ExtendedCreativeInv.java b/src/codechicken/nei/ExtendedCreativeInv.java
index 1a992b277..62ce54bd1 100644
--- a/src/codechicken/nei/ExtendedCreativeInv.java
+++ b/src/codechicken/nei/ExtendedCreativeInv.java
@@ -7,8 +7,8 @@
public class ExtendedCreativeInv implements IInventory
{
- PlayerSave playerSave;
- Side side;
+ final PlayerSave playerSave;
+ final Side side;
public ExtendedCreativeInv(PlayerSave playerSave, Side side) {
this.playerSave = playerSave;
@@ -33,10 +33,9 @@ public ItemStack decrStackSize(int slot, int size) {
if (item != null) {
if (item.stackSize <= size) {
- ItemStack itemstack = item;
setInventorySlotContents(slot, null);
markDirty();
- return itemstack;
+ return item;
}
ItemStack itemstack1 = item.splitStack(size);
if (item.stackSize == 0) {
diff --git a/src/codechicken/nei/FastTransferManager.java b/src/codechicken/nei/FastTransferManager.java
index a429cb3f4..d33650947 100644
--- a/src/codechicken/nei/FastTransferManager.java
+++ b/src/codechicken/nei/FastTransferManager.java
@@ -6,9 +6,14 @@
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import java.util.*;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
-import static codechicken.nei.NEIServerUtils.*;
+import static codechicken.nei.NEIServerUtils.areStacksIdentical;
+import static codechicken.nei.NEIServerUtils.areStacksSameType;
+import static codechicken.nei.NEIServerUtils.copyStack;
public class FastTransferManager
{
@@ -17,7 +22,7 @@ public class FastTransferManager
*/
public static class SlotPositionComparator implements Comparator
{
- Container container;
+ final Container container;
public SlotPositionComparator(Container c) {
container = c;
@@ -34,8 +39,8 @@ public int compare(Integer arg0, Integer arg1) {
}
}
- public LinkedList> slotZones = new LinkedList>();
- public HashMap slotZoneMap = new HashMap();
+ public LinkedList> slotZones = new LinkedList<>();
+ public HashMap slotZoneMap = new HashMap<>();
private void generateSlotMap(Container container, ItemStack stack) {
stack = stack.copy();
@@ -45,11 +50,11 @@ private void generateSlotMap(Container container, ItemStack stack) {
if (slotZoneMap.containsKey(slotNo) || !container.getSlot(slotNo).isItemValid(stack))
continue;
- HashSet connectedSlots = new HashSet();
+ HashSet connectedSlots = new HashSet<>();
findConnectedSlots(container, slotNo, connectedSlots);
- LinkedList zoneSlots = new LinkedList(connectedSlots);
- Collections.sort(zoneSlots, new SlotPositionComparator(container));
+ LinkedList zoneSlots = new LinkedList<>(connectedSlots);
+ zoneSlots.sort(new SlotPositionComparator(container));
slotZones.add(zoneSlots);
for (int i : zoneSlots) {
@@ -77,7 +82,7 @@ private void findConnectedSlots(Container container, int slotNo, HashSet saveContainer(Container container) {
- LinkedList stacks = new LinkedList();
+ LinkedList stacks = new LinkedList<>();
for (int i = 0; i < container.inventorySlots.size(); i++)
stacks.add(copyStack(container.getSlot(i).getStack()));
diff --git a/src/codechicken/nei/GuiEnchantmentModifier.java b/src/codechicken/nei/GuiEnchantmentModifier.java
index d2d5740ac..bc2571ff7 100644
--- a/src/codechicken/nei/GuiEnchantmentModifier.java
+++ b/src/codechicken/nei/GuiEnchantmentModifier.java
@@ -12,7 +12,7 @@
public class GuiEnchantmentModifier extends GuiContainer
{
- ContainerEnchantmentModifier container;
+ final ContainerEnchantmentModifier container;
public GuiEnchantmentModifier(InventoryPlayer inventoryplayer, World world, int i, int j, int k) {
super(new ContainerEnchantmentModifier(inventoryplayer, world, i, j, k));
diff --git a/src/codechicken/nei/GuiExtendedCreativeInv.java b/src/codechicken/nei/GuiExtendedCreativeInv.java
index 5c6586028..b22f789c8 100644
--- a/src/codechicken/nei/GuiExtendedCreativeInv.java
+++ b/src/codechicken/nei/GuiExtendedCreativeInv.java
@@ -8,7 +8,7 @@
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandler
@@ -41,7 +41,7 @@ public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) {
@Override
public List getInventoryAreas(GuiContainer gui) {
- return Arrays.asList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
+ return Collections.singletonList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
}
@Override
diff --git a/src/codechicken/nei/GuiNEIButton.java b/src/codechicken/nei/GuiNEIButton.java
index c63fa357c..fc3bca19d 100644
--- a/src/codechicken/nei/GuiNEIButton.java
+++ b/src/codechicken/nei/GuiNEIButton.java
@@ -8,7 +8,7 @@
public class GuiNEIButton extends GuiButton
{
- protected static ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
+ protected static final ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
public GuiNEIButton(int i, int j, int k, int l, int i1, String s)
{
diff --git a/src/codechicken/nei/GuiPotionCreator.java b/src/codechicken/nei/GuiPotionCreator.java
index f3d574d4f..ed1212b84 100644
--- a/src/codechicken/nei/GuiPotionCreator.java
+++ b/src/codechicken/nei/GuiPotionCreator.java
@@ -14,7 +14,7 @@
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
-import java.awt.*;
+import java.awt.Dimension;
import java.util.ArrayList;
import static codechicken.nei.NEIClientUtils.translate;
@@ -25,7 +25,7 @@ public class GuiSlotPotionEffects extends GuiScrollSlot
{
public int selectedslot = -1;
public boolean enabled = true;
- private ArrayList validPotions = new ArrayList();
+ private final ArrayList validPotions = new ArrayList<>();
public GuiSlotPotionEffects(int x, int y) {
super(x, y, 108, 76);
@@ -256,7 +256,7 @@ public int getDurationTicks() {
GuiCCButton ampUp;
GuiSlotPotionEffects slotPotionEffects;
GuiDurationField durationField;
- ContainerPotionCreator container;
+ final ContainerPotionCreator container;
public GuiPotionCreator(InventoryPlayer inventoryplayer) {
super(new ContainerPotionCreator(inventoryplayer, new ContainerPotionCreator.InventoryPotionStore()), 176, 208);
diff --git a/src/codechicken/nei/HUDRenderer.java b/src/codechicken/nei/HUDRenderer.java
index 1680899b6..4171c89b1 100644
--- a/src/codechicken/nei/HUDRenderer.java
+++ b/src/codechicken/nei/HUDRenderer.java
@@ -12,13 +12,15 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
-import java.awt.*;
+import java.awt.Dimension;
+import java.awt.Point;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
-import static codechicken.lib.gui.GuiDraw.*;
+import static codechicken.lib.gui.GuiDraw.displaySize;
+import static codechicken.lib.gui.GuiDraw.drawString;
+import static codechicken.lib.gui.GuiDraw.drawTooltipBox;
+import static codechicken.lib.gui.GuiDraw.getStringWidth;
public class HUDRenderer implements IKeyStateTracker
{
diff --git a/src/codechicken/nei/Image.java b/src/codechicken/nei/Image.java
index 5634a4f7a..4fb746a62 100644
--- a/src/codechicken/nei/Image.java
+++ b/src/codechicken/nei/Image.java
@@ -7,11 +7,11 @@ public class Image
public int width;
public int height;
- public Image(int i, int j, int k, int l)
+ public Image(int x, int y, int w, int h)
{
- x = i;
- y = j;
- width = k;
- height = l;
+ this.x = x;
+ this.y = y;
+ width = w;
+ height = h;
}
}
diff --git a/src/codechicken/nei/ItemList.java b/src/codechicken/nei/ItemList.java
index fac8434cd..aeb73695e 100644
--- a/src/codechicken/nei/ItemList.java
+++ b/src/codechicken/nei/ItemList.java
@@ -15,6 +15,8 @@
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ForkJoinPool;
import java.util.regex.Pattern;
public class ItemList
@@ -22,7 +24,7 @@ public class ItemList
/**
* Fields are replaced atomically and contents never modified.
*/
- public static volatile List items = new ArrayList();
+ public static volatile List items = new ArrayList<>();
/**
* Fields are replaced atomically and contents never modified.
*/
@@ -30,11 +32,11 @@ public class ItemList
/**
* Updates to this should be synchronised on this
*/
- public static final List itemFilterers = new LinkedList();
- public static final List loadCallbacks = new LinkedList();
+ public static final List itemFilterers = new LinkedList<>();
+ public static final List loadCallbacks = new LinkedList<>();
- private static HashSet- erroredItems = new HashSet
- ();
- private static HashSet stackTraces = new HashSet();
+ private static final HashSet
- erroredItems = new HashSet<>();
+ private static final HashSet stackTraces = new HashSet<>();
public static class EverythingItemFilter implements ItemFilter
{
@@ -68,14 +70,14 @@ public boolean matches(ItemStack item) {
public static class AllMultiItemFilter implements ItemFilter
{
- public List filters = new LinkedList();
+ public List filters;
public AllMultiItemFilter(List filters) {
this.filters = filters;
}
public AllMultiItemFilter() {
- this(new LinkedList());
+ this(new LinkedList<>());
}
@Override
@@ -93,14 +95,14 @@ public boolean matches(ItemStack item) {
public static class AnyMultiItemFilter implements ItemFilter
{
- public List filters = new LinkedList();
+ public List filters;
public AnyMultiItemFilter(List filters) {
this.filters = filters;
}
public AnyMultiItemFilter() {
- this(new LinkedList());
+ this(new LinkedList<>());
}
@Override
@@ -147,7 +149,7 @@ public static ItemFilter getItemListFilter() {
}
public static List getItemFilters() {
- LinkedList filters = new LinkedList();
+ LinkedList filters = new LinkedList<>();
synchronized (itemFilterers) {
for(ItemFilterProvider p : itemFilterers)
filters.add(p.getFilter());
@@ -158,7 +160,7 @@ public static List getItemFilters() {
public static final RestartableTask loadItems = new RestartableTask("NEI Item Loading")
{
private void damageSearch(Item item, List permutations) {
- HashSet damageIconSet = new HashSet();
+ HashSet damageIconSet = new HashSet<>();
for (int damage = 0; damage < 16; damage++)
try {
ItemStack itemstack = new ItemStack(item, 1, damage);
@@ -182,8 +184,8 @@ private void damageSearch(Item item, List permutations) {
public void execute() {
ThreadOperationTimer timer = getTimer(500);
- LinkedList items = new LinkedList();
- LinkedList permutations = new LinkedList();
+ LinkedList items = new LinkedList<>();
+ LinkedList permutations = new LinkedList<>();
ListMultimap
- itemMap = ArrayListMultimap.create();
timer.setLimit(500);
@@ -227,17 +229,36 @@ public void execute() {
}
};
+ public static ForkJoinPool getPool(int poolSize) {
+ if(poolSize < 1)
+ poolSize = 1;
+
+ return new ForkJoinPool(poolSize);
+ }
+
+ public static final int numProcessors = Runtime.getRuntime().availableProcessors();
+ public static ForkJoinPool forkJoinPool = getPool(numProcessors * 2 / 3);
+
public static final RestartableTask updateFilter = new RestartableTask("NEI Item Filtering")
{
@Override
public void execute() {
- ArrayList filtered = new ArrayList();
+ ArrayList filtered = new ArrayList<>();
ItemFilter filter = getItemListFilter();
- for(ItemStack item : items) {
- if (interrupted()) return;
- if(filter.matches(item))
- filtered.add(item);
+ try {
+ ItemList.forkJoinPool.submit(() -> items.parallelStream().forEach(item -> {
+ if (interrupted()) return;
+
+ if(filter.matches(item)) {
+ synchronized (filtered){
+ filtered.add(item);
+ }
+ }
+ })).get();
+ } catch (InterruptedException | ExecutionException e) {
+ e.printStackTrace();
+ stop();
}
if(interrupted()) return;
diff --git a/src/codechicken/nei/ItemMobSpawner.java b/src/codechicken/nei/ItemMobSpawner.java
index 21d042922..43ccf4061 100644
--- a/src/codechicken/nei/ItemMobSpawner.java
+++ b/src/codechicken/nei/ItemMobSpawner.java
@@ -17,10 +17,8 @@
import net.minecraftforge.client.MinecraftForgeClient;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
public class ItemMobSpawner extends ItemBlock
{
@@ -35,8 +33,8 @@ public ItemMobSpawner() {
hasSubtypes = true;
MinecraftForgeClient.registerItemRenderer(this, new SpawnerRenderer());
- entityHashMap = new HashMap();
- IDtoNameMap = new HashMap();
+ entityHashMap = new HashMap<>();
+ IDtoNameMap = new HashMap<>();
}
/**
@@ -129,11 +127,7 @@ public static void loadSpawners(World world) {
}
}
- for(Iterator> it = IDtoNameMap.entrySet().iterator(); it.hasNext();) {
- Entry e = it.next();
- if(getEntity(e.getKey()).getClass() == EntityPig.class && !e.getValue().equals("Pig"))
- it.remove();
- }
+ IDtoNameMap.entrySet().removeIf(e -> getEntity(e.getKey()).getClass() == EntityPig.class && !e.getValue().equals("Pig"));
}
@Override
diff --git a/src/codechicken/nei/ItemPanel.java b/src/codechicken/nei/ItemPanel.java
index 6943bcde0..d4d2a7eb4 100644
--- a/src/codechicken/nei/ItemPanel.java
+++ b/src/codechicken/nei/ItemPanel.java
@@ -14,20 +14,24 @@
import java.util.ArrayList;
import static codechicken.lib.gui.GuiDraw.drawRect;
+import static codechicken.nei.NEIClientConfig.canPerformAction;
-public class ItemPanel extends Widget
-{
+public class ItemPanel extends Widget {
/**
* Should not be externally modified, use updateItemList
*/
- public static ArrayList items = new ArrayList();
+ public ArrayList items = new ArrayList<>();
/**
* Swapped into visible items on update
*/
- private static ArrayList _items = items;
+ protected ArrayList _items = items;
+
+ public ArrayList getItems() {
+ return items;
+ }
public static void updateItemList(ArrayList newItems) {
- _items = newItems;
+ ItemPanels.itemPanel._items = newItems;
}
public class ItemPanelSlot
@@ -44,6 +48,11 @@ public ItemPanelSlot(int index) {
public ItemStack draggedStack;
public int mouseDownSlot = -1;
+ public Button prev;
+ public Button next;
+ public Label pageLabel;
+
+
private int marginLeft;
private int marginTop;
private int rows;
@@ -56,11 +65,112 @@ public ItemPanelSlot(int index) {
private int page;
private int numPages;
- public void resize() {
- items = _items;
- marginLeft = x + (w % 18) / 2;
- marginTop = y + (h % 18) / 2;
+
+ public void init() {
+ pageLabel = new Label("(0/0)", true);
+
+ prev = new Button("Prev")
+ {
+ public boolean onButtonPress(boolean rightclick) {
+ if (!rightclick) {
+ scroll(-1);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public String getRenderLabel() {
+ return "<";
+ }
+ };
+ next = new Button("Next")
+ {
+ public boolean onButtonPress(boolean rightclick) {
+ if (!rightclick) {
+ scroll(1);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public String getRenderLabel() {
+ return ">";
+ }
+ };
+ }
+
+ public int getMarginLeft() {
+ return x + (w % 18) / 2;
+ }
+
+ public int getMarginTop() {
+ return y + (h % 18) / 2;
+ }
+
+ public int getButtonTop() {
+ return 2;
+ }
+
+ public int getNextX(GuiContainer gui) {
+ return gui.width - prev.w - 2;
+ }
+
+ public int getPrevX(GuiContainer gui) {
+ return (gui.xSize + gui.width) / 2 + 2;
+ }
+
+ public int getPageX(GuiContainer gui) {
+ return gui.guiLeft * 3 / 2 + gui.xSize + 1;
+ }
+
+ public int getHeight(GuiContainer gui) {
+ return gui.height - 15 - y + getHightAdjustment();
+ }
+
+ public int getHightAdjustment() {
+ int hAdj = 0;
+ if (!canPerformAction("item"))
+ hAdj += 15;
+ return hAdj;
+ }
+
+ public int getWidth(GuiContainer gui) {
+ return LayoutManager.getSideWidth(gui) - x;
+ }
+
+ public String getLabelText() {
+ return pageLabel.text = "(" + getPage() + "/" + getNumPages() + ")";
+ }
+
+ public void resize(GuiContainer gui) {
+ items = _items;
+ final int buttonHeight = 16;
+ final int buttonWidth = 16;
+
+ prev.x = getPrevX(gui);
+ prev.y = getButtonTop();
+ prev.h = buttonHeight;
+ prev.w = buttonWidth;
+
+ next.x = getNextX(gui);
+ next.y = getButtonTop();
+ next.h = buttonHeight;
+ next.w = buttonWidth;
+
+ pageLabel.x = getPageX(gui);
+ pageLabel.y = prev.y + 5;
+ pageLabel.text = getLabelText();
+
+ y = prev.h + prev.y;
+ x = (gui.xSize + gui.width) / 2 + 3;
+ w = getWidth(gui);
+ h = getHeight(gui);
+
+ marginLeft = getMarginLeft();
+ marginTop = getMarginTop();
columns = w / 18;
rows = h / 18;
//sometimes width and height can be negative with certain resizing
@@ -86,6 +196,12 @@ private void calculatePage() {
page = firstIndex / itemsPerPage + 1;
}
+ public void setVisible() {
+ LayoutManager.addWidget(prev);
+ LayoutManager.addWidget(next);
+ LayoutManager.addWidget(pageLabel);
+
+ }
private void updateValidSlots() {
GuiContainer gui = NEIClientUtils.getGuiContainer();
validSlotMap = new boolean[rows * columns];
@@ -146,7 +262,7 @@ public void postDraw(int mousex, int mousey) {
@Override
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
if (mouseDownSlot >= 0 && draggedStack == null && NEIClientUtils.getHeldItem() == null &&
- NEIClientConfig.hasSMPCounterPart() && !GuiInfo.hasCustomSlots(NEIClientUtils.getGuiContainer())) {
+ NEIClientConfig.hasSMPCounterPart() && !GuiInfo.hasCustomSlots(NEIClientUtils.getGuiContainer())) {
ItemPanelSlot mouseOverSlot = getSlotMouseOver(mousex, mousey);
ItemStack stack = new ItemPanelSlot(mouseDownSlot).item;
if (stack != null && (mouseOverSlot == null || mouseOverSlot.slotIndex != mouseDownSlot || heldTime > 500)) {
diff --git a/src/codechicken/nei/ItemPanels.java b/src/codechicken/nei/ItemPanels.java
new file mode 100644
index 000000000..2eb3b5d2d
--- /dev/null
+++ b/src/codechicken/nei/ItemPanels.java
@@ -0,0 +1,6 @@
+package codechicken.nei;
+
+public class ItemPanels {
+ public static final ItemPanel itemPanel = new ItemPanel();
+ public static final BookmarkPanel bookmarkPanel = new BookmarkPanel();
+}
diff --git a/src/codechicken/nei/ItemQuantityField.java b/src/codechicken/nei/ItemQuantityField.java
index 5d5d9d3f5..6ca23f694 100644
--- a/src/codechicken/nei/ItemQuantityField.java
+++ b/src/codechicken/nei/ItemQuantityField.java
@@ -7,7 +7,7 @@ public ItemQuantityField(String ident) {
centered = true;
}
- @Override
+ // Find a way to work this this back in
public boolean isValid(String string) {
if (string.equals(""))
return true;
diff --git a/src/codechicken/nei/ItemSorter.java b/src/codechicken/nei/ItemSorter.java
index 53d24e1a8..fd8578b7a 100644
--- a/src/codechicken/nei/ItemSorter.java
+++ b/src/codechicken/nei/ItemSorter.java
@@ -10,14 +10,17 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
public class ItemSorter implements Comparator, ItemsLoadedCallback
{
public static class SortEntry
{
- public String name;
- public Comparator comparator;
+ public final String name;
+ public final Comparator comparator;
public SortEntry(String name, Comparator comparator) {
this.name = name;
@@ -35,8 +38,8 @@ public String getTooltip() {
}
}
- public static ArrayList entries = new ArrayList();
- public static ArrayList list = new ArrayList();
+ public static final ArrayList entries = new ArrayList<>();
+ public static ArrayList list = new ArrayList<>();
public static final ItemSorter instance = new ItemSorter();
//optimisations
@@ -44,7 +47,8 @@ public String getTooltip() {
public static void sort(ArrayList items) {
try {
- Collections.sort(items, instance);
+// items = (ArrayList) items.parallelStream().sorted(instance).collect(Collectors.toList());
+ items.sort(instance);
} catch (Exception e) {
NEIClientConfig.logger.error("Exception sorting item list", e);
}
@@ -61,7 +65,7 @@ public int compare(ItemStack o1, ItemStack o2) {
@Override
public void itemsLoaded() {
- HashMap newMap = new HashMap();
+ HashMap newMap = new HashMap<>();
int i = 0;
for(ItemStack stack : ItemList.items)
newMap.put(stack, i++);
@@ -77,76 +81,52 @@ public static SortEntry find(String name) {
}
public static int compareInt(int a, int b) {
- return a == b ? 0 : a < b ? -1 : 1;
+ return Integer.compare(a, b);
}
public static void add(String name, Comparator comparator) {
SortEntry e = new SortEntry(name, comparator);
entries.add(e);
- ArrayList nlist = new ArrayList(list);
+ ArrayList nlist = new ArrayList<>(list);
nlist.add(e);
list = nlist;//concurrency
}
public static void initConfig(ConfigTagParent tag) {
//minecraft, mod, id, default, meta, name
- API.addSortOption("nei.itemsort.minecraft", new Comparator()
- {
- @Override
- public int compare(ItemStack o1, ItemStack o2) {
- boolean m1 = "minecraft".equals(ItemInfo.itemOwners.get(o1.getItem()));
- boolean m2 = "minecraft".equals(ItemInfo.itemOwners.get(o2.getItem()));
- return m1 == m2 ? 0 : m1 ? -1 : 1;
- }
+ API.addSortOption("nei.itemsort.minecraft", (o1, o2) -> {
+ boolean m1 = "minecraft".equals(ItemInfo.itemOwners.get(o1.getItem()));
+ boolean m2 = "minecraft".equals(ItemInfo.itemOwners.get(o2.getItem()));
+ return m1 == m2 ? 0 : m1 ? -1 : 1;
});
- API.addSortOption("nei.itemsort.mod", new Comparator()
- {
- @Override
- public int compare(ItemStack o1, ItemStack o2) {
- String mod1 = ItemInfo.itemOwners.get(o1.getItem());
- String mod2 = ItemInfo.itemOwners.get(o2.getItem());
- if(mod1 == null) return mod2 == null ? 0 : 1;
- if(mod2 == null) return -1;
- return mod1.compareTo(mod2);
- }
+ API.addSortOption("nei.itemsort.mod", (o1, o2) -> {
+ String mod1 = ItemInfo.itemOwners.get(o1.getItem());
+ String mod2 = ItemInfo.itemOwners.get(o2.getItem());
+ if(mod1 == null) return mod2 == null ? 0 : 1;
+ if(mod2 == null) return -1;
+ return mod1.compareTo(mod2);
});
- API.addSortOption("nei.itemsort.id", new Comparator()
- {
- @Override
- public int compare(ItemStack o1, ItemStack o2) {
- int id1 = Item.getIdFromItem(o1.getItem());
- int id2 = Item.getIdFromItem(o2.getItem());
- return compareInt(id1, id2);
- }
+ API.addSortOption("nei.itemsort.id", (o1, o2) -> {
+ int id1 = Item.getIdFromItem(o1.getItem());
+ int id2 = Item.getIdFromItem(o2.getItem());
+ return compareInt(id1, id2);
});
- API.addSortOption("nei.itemsort.default", new Comparator()
- {
- @Override
- public int compare(ItemStack o1, ItemStack o2) {
- Integer order1 = instance.ordering.get(o1);
- Integer order2 = instance.ordering.get(o2);
- if(order1 == null) return order2 == null ? 0 : 1;
- if(order2 == null) return -1;
- return compareInt(order1, order2);
- }
+ API.addSortOption("nei.itemsort.default", (o1, o2) -> {
+ Integer order1 = instance.ordering.get(o1);
+ Integer order2 = instance.ordering.get(o2);
+ if(order1 == null) return order2 == null ? 0 : 1;
+ if(order2 == null) return -1;
+ return compareInt(order1, order2);
});
- API.addSortOption("nei.itemsort.damage", new Comparator()
- {
- @Override
- public int compare(ItemStack o1, ItemStack o2) {
- int id1 = o1.getItemDamage();
- int id2 = o2.getItemDamage();
- return compareInt(id1, id2);
- }
+ API.addSortOption("nei.itemsort.damage", (o1, o2) -> {
+ int id1 = o1.getItemDamage();
+ int id2 = o2.getItemDamage();
+ return compareInt(id1, id2);
});
- API.addSortOption("nei.itemsort.name", new Comparator()
- {
- @Override
- public int compare(ItemStack o1, ItemStack o2) {
- String name1 = ItemInfo.getSearchName(o1);
- String name2 = ItemInfo.getSearchName(o2);
- return name1.compareTo(name2);
- }
+ API.addSortOption("nei.itemsort.name", (o1, o2) -> {
+ String name1 = ItemInfo.getSearchName(o1);
+ String name2 = ItemInfo.getSearchName(o2);
+ return name1.compareTo(name2);
});
tag.getTag("inventory.itemsort").setDefaultValue(getSaveString(list));
API.addOption(new OptionOpenGui("inventory.itemsort", GuiItemSorter.class) {
@@ -171,9 +151,9 @@ public static String getSaveString(List list) {
public static ArrayList fromSaveString(String s) {
if(s == null)
- return new ArrayList(entries);
+ return new ArrayList<>(entries);
- ArrayList list = new ArrayList();
+ ArrayList list = new ArrayList<>();
for(String s2 : s.split(",")) {
SortEntry e = find(s2.trim());
if(e != null)
diff --git a/src/codechicken/nei/ItemStackMap.java b/src/codechicken/nei/ItemStackMap.java
index 198ad1ce2..9636c7f83 100644
--- a/src/codechicken/nei/ItemStackMap.java
+++ b/src/codechicken/nei/ItemStackMap.java
@@ -1,6 +1,6 @@
package codechicken.nei;
-import com.google.common.base.*;
+import com.google.common.base.Objects;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -21,8 +21,8 @@ public class ItemStackMap
{
public static class StackMetaKey
{
- public int damage;
- public NBTTagCompound tag;
+ public final int damage;
+ public final NBTTagCompound tag;
public StackMetaKey(int damage, NBTTagCompound tag) {
this.damage = damage;
@@ -47,8 +47,8 @@ public boolean equals(Object o) {
public static class Entry
{
- public ItemStack key;
- public T value;
+ public final ItemStack key;
+ public final T value;
public Entry(ItemStack key, T value) {
this.key = key;
@@ -70,11 +70,11 @@ public T get(ItemStack key) {
return wildcard;
if (damageMap != null) {
- T ret = damageMap.get(actualDamage(key));
+ final T ret = damageMap.get(actualDamage(key));
if (ret != null) return ret;
}
if (tagMap != null) {
- T ret = tagMap.get(key.stackTagCompound);
+ final T ret = tagMap.get(key.stackTagCompound);
if (ret != null) return ret;
}
if (metaMap != null)
@@ -87,13 +87,13 @@ public T put(ItemStack key, T value) {
try {
switch (getKeyType(actualDamage(key), key.stackTagCompound)) {
case 0:
- if (metaMap == null) metaMap = new HashMap();
+ if (metaMap == null) metaMap = new HashMap<>();
return metaMap.put(new StackMetaKey(key), value);
case 1:
- if (tagMap == null) tagMap = new HashMap();
+ if (tagMap == null) tagMap = new HashMap<>();
return tagMap.put(key.stackTagCompound, value);
case 2:
- if (damageMap == null) damageMap = new HashMap();
+ if (damageMap == null) damageMap = new HashMap<>();
return damageMap.put(actualDamage(key), value);
case 3:
T ret = wildcard;
@@ -167,16 +167,16 @@ public void addValues(List list) {
public void addEntries(Item item, List> list) {
if (wildcard != null)
- list.add(new Entry(newItemStack(item, 1, WILDCARD_VALUE, WILDCARD_TAG), wildcard));
+ list.add(new Entry<>(newItemStack(item, 1, WILDCARD_VALUE, WILDCARD_TAG), wildcard));
if (damageMap != null)
for (Map.Entry entry : damageMap.entrySet())
- list.add(new Entry(newItemStack(item, 1, entry.getKey(), WILDCARD_TAG), entry.getValue()));
+ list.add(new Entry<>(newItemStack(item, 1, entry.getKey(), WILDCARD_TAG), entry.getValue()));
if (tagMap != null)
for (Map.Entry entry : tagMap.entrySet())
- list.add(new Entry(newItemStack(item, 1, WILDCARD_VALUE, entry.getKey()), entry.getValue()));
+ list.add(new Entry<>(newItemStack(item, 1, WILDCARD_VALUE, entry.getKey()), entry.getValue()));
if (metaMap != null)
for (Map.Entry entry : metaMap.entrySet())
- list.add(new Entry(newItemStack(item, 1, entry.getKey().damage, entry.getKey().tag), entry.getValue()));
+ list.add(new Entry<>(newItemStack(item, 1, entry.getKey().damage, entry.getKey().tag), entry.getValue()));
}
}
@@ -199,21 +199,22 @@ public static boolean isWildcard(NBTTagCompound tag) {
return tag != null && tag.getBoolean("*");
}
- public static NBTTagCompound WILDCARD_TAG;
+ public static final NBTTagCompound WILDCARD_TAG;
static {
WILDCARD_TAG = new NBTTagCompound();
WILDCARD_TAG.setBoolean("*", true);
}
- private HashMap
- itemMap = new HashMap
- ();
+ private final HashMap
- itemMap = new HashMap<>();
private int size;
public T get(ItemStack key) {
- if (key == null || key.getItem() == null)
- return null;
+ if (key == null) return null;
+ final Item item = key.getItem();
+ if (item == null) return null;
- DetailMap map = itemMap.get(key.getItem());
+ final DetailMap map = itemMap.get(item);
return map == null ? null : map.get(key);
}
@@ -240,21 +241,21 @@ public T remove(ItemStack key) {
}
public List keys() {
- LinkedList list = new LinkedList();
+ LinkedList list = new LinkedList<>();
for (Map.Entry
- entry : itemMap.entrySet())
entry.getValue().addKeys(entry.getKey(), list);
return list;
}
public List values() {
- LinkedList list = new LinkedList();
+ LinkedList list = new LinkedList<>();
for (DetailMap map : itemMap.values())
map.addValues(list);
return list;
}
public List> entries() {
- LinkedList> list = new LinkedList>();
+ LinkedList> list = new LinkedList<>();
for (Map.Entry
- entry : itemMap.entrySet())
entry.getValue().addEntries(entry.getKey(), list);
return list;
diff --git a/src/codechicken/nei/KeyManager.java b/src/codechicken/nei/KeyManager.java
index 9e39fea6f..1d43fa523 100644
--- a/src/codechicken/nei/KeyManager.java
+++ b/src/codechicken/nei/KeyManager.java
@@ -23,8 +23,8 @@ public static class KeyState
public boolean up;
}
- public static HashMap keyStates = new HashMap();
- public static LinkedList trackers = new LinkedList();
+ public static HashMap keyStates = new HashMap<>();
+ public static LinkedList trackers = new LinkedList<>();
public static void tickKeyStates()
{
diff --git a/src/codechicken/nei/Label.java b/src/codechicken/nei/Label.java
index 2ba5e6e48..72aae7c99 100644
--- a/src/codechicken/nei/Label.java
+++ b/src/codechicken/nei/Label.java
@@ -5,9 +5,9 @@
public class Label extends Widget
{
- boolean centered;
- int colour;
- String text;
+ final boolean centered;
+ final int colour;
+ public String text;
public Label(String s, boolean center, int color)
{
diff --git a/src/codechicken/nei/LayoutManager.java b/src/codechicken/nei/LayoutManager.java
index 431f9209e..f1562ac0c 100644
--- a/src/codechicken/nei/LayoutManager.java
+++ b/src/codechicken/nei/LayoutManager.java
@@ -2,8 +2,18 @@
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.KeyManager.IKeyStateTracker;
-import codechicken.nei.api.*;
-import codechicken.nei.guihook.*;
+import codechicken.nei.api.API;
+import codechicken.nei.api.GuiInfo;
+import codechicken.nei.api.INEIGuiHandler;
+import codechicken.nei.api.IRecipeOverlayRenderer;
+import codechicken.nei.api.ItemInfo;
+import codechicken.nei.api.LayoutStyle;
+import codechicken.nei.guihook.GuiContainerManager;
+import codechicken.nei.guihook.IContainerDrawHandler;
+import codechicken.nei.guihook.IContainerInputHandler;
+import codechicken.nei.guihook.IContainerObjectHandler;
+import codechicken.nei.guihook.IContainerTooltipHandler;
+import cpw.mods.fml.common.Loader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -12,16 +22,45 @@
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import org.lwjgl.opengl.GL11;
import java.util.HashMap;
import java.util.List;
import java.util.TreeSet;
-import static codechicken.lib.gui.GuiDraw.*;
-import static codechicken.nei.NEIClientConfig.*;
-import static codechicken.nei.NEIClientUtils.*;
+import static codechicken.lib.gui.GuiDraw.changeTexture;
+import static codechicken.lib.gui.GuiDraw.drawRect;
+import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
+import static codechicken.nei.NEIClientConfig.canPerformAction;
+import static codechicken.nei.NEIClientConfig.disabledActions;
+import static codechicken.nei.NEIClientConfig.getItemQuantity;
+import static codechicken.nei.NEIClientConfig.getKeyBinding;
+import static codechicken.nei.NEIClientConfig.getOptionList;
+import static codechicken.nei.NEIClientConfig.getSearchExpression;
+import static codechicken.nei.NEIClientConfig.hasSMPCounterPart;
+import static codechicken.nei.NEIClientConfig.invCreativeMode;
+import static codechicken.nei.NEIClientConfig.isEnabled;
+import static codechicken.nei.NEIClientConfig.isHidden;
+import static codechicken.nei.NEIClientConfig.showIDs;
+import static codechicken.nei.NEIClientConfig.toggleBooleanSetting;
+import static codechicken.nei.NEIClientConfig.world;
+import static codechicken.nei.NEIClientUtils.controlKey;
+import static codechicken.nei.NEIClientUtils.cycleGamemode;
+import static codechicken.nei.NEIClientUtils.decreaseSlotStack;
+import static codechicken.nei.NEIClientUtils.deleteEverything;
+import static codechicken.nei.NEIClientUtils.deleteHeldItem;
+import static codechicken.nei.NEIClientUtils.deleteItemsOfType;
+import static codechicken.nei.NEIClientUtils.getGuiContainer;
+import static codechicken.nei.NEIClientUtils.getHeldItem;
+import static codechicken.nei.NEIClientUtils.getNextGamemode;
+import static codechicken.nei.NEIClientUtils.healPlayer;
+import static codechicken.nei.NEIClientUtils.isValidGamemode;
+import static codechicken.nei.NEIClientUtils.setHourForward;
+import static codechicken.nei.NEIClientUtils.setItemQuantity;
+import static codechicken.nei.NEIClientUtils.shiftKey;
+import static codechicken.nei.NEIClientUtils.toggleMagnetMode;
+import static codechicken.nei.NEIClientUtils.toggleRaining;
+import static codechicken.nei.NEIClientUtils.translate;
public class LayoutManager implements IContainerInputHandler, IContainerTooltipHandler, IContainerDrawHandler, IContainerObjectHandler, IKeyStateTracker
{
@@ -38,21 +77,17 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
private static TreeSet controlWidgets;
public static ItemPanel itemPanel;
+ public static BookmarkPanel bookmarkPanel;
public static SubsetWidget dropDown;
public static TextField searchField;
public static Button options;
+ public static Button bookmarks;
- public static Button prev;
- public static Button next;
- public static Label pageLabel;
public static Button more;
public static Button less;
public static ItemQuantityField quantity;
- public static SaveLoadButton[] stateButtons;
- public static Button[] deleteButtons;
-
public static Button delete;
public static ButtonCycled gamemode;
public static Button rain;
@@ -62,11 +97,14 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
public static IRecipeOverlayRenderer overlayRenderer;
- public static HashMap layoutStyles = new HashMap();
+ public static HashMap layoutStyles = new HashMap<>();
+
+ public static boolean ftbUtilsLoaded = false;
public static void load() {
+ ftbUtilsLoaded = Loader.isModLoaded("FTBU");
+
API.addLayoutStyle(0, new LayoutStyleMinecraft());
- API.addLayoutStyle(1, new LayoutStyleTMIOld());
instance = new LayoutManager();
KeyManager.trackers.add(instance);
@@ -93,6 +131,13 @@ public void onPreDraw(GuiContainer gui) {
}
}
+ public static int getSideWidth(GuiContainer gui) {
+ return gui.width - 3;
+ }
+ public static int getLeftSize(GuiContainer gui) {
+ return getSideWidth(gui) - (ftbUtilsLoaded ? 18 : 0);
+ }
+
@Override
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
if (isHidden())
@@ -263,7 +308,12 @@ public static void layout(GuiContainer gui) {
}
private static void init() {
- itemPanel = new ItemPanel();
+ itemPanel = ItemPanels.itemPanel;
+ itemPanel.init();
+
+ bookmarkPanel = ItemPanels.bookmarkPanel;
+ bookmarkPanel.init();
+
dropDown = new SubsetWidget();
searchField = new SearchField("search");
@@ -283,37 +333,19 @@ public String getRenderLabel() {
return translate("inventory.options");
}
};
- prev = new Button("Prev")
- {
- public boolean onButtonPress(boolean rightclick) {
- if (!rightclick) {
- LayoutManager.itemPanel.scroll(-1);
- return true;
- }
- return false;
- }
- @Override
- public String getRenderLabel() {
- return translate("inventory.prev");
- }
- };
- next = new Button("Next")
+ bookmarks = new Button("Bookmarks")
{
+ @Override
public boolean onButtonPress(boolean rightclick) {
- if (!rightclick) {
- LayoutManager.itemPanel.scroll(1);
- return true;
- }
return false;
}
@Override
public String getRenderLabel() {
- return translate("inventory.next");
+ return translate("bookmark.toggle");
}
};
- pageLabel = new Label("(0/0)", true);
more = new Button("+")
{
@Override
@@ -350,43 +382,6 @@ public boolean onButtonPress(boolean rightclick) {
};
quantity = new ItemQuantityField("quantity");
- stateButtons = new SaveLoadButton[7];
- deleteButtons = new Button[7];
-
- for (int i = 0; i < 7; i++) {
- final int savestate = i;
- stateButtons[i] = new SaveLoadButton("")
- {
- @Override
- public boolean onButtonPress(boolean rightclick) {
- if (isStateSaved(savestate))
- loadState(savestate);
- else
- saveState(savestate);
- return true;
- }
-
- @Override
- public void onTextChange() {
- NBTTagCompound statelist = global.nbt.getCompoundTag("statename");
- global.nbt.setTag("statename", statelist);
-
- statelist.setString("" + savestate, label);
- global.saveNBT();
- }
- };
- deleteButtons[i] = new Button("x")
- {
- @Override
- public boolean onButtonPress(boolean rightclick) {
- if (!rightclick) {
- clearState(savestate);
- return true;
- }
- return false;
- }
- };
- }
delete = new Button()
{
@@ -593,18 +588,18 @@ public boolean checkCreativeInv(GuiContainer gui) {
}
public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visiblity) {
- drawWidgets = new TreeSet(new WidgetZOrder(false));
- controlWidgets = new TreeSet(new WidgetZOrder(true));
+ drawWidgets = new TreeSet<>(new WidgetZOrder(false));
+ controlWidgets = new TreeSet<>(new WidgetZOrder(true));
if (!visiblity.showNEI)
return;
+
addWidget(options);
if (visiblity.showItemPanel) {
addWidget(itemPanel);
- addWidget(prev);
- addWidget(next);
- addWidget(pageLabel);
+ itemPanel.setVisible();
+
if (canPerformAction("item")) {
addWidget(more);
addWidget(less);
@@ -612,18 +607,16 @@ public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visib
}
}
+ if (visiblity.showBookmarkPanel) {
+ addWidget(bookmarkPanel);
+ bookmarkPanel.setVisible();
+ }
+
if (visiblity.showSearchSection) {
addWidget(dropDown);
addWidget(searchField);
}
- if (canPerformAction("item") && hasSMPCounterPart() && visiblity.showStateButtons) {
- for (int i = 0; i < 7; i++) {
- addWidget(stateButtons[i]);
- if (isStateSaved(i))
- addWidget(deleteButtons[i]);
- }
- }
if (visiblity.showUtilityButtons) {
if (canPerformAction("time")) {
for (int i = 0; i < 4; i++)
@@ -653,10 +646,10 @@ public static LayoutStyle getLayoutStyle(int id) {
}
public static LayoutStyle getLayoutStyle() {
- return getLayoutStyle(NEIClientConfig.getLayoutStyle());
+ return getLayoutStyle(0);
}
- private static void addWidget(Widget widget) {
+ public static void addWidget(Widget widget) {
drawWidgets.add(widget);
controlWidgets.add(widget);
}
@@ -716,7 +709,7 @@ public void renderSlotUnderlay(GuiContainer gui, Slot slot) {
@Override
public void renderSlotOverlay(GuiContainer window, Slot slot) {
ItemStack item = slot.getStack();
- if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.itemMatches(item))) {
+ if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.getItemListFilter().matches(item))) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef(0, 0, 150);
drawRect(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, 0x80000000);
@@ -798,4 +791,6 @@ public void tickKeyStates() {
if (KeyManager.keyStates.get("world.creative").down)
gamemode.onButtonPress(false);
}
+
}
+
diff --git a/src/codechicken/nei/LayoutStyleDefault.java b/src/codechicken/nei/LayoutStyleDefault.java
deleted file mode 100644
index 7e553436b..000000000
--- a/src/codechicken/nei/LayoutStyleDefault.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package codechicken.nei;
-
-import codechicken.nei.api.LayoutStyle;
-import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.nbt.NBTTagCompound;
-
-import static codechicken.lib.gui.GuiDraw.getStringWidth;
-import static codechicken.nei.LayoutManager.*;
-import static codechicken.nei.NEIClientConfig.*;
-
-public abstract class LayoutStyleDefault extends LayoutStyle
-{
- @Override
- public void layout(GuiContainer gui, VisiblityData visiblity) {
- int windowWidth = gui.width;
- int windowHeight = gui.height;
- int containerWidth = gui.xSize;
- int containerLeft = gui.guiLeft;
-
- reset();
-
- prev.y = 2;
- prev.h = 16;
- prev.w = containerLeft / 3;
- prev.x = (containerWidth + windowWidth) / 2 + 2;
- next.x = windowWidth - prev.w - 2;
-
- next.y = prev.y;
- next.w = prev.w;
- next.h = prev.h;
- pageLabel.x = containerLeft * 3 / 2 + containerWidth + 1;
- pageLabel.y = prev.y + 5;
- pageLabel.text = "(" + itemPanel.getPage() + "/" + itemPanel.getNumPages() + ")";
-
- itemPanel.y = prev.h + prev.y;
- itemPanel.x = (containerWidth + windowWidth) / 2 + 3;
- itemPanel.w = windowWidth - 3 - itemPanel.x;
- itemPanel.h = windowHeight - 15 - itemPanel.y;
- if (!canPerformAction("item"))
- itemPanel.h += 15;
- itemPanel.resize();
-
- more.w = more.h = less.w = less.h = 16;
- less.x = prev.x;
- more.x = windowWidth - less.w - 2;
- more.y = less.y = windowHeight - more.h - 2;
-
- quantity.x = less.x + less.w + 2;
- quantity.y = less.y;
- quantity.w = more.x - quantity.x - 2;
- quantity.h = less.h;
-
- options.x = isEnabled() ? 0 : 6;
- options.y = isEnabled() ? windowHeight - 22 : windowHeight - 28;
- options.w = 80;
- options.h = 22;
-
- delete.state = 0x4;
- if (NEIController.getDeleteMode())
- delete.state |= 1;
- else if (!visiblity.enableDeleteMode)
- delete.state |= 2;
-
- rain.state = 0x4;
- if (disabledActions.contains("rain"))
- rain.state |= 2;
- else if (NEIClientUtils.isRaining())
- rain.state |= 1;
-
- gamemode.state = 0x4;
- if (NEIClientUtils.getGamemode() != 0) {
- gamemode.state |= 0x1;
- gamemode.index = NEIClientUtils.getGamemode() - 1;
- } else {
- if (NEIClientUtils.isValidGamemode("creative"))
- gamemode.index = 0;
- else if (NEIClientUtils.isValidGamemode("creative+"))
- gamemode.index = 1;
- else if (NEIClientUtils.isValidGamemode("adventure"))
- gamemode.index = 2;
- }
-
- magnet.state = 0x4 | (getMagnetMode() ? 1 : 0);
-
- if (canPerformAction("delete"))
- layoutButton(delete);
- if (canPerformAction("rain"))
- layoutButton(rain);
- if (NEIClientUtils.isValidGamemode("creative") ||
- NEIClientUtils.isValidGamemode("creative+") ||
- NEIClientUtils.isValidGamemode("adventure"))
- layoutButton(gamemode);
- if (canPerformAction("magnet"))
- layoutButton(magnet);
- if (canPerformAction("time")) {
- for (int i = 0; i < 4; i++) {
- timeButtons[i].state = disabledActions.contains(NEIActions.timeZones[i]) ? 2 : 0;
- layoutButton(timeButtons[i]);
- }
- }
- if (canPerformAction("heal"))
- layoutButton(heal);
-
- searchField.y = windowHeight - searchField.h - 2;
-
- dropDown.h = 20;
- dropDown.w = prev.x - dropDown.x - 3;
- searchField.h = 20;
- searchField.w = 150;
- searchField.x = (windowWidth - searchField.w) / 2;
-
- if (!visiblity.showItemSection) {
- //TODO dropDown.setDropDown(0);
- searchField.setFocus(false);
- }
-
- int maxWidth = 0;
- for (int i = 0; i < 7; i++) {
- deleteButtons[i].w = 16;
- deleteButtons[i].h = 16;
-
- NBTTagCompound statelist = global.nbt.getCompoundTag("statename");
- global.nbt.setTag("statename", statelist);
- String name = statelist.getString("" + i);
- if (statelist.getTag("" + i) == null) {
- name = "" + (i + 1);
- statelist.setString("" + i, name);
- }
- stateButtons[i].label = name;
- stateButtons[i].saved = isStateSaved(i);
-
- int width = getStringWidth(stateButtons[i].getRenderLabel()) + 26;
- if (width + 22 > containerLeft)
- width = containerLeft - 22;
-
- if (width > maxWidth)
- maxWidth = width;
- }
-
- for (int i = 0; i < 7; i++) {
- stateButtons[i].x = 0;
- stateButtons[i].y = 58 + i * 22;
- stateButtons[i].h = 20;
-
- stateButtons[i].x = 0;
- stateButtons[i].w = maxWidth;
- deleteButtons[i].x = stateButtons[i].w + 3;
- deleteButtons[i].y = stateButtons[i].y + 2;
- }
- }
-
- public abstract void layoutButton(Button button);
-}
diff --git a/src/codechicken/nei/LayoutStyleMinecraft.java b/src/codechicken/nei/LayoutStyleMinecraft.java
index 57d3a1522..c535b2b3e 100644
--- a/src/codechicken/nei/LayoutStyleMinecraft.java
+++ b/src/codechicken/nei/LayoutStyleMinecraft.java
@@ -1,14 +1,34 @@
package codechicken.nei;
+import codechicken.nei.api.LayoutStyle;
+import net.minecraft.client.gui.inventory.GuiContainer;
import org.lwjgl.opengl.GL11;
import static codechicken.lib.gui.GuiDraw.drawStringC;
-import static codechicken.nei.LayoutManager.*;
+import static codechicken.nei.LayoutManager.bookmarkPanel;
+import static codechicken.nei.LayoutManager.delete;
+import static codechicken.nei.LayoutManager.dropDown;
+import static codechicken.nei.LayoutManager.gamemode;
+import static codechicken.nei.LayoutManager.heal;
+import static codechicken.nei.LayoutManager.itemPanel;
+import static codechicken.nei.LayoutManager.less;
+import static codechicken.nei.LayoutManager.magnet;
+import static codechicken.nei.LayoutManager.more;
+import static codechicken.nei.LayoutManager.options;
+import static codechicken.nei.LayoutManager.quantity;
+import static codechicken.nei.LayoutManager.rain;
+import static codechicken.nei.LayoutManager.searchField;
+import static codechicken.nei.LayoutManager.timeButtons;
+import static codechicken.nei.NEIClientConfig.canPerformAction;
+import static codechicken.nei.NEIClientConfig.disabledActions;
+import static codechicken.nei.NEIClientConfig.getMagnetMode;
+import static codechicken.nei.NEIClientConfig.isEnabled;
-public class LayoutStyleMinecraft extends LayoutStyleDefault
+public class LayoutStyleMinecraft extends LayoutStyle
{
- int stateButtonCount;
- int clickButtonCount;
+ public int buttonCount;
+ public int leftSize;
+ public int numButtons;
@Override
public String getName() {
@@ -18,38 +38,118 @@ public String getName() {
@Override
public void init() {
delete.icon = new Image(144, 12, 12, 12);
+ rain.icon = new Image(120, 12, 12, 12);
gamemode.icons[0] = new Image(132, 12, 12, 12);
gamemode.icons[1] = new Image(156, 12, 12, 12);
gamemode.icons[2] = new Image(168, 12, 12, 12);
- rain.icon = new Image(120, 12, 12, 12);
magnet.icon = new Image(180, 24, 12, 12);
timeButtons[0].icon = new Image(132, 24, 12, 12);
timeButtons[1].icon = new Image(120, 24, 12, 12);
timeButtons[2].icon = new Image(144, 24, 12, 12);
timeButtons[3].icon = new Image(156, 24, 12, 12);
heal.icon = new Image(168, 24, 12, 12);
- dropDown.x = 90;
}
@Override
public void reset() {
- stateButtonCount = clickButtonCount = 0;
+ buttonCount = 0;
}
@Override
- public void layoutButton(Button button) {
- if ((button.state & 0x4) != 0) {
- button.x = 6 + stateButtonCount * 20;
- button.y = 3;
- stateButtonCount++;
+ public void layout(GuiContainer gui, VisiblityData visiblity) {
+ reset();
+
+ //leftSize = ((gui.width - gui.xSize) / 2) - 3;
+ leftSize = ItemPanels.bookmarkPanel.getWidth(gui);
+ numButtons = leftSize / 18;
+
+ delete.state = 0x4;
+ if (NEIController.getDeleteMode())
+ delete.state |= 1;
+ else if (!visiblity.enableDeleteMode)
+ delete.state |= 2;
+
+ rain.state = 0x4;
+ if (disabledActions.contains("rain"))
+ rain.state |= 2;
+ else if (NEIClientUtils.isRaining())
+ rain.state |= 1;
+
+ gamemode.state = 0x4;
+ if (NEIClientUtils.getGamemode() != 0) {
+ gamemode.state |= 0x1;
+ gamemode.index = NEIClientUtils.getGamemode() - 1;
} else {
- button.x = 6 + (clickButtonCount % 4) * 20;
- button.y = 3 + (1 + clickButtonCount / 4) * 18;
- clickButtonCount++;
+ if (NEIClientUtils.isValidGamemode("creative"))
+ gamemode.index = 0;
+ else if (NEIClientUtils.isValidGamemode("creative+"))
+ gamemode.index = 1;
+ else if (NEIClientUtils.isValidGamemode("adventure"))
+ gamemode.index = 2;
+ }
+
+ magnet.state = 0x4 | (getMagnetMode() ? 1 : 0);
+
+ if (canPerformAction("delete"))
+ layoutButton(delete);
+ if (canPerformAction("rain"))
+ layoutButton(rain);
+ if (NEIClientUtils.isValidGamemode("creative") ||
+ NEIClientUtils.isValidGamemode("creative+") ||
+ NEIClientUtils.isValidGamemode("adventure"))
+ layoutButton(gamemode);
+ if (canPerformAction("magnet"))
+ layoutButton(magnet);
+ if (canPerformAction("time")) {
+ for (int i = 0; i < 4; i++) {
+ timeButtons[i].state = disabledActions.contains(NEIActions.timeZones[i]) ? 2 : 0;
+ layoutButton(timeButtons[i]);
+ }
}
+ if (canPerformAction("heal"))
+ layoutButton(heal);
+
+ itemPanel.resize(gui);
+ bookmarkPanel.resize(gui);
+
+ more.w = more.h = less.w = less.h = 16;
+ less.x = itemPanel.prev.x;
+ more.x = gui.width - less.w - 2;
+ more.y = less.y = gui.height - more.h - 2;
+
+ quantity.x = less.x + less.w + 2;
+ quantity.y = less.y;
+ quantity.w = more.x - quantity.x - 2;
+ quantity.h = less.h;
+
+ options.x = isEnabled() ? 0 : 6;
+ options.y = isEnabled() ? gui.height - 22 : gui.height - 28;
+ options.w = 80;
+ options.h = 22;
+
+ searchField.y = gui.height - searchField.h - 2;
+
+ dropDown.x = itemPanel.x - 150;
+ dropDown.h = 20;
+ dropDown.w = Math.min(itemPanel.prev.x - dropDown.x - 3, 100);
+ searchField.h = 20;
+ searchField.w = 150;
+ searchField.x = (gui.width - searchField.w) / 2;
+
+ if (!visiblity.showItemSection) {
+ searchField.setFocus(false);
+ }
+
+ }
+
+ public void layoutButton(Button button) {
+ button.x = 6 + (buttonCount % numButtons) * 20;
+ button.y = 3 + (buttonCount / numButtons) * 18;
button.h = 17;
button.w = button.contentWidth() + 6;
+
+ buttonCount++;
}
@Override
@@ -61,7 +161,7 @@ public void drawButton(Button b, int mousex, int mousey) {
if ((b.state & 0x3) == 2)
tex = 0;
else if ((b.state & 0x4) == 0 && b.contains(mousex, mousey) ||//not a state button and mouseover
- (b.state & 0x3) == 1)//state active
+ (b.state & 0x3) == 1)//state active
tex = 2;
else
tex = 1;
@@ -70,7 +170,7 @@ else if ((b.state & 0x4) == 0 && b.contains(mousex, mousey) ||//not a state butt
Image icon = b.getRenderIcon();
if (icon == null) {
int colour = tex == 2 ? 0xffffa0 :
- tex == 0 ? 0x601010 : 0xe0e0e0;
+ tex == 0 ? 0x601010 : 0xe0e0e0;
drawStringC(b.getRenderLabel(), b.x + b.w / 2, b.y + (b.h - 8) / 2, colour);
} else {
diff --git a/src/codechicken/nei/LayoutStyleTMIOld.java b/src/codechicken/nei/LayoutStyleTMIOld.java
deleted file mode 100644
index 325990ebd..000000000
--- a/src/codechicken/nei/LayoutStyleTMIOld.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package codechicken.nei;
-
-import codechicken.nei.guihook.GuiContainerManager;
-
-import static codechicken.lib.gui.GuiDraw.drawRect;
-import static codechicken.lib.gui.GuiDraw.drawString;
-import static codechicken.lib.gui.GuiDraw.drawStringC;
-import static codechicken.nei.LayoutManager.*;
-
-public class LayoutStyleTMIOld extends LayoutStyleDefault
-{
- public static final Image stateOff = new Image(48, 0, 8, 12);
- public static final Image stateOn = new Image(56, 0, 8, 12);
- public static final Image stateDisabled = new Image(64, 0, 8, 12);
-
- int stateButtonCount;
- int clickButtonCount;
-
- @Override
- public String getName()
- {
- return "oldtmi";
- }
-
- @Override
- public void init()
- {
- delete.icon = new Image(24, 12, 12, 12);
- gamemode.icons[0] = new Image(12, 12, 12, 12);
- gamemode.icons[1] = new Image(36, 12, 12, 12);
- gamemode.icons[2] = new Image(48, 12, 12, 12);
- rain.icon = new Image(0, 12, 12, 12);
- magnet.icon = new Image(60, 24, 12, 12);
- timeButtons[0].icon = new Image(12, 24, 12, 12);
- timeButtons[1].icon = new Image(0, 24, 12, 12);
- timeButtons[2].icon = new Image(24, 24, 12, 12);
- timeButtons[3].icon = new Image(36, 24, 12, 12);
- heal.icon = new Image(48, 24, 12, 12);
- dropDown.x = 93;
- }
-
- @Override
- public void reset()
- {
- stateButtonCount = clickButtonCount = 0;
- }
-
- @Override
- public void layoutButton(Button button)
- {
- int offsetx = 2;
- int offsety = 2;
-
- if((button.state & 0x4) != 0)
- {
- button.x = offsetx + stateButtonCount*22;
- button.y = offsety;
- stateButtonCount++;
- }
- else
- {
- button.x = offsetx + (clickButtonCount%4)*22;
- button.y = offsety + (1+clickButtonCount/4)*17;
- clickButtonCount++;
- }
-
- button.h = 14;
- button.w = button.contentWidth() + 2;
- if((button.state & 0x4) != 0)
- button.w += stateOff.width;
- }
-
- @Override
- public void drawBackground(GuiContainerManager gui)
- {
- if(clickButtonCount == 0 && stateButtonCount == 0)
- return;
-
- int maxx = Math.max(stateButtonCount, clickButtonCount);
- if(maxx > 4)maxx = 4;
- int maxy = clickButtonCount == 0 ? 1 : (clickButtonCount / 4 + 2);
-
- drawRect(0, 0, 2+22*maxx, 1+maxy*17, 0xFF000000);
- }
-
- @Override
- public void drawButton(Button b, int mousex, int mousey)
- {
- int cwidth = b.contentWidth();
- if((b.state & 0x4) != 0)
- cwidth += stateOff.width;
- int textx = b.x + (b.w - cwidth) / 2;
- int texty = b.y + (b.h - 8) / 2;
-
- drawRect(b.x, b.y, b.w, b.h, b.contains(mousex, mousey) ? 0xee401008 : 0xee000000);
-
- Image icon = b.getRenderIcon();
- if(icon == null)
- {
- drawString(b.getRenderLabel(), textx, texty, -1);
- }
- else
- {
- int icony = b.y + (b.h - icon.height) / 2;
- LayoutManager.drawIcon(textx, icony, icon);
- if((b.state & 0x3) == 2)
- drawRect(textx, icony, icon.width, icon.height, 0x80000000);
-
- if((b.state & 0x4) != 0)
- {
- Image stateimage;
- if((b.state & 0x3) == 1)
- stateimage = stateOn;
- else if((b.state & 0x3) == 2)
- stateimage = stateDisabled;
- else
- stateimage = stateOff;
- LayoutManager.drawIcon(textx+icon.width, icony, stateimage);
- }
- }
- }
-
- @Override
- public void drawSubsetTag(String text, int x, int y, int w, int h, int state, boolean mouseover) {
- drawRect(x, y, w, h, mouseover ? 0xFF401008 : 0xFF000000);
- if(text != null) {
- int colour = -1;
- if (state == 0)
- colour = 0xFF601010;
- else if (state == 1)
- colour = 0xFF807070;
- drawStringC(text, x, y, w, h, colour, state == 0);
- }
- }
-}
diff --git a/src/codechicken/nei/NEIActions.java b/src/codechicken/nei/NEIActions.java
index a1f30825f..ac4b92417 100644
--- a/src/codechicken/nei/NEIActions.java
+++ b/src/codechicken/nei/NEIActions.java
@@ -9,8 +9,8 @@ public class NEIActions
{
public static final int protocol = 0;
- public static HashMap nameActionMap = new HashMap();
- public static HashSet canDisable = new HashSet();
+ public static HashMap nameActionMap = new HashMap<>();
+ public static HashSet canDisable = new HashSet<>();
public static void addAction(String name, String base, boolean smpreq)
{
@@ -85,7 +85,7 @@ public NEIActions(String name, String base, boolean smpreq)
public static List baseActions()
{
- List list = new LinkedList();
+ List list = new LinkedList<>();
for(NEIActions a : nameActionMap.values())
if(a.base.equals(a.name))
list.add(a.name);
diff --git a/src/codechicken/nei/NEIChestGuiHandler.java b/src/codechicken/nei/NEIChestGuiHandler.java
index 98d30eff8..4a6b9c7b7 100644
--- a/src/codechicken/nei/NEIChestGuiHandler.java
+++ b/src/codechicken/nei/NEIChestGuiHandler.java
@@ -7,7 +7,6 @@
import net.minecraft.inventory.ContainerChest;
import net.minecraft.item.ItemStack;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -19,11 +18,11 @@ public int chestSize(GuiContainer gui) {
@Override
public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) {
- return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList();
+ return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList();
}
@Override
public List getInventoryAreas(GuiContainer gui) {
- return gui instanceof GuiChest ? Arrays.asList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
+ return gui instanceof GuiChest ? Collections.singletonList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
}
}
diff --git a/src/codechicken/nei/NEIClientConfig.java b/src/codechicken/nei/NEIClientConfig.java
index 5681657ae..44f04db63 100644
--- a/src/codechicken/nei/NEIClientConfig.java
+++ b/src/codechicken/nei/NEIClientConfig.java
@@ -1,19 +1,34 @@
package codechicken.nei;
-import codechicken.core.*;
+import codechicken.core.CCUpdateChecker;
+import codechicken.core.ClassDiscoverer;
+import codechicken.core.ClientUtils;
+import codechicken.core.CommonUtils;
import codechicken.lib.config.ConfigFile;
import codechicken.lib.config.ConfigTag;
import codechicken.lib.config.ConfigTagParent;
-import codechicken.nei.api.*;
-import codechicken.nei.config.*;
+import codechicken.nei.api.API;
+import codechicken.nei.api.GuiInfo;
+import codechicken.nei.api.IConfigureNEI;
+import codechicken.nei.api.ItemInfo;
+import codechicken.nei.api.NEIInfo;
+import codechicken.nei.config.ConfigSet;
+import codechicken.nei.config.GuiHighlightTips;
+import codechicken.nei.config.GuiNEIOptionList;
+import codechicken.nei.config.GuiOptionList;
+import codechicken.nei.config.OptionCycled;
+import codechicken.nei.config.OptionGamemodes;
+import codechicken.nei.config.OptionList;
+import codechicken.nei.config.OptionOpenGui;
+import codechicken.nei.config.OptionTextField;
+import codechicken.nei.config.OptionToggleButton;
+import codechicken.nei.config.OptionUtilities;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.obfuscator.ObfuscationRun;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraft.world.storage.SaveFormatComparator;
import org.apache.logging.log4j.LogManager;
@@ -21,11 +36,8 @@
import org.lwjgl.input.Keyboard;
import java.io.File;
-import java.util.Collections;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
-import java.util.Map.Entry;
public class NEIClientConfig
{
@@ -38,14 +50,14 @@ public class NEIClientConfig
new File("saves/NEI/client.dat"),
new ConfigFile(new File(configDir, "client.cfg")));
public static ConfigSet world;
+ public static final File bookmarkFile = new File(configDir, "bookmarks.ini");
- public static ItemStack creativeInv[];
- private static boolean statesSaved[] = new boolean[7];
+ public static ItemStack[] creativeInv;
public static boolean hasSMPCounterpart;
- public static HashSet permissableActions = new HashSet();
- public static HashSet disabledActions = new HashSet();
- public static HashSet enabledActions = new HashSet();
+ public static HashSet permissableActions = new HashSet<>();
+ public static HashSet disabledActions = new HashSet<>();
+ public static HashSet enabledActions = new HashSet<>();
public static ItemStackSet bannedBlocks = new ItemStackSet();
@@ -84,42 +96,6 @@ public boolean optionValid(int index) {
tag.getTag("inventory.gamemodes").setDefaultValue("creative, creative+, adventure");
API.addOption(new OptionGamemodes("inventory.gamemodes"));
- tag.getTag("inventory.layoutstyle").getIntValue(0);
- API.addOption(new OptionCycled("inventory.layoutstyle", 0)
- {
- @Override
- public String getPrefix() {
- return translateN(name);
- }
-
- @Override
- public String getButtonText() {
- return NEIClientUtils.translate("layoutstyle." +
- LayoutManager.getLayoutStyle(renderTag().getIntValue()).getName());
- }
-
- @Override
- public boolean cycle() {
- LinkedList list = new LinkedList();
- for (Entry entry : LayoutManager.layoutStyles.entrySet())
- list.add(entry.getKey());
-
- Collections.sort(list);
-
- int nextLayout = renderTag().getIntValue();
- if (nextLayout == list.getLast())//loop list
- nextLayout = -1;
- for (Integer i : list) {
- if (i > nextLayout) {
- nextLayout = i;
- break;
- }
- }
-
- getTag().setIntValue(nextLayout);
- return true;
- }
- });
ItemSorter.initConfig(tag);
@@ -186,6 +162,7 @@ private static void setDefaultKeyBindings() {
API.addKeyBind("gui.next", Keyboard.KEY_NEXT);
API.addKeyBind("gui.hide", Keyboard.KEY_O);
API.addKeyBind("gui.search", Keyboard.KEY_F);
+ API.addKeyBind("gui.bookmark", Keyboard.KEY_A);
API.addKeyBind("world.chunkoverlay", Keyboard.KEY_F9);
API.addKeyBind("world.moboverlay", Keyboard.KEY_F7);
API.addKeyBind("world.highlight_tips", Keyboard.KEY_NUMPAD0);
@@ -252,23 +229,16 @@ public static void bootNEI(World world) {
if (configLoaded)
return;
- loadStates();
- //ItemVisibilityHash.loadStates();
- //vishash = new ItemVisibilityHash();
ItemInfo.load(world);
GuiInfo.load();
RecipeInfo.load();
LayoutManager.load();
+ ItemPanels.bookmarkPanel.loadBookmarks();
NEIController.load();
configLoaded = true;
- ClassDiscoverer classDiscoverer = new ClassDiscoverer(new IStringMatcher()
- {
- public boolean matches(String test) {
- return test.startsWith("NEI") && test.endsWith("Config.class");
- }
- }, IConfigureNEI.class);
+ ClassDiscoverer classDiscoverer = new ClassDiscoverer(test -> test.startsWith("NEI") && test.endsWith("Config.class"), IConfigureNEI.class);
classDiscoverer.findClasses();
@@ -286,21 +256,12 @@ public boolean matches(String test) {
ItemSorter.loadConfig();
}
- public static void loadStates() {
- for (int state = 0; state < 7; state++)
- statesSaved[state] = !global.nbt.getCompoundTag("save" + state).hasNoTags();
- }
-
public static boolean isWorldSpecific(String setting) {
if(world == null) return false;
ConfigTag tag = world.config.getTag(setting, false);
return tag != null && tag.value != null;
}
- public static boolean isStateSaved(int i) {
- return statesSaved[i];
- }
-
public static ConfigTag getSetting(String s) {
return isWorldSpecific(s) ? world.config.getTag(s) : global.config.getTag(s);
}
@@ -390,79 +351,6 @@ public static boolean areDamageVariantsShown() {
return hasSMPCounterPart() || getSetting("command.item").getValue().contains("{3}");
}
- public static void clearState(int state) {
- statesSaved[state] = false;
- global.nbt.setTag("save" + state, new NBTTagCompound());
- global.saveNBT();
- }
-
- public static void loadState(int state) {
- if (!statesSaved[state])
- return;
-
- NBTTagCompound statesave = global.nbt.getCompoundTag("save" + state);
- GuiContainer currentContainer = NEIClientUtils.getGuiContainer();
- LinkedList saveAreas = new LinkedList();
- saveAreas.add(new TaggedInventoryArea(NEIClientUtils.mc().thePlayer.inventory));
-
- for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
- List areaList = handler.getInventoryAreas(currentContainer);
- if (areaList != null)
- saveAreas.addAll(areaList);
- }
-
- for (TaggedInventoryArea area : saveAreas) {
- if (!statesave.hasKey(area.tagName))
- continue;
-
- for (int slot : area.slots) {
- NEIClientUtils.setSlotContents(slot, null, area.isContainer());
- }
-
- NBTTagList areaTag = statesave.getTagList(area.tagName, 10);
- for (int i = 0; i < areaTag.tagCount(); i++) {
- NBTTagCompound stacksave = areaTag.getCompoundTagAt(i);
- int slot = stacksave.getByte("Slot") & 0xFF;
- if (!area.slots.contains(slot))
- continue;
-
- NEIClientUtils.setSlotContents(slot, ItemStack.loadItemStackFromNBT(stacksave), area.isContainer());
- }
- }
- }
-
- public static void saveState(int state) {
- NBTTagCompound statesave = global.nbt.getCompoundTag("save" + state);
- GuiContainer currentContainer = NEIClientUtils.getGuiContainer();
- LinkedList saveAreas = new LinkedList();
- saveAreas.add(new TaggedInventoryArea(NEIClientUtils.mc().thePlayer.inventory));
-
- for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
- List areaList = handler.getInventoryAreas(currentContainer);
- if (areaList != null)
- saveAreas.addAll(areaList);
- }
-
- for (TaggedInventoryArea area : saveAreas) {
- NBTTagList areaTag = new NBTTagList();
-
- for (int i : area.slots) {
- ItemStack stack = area.getStackInSlot(i);
- if (stack == null)
- continue;
- NBTTagCompound stacksave = new NBTTagCompound();
- stacksave.setByte("Slot", (byte) i);
- stack.writeToNBT(stacksave);
- areaTag.appendTag(stacksave);
- }
- statesave.setTag(area.tagName, areaTag);
- }
-
- global.nbt.setTag("save" + state, statesave);
- global.saveNBT();
- statesSaved[state] = true;
- }
-
public static boolean hasSMPCounterPart() {
return hasSMPCounterpart;
}
@@ -494,10 +382,7 @@ public static boolean canPerformAction(String name) {
return false;
String cmd = getStringSetting("command." + base);
- if (cmd == null || !cmd.startsWith("/"))
- return false;
-
- return true;
+ return cmd != null && cmd.startsWith("/");
}
private static boolean modePermitsAction(String name) {
@@ -532,7 +417,7 @@ public static void reloadSaves() {
logger.error("Error loading saves", e);
return;
}
- HashSet saveFileNames = new HashSet();
+ HashSet saveFileNames = new HashSet<>();
for (SaveFormatComparator save : saves)
saveFileNames.add(save.getFileName());
diff --git a/src/codechicken/nei/NEIClientUtils.java b/src/codechicken/nei/NEIClientUtils.java
index df0a8301c..e672a21d7 100644
--- a/src/codechicken/nei/NEIClientUtils.java
+++ b/src/codechicken/nei/NEIClientUtils.java
@@ -22,9 +22,20 @@
import java.text.MessageFormat;
import java.text.NumberFormat;
-import java.util.*;
-
-import static codechicken.nei.NEIClientConfig.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import static codechicken.nei.NEIClientConfig.canCheatItem;
+import static codechicken.nei.NEIClientConfig.canPerformAction;
+import static codechicken.nei.NEIClientConfig.getItemQuantity;
+import static codechicken.nei.NEIClientConfig.getStringArrSetting;
+import static codechicken.nei.NEIClientConfig.getStringSetting;
+import static codechicken.nei.NEIClientConfig.hasSMPCounterPart;
+import static codechicken.nei.NEIClientConfig.invCreativeMode;
+import static codechicken.nei.NEIClientConfig.world;
public class NEIClientUtils extends NEIServerUtils
{
@@ -146,7 +157,7 @@ public static void giveStack(ItemStack base, int i, boolean infinite) {
ItemStack typestack = copyStack(stack, 1);
if (!infinite && !canItemFitInInventory(mc().thePlayer, stack) && (mc().currentScreen instanceof GuiContainer)) {
GuiContainer gui = getGuiContainer();
- List> handlerSlots = new LinkedList>();
+ List> handlerSlots = new LinkedList<>();
for(INEIGuiHandler handler : GuiInfo.guiHandlers)
handlerSlots.add(handler.getItemSpawnSlots(gui, typestack));
@@ -295,7 +306,7 @@ public static void toggleMagnetMode() {
}
public static ArrayList concatIntegersToRanges(List damages) {
- ArrayList ranges = new ArrayList();
+ ArrayList ranges = new ArrayList<>();
if (damages.size() == 0) return ranges;
Collections.sort(damages);
diff --git a/src/codechicken/nei/NEIController.java b/src/codechicken/nei/NEIController.java
index 7c93ac6a1..9a35350a2 100644
--- a/src/codechicken/nei/NEIController.java
+++ b/src/codechicken/nei/NEIController.java
@@ -1,6 +1,10 @@
package codechicken.nei;
-import codechicken.nei.api.*;
+import codechicken.nei.api.API;
+import codechicken.nei.api.GuiInfo;
+import codechicken.nei.api.IInfiniteItemHandler;
+import codechicken.nei.api.INEIGuiHandler;
+import codechicken.nei.api.ItemInfo;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerInputHandler;
import codechicken.nei.guihook.IContainerSlotClickHandler;
@@ -11,14 +15,14 @@
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
-import java.awt.*;
+import java.awt.Point;
import java.util.LinkedList;
import static codechicken.lib.gui.GuiDraw.getMousePosition;
public class NEIController implements IContainerSlotClickHandler, IContainerInputHandler
{
- private static NEIController instance = new NEIController();
+ private static final NEIController instance = new NEIController();
public static GuiContainerManager manager;
public static FastTransferManager fastTransferManager;
@@ -56,7 +60,7 @@ public static void updateUnlimitedItems(InventoryPlayer inventory) {
if (!NEIClientConfig.canPerformAction("item") || !NEIClientConfig.hasSMPCounterPart())
return;
- LinkedList beforeStacks = new LinkedList();
+ LinkedList beforeStacks = new LinkedList<>();
for (int i = 0; i < inventory.getSizeInventory(); i++)
beforeStacks.add(NEIServerUtils.copyStack(inventory.getStackInSlot(i)));
diff --git a/src/codechicken/nei/NEIModContainer.java b/src/codechicken/nei/NEIModContainer.java
index f32293143..1fb8c1dc9 100644
--- a/src/codechicken/nei/NEIModContainer.java
+++ b/src/codechicken/nei/NEIModContainer.java
@@ -20,11 +20,14 @@
import net.minecraft.util.EnumChatFormatting;
import java.io.File;
-import java.util.*;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
public class NEIModContainer extends DummyModContainer
{
- public static LinkedList plugins = new LinkedList();
+ public static LinkedList plugins = new LinkedList<>();
public NEIModContainer() {
super(MetadataCollection.from(MetadataCollection.class.getResourceAsStream("/neimod.info"), "NotEnoughItems").getMetadataForId("NotEnoughItems", null));
@@ -33,14 +36,14 @@ public NEIModContainer() {
@Override
public Set getRequirements() {
- Set deps = new HashSet();
+ Set deps = new HashSet<>();
deps.add(VersionParser.parseVersionReference("CodeChickenCore@["+CodeChickenCorePlugin.version+",)"));
return deps;
}
@Override
public List getDependencies() {
- return new LinkedList(getRequirements());
+ return new LinkedList<>(getRequirements());
}
private String description;
@@ -50,22 +53,22 @@ private void loadMetadata() {
@Override
public ModMetadata getMetadata() {
- String s_plugins = "";
+ StringBuilder s_plugins = new StringBuilder();
if (plugins.size() == 0) {
- s_plugins += EnumChatFormatting.RED+"No installed plugins.";
+ s_plugins.append(EnumChatFormatting.RED).append("No installed plugins.");
} else {
- s_plugins += EnumChatFormatting.GREEN+"Installed plugins: ";
+ s_plugins.append(EnumChatFormatting.GREEN).append("Installed plugins: ");
for (int i = 0; i < plugins.size(); i++) {
if (i > 0)
- s_plugins += ", ";
+ s_plugins.append(", ");
IConfigureNEI plugin = plugins.get(i);
- s_plugins += plugin.getName() + " " + plugin.getVersion();
+ s_plugins.append(plugin.getName()).append(" ").append(plugin.getVersion());
}
- s_plugins += ".";
+ s_plugins.append(".");
}
ModMetadata meta = super.getMetadata();
- meta.description = description.replace("", s_plugins);
+ meta.description = description.replace("", s_plugins.toString());
return meta;
}
diff --git a/src/codechicken/nei/NEISPH.java b/src/codechicken/nei/NEISPH.java
index b3bc52da8..91ed283ad 100644
--- a/src/codechicken/nei/NEISPH.java
+++ b/src/codechicken/nei/NEISPH.java
@@ -1,7 +1,6 @@
package codechicken.nei;
import codechicken.core.CommonUtils;
-import codechicken.core.IGuiPacketSender;
import codechicken.core.ServerUtils;
import codechicken.lib.inventory.SlotDummy;
import codechicken.lib.packet.PacketCustom;
@@ -112,15 +111,11 @@ private void handlePropertyChange(EntityPlayerMP sender, PacketCustom packet) {
public static void processCreativeInv(EntityPlayerMP sender, boolean open) {
if (open) {
- ServerUtils.openSMPContainer(sender, new ContainerCreativeInv(sender, new ExtendedCreativeInv(NEIServerConfig.forPlayer(sender.getCommandSenderName()), Side.SERVER)), new IGuiPacketSender()
- {
- @Override
- public void sendPacket(EntityPlayerMP player, int windowId) {
- PacketCustom packet = new PacketCustom(channel, 23);
- packet.writeBoolean(true);
- packet.writeByte(windowId);
- packet.sendToPlayer(player);
- }
+ ServerUtils.openSMPContainer(sender, new ContainerCreativeInv(sender, new ExtendedCreativeInv(NEIServerConfig.forPlayer(sender.getCommandSenderName()), Side.SERVER)), (player, windowId) -> {
+ PacketCustom packet = new PacketCustom(channel, 23);
+ packet.writeBoolean(true);
+ packet.writeByte(windowId);
+ packet.sendToPlayer(player);
});
} else {
sender.closeContainer();
@@ -155,14 +150,10 @@ private void modifyEnchantment(EntityPlayerMP player, int e, int lvl, boolean ad
}
private void openEnchantmentGui(EntityPlayerMP player) {
- ServerUtils.openSMPContainer(player, new ContainerEnchantmentModifier(player.inventory, player.worldObj, 0, 0, 0), new IGuiPacketSender()
- {
- @Override
- public void sendPacket(EntityPlayerMP player, int windowId) {
- PacketCustom packet = new PacketCustom(channel, 21);
- packet.writeByte(windowId);
- packet.sendToPlayer(player);
- }
+ ServerUtils.openSMPContainer(player, new ContainerEnchantmentModifier(player.inventory, player.worldObj, 0, 0, 0), (player1, windowId) -> {
+ PacketCustom packet = new PacketCustom(channel, 21);
+ packet.writeByte(windowId);
+ packet.sendToPlayer(player1);
});
}
@@ -170,14 +161,10 @@ private void openPotionGui(EntityPlayerMP player, PacketCustom packet) {
InventoryBasic b = new InventoryBasic("potionStore", true, 9);
for (int i = 0; i < b.getSizeInventory(); i++)
b.setInventorySlotContents(i, packet.readItemStack());
- ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), new IGuiPacketSender()
- {
- @Override
- public void sendPacket(EntityPlayerMP player, int windowId) {
- PacketCustom packet = new PacketCustom(channel, 24);
- packet.writeByte(windowId);
- packet.sendToPlayer(player);
- }
+ ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), (player1, windowId) -> {
+ PacketCustom packet1 = new PacketCustom(channel, 24);
+ packet1.writeByte(windowId);
+ packet1.sendToPlayer(player1);
});
}
@@ -196,10 +183,10 @@ public static void sendActionEnabled(EntityPlayerMP player, String name, boolean
}
private void sendLoginState(EntityPlayerMP player) {
- LinkedList actions = new LinkedList();
- LinkedList disabled = new LinkedList();
- LinkedList enabled = new LinkedList();
- LinkedList bannedItems = new LinkedList();
+ LinkedList actions = new LinkedList<>();
+ LinkedList disabled = new LinkedList<>();
+ LinkedList enabled = new LinkedList<>();
+ LinkedList bannedItems = new LinkedList<>();
PlayerSave playerSave = NEIServerConfig.forPlayer(player.getCommandSenderName());
for (String name : NEIActions.nameActionMap.keySet()) {
diff --git a/src/codechicken/nei/NEIServerConfig.java b/src/codechicken/nei/NEIServerConfig.java
index 65a6c7053..6f9015568 100644
--- a/src/codechicken/nei/NEIServerConfig.java
+++ b/src/codechicken/nei/NEIServerConfig.java
@@ -21,7 +21,14 @@
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
public class NEIServerConfig
{
@@ -30,9 +37,9 @@ public class NEIServerConfig
public static Logger logger = LogManager.getLogger("NotEnoughItems");
public static File saveDir;
public static ConfigFile serverConfig;
- public static Map dimTags = new HashMap();
- public static HashMap playerSaves = new HashMap();
- public static ItemStackMap> bannedItems = new ItemStackMap>();
+ public static Map dimTags = new HashMap<>();
+ public static HashMap playerSaves = new HashMap<>();
+ public static ItemStackMap> bannedItems = new ItemStackMap<>();
public static void load(World world) {
if (MinecraftServer.getServer() != server) {
@@ -89,13 +96,13 @@ private static void setDefaultFeature(String featurename, String... names) {
if (names.length == 0)
names = new String[]{"OP"};
- String list = "";
+ StringBuilder list = new StringBuilder();
for (int i = 0; i < names.length; i++) {
if (i >= 1)
- list += ", ";
- list += names[i];
+ list.append(", ");
+ list.append(names[i]);
}
- serverConfig.getTag("permissions." + featurename).setDefaultValue(list);
+ serverConfig.getTag("permissions." + featurename).setDefaultValue(list.toString());
}
private static void saveWorld(int dim) {
@@ -139,7 +146,7 @@ public static void disableAction(int dim, String name, boolean disable) {
public static HashSet getPlayerList(String tag) {
String[] list = serverConfig.getTag(tag).getValue("").replace(" ", "").split(",");
- return new HashSet(Arrays.asList(list));
+ return new HashSet<>(Arrays.asList(list));
}
public static void addPlayerToList(String playername, String tag) {
@@ -179,7 +186,7 @@ private static void loadBannedItems() {
bannedItems.clear();
File file = new File(saveDir, "banneditems.cfg");
if(!file.exists()) {
- bannedItems.put(new ItemStack(Blocks.command_block), new HashSet(Arrays.asList("NONE")));
+ bannedItems.put(new ItemStack(Blocks.command_block), new HashSet<>(Collections.singletonList("NONE")));
saveBannedItems();
return;
}
@@ -196,7 +203,7 @@ private static void loadBannedItems() {
}
try {
NBTTagCompound key = (NBTTagCompound) JsonToNBT.func_150315_a(s.substring(0, delim));
- Set values = new HashSet();
+ Set values = new HashSet<>();
for(String s2 : s.substring(delim+1).split(","))
values.add(s2.trim());
bannedItems.put(InventoryUtils.loadPersistant(key), values);
diff --git a/src/codechicken/nei/NEIServerUtils.java b/src/codechicken/nei/NEIServerUtils.java
index 9a941e7f6..23e36bd12 100644
--- a/src/codechicken/nei/NEIServerUtils.java
+++ b/src/codechicken/nei/NEIServerUtils.java
@@ -25,8 +25,16 @@
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.oredict.OreDictionary;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
import java.util.zip.ZipException;
public class NEIServerUtils
@@ -287,7 +295,7 @@ public static void cycleCreativeInv(EntityPlayerMP player, int steps) {
}
public static List getEnchantments(ItemStack itemstack) {
- ArrayList arraylist = new ArrayList();
+ ArrayList