mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 10:44:45 +00:00
Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb40acc7a3 | ||
|
|
abd1b38870 | ||
|
|
2c0292c3e7 | ||
|
|
3c5e180f9a | ||
|
|
88d6937d11 | ||
|
|
bc1aa9e97e | ||
|
|
e84ce8b9f4 | ||
|
|
64ad0f826e | ||
|
|
7e4eec1410 | ||
|
|
935a82d079 | ||
|
|
f40272fe43 | ||
|
|
8364eaef6f | ||
|
|
9ed2314f08 | ||
|
|
9359df3031 | ||
|
|
3a9551843e | ||
|
|
503d26dcdf | ||
|
|
4b56f78b46 | ||
|
|
dad378e918 | ||
|
|
05b5fa7baf | ||
|
|
e3462ac9c9 | ||
|
|
f272e5942e | ||
|
|
6d9ff9ea0a |
No files matched your search
+6
-2
@@ -1,3 +1,7 @@
|
||||
/build/build
|
||||
/build/.gradle
|
||||
build/build/*
|
||||
build/run/*
|
||||
build/.gradle/*
|
||||
*.ipr
|
||||
*.iml
|
||||
*.iws
|
||||
.idea/**
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.1996
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
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.
|
||||
+41
-2
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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-beta-4-GTNH
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
nei.load=Load
|
||||
nei.save=Save
|
||||
nei.bookmark.toggle=Bookmarks
|
||||
|
||||
nei.enchant=Enchant
|
||||
nei.enchant.level=Level
|
||||
@@ -59,16 +60,22 @@ 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
|
||||
nei.options.keys.gui.enchant=Enchantments
|
||||
nei.options.keys.gui.potion=Potions
|
||||
nei.options.keys.gui.back=Prev Recipe
|
||||
nei.options.keys.gui.prev=Prev Page
|
||||
nei.options.keys.gui.next=Next Page
|
||||
nei.options.keys.gui.back=Back to last Recipe
|
||||
nei.options.keys.gui.prev=Prev Item Panel Page
|
||||
nei.options.keys.gui.next=Next Item Panel Page
|
||||
nei.options.keys.gui.hide=Toggle NEI Visibility
|
||||
nei.options.keys.gui.next_recipe=Next Recipe
|
||||
nei.options.keys.gui.prev_recipe=Prev Recipe
|
||||
nei.options.keys.gui.next_machine=Next Machine
|
||||
nei.options.keys.gui.prev_machine=Prev Machine
|
||||
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 +95,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 +167,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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=유형 조합법
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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=Рецепты
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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=有序合成
|
||||
|
||||
@@ -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=成型工藝
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
<plugins>
|
||||
|
||||
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"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setItems() {
|
||||
realItems = _items;
|
||||
}
|
||||
|
||||
public String getLabelText() {
|
||||
return super.getLabelText() + " [" + realItems.size() + "]";
|
||||
}
|
||||
|
||||
public void addOrRemoveItem(ItemStack item) {
|
||||
ItemStack normalized = normalize(item);
|
||||
if(!remove(normalized)) {
|
||||
_items.add(normalized);
|
||||
}
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
public static NBTTagCompound itemStackToNBT(ItemStack stack, NBTTagCompound nbTag)
|
||||
{
|
||||
String strId = Item.itemRegistry.getNameForObject(stack.getItem());
|
||||
nbTag.setString("strId", strId);
|
||||
nbTag.setByte("Count", (byte)stack.stackSize);
|
||||
nbTag.setShort("Damage", (short)stack.getItemDamage());
|
||||
|
||||
if (stack.stackTagCompound != null)
|
||||
{
|
||||
nbTag.setTag("tag", stack.stackTagCompound);
|
||||
}
|
||||
|
||||
return nbTag;
|
||||
}
|
||||
|
||||
public static ItemStack loadFromNBT(NBTTagCompound nbtTag)
|
||||
{
|
||||
if (!nbtTag.hasKey("id")) {
|
||||
final short id = (short)GameData.getItemRegistry().getId(nbtTag.getString("strId"));
|
||||
nbtTag.setShort("id", id);
|
||||
}
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(nbtTag);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void saveBookmarks() {
|
||||
List<String> strings = new ArrayList<>();
|
||||
for (ItemStack item:_items) {
|
||||
strings.add(itemStackToNBT(item, 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<String> 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 = loadFromNBT(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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public abstract class Button extends Widget
|
||||
return label;
|
||||
}
|
||||
|
||||
public String label;
|
||||
public final String label;
|
||||
public Image icon;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,11 @@ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
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<EntityItem> SMPmagneticItems = new ArrayList<EntityItem>();
|
||||
private ArrayList<EntityItem> 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -29,12 +29,12 @@ public class ContainerEnchantmentModifier extends ContainerEnchantment
|
||||
level = l;
|
||||
}
|
||||
|
||||
Enchantment enchantment;
|
||||
final Enchantment enchantment;
|
||||
int state;
|
||||
int level;
|
||||
final int level;
|
||||
}
|
||||
|
||||
public ArrayList<EnchantmentHash> slotEnchantment = new ArrayList<EnchantmentHash>();
|
||||
public final ArrayList<EnchantmentHash> slotEnchantment = new ArrayList<>();
|
||||
int level = 5;
|
||||
|
||||
public int scrollclicky = -1;
|
||||
@@ -60,11 +60,7 @@ public class ContainerEnchantmentModifier extends ContainerEnchantment
|
||||
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 class ContainerEnchantmentModifier extends ContainerEnchantment
|
||||
|
||||
public void drawSlots(GuiEnchantmentModifier gui) {
|
||||
for (int slot = 0; slot < 3; slot++) {
|
||||
int shade = 0;
|
||||
int shade;
|
||||
String text = "";
|
||||
|
||||
int containerslot = slot + getScrolledSlots();
|
||||
|
||||
@@ -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 class ContainerPotionCreator extends ContainerExtended
|
||||
}
|
||||
}
|
||||
|
||||
InventoryPlayer playerInv;
|
||||
InventoryBasic potionInv;
|
||||
IInventory potionStoreInv;
|
||||
final InventoryPlayer playerInv;
|
||||
final InventoryBasic potionInv;
|
||||
final IInventory potionStoreInv;
|
||||
|
||||
public ContainerPotionCreator(InventoryPlayer inventoryPlayer, IInventory potionStoreInv) {
|
||||
playerInv = inventoryPlayer;
|
||||
|
||||
@@ -7,8 +7,8 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
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 class ExtendedCreativeInv implements IInventory
|
||||
|
||||
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) {
|
||||
|
||||
@@ -6,9 +6,14 @@ import net.minecraft.inventory.Container;
|
||||
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<Integer>
|
||||
{
|
||||
Container container;
|
||||
final Container container;
|
||||
|
||||
public SlotPositionComparator(Container c) {
|
||||
container = c;
|
||||
@@ -34,8 +39,8 @@ public class FastTransferManager
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedList<LinkedList<Integer>> slotZones = new LinkedList<LinkedList<Integer>>();
|
||||
public HashMap<Integer, Integer> slotZoneMap = new HashMap<Integer, Integer>();
|
||||
public LinkedList<LinkedList<Integer>> slotZones = new LinkedList<>();
|
||||
public HashMap<Integer, Integer> slotZoneMap = new HashMap<>();
|
||||
|
||||
private void generateSlotMap(Container container, ItemStack stack) {
|
||||
stack = stack.copy();
|
||||
@@ -45,11 +50,11 @@ public class FastTransferManager
|
||||
if (slotZoneMap.containsKey(slotNo) || !container.getSlot(slotNo).isItemValid(stack))
|
||||
continue;
|
||||
|
||||
HashSet<Integer> connectedSlots = new HashSet<Integer>();
|
||||
HashSet<Integer> connectedSlots = new HashSet<>();
|
||||
findConnectedSlots(container, slotNo, connectedSlots);
|
||||
|
||||
LinkedList<Integer> zoneSlots = new LinkedList<Integer>(connectedSlots);
|
||||
Collections.sort(zoneSlots, new SlotPositionComparator(container));
|
||||
LinkedList<Integer> zoneSlots = new LinkedList<>(connectedSlots);
|
||||
zoneSlots.sort(new SlotPositionComparator(container));
|
||||
slotZones.add(zoneSlots);
|
||||
|
||||
for (int i : zoneSlots) {
|
||||
@@ -77,7 +82,7 @@ public class FastTransferManager
|
||||
public static int findSlotWithItem(Container container, ItemStack teststack) {
|
||||
for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) {
|
||||
ItemStack stack = container.getSlot(slotNo).getStack();
|
||||
if (stack != null && areStacksSameType(stack, teststack))
|
||||
if (areStacksSameType(stack, teststack))
|
||||
return slotNo;
|
||||
}
|
||||
return -1;
|
||||
@@ -159,7 +164,7 @@ public class FastTransferManager
|
||||
}
|
||||
|
||||
public LinkedList<ItemStack> saveContainer(Container container) {
|
||||
LinkedList<ItemStack> stacks = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> stacks = new LinkedList<>();
|
||||
for (int i = 0; i < container.inventorySlots.size(); i++)
|
||||
stacks.add(copyStack(container.getSlot(i).getStack()));
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
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));
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.inventory.Container;
|
||||
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 class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandl
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||
return Arrays.asList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
|
||||
return Collections.singletonList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.potion.PotionEffect;
|
||||
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 GuiPotionCreator extends GuiContainerWidget
|
||||
{
|
||||
public int selectedslot = -1;
|
||||
public boolean enabled = true;
|
||||
private ArrayList<Potion> validPotions = new ArrayList<Potion>();
|
||||
private final ArrayList<Potion> validPotions = new ArrayList<>();
|
||||
|
||||
public GuiSlotPotionEffects(int x, int y) {
|
||||
super(x, y, 108, 76);
|
||||
@@ -256,7 +256,7 @@ public class GuiPotionCreator extends GuiContainerWidget
|
||||
GuiCCButton ampUp;
|
||||
GuiSlotPotionEffects slotPotionEffects;
|
||||
GuiDurationField durationField;
|
||||
ContainerPotionCreator container;
|
||||
final ContainerPotionCreator container;
|
||||
|
||||
public GuiPotionCreator(InventoryPlayer inventoryplayer) {
|
||||
super(new ContainerPotionCreator(inventoryplayer, new ContainerPotionCreator.InventoryPotionStore()), 176, 208);
|
||||
|
||||
@@ -12,13 +12,15 @@ import net.minecraft.world.World;
|
||||
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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ import java.util.ArrayList;
|
||||
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<ItemStack> items = new ArrayList<ItemStack>();
|
||||
public static volatile List<ItemStack> 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<ItemFilterProvider> itemFilterers = new LinkedList<ItemFilterProvider>();
|
||||
public static final List<ItemsLoadedCallback> loadCallbacks = new LinkedList<ItemsLoadedCallback>();
|
||||
public static final List<ItemFilterProvider> itemFilterers = new LinkedList<>();
|
||||
public static final List<ItemsLoadedCallback> loadCallbacks = new LinkedList<>();
|
||||
|
||||
private static HashSet<Item> erroredItems = new HashSet<Item>();
|
||||
private static HashSet<String> stackTraces = new HashSet<String>();
|
||||
private static final HashSet<Item> erroredItems = new HashSet<>();
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
|
||||
public static class EverythingItemFilter implements ItemFilter
|
||||
{
|
||||
@@ -68,14 +70,14 @@ public class ItemList
|
||||
|
||||
public static class AllMultiItemFilter implements ItemFilter
|
||||
{
|
||||
public List<ItemFilter> filters = new LinkedList<ItemFilter>();
|
||||
public List<ItemFilter> filters;
|
||||
|
||||
public AllMultiItemFilter(List<ItemFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public AllMultiItemFilter() {
|
||||
this(new LinkedList<ItemFilter>());
|
||||
this(new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,14 +95,14 @@ public class ItemList
|
||||
|
||||
public static class AnyMultiItemFilter implements ItemFilter
|
||||
{
|
||||
public List<ItemFilter> filters = new LinkedList<ItemFilter>();
|
||||
public List<ItemFilter> filters;
|
||||
|
||||
public AnyMultiItemFilter(List<ItemFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public AnyMultiItemFilter() {
|
||||
this(new LinkedList<ItemFilter>());
|
||||
this(new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +149,7 @@ public class ItemList
|
||||
}
|
||||
|
||||
public static List<ItemFilter> getItemFilters() {
|
||||
LinkedList<ItemFilter> filters = new LinkedList<ItemFilter>();
|
||||
LinkedList<ItemFilter> filters = new LinkedList<>();
|
||||
synchronized (itemFilterers) {
|
||||
for(ItemFilterProvider p : itemFilterers)
|
||||
filters.add(p.getFilter());
|
||||
@@ -158,7 +160,7 @@ public class ItemList
|
||||
public static final RestartableTask loadItems = new RestartableTask("NEI Item Loading")
|
||||
{
|
||||
private void damageSearch(Item item, List<ItemStack> permutations) {
|
||||
HashSet<String> damageIconSet = new HashSet<String>();
|
||||
HashSet<String> damageIconSet = new HashSet<>();
|
||||
for (int damage = 0; damage < 16; damage++)
|
||||
try {
|
||||
ItemStack itemstack = new ItemStack(item, 1, damage);
|
||||
@@ -180,10 +182,11 @@ public class ItemList
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Item Loading");
|
||||
ThreadOperationTimer timer = getTimer(500);
|
||||
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> permutations = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> items = new LinkedList<>();
|
||||
LinkedList<ItemStack> permutations = new LinkedList<>();
|
||||
ListMultimap<Item, ItemStack> itemMap = ArrayListMultimap.create();
|
||||
|
||||
timer.setLimit(500);
|
||||
@@ -227,17 +230,37 @@ public class ItemList
|
||||
}
|
||||
};
|
||||
|
||||
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<ItemStack> filtered = new ArrayList<ItemStack>();
|
||||
// System.out.println("Executing NEI Item Filtering");
|
||||
ArrayList<ItemStack> 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;
|
||||
|
||||
@@ -17,10 +17,8 @@ import net.minecraft.world.World;
|
||||
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 class ItemMobSpawner extends ItemBlock
|
||||
hasSubtypes = true;
|
||||
MinecraftForgeClient.registerItemRenderer(this, new SpawnerRenderer());
|
||||
|
||||
entityHashMap = new HashMap<Integer, EntityLiving>();
|
||||
IDtoNameMap = new HashMap<Integer, String>();
|
||||
entityHashMap = new HashMap<>();
|
||||
IDtoNameMap = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,11 +127,7 @@ public class ItemMobSpawner extends ItemBlock
|
||||
}
|
||||
}
|
||||
|
||||
for(Iterator<Entry<Integer, String>> it = IDtoNameMap.entrySet().iterator(); it.hasNext();) {
|
||||
Entry<Integer, String> 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
|
||||
|
||||
@@ -14,20 +14,29 @@ import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
import static codechicken.nei.NEIClientConfig.canPerformAction;
|
||||
|
||||
public class ItemPanel extends Widget {
|
||||
/**
|
||||
* Backwards compat :-/
|
||||
*/
|
||||
public static ArrayList<ItemStack> items = new ArrayList<>();
|
||||
|
||||
public class ItemPanel extends Widget
|
||||
{
|
||||
/**
|
||||
* Should not be externally modified, use updateItemList
|
||||
*/
|
||||
public static ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
public ArrayList<ItemStack> realItems = new ArrayList<>();
|
||||
/**
|
||||
* Swapped into visible items on update
|
||||
*/
|
||||
private static ArrayList<ItemStack> _items = items;
|
||||
protected ArrayList<ItemStack> _items = realItems;
|
||||
|
||||
public ArrayList<ItemStack> getItems() {
|
||||
return realItems;
|
||||
}
|
||||
|
||||
public static void updateItemList(ArrayList<ItemStack> newItems) {
|
||||
_items = newItems;
|
||||
ItemPanels.itemPanel._items = newItems;
|
||||
}
|
||||
|
||||
public class ItemPanelSlot
|
||||
@@ -36,7 +45,7 @@ public class ItemPanel extends Widget
|
||||
public int slotIndex;
|
||||
|
||||
public ItemPanelSlot(int index) {
|
||||
item = items.get(index);
|
||||
item = realItems.get(index);
|
||||
slotIndex = index;
|
||||
}
|
||||
}
|
||||
@@ -44,6 +53,11 @@ public class ItemPanel extends Widget
|
||||
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 +70,119 @@ public class ItemPanel extends Widget
|
||||
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() + ")";
|
||||
}
|
||||
|
||||
protected void setItems() {
|
||||
realItems = _items;
|
||||
|
||||
// Backwards compat
|
||||
ItemPanels.itemPanel._items = _items;
|
||||
}
|
||||
|
||||
public void resize(GuiContainer gui) {
|
||||
setItems();
|
||||
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
|
||||
@@ -75,9 +197,9 @@ public class ItemPanel extends Widget
|
||||
if (itemsPerPage == 0)
|
||||
numPages = 0;
|
||||
else
|
||||
numPages = (int) Math.ceil((float) items.size() / (float) itemsPerPage);
|
||||
numPages = (int) Math.ceil((float) realItems.size() / (float) itemsPerPage);
|
||||
|
||||
if (firstIndex >= items.size())
|
||||
if (firstIndex >= realItems.size())
|
||||
firstIndex = 0;
|
||||
|
||||
if (numPages == 0)
|
||||
@@ -86,6 +208,12 @@ public class ItemPanel extends Widget
|
||||
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];
|
||||
@@ -120,13 +248,13 @@ public class ItemPanel extends Widget
|
||||
|
||||
GuiContainerManager.enableMatrixStackLogging();
|
||||
int index = firstIndex;
|
||||
for (int i = 0; i < rows * columns && index < items.size(); i++) {
|
||||
for (int i = 0; i < rows * columns && index < realItems.size(); i++) {
|
||||
if (validSlotMap[i]) {
|
||||
Rectangle4i rect = getSlotRect(i);
|
||||
if (rect.contains(mousex, mousey))
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);//highlight
|
||||
|
||||
GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, items.get(index));
|
||||
GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, realItems.get(index));
|
||||
|
||||
index++;
|
||||
}
|
||||
@@ -146,7 +274,7 @@ public class ItemPanel extends Widget
|
||||
@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)) {
|
||||
@@ -300,7 +428,7 @@ public class ItemPanel extends Widget
|
||||
|
||||
public ItemPanelSlot getSlotMouseOver(int mousex, int mousey) {
|
||||
int index = firstIndex;
|
||||
for (int i = 0; i < rows * columns && index < items.size(); i++)
|
||||
for (int i = 0; i < rows * columns && index < realItems.size(); i++)
|
||||
if (validSlotMap[i]) {
|
||||
if (getSlotRect(i).contains(mousex, mousey))
|
||||
return new ItemPanelSlot(index);
|
||||
@@ -314,13 +442,13 @@ public class ItemPanel extends Widget
|
||||
if (itemsPerPage != 0) {
|
||||
int oldIndex = firstIndex;
|
||||
firstIndex += i * itemsPerPage;
|
||||
if (firstIndex >= items.size())
|
||||
if (firstIndex >= realItems.size())
|
||||
firstIndex = 0;
|
||||
if (firstIndex < 0)
|
||||
if (oldIndex > 0)
|
||||
firstIndex = 0;
|
||||
else
|
||||
firstIndex = (items.size() - 1) / itemsPerPage * itemsPerPage;
|
||||
firstIndex = (realItems.size() - 1) / itemsPerPage * itemsPerPage;
|
||||
|
||||
calculatePage();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
public class ItemPanels {
|
||||
public static final ItemPanel itemPanel = new ItemPanel();
|
||||
public static final BookmarkPanel bookmarkPanel = new BookmarkPanel();
|
||||
}
|
||||
@@ -7,7 +7,7 @@ public class ItemQuantityField extends TextField
|
||||
centered = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
// Find a way to work this this back in
|
||||
public boolean isValid(String string) {
|
||||
if (string.equals(""))
|
||||
return true;
|
||||
|
||||
@@ -10,14 +10,17 @@ import net.minecraft.item.Item;
|
||||
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<ItemStack>, ItemsLoadedCallback
|
||||
{
|
||||
public static class SortEntry
|
||||
{
|
||||
public String name;
|
||||
public Comparator<ItemStack> comparator;
|
||||
public final String name;
|
||||
public final Comparator<ItemStack> comparator;
|
||||
|
||||
public SortEntry(String name, Comparator<ItemStack> comparator) {
|
||||
this.name = name;
|
||||
@@ -35,8 +38,8 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<SortEntry> entries = new ArrayList<SortEntry>();
|
||||
public static ArrayList<SortEntry> list = new ArrayList<SortEntry>();
|
||||
public static final ArrayList<SortEntry> entries = new ArrayList<>();
|
||||
public static ArrayList<SortEntry> list = new ArrayList<>();
|
||||
public static final ItemSorter instance = new ItemSorter();
|
||||
|
||||
//optimisations
|
||||
@@ -44,7 +47,8 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
|
||||
public static void sort(ArrayList<ItemStack> items) {
|
||||
try {
|
||||
Collections.sort(items, instance);
|
||||
// items = (ArrayList<ItemStack>) 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 class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
|
||||
@Override
|
||||
public void itemsLoaded() {
|
||||
HashMap<ItemStack, Integer> newMap = new HashMap<ItemStack, Integer>();
|
||||
HashMap<ItemStack, Integer> newMap = new HashMap<>();
|
||||
int i = 0;
|
||||
for(ItemStack stack : ItemList.items)
|
||||
newMap.put(stack, i++);
|
||||
@@ -77,76 +81,52 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
}
|
||||
|
||||
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<ItemStack> comparator) {
|
||||
SortEntry e = new SortEntry(name, comparator);
|
||||
entries.add(e);
|
||||
ArrayList<SortEntry> nlist = new ArrayList<SortEntry>(list);
|
||||
ArrayList<SortEntry> 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<ItemStack>()
|
||||
{
|
||||
@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<ItemStack>()
|
||||
{
|
||||
@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<ItemStack>()
|
||||
{
|
||||
@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<ItemStack>()
|
||||
{
|
||||
@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<ItemStack>()
|
||||
{
|
||||
@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<ItemStack>()
|
||||
{
|
||||
@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 class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
|
||||
public static ArrayList<SortEntry> fromSaveString(String s) {
|
||||
if(s == null)
|
||||
return new ArrayList<SortEntry>(entries);
|
||||
return new ArrayList<>(entries);
|
||||
|
||||
ArrayList<SortEntry> list = new ArrayList<SortEntry>();
|
||||
ArrayList<SortEntry> list = new ArrayList<>();
|
||||
for(String s2 : s.split(",")) {
|
||||
SortEntry e = find(s2.trim());
|
||||
if(e != null)
|
||||
|
||||
@@ -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<T>
|
||||
{
|
||||
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 class ItemStackMap<T>
|
||||
|
||||
public static class Entry<T>
|
||||
{
|
||||
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 class ItemStackMap<T>
|
||||
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 class ItemStackMap<T>
|
||||
try {
|
||||
switch (getKeyType(actualDamage(key), key.stackTagCompound)) {
|
||||
case 0:
|
||||
if (metaMap == null) metaMap = new HashMap<StackMetaKey, T>();
|
||||
if (metaMap == null) metaMap = new HashMap<>();
|
||||
return metaMap.put(new StackMetaKey(key), value);
|
||||
case 1:
|
||||
if (tagMap == null) tagMap = new HashMap<NBTTagCompound, T>();
|
||||
if (tagMap == null) tagMap = new HashMap<>();
|
||||
return tagMap.put(key.stackTagCompound, value);
|
||||
case 2:
|
||||
if (damageMap == null) damageMap = new HashMap<Integer, T>();
|
||||
if (damageMap == null) damageMap = new HashMap<>();
|
||||
return damageMap.put(actualDamage(key), value);
|
||||
case 3:
|
||||
T ret = wildcard;
|
||||
@@ -167,16 +167,16 @@ public class ItemStackMap<T>
|
||||
|
||||
public void addEntries(Item item, List<Entry<T>> list) {
|
||||
if (wildcard != null)
|
||||
list.add(new Entry<T>(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<Integer, T> entry : damageMap.entrySet())
|
||||
list.add(new Entry<T>(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<NBTTagCompound, T> entry : tagMap.entrySet())
|
||||
list.add(new Entry<T>(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<StackMetaKey, T> entry : metaMap.entrySet())
|
||||
list.add(new Entry<T>(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 class ItemStackMap<T>
|
||||
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<Item, DetailMap> itemMap = new HashMap<Item, DetailMap>();
|
||||
private final HashMap<Item, DetailMap> 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 class ItemStackMap<T>
|
||||
}
|
||||
|
||||
public List<ItemStack> keys() {
|
||||
LinkedList<ItemStack> list = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> list = new LinkedList<>();
|
||||
for (Map.Entry<Item, DetailMap> entry : itemMap.entrySet())
|
||||
entry.getValue().addKeys(entry.getKey(), list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<T> values() {
|
||||
LinkedList<T> list = new LinkedList<T>();
|
||||
LinkedList<T> list = new LinkedList<>();
|
||||
for (DetailMap map : itemMap.values())
|
||||
map.addValues(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Entry<T>> entries() {
|
||||
LinkedList<Entry<T>> list = new LinkedList<Entry<T>>();
|
||||
LinkedList<Entry<T>> list = new LinkedList<>();
|
||||
for (Map.Entry<Item, DetailMap> entry : itemMap.entrySet())
|
||||
entry.getValue().addEntries(entry.getKey(), list);
|
||||
return list;
|
||||
|
||||
@@ -23,8 +23,8 @@ public class KeyManager
|
||||
public boolean up;
|
||||
}
|
||||
|
||||
public static HashMap<String, KeyState> keyStates = new HashMap<String, KeyState>();
|
||||
public static LinkedList<IKeyStateTracker> trackers = new LinkedList<IKeyStateTracker>();
|
||||
public static HashMap<String, KeyState> keyStates = new HashMap<>();
|
||||
public static LinkedList<IKeyStateTracker> trackers = new LinkedList<>();
|
||||
|
||||
public static void tickKeyStates()
|
||||
{
|
||||
|
||||
@@ -5,9 +5,9 @@ import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,18 @@ package codechicken.nei;
|
||||
|
||||
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.client.renderer.InventoryEffectRenderer;
|
||||
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<Widget> 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,15 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
public static IRecipeOverlayRenderer overlayRenderer;
|
||||
|
||||
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<Integer, LayoutStyle>();
|
||||
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<>();
|
||||
|
||||
public static boolean ftbUtilsLoaded = false;
|
||||
public static boolean itemsLoaded = 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 +132,13 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
}
|
||||
|
||||
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 +309,12 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
|
||||
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 +334,19 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return translate("inventory.options");
|
||||
}
|
||||
};
|
||||
prev = new Button("Prev")
|
||||
|
||||
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.prev");
|
||||
return translate("bookmark.toggle");
|
||||
}
|
||||
};
|
||||
next = new Button("Next")
|
||||
{
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) {
|
||||
LayoutManager.itemPanel.scroll(1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderLabel() {
|
||||
return translate("inventory.next");
|
||||
}
|
||||
};
|
||||
pageLabel = new Label("(0/0)", true);
|
||||
more = new Button("+")
|
||||
{
|
||||
@Override
|
||||
@@ -350,43 +383,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
};
|
||||
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()
|
||||
{
|
||||
@@ -564,7 +560,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (isEnabled()) {
|
||||
setInputFocused(null);
|
||||
|
||||
ItemList.loadItems.restart();
|
||||
if(!itemsLoaded) {
|
||||
ItemList.loadItems.restart();
|
||||
itemsLoaded = true;
|
||||
}
|
||||
overlayRenderer = null;
|
||||
|
||||
getLayoutStyle().init();
|
||||
@@ -593,18 +592,18 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
|
||||
public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visiblity) {
|
||||
drawWidgets = new TreeSet<Widget>(new WidgetZOrder(false));
|
||||
controlWidgets = new TreeSet<Widget>(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 +611,16 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
}
|
||||
|
||||
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 +650,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
|
||||
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 +713,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@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 +795,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (KeyManager.keyStates.get("world.creative").down)
|
||||
gamemode.onButtonPress(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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 class LayoutStyleMinecraft extends LayoutStyleDefault
|
||||
@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 = Math.max(leftSize / 18, 1);
|
||||
|
||||
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 class LayoutStyleMinecraft extends LayoutStyleDefault
|
||||
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 @@ public class LayoutStyleMinecraft extends LayoutStyleDefault
|
||||
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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ public class NEIActions
|
||||
{
|
||||
public static final int protocol = 0;
|
||||
|
||||
public static HashMap<String, NEIActions> nameActionMap = new HashMap<String, NEIActions>();
|
||||
public static HashSet<String> canDisable = new HashSet<String>();
|
||||
public static HashMap<String, NEIActions> nameActionMap = new HashMap<>();
|
||||
public static HashSet<String> canDisable = new HashSet<>();
|
||||
|
||||
public static void addAction(String name, String base, boolean smpreq)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ public class NEIActions
|
||||
|
||||
public static List<String> baseActions()
|
||||
{
|
||||
List<String> list = new LinkedList<String>();
|
||||
List<String> list = new LinkedList<>();
|
||||
for(NEIActions a : nameActionMap.values())
|
||||
if(a.base.equals(a.name))
|
||||
list.add(a.name);
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
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 class NEIChestGuiHandler extends INEIGuiAdapter
|
||||
|
||||
@Override
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
||||
return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.<Integer>emptyList();
|
||||
return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> 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;
|
||||
}
|
||||
}
|
||||
@@ -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.apache.logging.log4j.Logger;
|
||||
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<String> permissableActions = new HashSet<String>();
|
||||
public static HashSet<String> disabledActions = new HashSet<String>();
|
||||
public static HashSet<String> enabledActions = new HashSet<String>();
|
||||
public static HashSet<String> permissableActions = new HashSet<>();
|
||||
public static HashSet<String> disabledActions = new HashSet<>();
|
||||
public static HashSet<String> enabledActions = new HashSet<>();
|
||||
|
||||
public static ItemStackSet bannedBlocks = new ItemStackSet();
|
||||
|
||||
@@ -84,42 +96,6 @@ public class NEIClientConfig
|
||||
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<Integer> list = new LinkedList<Integer>();
|
||||
for (Entry<Integer, LayoutStyle> 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);
|
||||
|
||||
@@ -184,8 +160,13 @@ public class NEIClientConfig
|
||||
API.addKeyBind("gui.potion", Keyboard.KEY_P);
|
||||
API.addKeyBind("gui.prev", Keyboard.KEY_PRIOR);
|
||||
API.addKeyBind("gui.next", Keyboard.KEY_NEXT);
|
||||
API.addKeyBind("gui.prev_machine", Keyboard.KEY_UP);
|
||||
API.addKeyBind("gui.next_machine", Keyboard.KEY_DOWN);
|
||||
API.addKeyBind("gui.prev_recipe", Keyboard.KEY_LEFT);
|
||||
API.addKeyBind("gui.next_recipe", Keyboard.KEY_RIGHT);
|
||||
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 +233,16 @@ public class NEIClientConfig
|
||||
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 +260,12 @@ public class NEIClientConfig
|
||||
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 +355,6 @@ public class NEIClientConfig
|
||||
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<TaggedInventoryArea> saveAreas = new LinkedList<TaggedInventoryArea>();
|
||||
saveAreas.add(new TaggedInventoryArea(NEIClientUtils.mc().thePlayer.inventory));
|
||||
|
||||
for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
|
||||
List<TaggedInventoryArea> 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<TaggedInventoryArea> saveAreas = new LinkedList<TaggedInventoryArea>();
|
||||
saveAreas.add(new TaggedInventoryArea(NEIClientUtils.mc().thePlayer.inventory));
|
||||
|
||||
for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
|
||||
List<TaggedInventoryArea> 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 +386,7 @@ public class NEIClientConfig
|
||||
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 +421,7 @@ public class NEIClientConfig
|
||||
logger.error("Error loading saves", e);
|
||||
return;
|
||||
}
|
||||
HashSet<String> saveFileNames = new HashSet<String>();
|
||||
HashSet<String> saveFileNames = new HashSet<>();
|
||||
for (SaveFormatComparator save : saves)
|
||||
saveFileNames.add(save.getFileName());
|
||||
|
||||
|
||||
@@ -22,9 +22,20 @@ import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
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.*;
|
||||
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 class NEIClientUtils extends NEIServerUtils
|
||||
ItemStack typestack = copyStack(stack, 1);
|
||||
if (!infinite && !canItemFitInInventory(mc().thePlayer, stack) && (mc().currentScreen instanceof GuiContainer)) {
|
||||
GuiContainer gui = getGuiContainer();
|
||||
List<Iterable<Integer>> handlerSlots = new LinkedList<Iterable<Integer>>();
|
||||
List<Iterable<Integer>> handlerSlots = new LinkedList<>();
|
||||
for(INEIGuiHandler handler : GuiInfo.guiHandlers)
|
||||
handlerSlots.add(handler.getItemSpawnSlots(gui, typestack));
|
||||
|
||||
@@ -295,7 +306,7 @@ public class NEIClientUtils extends NEIServerUtils
|
||||
}
|
||||
|
||||
public static ArrayList<int[]> concatIntegersToRanges(List<Integer> damages) {
|
||||
ArrayList<int[]> ranges = new ArrayList<int[]>();
|
||||
ArrayList<int[]> ranges = new ArrayList<>();
|
||||
if (damages.size() == 0) return ranges;
|
||||
|
||||
Collections.sort(damages);
|
||||
|
||||
@@ -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.Slot;
|
||||
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 class NEIController implements IContainerSlotClickHandler, IContainerInpu
|
||||
if (!NEIClientConfig.canPerformAction("item") || !NEIClientConfig.hasSMPCounterPart())
|
||||
return;
|
||||
|
||||
LinkedList<ItemStack> beforeStacks = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> beforeStacks = new LinkedList<>();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
beforeStacks.add(NEIServerUtils.copyStack(inventory.getStackInSlot(i)));
|
||||
|
||||
|
||||
@@ -20,11 +20,14 @@ import cpw.mods.fml.common.versioning.VersionRange;
|
||||
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<IConfigureNEI> plugins = new LinkedList<IConfigureNEI>();
|
||||
public static LinkedList<IConfigureNEI> plugins = new LinkedList<>();
|
||||
|
||||
public NEIModContainer() {
|
||||
super(MetadataCollection.from(MetadataCollection.class.getResourceAsStream("/neimod.info"), "NotEnoughItems").getMetadataForId("NotEnoughItems", null));
|
||||
@@ -33,14 +36,14 @@ public class NEIModContainer extends DummyModContainer
|
||||
|
||||
@Override
|
||||
public Set<ArtifactVersion> getRequirements() {
|
||||
Set<ArtifactVersion> deps = new HashSet<ArtifactVersion>();
|
||||
Set<ArtifactVersion> deps = new HashSet<>();
|
||||
deps.add(VersionParser.parseVersionReference("CodeChickenCore@["+CodeChickenCorePlugin.version+",)"));
|
||||
return deps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArtifactVersion> getDependencies() {
|
||||
return new LinkedList<ArtifactVersion>(getRequirements());
|
||||
return new LinkedList<>(getRequirements());
|
||||
}
|
||||
|
||||
private String description;
|
||||
@@ -50,22 +53,22 @@ public class NEIModContainer extends DummyModContainer
|
||||
|
||||
@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("<plugins>", s_plugins);
|
||||
meta.description = description.replace("<plugins>", s_plugins.toString());
|
||||
return meta;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 @@ public class NEISPH implements IServerPacketHandler
|
||||
|
||||
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 @@ public class NEISPH implements IServerPacketHandler
|
||||
}
|
||||
|
||||
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 @@ public class NEISPH implements IServerPacketHandler
|
||||
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 class NEISPH implements IServerPacketHandler
|
||||
}
|
||||
|
||||
private void sendLoginState(EntityPlayerMP player) {
|
||||
LinkedList<String> actions = new LinkedList<String>();
|
||||
LinkedList<String> disabled = new LinkedList<String>();
|
||||
LinkedList<String> enabled = new LinkedList<String>();
|
||||
LinkedList<ItemStack> bannedItems = new LinkedList<ItemStack>();
|
||||
LinkedList<String> actions = new LinkedList<>();
|
||||
LinkedList<String> disabled = new LinkedList<>();
|
||||
LinkedList<String> enabled = new LinkedList<>();
|
||||
LinkedList<ItemStack> bannedItems = new LinkedList<>();
|
||||
PlayerSave playerSave = NEIServerConfig.forPlayer(player.getCommandSenderName());
|
||||
|
||||
for (String name : NEIActions.nameActionMap.keySet()) {
|
||||
|
||||
@@ -21,7 +21,14 @@ import org.apache.logging.log4j.Logger;
|
||||
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<Integer, NBTTagCompound> dimTags = new HashMap<Integer, NBTTagCompound>();
|
||||
public static HashMap<String, PlayerSave> playerSaves = new HashMap<String, PlayerSave>();
|
||||
public static ItemStackMap<Set<String>> bannedItems = new ItemStackMap<Set<String>>();
|
||||
public static Map<Integer, NBTTagCompound> dimTags = new HashMap<>();
|
||||
public static HashMap<String, PlayerSave> playerSaves = new HashMap<>();
|
||||
public static ItemStackMap<Set<String>> bannedItems = new ItemStackMap<>();
|
||||
|
||||
public static void load(World world) {
|
||||
if (MinecraftServer.getServer() != server) {
|
||||
@@ -89,13 +96,13 @@ public class NEIServerConfig
|
||||
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 class NEIServerConfig
|
||||
|
||||
public static HashSet<String> getPlayerList(String tag) {
|
||||
String[] list = serverConfig.getTag(tag).getValue("").replace(" ", "").split(",");
|
||||
return new HashSet<String>(Arrays.asList(list));
|
||||
return new HashSet<>(Arrays.asList(list));
|
||||
}
|
||||
|
||||
public static void addPlayerToList(String playername, String tag) {
|
||||
@@ -179,7 +186,7 @@ public class NEIServerConfig
|
||||
bannedItems.clear();
|
||||
File file = new File(saveDir, "banneditems.cfg");
|
||||
if(!file.exists()) {
|
||||
bannedItems.put(new ItemStack(Blocks.command_block), new HashSet<String>(Arrays.asList("NONE")));
|
||||
bannedItems.put(new ItemStack(Blocks.command_block), new HashSet<>(Collections.singletonList("NONE")));
|
||||
saveBannedItems();
|
||||
return;
|
||||
}
|
||||
@@ -196,7 +203,7 @@ public class NEIServerConfig
|
||||
}
|
||||
try {
|
||||
NBTTagCompound key = (NBTTagCompound) JsonToNBT.func_150315_a(s.substring(0, delim));
|
||||
Set<String> values = new HashSet<String>();
|
||||
Set<String> values = new HashSet<>();
|
||||
for(String s2 : s.substring(delim+1).split(","))
|
||||
values.add(s2.trim());
|
||||
bannedItems.put(InventoryUtils.loadPersistant(key), values);
|
||||
|
||||
@@ -25,8 +25,16 @@ import net.minecraft.world.WorldServer;
|
||||
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 class NEIServerUtils
|
||||
}
|
||||
|
||||
public static List<int[]> getEnchantments(ItemStack itemstack) {
|
||||
ArrayList<int[]> arraylist = new ArrayList<int[]>();
|
||||
ArrayList<int[]> arraylist = new ArrayList<>();
|
||||
if (itemstack != null) {
|
||||
NBTTagList nbttaglist = itemstack.getEnchantmentTagList();
|
||||
if (nbttaglist != null)
|
||||
|
||||
@@ -24,5 +24,5 @@ public class OffsetPositioner implements IStackPositioner
|
||||
}
|
||||
|
||||
public int offsetx;
|
||||
public int offsety;
|
||||
public int offsety;
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import codechicken.core.ServerUtils;
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class PositionedStack
|
||||
{
|
||||
public int relx;
|
||||
public int rely;
|
||||
public ItemStack items[];
|
||||
public ItemStack[] items;
|
||||
//compatibility dummy
|
||||
public ItemStack item;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PositionedStack
|
||||
if(permutated)
|
||||
return;
|
||||
|
||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> stacks = new ArrayList<>();
|
||||
for(ItemStack item : items)
|
||||
{
|
||||
if(item == null || item.getItem() == null)
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
public abstract class SaveLoadButton extends Button
|
||||
{
|
||||
public SaveLoadButton(String s)
|
||||
{
|
||||
super(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button)
|
||||
{
|
||||
if(button == 1)
|
||||
{
|
||||
label = "";
|
||||
onTextChange();
|
||||
focused = true;
|
||||
NEIClientUtils.playClickSound();
|
||||
return true;
|
||||
}
|
||||
return super.handleClick(mousex, mousey, button);
|
||||
}
|
||||
|
||||
public abstract void onTextChange();
|
||||
|
||||
@Override
|
||||
public void onGuiClick(int i, int j)
|
||||
{
|
||||
if(!contains(i, j))
|
||||
focused = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyPress(int keyID, char keyChar)
|
||||
{
|
||||
if(!focused)
|
||||
return false;
|
||||
|
||||
if(keyID == Keyboard.KEY_BACK)
|
||||
{
|
||||
if(label.length() > 0)
|
||||
{
|
||||
label = label.substring(0, label.length() - 1);
|
||||
onTextChange();
|
||||
backdowntime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
else if(keyID == Keyboard.KEY_RETURN)
|
||||
{
|
||||
focused = false;
|
||||
}
|
||||
else if(keyChar == 22)//paste
|
||||
{
|
||||
String pastestring = GuiScreen.getClipboardString();
|
||||
if(pastestring == null)
|
||||
pastestring = "";
|
||||
|
||||
label = label + pastestring;
|
||||
onTextChange();
|
||||
}
|
||||
else if(ChatAllowedCharacters.isAllowedCharacter(keyChar))
|
||||
{
|
||||
label = label + keyChar;
|
||||
onTextChange();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
cursorCounter++;
|
||||
if(backdowntime > 0)
|
||||
{
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_BACK) && label.length() > 5)
|
||||
{
|
||||
if(System.currentTimeMillis() - backdowntime > 200 / (1+backs * 0.3F))
|
||||
{
|
||||
label = label.substring(0, label.length() - 1);
|
||||
onTextChange();
|
||||
backdowntime = System.currentTimeMillis();
|
||||
backs++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
backdowntime = 0;
|
||||
backs = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey)
|
||||
{
|
||||
super.draw(mousex, mousey);
|
||||
if(focused && (cursorCounter / 6) % 2 == 0)
|
||||
drawString("_", x + (w + getStringWidth(getRenderLabel())) / 2, y + (h - 8) / 2, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderLabel()
|
||||
{
|
||||
return translate(saved ? "load" : "save") + " " + label;
|
||||
}
|
||||
|
||||
public boolean saved;
|
||||
public long backdowntime;
|
||||
public int backs;
|
||||
public int cursorCounter;
|
||||
public boolean focused;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.EverythingItemFilter;
|
||||
import codechicken.nei.ItemList.PatternItemFilter;
|
||||
@@ -13,8 +14,6 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawGradientRect;
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
import static codechicken.nei.NEIClientConfig.world;
|
||||
|
||||
public class SearchField extends TextField implements ItemFilterProvider
|
||||
@@ -49,7 +48,7 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ISearchProvider> searchProviders = new LinkedList<ISearchProvider>();
|
||||
public static List<ISearchProvider> searchProviders = new LinkedList<>();
|
||||
|
||||
long lastclicktime;
|
||||
|
||||
@@ -64,18 +63,32 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBox() {
|
||||
if (searchInventories())
|
||||
drawGradientRect(x, y, w, h, 0xFFFFFF00, 0xFFC0B000);
|
||||
else
|
||||
drawRect(x, y, w, h, 0xffA0A0A0);
|
||||
drawRect(x + 1, y + 1, w - 2, h - 2, 0xFF000000);
|
||||
public int getTextColour() {
|
||||
if(ItemPanels.itemPanel.realItems.size() == 0) {
|
||||
return focused() ? 0xFFcc3300 : 0xFF993300;
|
||||
} else {
|
||||
return focused() ? 0xFFE0E0E0 : 0xFF909090;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
|
||||
super.draw(mousex, mousey);
|
||||
|
||||
if (searchInventories()) {
|
||||
GuiDraw.drawGradientRect(x - 1, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000); //Left
|
||||
GuiDraw.drawGradientRect(x - 1, y - 1, w + 2, 1, 0xFFFFFF00, 0xFFC0B000); //Top
|
||||
GuiDraw.drawGradientRect(x + w, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000); //Left
|
||||
GuiDraw.drawGradientRect(x - 1, y + h, w + 2, 1, 0xFFFFFF00, 0xFFC0B000); //Bottom
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button) {
|
||||
if (button == 0) {
|
||||
if (focused() && (System.currentTimeMillis() - lastclicktime < 500)) {//double click
|
||||
if (focused() && (System.currentTimeMillis() - lastclicktime < 400)) { //double click
|
||||
NEIClientConfig.world.nbt.setBoolean("searchinventories", !searchInventories());
|
||||
NEIClientConfig.world.saveNBT();
|
||||
}
|
||||
@@ -86,7 +99,11 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
NEIClientConfig.setSearchExpression(text());
|
||||
final String newText = text();
|
||||
if( newText.length() > 0)
|
||||
NEIClientConfig.logger.debug("Searching for " + text());
|
||||
|
||||
NEIClientConfig.setSearchExpression(newText);
|
||||
ItemList.updateFilter.restart();
|
||||
}
|
||||
|
||||
@@ -125,8 +142,8 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
public ItemFilter getFilter() {
|
||||
String s_filter = text().toLowerCase();
|
||||
|
||||
List<ItemFilter> primary = new LinkedList<ItemFilter>();
|
||||
List<ItemFilter> secondary = new LinkedList<ItemFilter>();
|
||||
List<ItemFilter> primary = new LinkedList<>();
|
||||
List<ItemFilter> secondary = new LinkedList<>();
|
||||
for (ISearchProvider p : searchProviders) {
|
||||
ItemFilter filter = p.getFilter(s_filter);
|
||||
if (filter != null)
|
||||
|
||||
@@ -2,7 +2,6 @@ package codechicken.nei;
|
||||
|
||||
import codechicken.core.ClientUtils;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.TextureUtils;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
@@ -18,9 +18,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -31,7 +36,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
public static class SubsetState
|
||||
{
|
||||
int state = 2;
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static class SubsetTag
|
||||
@@ -58,7 +63,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
if(slot < sorted.size()) {
|
||||
SubsetTag tag = sorted.get(slot);
|
||||
if (NEIClientUtils.shiftKey())
|
||||
LayoutManager.searchField.setText("@" + tag.fullname);
|
||||
codechicken.nei.LayoutManager.searchField.setText("@" + tag.fullname);
|
||||
else if (button == 0 && count >= 2)
|
||||
SubsetWidget.showOnly(tag);
|
||||
else
|
||||
@@ -78,7 +83,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
Rectangle4i r = new Rectangle4i(x, y, w, getSlotHeight(slot));
|
||||
if(slot < sorted.size()) {
|
||||
SubsetTag tag = sorted.get(slot);
|
||||
LayoutManager.getLayoutStyle().drawSubsetTag(tag.displayName(), x, y, r.w, r.h, tag.state.state, r.contains(mx, my));
|
||||
codechicken.nei.LayoutManager.getLayoutStyle().drawSubsetTag(tag.displayName(), x, y, r.w, r.h, tag.state.state, r.contains(mx, my));
|
||||
}
|
||||
else {
|
||||
ItemStack stack = state.items.get(slot-sorted.size());
|
||||
@@ -87,7 +92,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
int itemx = w/2-8;
|
||||
int itemy = 1;
|
||||
|
||||
LayoutManager.getLayoutStyle().drawSubsetTag(null, x, y, r.w, r.h, hidden ? 0 : 2, false);
|
||||
codechicken.nei.LayoutManager.getLayoutStyle().drawSubsetTag(null, x, y, r.w, r.h, hidden ? 0 : 2, false);
|
||||
|
||||
GuiContainerManager.drawItem(x+itemx, y+itemy, stack);
|
||||
if(new Rectangle4i(itemx, itemy, 16, 16).contains(mx, my))
|
||||
@@ -123,7 +128,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
|
||||
public final String fullname;
|
||||
public final ItemFilter filter;
|
||||
public TreeMap<String, SubsetTag> children = new TreeMap<String, SubsetTag>();
|
||||
public TreeMap<String, SubsetTag> children = new TreeMap<>();
|
||||
public List<SubsetTag> sorted = Collections.emptyList();
|
||||
private int childwidth;
|
||||
|
||||
@@ -172,7 +177,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
}
|
||||
|
||||
private void recacheChildren() {
|
||||
sorted = new ArrayList<SubsetTag>(children.values());
|
||||
sorted = new ArrayList<>(children.values());
|
||||
childwidth = 0;
|
||||
for(SubsetTag tag : sorted)
|
||||
childwidth = Math.max(childwidth, tag.nameWidth()+2);
|
||||
@@ -367,12 +372,12 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
public static Rectangle4i area = new Rectangle4i();
|
||||
public static ItemStack hoverStack;
|
||||
|
||||
private static HashMap<String, SubsetState> subsetState = new HashMap<String, SubsetState>();
|
||||
private static HashMap<String, SubsetState> subsetState = new HashMap<>();
|
||||
/**
|
||||
* All operations on this variable should be synchronised.
|
||||
*/
|
||||
private static final ItemStackSet hiddenItems = new ItemStackSet();
|
||||
private static final AtomicReference<NBTTagList> dirtyHiddenItems = new AtomicReference<NBTTagList>();
|
||||
private static final AtomicReference<NBTTagList> dirtyHiddenItems = new AtomicReference<>();
|
||||
|
||||
public static SubsetState getState(SubsetTag tag) {
|
||||
SubsetState state = subsetState.get(tag.fullname);
|
||||
@@ -450,7 +455,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
hiddenItems.clear();
|
||||
}
|
||||
|
||||
List<ItemStack> itemList = new LinkedList<ItemStack>();
|
||||
List<ItemStack> itemList = new LinkedList<>();
|
||||
try {
|
||||
NBTTagList list = NEIClientConfig.world.nbt.getTagList("hiddenItems", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
@@ -513,14 +518,17 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
}
|
||||
|
||||
public synchronized void reallocate() {
|
||||
// System.out.println("NEI Subset - Reallocate");
|
||||
// Thread.dumpStack();
|
||||
reallocate = true;
|
||||
restart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
HashMap<String, SubsetState> state = new HashMap<String, SubsetState>();
|
||||
List<SubsetTag> tags = new LinkedList<SubsetTag>();
|
||||
// System.out.println("Executing NEI Subset Item Allocation");
|
||||
HashMap<String, SubsetState> state = new HashMap<>();
|
||||
List<SubsetTag> tags = new LinkedList<>();
|
||||
synchronized (root) {
|
||||
cloneStates(root, tags, state);
|
||||
if(interrupted()) return;
|
||||
@@ -696,13 +704,10 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter() {
|
||||
return new ItemFilter()//synchronise access on hiddenItems
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
synchronized (hiddenItems) {
|
||||
return !hiddenItems.matches(item);
|
||||
}
|
||||
//synchronise access on hiddenItems
|
||||
return item -> {
|
||||
synchronized (hiddenItems) {
|
||||
return !hiddenItems.matches(item);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -726,7 +731,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
Pattern p = SearchField.getPattern(searchText);
|
||||
if(p == null) return null;
|
||||
|
||||
List<SubsetTag> matching = new LinkedList<SubsetTag>();
|
||||
List<SubsetTag> matching = new LinkedList<>();
|
||||
root.search(matching, p);
|
||||
if(matching.isEmpty()) return null;
|
||||
for(SubsetTag tag2 : matching)
|
||||
|
||||
@@ -1,43 +1,59 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
|
||||
public abstract class TextField extends Widget
|
||||
{
|
||||
protected GuiTextField field;
|
||||
|
||||
private static final int maxSearchLength = 256;
|
||||
|
||||
public boolean centered;
|
||||
public String identifier;
|
||||
|
||||
private boolean previousKeyboardRepeatEnabled;
|
||||
|
||||
protected void initInternalTextField() {
|
||||
field = new GuiTextField(Minecraft.getMinecraft().fontRenderer, 0, 0, 0, 0);
|
||||
field.setMaxStringLength(maxSearchLength);
|
||||
field.setCursorPositionZero();
|
||||
}
|
||||
|
||||
public TextField(String ident) {
|
||||
identifier = ident;
|
||||
initInternalTextField();
|
||||
// Keyboard.enableRepeatEvents(true);
|
||||
}
|
||||
|
||||
public int getTextColour() {
|
||||
return focused() ? 0xFFE0E0E0 : 0xFF909090;
|
||||
}
|
||||
|
||||
public void drawBox() {
|
||||
drawRect(x, y, w, h, 0xffA0A0A0);
|
||||
drawRect(x + 1, y + 1, w - 2, h - 2, 0xFF000000);
|
||||
protected void setDimensionsAndColor() {
|
||||
field.xPosition = this.x + 2;
|
||||
field.yPosition = this.y + 2;
|
||||
field.width = this.w - 4;
|
||||
field.height = this.h - 4;
|
||||
field.setTextColor(getTextColour());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
drawBox();
|
||||
try {
|
||||
setDimensionsAndColor();
|
||||
field.drawTextBox();
|
||||
} catch(NullPointerException npe) {
|
||||
// Hack to deal with a null font renderer... recreate the field and it should work
|
||||
GuiTextField oldField = field;
|
||||
|
||||
String drawtext = text;
|
||||
initInternalTextField();
|
||||
setDimensionsAndColor();
|
||||
|
||||
int textWidth;
|
||||
while((textWidth = getStringWidth(drawtext)) > w - 14)
|
||||
drawtext = drawtext.substring(1);
|
||||
|
||||
if (focused() && (cursorCounter / 6) % 2 == 0)
|
||||
drawtext = drawtext + '_';
|
||||
|
||||
int textx = centered ? x + (w - textWidth) / 2 : x + 4;
|
||||
int texty = y + (h + 1) / 2 - 3;
|
||||
|
||||
drawString(drawtext, textx, texty, getTextColour());
|
||||
field.setText(oldField.getText());
|
||||
field.drawTextBox();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,9 +64,13 @@ public abstract class TextField extends Widget
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button) {
|
||||
setFocus(true);
|
||||
|
||||
if (button == 1)
|
||||
setText("");
|
||||
setFocus(true);
|
||||
else
|
||||
field.mouseClicked(mousex, mousey, button);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,58 +79,32 @@ public abstract class TextField extends Widget
|
||||
if (!focused())
|
||||
return false;
|
||||
|
||||
if (keyID == Keyboard.KEY_BACK) {
|
||||
if (text.length() > 0) {
|
||||
setText(text.substring(0, text.length() - 1));
|
||||
backdowntime = System.currentTimeMillis();
|
||||
boolean handled = field.textboxKeyTyped(keyChar, keyID);
|
||||
if(!handled) {
|
||||
if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_NUMPADENTER || keyID == Keyboard.KEY_ESCAPE) {
|
||||
setFocus(false);
|
||||
handled = true;
|
||||
}
|
||||
} else if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_ESCAPE) {
|
||||
setFocus(false);
|
||||
onExit();
|
||||
} else if (keyChar == 22)//paste
|
||||
{
|
||||
String pastestring = GuiScreen.getClipboardString();
|
||||
if (pastestring == null)
|
||||
pastestring = "";
|
||||
}
|
||||
|
||||
if (isValid(text + pastestring))
|
||||
setText(text + pastestring);
|
||||
} else if (isValid(text + keyChar))
|
||||
setText(text + keyChar);
|
||||
if(handled) {
|
||||
onTextChange(text());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return handled;
|
||||
|
||||
public void onExit() {
|
||||
}
|
||||
|
||||
public abstract void onTextChange(String oldText);
|
||||
|
||||
public boolean isValid(String string) {
|
||||
// Solve the problem that Minecraft can't post Chinese characters
|
||||
return ChatAllowedCharacters.isAllowedCharacter(string.charAt(string.length() - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
cursorCounter++;
|
||||
if (backdowntime > 0) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_BACK) && text.length() > 0) {
|
||||
if (System.currentTimeMillis() - backdowntime > 200 / (1 + backs * 0.3F)) {
|
||||
setText(text.substring(0, text.length() - 1));
|
||||
backdowntime = System.currentTimeMillis();
|
||||
backs++;
|
||||
}
|
||||
} else {
|
||||
backdowntime = 0;
|
||||
backs = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setText(String s) {
|
||||
String oldText = text;
|
||||
text = filterText(s);
|
||||
String oldText = text();
|
||||
field.setText(s);
|
||||
field.setCursorPositionZero();
|
||||
onTextChange(oldText);
|
||||
}
|
||||
|
||||
@@ -119,25 +113,26 @@ public abstract class TextField extends Widget
|
||||
}
|
||||
|
||||
public void setFocus(boolean focus) {
|
||||
if (focus) {
|
||||
LayoutManager.setInputFocused(this);
|
||||
} else if (focused()) {
|
||||
LayoutManager.setInputFocused(null);
|
||||
final boolean previousFocus = field.isFocused();
|
||||
field.setFocused(focus);
|
||||
|
||||
if (previousFocus != focus) {
|
||||
if (focus) {
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
} else {
|
||||
Keyboard.enableRepeatEvents(previousKeyboardRepeatEnabled);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean focused() {
|
||||
return LayoutManager.getInputFocused() == this;
|
||||
return field.isFocused();
|
||||
}
|
||||
|
||||
public String text() {
|
||||
return text;
|
||||
return field.getText();
|
||||
}
|
||||
|
||||
private String text = "";
|
||||
public boolean centered;
|
||||
public long backdowntime;
|
||||
public int backs;
|
||||
public String identifier;
|
||||
public int cursorCounter;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class ThreadOperationTimer extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
private Thread thread;
|
||||
private final Thread thread;
|
||||
private Object operation;
|
||||
private long opTime;
|
||||
private long limit;
|
||||
|
||||
@@ -3,11 +3,14 @@ package codechicken.nei;
|
||||
public class VisiblityData
|
||||
{
|
||||
public boolean showUtilityButtons = true;
|
||||
public boolean showStateButtons = true;
|
||||
/**
|
||||
* Item panel and associated buttons
|
||||
*/
|
||||
public boolean showItemPanel = true;
|
||||
/**
|
||||
* Bookmark panel and associated buttons
|
||||
*/
|
||||
public boolean showBookmarkPanel = true;
|
||||
/**
|
||||
* Item and search section
|
||||
*/
|
||||
@@ -25,14 +28,18 @@ public class VisiblityData
|
||||
*/
|
||||
public boolean showNEI = true;
|
||||
public boolean enableDeleteMode = true;
|
||||
|
||||
|
||||
// Deprecated -- left in for campatability with other mods that mess with this
|
||||
public boolean showStateButtons = false;
|
||||
|
||||
public void translateDependancies()
|
||||
{
|
||||
if(!showNEI)
|
||||
showWidgets = false;
|
||||
if(!showWidgets)
|
||||
showItemSection = showUtilityButtons = showStateButtons = false;
|
||||
showItemSection = showUtilityButtons = false;
|
||||
if(!showItemSection)
|
||||
showSearchSection = showItemPanel = false;
|
||||
showBookmarkPanel = showSearchSection = showItemPanel = false;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import java.util.Comparator;
|
||||
public class WidgetZOrder
|
||||
implements Comparator<Widget>
|
||||
{
|
||||
boolean topfirst;
|
||||
final boolean topfirst;
|
||||
public WidgetZOrder(boolean topfirst)
|
||||
{
|
||||
this.topfirst = topfirst;
|
||||
|
||||
@@ -98,8 +98,8 @@ public class WorldOverlayRenderer implements IKeyStateTracker
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private static Entity dummyEntity = new EntityPig(null);
|
||||
private static AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
|
||||
private static final Entity dummyEntity = new EntityPig(null);
|
||||
private static final AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
|
||||
private static int getSpawnMode(Chunk chunk, int x, int y, int z) {
|
||||
if (!SpawnerAnimals.canCreatureTypeSpawnAtLocation(EnumCreatureType.monster, chunk.worldObj, x, y, z) ||
|
||||
chunk.getSavedLightValue(EnumSkyBlock.Block, x & 15, y, z & 15) >= 8)
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.nei.*;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
import codechicken.nei.KeyManager;
|
||||
import codechicken.nei.KeyManager.KeyState;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.OffsetPositioner;
|
||||
import codechicken.nei.SearchField;
|
||||
import codechicken.nei.SearchField.ISearchProvider;
|
||||
import codechicken.nei.SubsetWidget;
|
||||
import codechicken.nei.SubsetWidget.SubsetTag;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.config.Option;
|
||||
import codechicken.nei.config.OptionKeyBind;
|
||||
import codechicken.nei.recipe.*;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
import codechicken.nei.recipe.IUsageHandler;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class DefaultOverlayRenderer implements IRecipeOverlayRenderer
|
||||
public DefaultOverlayRenderer(List<PositionedStack> ai, IStackPositioner positioner)
|
||||
{
|
||||
positioner = this.positioner = positioner;
|
||||
ingreds = new ArrayList<PositionedStack>();
|
||||
ingreds = new ArrayList<>();
|
||||
for(PositionedStack stack : ai)
|
||||
ingreds.add(stack.copy());
|
||||
ingreds = positioner.positionStacks(ingreds);
|
||||
@@ -39,6 +39,6 @@ public class DefaultOverlayRenderer implements IRecipeOverlayRenderer
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
IStackPositioner positioner;
|
||||
final IStackPositioner positioner;
|
||||
ArrayList<PositionedStack> ingreds;
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import java.util.LinkedList;
|
||||
|
||||
public class GuiInfo
|
||||
{
|
||||
public static LinkedList<INEIGuiHandler> guiHandlers = new LinkedList<INEIGuiHandler>();
|
||||
public static HashSet<Class<? extends GuiContainer>> customSlotGuis = new HashSet<Class<? extends GuiContainer>>();
|
||||
public static final LinkedList<INEIGuiHandler> guiHandlers = new LinkedList<>();
|
||||
public static final HashSet<Class<? extends GuiContainer>> customSlotGuis = new HashSet<>();
|
||||
|
||||
public static void load() {
|
||||
API.registerNEIGuiHandler(new NEICreativeGuiHandler());
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.core.featurehack.GameDataManipulator;
|
||||
import codechicken.nei.*;
|
||||
import codechicken.nei.ItemList.ItemsLoadedCallback;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.InfiniteStackSizeHandler;
|
||||
import codechicken.nei.InfiniteToolHandler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemMobSpawner;
|
||||
import codechicken.nei.ItemStackMap;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PopupInputHandler;
|
||||
import codechicken.nei.config.ArrayDumper;
|
||||
import codechicken.nei.config.ItemPanelDumper;
|
||||
import codechicken.nei.config.RegistryDumper;
|
||||
@@ -27,7 +32,15 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -38,7 +51,11 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
@@ -52,20 +69,20 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
public static final ArrayListMultimap<Layout, IHighlightHandler> highlightHandlers = ArrayListMultimap.create();
|
||||
public static final ItemStackMap<String> nameOverrides = new ItemStackMap<String>();
|
||||
public static final ItemStackMap<String> nameOverrides = new ItemStackMap<>();
|
||||
public static final ItemStackSet hiddenItems = new ItemStackSet();
|
||||
public static final ItemStackSet finiteItems = new ItemStackSet();
|
||||
public static final ArrayListMultimap<Item, ItemStack> itemOverrides = ArrayListMultimap.create();
|
||||
public static final ArrayListMultimap<Item, ItemStack> itemVariants = ArrayListMultimap.create();
|
||||
|
||||
public static final LinkedList<IInfiniteItemHandler> infiniteHandlers = new LinkedList<IInfiniteItemHandler>();
|
||||
public static final LinkedList<IInfiniteItemHandler> infiniteHandlers = new LinkedList<>();
|
||||
public static final ArrayListMultimap<Block, IHighlightHandler> highlightIdentifiers = ArrayListMultimap.create();
|
||||
public static final HashSet<Class<? extends Slot>> fastTransferExemptions = new HashSet<Class<? extends Slot>>();
|
||||
public static final HashSet<Class<? extends Slot>> fastTransferExemptions = new HashSet<>();
|
||||
|
||||
public static final HashMap<Item, String> itemOwners = new HashMap<Item, String>();
|
||||
public static final HashMap<Item, String> itemOwners = new HashMap<>();
|
||||
|
||||
//lookup optimisation
|
||||
public static final HashMap<ItemStack, String> itemSearchNames = new HashMap<ItemStack, String>();
|
||||
public static final HashMap<ItemStack, String> itemSearchNames = new HashMap<>();
|
||||
|
||||
public static boolean isHidden(ItemStack stack) {
|
||||
return hiddenItems.contains(stack);
|
||||
@@ -111,28 +128,11 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
private static void addSearchOptimisation() {
|
||||
ItemList.loadCallbacks.add(new ItemsLoadedCallback()
|
||||
{
|
||||
@Override public void itemsLoaded() {
|
||||
itemSearchNames.clear();
|
||||
}
|
||||
});
|
||||
ItemList.loadCallbacks.add(itemSearchNames::clear);
|
||||
}
|
||||
|
||||
private static void addHiddenItemFilter() {
|
||||
API.addItemFilter(new ItemFilterProvider()
|
||||
{
|
||||
@Override
|
||||
public ItemFilter getFilter() {
|
||||
return new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return !hiddenItems.contains(item);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
API.addItemFilter(() -> item -> !hiddenItems.contains(item));
|
||||
}
|
||||
|
||||
private static void addIDDumps() {
|
||||
@@ -264,7 +264,7 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
private static void parseModItems() {
|
||||
HashMap<String, ItemStackSet> modSubsets = new HashMap<String, ItemStackSet>();
|
||||
HashMap<String, ItemStackSet> modSubsets = new HashMap<>();
|
||||
for (Item item : (Iterable<Item>) Item.itemRegistry) {
|
||||
UniqueIdentifier ident = null;
|
||||
try {
|
||||
@@ -323,20 +323,8 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
private static void addDefaultDropDowns() {
|
||||
API.addSubset("Items", new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return Block.getBlockFromItem(item.getItem()) == Blocks.air;
|
||||
}
|
||||
});
|
||||
API.addSubset("Blocks", new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return Block.getBlockFromItem(item.getItem()) != Blocks.air;
|
||||
}
|
||||
});
|
||||
API.addSubset("Items", item -> Block.getBlockFromItem(item.getItem()) == Blocks.air);
|
||||
API.addSubset("Blocks", item -> Block.getBlockFromItem(item.getItem()) != Blocks.air);
|
||||
API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner));
|
||||
}
|
||||
|
||||
@@ -356,8 +344,8 @@ public class ItemInfo
|
||||
ItemStackSet food = new ItemStackSet();
|
||||
ItemStackSet potioningredients = new ItemStackSet();
|
||||
|
||||
ArrayList<ItemStackSet> creativeTabRanges = new ArrayList<ItemStackSet>(CreativeTabs.creativeTabArray.length);
|
||||
List<ItemStack> stackList = new LinkedList<ItemStack>();
|
||||
ArrayList<ItemStackSet> creativeTabRanges = new ArrayList<>(CreativeTabs.creativeTabArray.length);
|
||||
List<ItemStack> stackList = new LinkedList<>();
|
||||
|
||||
for (Item item : (Iterable<Item>) Item.itemRegistry) {
|
||||
if (item == null)
|
||||
@@ -419,7 +407,7 @@ public class ItemInfo
|
||||
food.with(item);
|
||||
|
||||
try {
|
||||
LinkedList<ItemStack> subItems = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> subItems = new LinkedList<>();
|
||||
item.getSubItems(item, null, subItems);
|
||||
for(ItemStack stack : subItems) {
|
||||
if (item.isPotionIngredient(stack) && item.getPotionEffect(stack) != null) {
|
||||
@@ -473,9 +461,9 @@ public class ItemInfo
|
||||
int z = hit.blockZ;
|
||||
Block mouseoverBlock = world.getBlock(x, y, z);
|
||||
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
|
||||
ArrayList<IHighlightHandler> handlers = new ArrayList<IHighlightHandler>();
|
||||
ArrayList<IHighlightHandler> handlers = new ArrayList<>();
|
||||
if (highlightIdentifiers.containsKey(null))
|
||||
handlers.addAll(highlightIdentifiers.get(null));
|
||||
if (highlightIdentifiers.containsKey(mouseoverBlock))
|
||||
@@ -514,7 +502,7 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
public static List<String> getText(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop) {
|
||||
List<String> retString = new ArrayList<String>();
|
||||
List<String> retString = new ArrayList<>();
|
||||
|
||||
for (ItemInfo.Layout layout : ItemInfo.Layout.values())
|
||||
for (IHighlightHandler handler : ItemInfo.highlightHandlers.get(layout))
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.LinkedList;
|
||||
|
||||
public class NEIInfo
|
||||
{
|
||||
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<INEIModeHandler>();
|
||||
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<>();
|
||||
|
||||
public static void load(World world) {
|
||||
OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode");
|
||||
|
||||
@@ -9,8 +9,8 @@ import java.util.HashSet;
|
||||
|
||||
public class TaggedInventoryArea
|
||||
{
|
||||
public HashSet<Integer> slots = new HashSet<Integer>();
|
||||
public String tagName;
|
||||
public final HashSet<Integer> slots = new HashSet<>();
|
||||
public final String tagName;
|
||||
/**
|
||||
* Only for player inventories.
|
||||
*/
|
||||
@@ -18,7 +18,7 @@ public class TaggedInventoryArea
|
||||
/**
|
||||
* Other inventories
|
||||
*/
|
||||
private Container container;
|
||||
private final Container container;
|
||||
|
||||
public TaggedInventoryArea(InventoryPlayer invPlayer)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,43 @@
|
||||
package codechicken.nei.asm;
|
||||
|
||||
import codechicken.lib.asm.*;
|
||||
import codechicken.lib.asm.ModularASMTransformer.*;
|
||||
import codechicken.lib.asm.ASMBlock;
|
||||
import codechicken.lib.asm.ASMHelper;
|
||||
import codechicken.lib.asm.ASMInit;
|
||||
import codechicken.lib.asm.ASMReader;
|
||||
import codechicken.lib.asm.ClassHeirachyManager;
|
||||
import codechicken.lib.asm.InsnListSection;
|
||||
import codechicken.lib.asm.ModularASMTransformer;
|
||||
import codechicken.lib.asm.ModularASMTransformer.FieldWriter;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodInjector;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodReplacer;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodTransformer;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodWriter;
|
||||
import codechicken.lib.asm.ObfMapping;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.*;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static codechicken.lib.asm.InsnComparator.*;
|
||||
import static codechicken.lib.asm.InsnComparator.findN;
|
||||
import static codechicken.lib.asm.InsnComparator.findOnce;
|
||||
import static codechicken.lib.asm.InsnComparator.getControlFlowLabels;
|
||||
import static codechicken.lib.asm.InsnComparator.matches;
|
||||
import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
|
||||
import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.ACC_STATIC;
|
||||
import static org.objectweb.asm.Opcodes.ALOAD;
|
||||
import static org.objectweb.asm.Opcodes.ILOAD;
|
||||
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
|
||||
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
|
||||
import static org.objectweb.asm.Opcodes.IRETURN;
|
||||
|
||||
public class NEITransformer implements IClassTransformer
|
||||
{
|
||||
@@ -20,8 +45,8 @@ public class NEITransformer implements IClassTransformer
|
||||
ASMInit.init();
|
||||
}
|
||||
|
||||
private ModularASMTransformer transformer = new ModularASMTransformer();
|
||||
private Map<String, ASMBlock> asmblocks = ASMReader.loadResource("/assets/nei/asm/blocks.asm");
|
||||
private final ModularASMTransformer transformer = new ModularASMTransformer();
|
||||
private final Map<String, ASMBlock> asmblocks = ASMReader.loadResource("/assets/nei/asm/blocks.asm");
|
||||
|
||||
public NEITransformer() {
|
||||
if(FMLLaunchHandler.side().isClient()) {
|
||||
@@ -199,7 +224,7 @@ public class NEITransformer implements IClassTransformer
|
||||
transformer.add(new MethodWriter(ACC_PUBLIC, publicCall, forward2));
|
||||
}
|
||||
|
||||
private ObfMapping c_GuiContainer = new ObfMapping("net/minecraft/client/gui/inventory/GuiContainer").toClassloading();
|
||||
private final ObfMapping c_GuiContainer = new ObfMapping("net/minecraft/client/gui/inventory/GuiContainer").toClassloading();
|
||||
/**
|
||||
* Adds super.updateScreen() to non implementing GuiContainer subclasses
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ public abstract class ArrayDumper<T> extends DataDumper
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<String[]>();
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
T[] array = array();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
T obj = array[i];
|
||||
|
||||
@@ -2,16 +2,15 @@ package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.config.ConfigTagParent;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigSet
|
||||
{
|
||||
private File nbtFile;
|
||||
private final File nbtFile;
|
||||
public NBTTagCompound nbt;
|
||||
public ConfigTagParent config;
|
||||
public final ConfigTagParent config;
|
||||
|
||||
public ConfigSet(File nbtFile, ConfigTagParent config) {
|
||||
this.nbtFile = nbtFile;
|
||||
|
||||
@@ -11,7 +11,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,9 +22,9 @@ import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
public class GuiHighlightTips extends GuiScreenWidget
|
||||
{
|
||||
private String name;
|
||||
private final String name;
|
||||
private GuiCCButton toggleButton;
|
||||
private Option opt;
|
||||
private final Option opt;
|
||||
private Point dragDown;
|
||||
|
||||
public GuiHighlightTips(Option opt) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemPanel;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
@@ -22,7 +22,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -39,7 +39,7 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
private Option opt;
|
||||
private int drawIndex;
|
||||
private int parseIndex;
|
||||
private File dir = new File(CommonUtils.getMinecraftDir(), "dumps/itempanel_icons");
|
||||
private final File dir = new File(CommonUtils.getMinecraftDir(), "dumps/itempanel_icons");
|
||||
private int iconSize;
|
||||
private int borderSize;
|
||||
private int boxSize;
|
||||
@@ -100,10 +100,10 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
for(int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) {
|
||||
for(int i = 0; drawIndex < ItemPanels.itemPanel.realItems.size() && i < fit; drawIndex++, i++) {
|
||||
int x = i%cols * 18;
|
||||
int y = i/cols * 18;
|
||||
GuiContainerManager.drawItem(x+1, y+1, ItemPanel.items.get(drawIndex));
|
||||
GuiContainerManager.drawItem(x+1, y+1, ItemPanels.itemPanel.realItems.get(drawIndex));
|
||||
}
|
||||
|
||||
GL11.glFlush();
|
||||
@@ -114,20 +114,20 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
int rows = img.getHeight() / boxSize;
|
||||
int cols = img.getWidth() / boxSize;
|
||||
int fit = rows*cols;
|
||||
for(int i = 0; parseIndex < ItemPanel.items.size() && i < fit; parseIndex++, i++) {
|
||||
for(int i = 0; parseIndex < ItemPanels.itemPanel.realItems.size() && i < fit; parseIndex++, i++) {
|
||||
int x = i%cols * boxSize;
|
||||
int y = i/cols * boxSize;
|
||||
exportImage(dir, img.getSubimage(x+borderSize, y+borderSize, iconSize, iconSize), ItemPanel.items.get(parseIndex));
|
||||
exportImage(dir, img.getSubimage(x+borderSize, y+borderSize, iconSize, iconSize), ItemPanels.itemPanel.realItems.get(parseIndex));
|
||||
}
|
||||
|
||||
if(parseIndex >= ItemPanel.items.size())
|
||||
if(parseIndex >= ItemPanels.itemPanel.realItems.size())
|
||||
returnScreen(new ChatComponentTranslation(opt.fullName()+".icon.dumped", "dumps/itempanel_icons"));
|
||||
}
|
||||
|
||||
public static String cleanFileName(String name) {
|
||||
StringBuilder cleanName = new StringBuilder();
|
||||
for (int i = 0; i < name.length(); i++) {
|
||||
int c = (int)name.charAt(i);
|
||||
int c = name.charAt(i);
|
||||
if (Arrays.binarySearch(illegalChars, c) < 0)
|
||||
cleanName.append((char)c);
|
||||
else
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
import codechicken.nei.*;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemSorter.SortEntry;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class GuiItemSorter extends GuiOptionPane
|
||||
{
|
||||
public double ya;
|
||||
public double y;
|
||||
public SortEntry e;
|
||||
public final SortEntry e;
|
||||
|
||||
public SortItem(SortEntry e) {
|
||||
this.e = e;
|
||||
@@ -45,9 +45,9 @@ public class GuiItemSorter extends GuiOptionPane
|
||||
}
|
||||
}
|
||||
|
||||
public Option opt;
|
||||
public List<SortItem> slots = new ArrayList<SortItem>();
|
||||
public List<SortEntry> list;
|
||||
public final Option opt;
|
||||
public final List<SortItem> slots = new ArrayList<>();
|
||||
public final List<SortEntry> list;
|
||||
|
||||
boolean dragging;
|
||||
public SortItem dragged;
|
||||
@@ -120,7 +120,7 @@ public class GuiItemSorter extends GuiOptionPane
|
||||
list.add(nslot, dragged.e);
|
||||
opt.getTag().setValue(ItemSorter.getSaveString(list));
|
||||
if(opt.activeTag() == opt.getTag())
|
||||
ItemSorter.list = new ArrayList<SortEntry>(list);
|
||||
ItemSorter.list = new ArrayList<>(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
|
||||
import java.awt.*;
|
||||
import java.net.URI;
|
||||
|
||||
public class GuiNEIOptionList extends GuiOptionList implements GuiYesNoCallback
|
||||
{
|
||||
private GuiCCButton patreonButton;
|
||||
|
||||
public GuiNEIOptionList(GuiScreen parent, OptionList optionList, boolean world) {
|
||||
super(parent, optionList, world);
|
||||
@@ -20,35 +13,20 @@ public class GuiNEIOptionList extends GuiOptionList implements GuiYesNoCallback
|
||||
@Override
|
||||
public void resize() {
|
||||
super.resize();
|
||||
patreonButton.x = width-73;
|
||||
patreonButton.y = height-23;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
add(patreonButton = new PatreonButton(0, 0, 70, 20).setActionCommand("patreon"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(String ident, Object... params) {
|
||||
if (ident.equals("patreon")) {
|
||||
GuiConfirmOpenLink gui = new GuiConfirmOpenLink(this, "patreon.com/cb", 0, true);
|
||||
gui.func_146358_g();
|
||||
mc.displayGuiScreen(gui);
|
||||
} else
|
||||
super.actionPerformed(ident, params);
|
||||
super.actionPerformed(ident, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean yes, int id) {
|
||||
if(yes && id == 0) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI("http://patreon.com/cb"));
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Failed to open patreon page", e);
|
||||
}
|
||||
}
|
||||
mc.displayGuiScreen(this);
|
||||
}
|
||||
}
|
||||
@@ -6,26 +6,28 @@ import codechicken.core.gui.GuiScrollSlot;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.net.URI;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
import static codechicken.lib.gui.GuiDraw.drawMultilineTip;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static net.minecraft.util.StatCollector.translateToLocal;
|
||||
|
||||
public class GuiOptionList extends GuiScreenWidget
|
||||
{
|
||||
public class OptionScrollSlot extends GuiScrollSlot
|
||||
{
|
||||
public ArrayList<Option> options = new ArrayList<Option>();
|
||||
public final ArrayList<Option> options = new ArrayList<>();
|
||||
|
||||
public OptionScrollSlot() {
|
||||
super(0, 0, 0, 0);
|
||||
@@ -35,8 +37,7 @@ public class GuiOptionList extends GuiScreenWidget
|
||||
@Override
|
||||
public void onAdded(GuiScreen s) {
|
||||
super.onAdded(s);
|
||||
for (Option o : optionList.optionList)
|
||||
options.add(o);
|
||||
options.addAll(optionList.optionList);
|
||||
for (Option o : options)
|
||||
o.onAdded(this);
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class GuiOptionList extends GuiScreenWidget
|
||||
}
|
||||
|
||||
private void drawTooltip() {
|
||||
List<String> tooltip = new LinkedList<String>();
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
Point mouse = getMousePosition();
|
||||
if (worldButton.pointInside(mouse.x, mouse.y))
|
||||
tooltip.addAll(Arrays.asList(translateToLocal("nei.options.global.tip." + (world ? "1" : "0")).split(":")));
|
||||
|
||||
@@ -6,8 +6,9 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawMultilineTip;
|
||||
@@ -93,7 +94,7 @@ public abstract class GuiOptionPane extends GuiScreenWidget
|
||||
|
||||
public void drawTooltip() {
|
||||
Point mouse = getMousePosition();
|
||||
drawMultilineTip(mouse.x + 12, mouse.y - 12, handleTooltip(mouse.x, mouse.y, new LinkedList<String>()));
|
||||
drawMultilineTip(mouse.x + 12, mouse.y - 12, handleTooltip(mouse.x, mouse.y, new LinkedList<>()));
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(int mx, int my, List<String> tooltip) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemPanel;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -22,7 +22,7 @@ import java.util.LinkedList;
|
||||
|
||||
public class ItemPanelDumper extends DataDumper
|
||||
{
|
||||
private static int[] resolutions = new int[]{16, 32, 48, 64, 128, 256};
|
||||
private static final int[] resolutions = new int[]{16, 32, 48, 64, 128, 256};
|
||||
|
||||
public ItemPanelDumper(String name) {
|
||||
super(name);
|
||||
@@ -35,8 +35,8 @@ public class ItemPanelDumper extends DataDumper
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<String[]>();
|
||||
for (ItemStack stack : ItemPanel.items)
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
for (ItemStack stack : ItemPanels.itemPanel.realItems)
|
||||
list.add(new String[]{
|
||||
Item.itemRegistry.getNameForObject(stack.getItem()),
|
||||
Integer.toString(Item.getIdFromItem(stack.getItem())),
|
||||
@@ -123,7 +123,7 @@ public class ItemPanelDumper extends DataDumper
|
||||
|
||||
public void dumpNBT(File file) throws IOException {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (ItemStack stack : ItemPanel.items)
|
||||
for (ItemStack stack : ItemPanels.itemPanel.realItems)
|
||||
list.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
@@ -134,7 +134,7 @@ public class ItemPanelDumper extends DataDumper
|
||||
|
||||
public void dumpJson(File file) throws IOException {
|
||||
PrintWriter p = new PrintWriter(file);
|
||||
for (ItemStack stack : ItemPanel.items) {
|
||||
for (ItemStack stack : ItemPanels.itemPanel.realItems) {
|
||||
NBTTagCompound tag = stack.writeToNBT(new NBTTagCompound());
|
||||
tag.removeTag("Count");
|
||||
p.println(tag);
|
||||
|
||||
@@ -4,14 +4,17 @@ import codechicken.nei.LayoutManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
public abstract class OptionButton extends Option
|
||||
{
|
||||
protected static ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
protected static final ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
|
||||
public final String prefix;
|
||||
public final String text;
|
||||
|
||||
@@ -18,8 +18,10 @@ public class OptionGamemodes extends OptionStringSet
|
||||
public void drawIcons()
|
||||
{
|
||||
int x = buttonX();
|
||||
LayoutManager.drawIcon(x+4, 4, new Image(132, 12, 12, 12)); x+=24;
|
||||
LayoutManager.drawIcon(x+4, 4, new Image(156, 12, 12, 12)); x+=24;
|
||||
LayoutManager.drawIcon(x+4, 4, new Image(168, 12, 12, 12)); x+=24;
|
||||
LayoutManager.drawIcon(x+4, 4, new Image(132, 12, 12, 12));
|
||||
x+=24;
|
||||
LayoutManager.drawIcon(x+4, 4, new Image(156, 12, 12, 12));
|
||||
x+=24;
|
||||
LayoutManager.drawIcon(x+4, 4, new Image(168, 12, 12, 12));
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package codechicken.nei.config;
|
||||
|
||||
public class OptionIntegerField extends OptionTextField
|
||||
{
|
||||
public int min;
|
||||
public int max;
|
||||
public final int min;
|
||||
public final int max;
|
||||
public OptionIntegerField(String name, int min, int max) {
|
||||
super(name);
|
||||
this.min = min;
|
||||
|
||||
@@ -74,8 +74,8 @@ public class OptionList extends OptionButton
|
||||
return fullName.substring(i + 1);
|
||||
}
|
||||
|
||||
public ArrayList<Option> optionList = new ArrayList<Option>();
|
||||
public HashMap<String, Option> options = new HashMap<String, Option>();
|
||||
public ArrayList<Option> optionList = new ArrayList<>();
|
||||
public HashMap<String, Option> options = new HashMap<>();
|
||||
|
||||
public OptionList(String name) {
|
||||
super(name);
|
||||
|
||||
@@ -5,16 +5,20 @@ import codechicken.nei.LayoutManager;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
|
||||
public abstract class OptionStringSet extends Option
|
||||
{
|
||||
public LinkedList<String> options = new LinkedList<String>();
|
||||
public Multimap<String, String> dependants = ArrayListMultimap.create();
|
||||
public Map<String, String> dependancies = new HashMap<String, String>();
|
||||
public Multimap<String, String> groups = ArrayListMultimap.create();
|
||||
public final LinkedList<String> options = new LinkedList<>();
|
||||
public final Multimap<String, String> dependants = ArrayListMultimap.create();
|
||||
public final Map<String, String> dependancies = new HashMap<>();
|
||||
public final Multimap<String, String> groups = ArrayListMultimap.create();
|
||||
|
||||
public OptionStringSet(String name) {
|
||||
super(name);
|
||||
@@ -70,16 +74,15 @@ public abstract class OptionStringSet extends Option
|
||||
public boolean clickButton(int mousex, int mousey, int button) {
|
||||
int x = buttonX();
|
||||
List<String> values = values();
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
for (String option : options) {
|
||||
if (new Rectangle4i(x, 0, 20, 20).contains(mousex, mousey)) {
|
||||
String s = options.get(i);
|
||||
boolean set = values.contains(s);
|
||||
boolean set = values.contains(option);
|
||||
if (button == 0 && !set) {
|
||||
setValue(s);
|
||||
setValue(option);
|
||||
return true;
|
||||
}
|
||||
if (button == 1 && set) {
|
||||
remValue(s);
|
||||
remValue(option);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -101,7 +104,7 @@ public abstract class OptionStringSet extends Option
|
||||
for (String grp : groups.get(s))
|
||||
setValue(grp);
|
||||
} else {
|
||||
List<String> setUtils = new LinkedList<String>(values());
|
||||
List<String> setUtils = new LinkedList<>(values());
|
||||
setUtils.add(s);
|
||||
setValues(setUtils);
|
||||
}
|
||||
@@ -115,7 +118,7 @@ public abstract class OptionStringSet extends Option
|
||||
for (String grp : groups.get(s))
|
||||
remValue(grp);
|
||||
} else {
|
||||
List<String> values = new LinkedList<String>(values());
|
||||
List<String> values = new LinkedList<>(values());
|
||||
values.remove(s);
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
@@ -12,17 +12,12 @@ import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
public class OptionTextField extends Option
|
||||
{
|
||||
private boolean focused = false;
|
||||
private TextField textField = new TextField("")
|
||||
private TextField textField = new TextField("test")
|
||||
{
|
||||
@Override
|
||||
public boolean isValid(String string) {
|
||||
return super.isValid(string) && isValidInput(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if(focused() && isValidValue(text()))
|
||||
if(!defaulting() || !text().equals(getTag().getValue()))//don't override global if text hasn't changed
|
||||
if(!defaulting() || !text().equals(getTag().getValue())) //don't override global if text hasn't changed
|
||||
getTag().setValue(text());
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,10 @@ public class OptionUtilities extends OptionStringSet
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
ItemStack sword = new ItemStack(Items.diamond_sword);
|
||||
sword.addEnchantment(Enchantment.sharpness, 1);
|
||||
GuiContainerManager.drawItem(x+2, 2, sword); x+=24;
|
||||
GuiContainerManager.drawItem(x+2, 2, new ItemStack(Items.potionitem)); x+=24;
|
||||
GuiContainerManager.drawItem(x+2, 2, new ItemStack(Blocks.stone)); x+=24;
|
||||
GuiContainerManager.drawItem(x+2, 2, sword);
|
||||
x+=24;
|
||||
GuiContainerManager.drawItem(x+2, 2, new ItemStack(Items.potionitem));
|
||||
x+=24;
|
||||
GuiContainerManager.drawItem(x+2, 2, new ItemStack(Blocks.stone));
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class PatreonButton extends GuiCCButton
|
||||
{
|
||||
public PatreonButton(int x, int y, int width, int height) {
|
||||
super(x, y, width, height, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButtonTex(int mousex, int mousey) {
|
||||
super.drawButtonTex(mousex, mousey);
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
CCRenderState.changeTexture("nei:textures/patreonNeon.png");
|
||||
int texh = height-4;
|
||||
int texw = texh*4;
|
||||
func_146110_a(x+width/2-texw/2, y+height/2-texh/2, 0, 0, texw, texh, texw, texh);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public abstract class RegistryDumper <T> extends DataDumper
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<String[]>();
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
RegistryNamespaced registry = registry();
|
||||
|
||||
for(T obj : (Iterable<T>)registry)
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Point;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -24,18 +24,21 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
import static codechicken.lib.gui.GuiDraw.drawMultilineTip;
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static codechicken.lib.gui.GuiDraw.renderEngine;
|
||||
|
||||
public class GuiContainerManager
|
||||
{
|
||||
public GuiContainer window;
|
||||
|
||||
public static RenderItem drawItems = new RenderItem();
|
||||
public static final LinkedList<IContainerTooltipHandler> tooltipHandlers = new LinkedList<IContainerTooltipHandler>();
|
||||
public static final LinkedList<IContainerInputHandler> inputHandlers = new LinkedList<IContainerInputHandler>();
|
||||
public static final LinkedList<IContainerDrawHandler> drawHandlers = new LinkedList<IContainerDrawHandler>();
|
||||
public static final LinkedList<IContainerObjectHandler> objectHandlers = new LinkedList<IContainerObjectHandler>();
|
||||
public static final LinkedList<IContainerSlotClickHandler> slotClickHandlers = new LinkedList<IContainerSlotClickHandler>();
|
||||
public static LinkedList<IContainerTooltipHandler> tooltipHandlers = new LinkedList<>();
|
||||
public static LinkedList<IContainerInputHandler> inputHandlers = new LinkedList<>();
|
||||
public static LinkedList<IContainerDrawHandler> drawHandlers = new LinkedList<>();
|
||||
public static LinkedList<IContainerObjectHandler> objectHandlers = new LinkedList<>();
|
||||
public static LinkedList<IContainerSlotClickHandler> slotClickHandlers = new LinkedList<>();
|
||||
|
||||
static {
|
||||
addSlotClickHandler(new DefaultSlotClickHandler());
|
||||
@@ -120,7 +123,7 @@ public class GuiContainerManager
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
if (namelist == null)
|
||||
namelist = new ArrayList<String>();
|
||||
namelist = new ArrayList<>();
|
||||
|
||||
if (namelist.size() == 0)
|
||||
namelist.add("Unnamed");
|
||||
@@ -178,7 +181,7 @@ public class GuiContainerManager
|
||||
}
|
||||
|
||||
private static int modelviewDepth = -1;
|
||||
private static HashSet<String> stackTraces = new HashSet<String>();
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) {
|
||||
enable3DRender();
|
||||
@@ -251,7 +254,7 @@ public class GuiContainerManager
|
||||
public GuiContainerManager(GuiContainer screen) {
|
||||
window = screen;
|
||||
if (screen instanceof IContainerTooltipHandler) {
|
||||
instanceTooltipHandlers = new LinkedList<IContainerTooltipHandler>();
|
||||
instanceTooltipHandlers = new LinkedList<>();
|
||||
instanceTooltipHandlers.add((IContainerTooltipHandler) screen);
|
||||
instanceTooltipHandlers.addAll(tooltipHandlers);
|
||||
} else
|
||||
@@ -392,7 +395,7 @@ public class GuiContainerManager
|
||||
}
|
||||
|
||||
public void renderToolTips(int mousex, int mousey) {
|
||||
List<String> tooltip = new LinkedList<String>();
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
FontRenderer font = GuiDraw.fontRenderer;
|
||||
|
||||
for (IContainerTooltipHandler handler : instanceTooltipHandlers)
|
||||
|
||||
@@ -5,9 +5,6 @@ import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.minecraft.client.gui.inventory.GuiBrewingStand;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
@@ -16,11 +13,12 @@ import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraft.init.Items.potionitem;
|
||||
|
||||
@@ -41,7 +39,7 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public class CachedBrewingRecipe extends CachedRecipe
|
||||
{
|
||||
public BrewingRecipe recipe;
|
||||
public final BrewingRecipe recipe;
|
||||
|
||||
public CachedBrewingRecipe(BrewingRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
@@ -54,7 +52,7 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> getIngredients() {
|
||||
ArrayList<PositionedStack> recipestacks = new ArrayList<PositionedStack>();
|
||||
ArrayList<PositionedStack> recipestacks = new ArrayList<>();
|
||||
recipestacks.add(recipe.ingredient);
|
||||
recipestacks.add(recipe.precursorPotion);
|
||||
return recipestacks;
|
||||
@@ -62,7 +60,7 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
public static final ItemStackSet ingredients = new ItemStackSet();
|
||||
public static final HashSet<BrewingRecipe> apotions = new HashSet<BrewingRecipe>();
|
||||
public static final HashSet<BrewingRecipe> apotions = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
@@ -121,12 +119,12 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
public static void searchPotions() {
|
||||
TreeSet<Integer> allPotions = new TreeSet<Integer>();
|
||||
HashSet<Integer> searchPotions = new HashSet<Integer>();
|
||||
TreeSet<Integer> allPotions = new TreeSet<>();
|
||||
HashSet<Integer> searchPotions = new HashSet<>();
|
||||
searchPotions.add(0);
|
||||
allPotions.add(0);
|
||||
do {
|
||||
HashSet<Integer> newPotions = new HashSet<Integer>();
|
||||
HashSet<Integer> newPotions = new HashSet<>();
|
||||
for (Integer basePotion : searchPotions) {
|
||||
if (ItemPotion.isSplash(basePotion))
|
||||
continue;
|
||||
@@ -155,21 +153,9 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
while (!searchPotions.isEmpty());
|
||||
|
||||
API.setItemListEntries(potionitem, Iterables.transform(allPotions, new Function<Integer, ItemStack>()//override with only potions that can be crafted
|
||||
{
|
||||
@Override
|
||||
public ItemStack apply(Integer potionID) {
|
||||
return new ItemStack(potionitem, 1, potionID);
|
||||
}
|
||||
}));
|
||||
API.setItemListEntries(potionitem, allPotions.stream().map(potionID -> new ItemStack(potionitem, 1, potionID)).collect(Collectors.toList()));
|
||||
API.addSubset("Items.Potions", new ItemStackSet().with(potionitem));
|
||||
API.addSubset("Items.Potions.Splash", new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return item.getItem() == potionitem && (item.getItemDamage() & 0x4000) != 0;
|
||||
}
|
||||
});
|
||||
API.addSubset("Items.Potions.Splash", item -> item.getItem() == potionitem && (item.getItemDamage() & 0x4000) != 0);
|
||||
|
||||
ItemStackSet positivepots = new ItemStackSet();
|
||||
ItemStackSet negativepots = new ItemStackSet();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ContainerRecipe extends Container
|
||||
}
|
||||
}
|
||||
|
||||
private RecipeInventory recipeInventory = new RecipeInventory();
|
||||
private final RecipeInventory recipeInventory = new RecipeInventory();
|
||||
|
||||
public void clearInventory()
|
||||
{
|
||||
@@ -119,10 +119,9 @@ public class ContainerRecipe extends Container
|
||||
|
||||
public Slot getSlotWithStack(PositionedStack stack, int recipex, int recipey)
|
||||
{
|
||||
for(int i = 0; i < inventorySlots.size(); i++)
|
||||
{
|
||||
Slot slot = (Slot) inventorySlots.get(i);
|
||||
if(slot.xDisplayPosition == (stack.relx + recipex) && slot.yDisplayPosition == (stack.rely + recipey))
|
||||
for (Object inventorySlot : inventorySlots) {
|
||||
Slot slot = (Slot) inventorySlot;
|
||||
if (slot.xDisplayPosition == (stack.relx + recipex) && slot.yDisplayPosition == (stack.rely + recipey))
|
||||
return slot;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -9,7 +9,12 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultOverlayHandler implements IOverlayHandler
|
||||
{
|
||||
@@ -20,7 +25,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
stack = InventoryUtils.copyStack(item, 1);
|
||||
}
|
||||
|
||||
public ItemStack stack;
|
||||
public ItemStack stack;
|
||||
public int invAmount;
|
||||
public int distributed;
|
||||
public int numSlots;
|
||||
@@ -164,19 +169,19 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
{
|
||||
Slot[][] recipeSlots = mapIngredSlots(gui, ingredients);//setup the slot map
|
||||
|
||||
HashMap<Slot, Integer> distribution = new HashMap<Slot, Integer>();
|
||||
for(int i = 0; i < recipeSlots.length; i++)
|
||||
for(Slot slot : recipeSlots[i])
|
||||
if(!distribution.containsKey(slot))
|
||||
HashMap<Slot, Integer> distribution = new HashMap<>();
|
||||
for (Slot[] recipeSlot : recipeSlots)
|
||||
for (Slot slot : recipeSlot)
|
||||
if (!distribution.containsKey(slot))
|
||||
distribution.put(slot, -1);
|
||||
|
||||
HashSet<Slot> avaliableSlots = new HashSet<Slot>(distribution.keySet());
|
||||
HashSet<Integer> remainingIngreds = new HashSet<Integer>();
|
||||
ArrayList<LinkedList<Slot>> assignedSlots = new ArrayList<LinkedList<Slot>>();
|
||||
HashSet<Slot> avaliableSlots = new HashSet<>(distribution.keySet());
|
||||
HashSet<Integer> remainingIngreds = new HashSet<>();
|
||||
ArrayList<LinkedList<Slot>> assignedSlots = new ArrayList<>();
|
||||
for(int i = 0; i < ingredients.size(); i++)
|
||||
{
|
||||
remainingIngreds.add(i);
|
||||
assignedSlots.add(new LinkedList<Slot>());
|
||||
assignedSlots.add(new LinkedList<>());
|
||||
}
|
||||
|
||||
while(avaliableSlots.size() > 0 && remainingIngreds.size() > 0)
|
||||
@@ -214,7 +219,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
|
||||
private List<IngredientDistribution> assignIngredients(List<PositionedStack> ingredients, List<DistributedIngred> ingredStacks)
|
||||
{
|
||||
ArrayList<IngredientDistribution> assignedIngredients = new ArrayList<IngredientDistribution>();
|
||||
ArrayList<IngredientDistribution> assignedIngredients = new ArrayList<>();
|
||||
for(PositionedStack posstack : ingredients)//assign what we need and have
|
||||
{
|
||||
DistributedIngred biggestIngred = null;
|
||||
@@ -222,15 +227,12 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
int biggestSize = 0;
|
||||
for(ItemStack pstack : posstack.items)
|
||||
{
|
||||
for(int j = 0; j < ingredStacks.size(); j++)
|
||||
{
|
||||
DistributedIngred istack = ingredStacks.get(j);
|
||||
if(!canStack(pstack, istack.stack) || istack.invAmount-istack.distributed < pstack.stackSize)
|
||||
for (DistributedIngred istack : ingredStacks) {
|
||||
if (!canStack(pstack, istack.stack) || istack.invAmount - istack.distributed < pstack.stackSize)
|
||||
continue;
|
||||
|
||||
int relsize = (istack.invAmount-istack.invAmount/istack.recipeAmount*istack.distributed)/pstack.stackSize;
|
||||
if(relsize > biggestSize)
|
||||
{
|
||||
|
||||
int relsize = (istack.invAmount - istack.invAmount / istack.recipeAmount * istack.distributed) / pstack.stackSize;
|
||||
if (relsize > biggestSize) {
|
||||
biggestSize = relsize;
|
||||
biggestIngred = istack;
|
||||
permutation = pstack;
|
||||
@@ -266,7 +268,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
|
||||
private List<DistributedIngred> getPermutationIngredients(List<PositionedStack> ingredients)
|
||||
{
|
||||
ArrayList<DistributedIngred> ingredStacks = new ArrayList<DistributedIngred>();
|
||||
ArrayList<DistributedIngred> ingredStacks = new ArrayList<>();
|
||||
for(PositionedStack posstack : ingredients)//work out what we need
|
||||
{
|
||||
for(ItemStack pstack : posstack.items)
|
||||
@@ -290,7 +292,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
Slot[][] recipeSlotList = new Slot[ingredients.size()][];
|
||||
for(int i = 0; i < ingredients.size(); i++)//identify slots
|
||||
{
|
||||
LinkedList<Slot> recipeSlots = new LinkedList<Slot>();
|
||||
LinkedList<Slot> recipeSlots = new LinkedList<>();
|
||||
PositionedStack pstack = ingredients.get(i);
|
||||
for(Slot slot : (List<Slot>)gui.inventorySlots.inventorySlots)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,10 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.RecipeFireworks;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,11 +22,11 @@ public class FireworkRecipeHandler extends ShapelessRecipeHandler
|
||||
{
|
||||
public class CachedFireworkRecipe extends CachedShapelessRecipe
|
||||
{
|
||||
LinkedList<Object> itemList = new LinkedList<Object>();
|
||||
final LinkedList<Object> itemList = new LinkedList<>();
|
||||
|
||||
public Object[] baseIngredients;
|
||||
public Object extraIngred;
|
||||
public int recipeType;
|
||||
public final Object[] baseIngredients;
|
||||
public final Object extraIngred;
|
||||
public final int recipeType;
|
||||
|
||||
public CachedFireworkRecipe(Object[] base, Object extra, int type) {
|
||||
super(new ItemStack(Items.fireworks));
|
||||
@@ -37,8 +39,7 @@ public class FireworkRecipeHandler extends ShapelessRecipeHandler
|
||||
|
||||
public void cycle() {
|
||||
itemList.clear();
|
||||
for (Object obj : baseIngredients)
|
||||
itemList.add(obj);
|
||||
itemList.addAll(Arrays.asList(baseIngredients));
|
||||
int extras = (cycleticks / 40) % (10 - itemList.size());
|
||||
for (int i = 0; i < extras; i++)
|
||||
itemList.add(extraIngred);
|
||||
@@ -54,10 +55,10 @@ public class FireworkRecipeHandler extends ShapelessRecipeHandler
|
||||
}
|
||||
}
|
||||
|
||||
private InventoryCrafting inventoryCrafting = new InventoryCraftingDummy();
|
||||
private RecipeFireworks recipeFireworks = new RecipeFireworks();
|
||||
private final InventoryCrafting inventoryCrafting = new InventoryCraftingDummy();
|
||||
private final RecipeFireworks recipeFireworks = new RecipeFireworks();
|
||||
|
||||
public ArrayList<CachedFireworkRecipe> mfireworks = new ArrayList<CachedFireworkRecipe>();
|
||||
public final ArrayList<CachedFireworkRecipe> mfireworks = new ArrayList<>();
|
||||
|
||||
public FireworkRecipeHandler() {
|
||||
super();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class FuelRecipeHandler extends FurnaceRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
public final FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel) {
|
||||
this.fuel = fuel;
|
||||
@@ -38,7 +38,7 @@ public class FuelRecipeHandler extends FurnaceRecipeHandler
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<SmeltingPair> mfurnace = new ArrayList<FurnaceRecipeHandler.SmeltingPair>();
|
||||
private final ArrayList<SmeltingPair> mfurnace = new ArrayList<>();
|
||||
|
||||
public FuelRecipeHandler() {
|
||||
super();
|
||||
|
||||
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user