Compare commits
1 Commits
main
...
d84c71f279
Author | SHA1 | Date | |
---|---|---|---|
d84c71f279 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -36,6 +36,3 @@ build/
|
|||||||
|
|
||||||
### Mac OS ###
|
### Mac OS ###
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
logs
|
|
||||||
world.ser
|
|
||||||
|
6
.idea/inspectionProfiles/Project_Default.xml
generated
6
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@ -1,10 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="EntryPointsManager">
|
|
||||||
<writeAnnotations>
|
|
||||||
<writeAnnotation name="cz.jzitnik.game.annotations.AutoTransient" />
|
|
||||||
</writeAnnotations>
|
|
||||||
</component>
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MavenProjectsManager">
|
<component name="MavenProjectsManager">
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
|
674
COPYING
674
COPYING
@ -1,674 +0,0 @@
|
|||||||
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>.
|
|
50
normalize.js
50
normalize.js
@ -1,50 +0,0 @@
|
|||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
if (process.argv.length < 4) {
|
|
||||||
console.error("Usage: node script.js <inputFile> <outputFile>");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const inputFile = process.argv[2];
|
|
||||||
const outputFile = process.argv[3];
|
|
||||||
|
|
||||||
const file = fs.readFileSync(inputFile, "utf8");
|
|
||||||
const lines = file.split("\n");
|
|
||||||
|
|
||||||
const final = [];
|
|
||||||
|
|
||||||
for (const line of lines) {
|
|
||||||
let str = "";
|
|
||||||
const chars = line.split("");
|
|
||||||
|
|
||||||
function testSpace(index) {
|
|
||||||
if (chars[index - 2] == " ") {
|
|
||||||
return testSpace(index - 1);
|
|
||||||
} else if (chars[index - 2] == "m") {
|
|
||||||
if (chars.join("").substring(index - 5, index - 1) == "[49m") {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < chars.length; i++) {
|
|
||||||
const char = chars[i];
|
|
||||||
if (char === " ") {
|
|
||||||
if (testSpace(i)) {
|
|
||||||
str += "\x1b[49m ";
|
|
||||||
} else {
|
|
||||||
str += char;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
str += char;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final.push(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(outputFile, final.join("\n"), "utf8");
|
|
||||||
console.log(`Processed file saved as: ${outputFile}`);
|
|
98
pom.xml
98
pom.xml
@ -9,82 +9,18 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>23</maven.compiler.source>
|
<maven.compiler.source>22</maven.compiler.source>
|
||||||
<maven.compiler.target>23</maven.compiler.target>
|
<maven.compiler.target>22</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.11.0</version>
|
|
||||||
<configuration>
|
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.18.38</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<transformers>
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
||||||
<mainClass>cz.jzitnik.Main</mainClass>
|
|
||||||
</transformer>
|
|
||||||
</transformers>
|
|
||||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>exec-maven-plugin</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>java</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<mainClass>cz.jzitnik.Main</mainClass>
|
|
||||||
<classpathScope>compile</classpathScope>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.38</version>
|
<version>1.18.36</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter</artifactId>
|
|
||||||
<version>5.8.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -110,34 +46,6 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>2.18.2</version>
|
<version>2.18.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.13.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>2.0.17</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.5.18</version> <!-- latest at the time -->
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.trilarion</groupId>
|
|
||||||
<artifactId>java-vorbis-support</artifactId>
|
|
||||||
<version>1.2.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.esotericsoftware</groupId>
|
|
||||||
<artifactId>kryo</artifactId>
|
|
||||||
<version>5.6.2</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,50 +1,45 @@
|
|||||||
package cz.jzitnik;
|
package cz.jzitnik;
|
||||||
|
|
||||||
import cz.jzitnik.game.GameSaver;
|
import cz.jzitnik.game.Game;
|
||||||
import cz.jzitnik.game.logic.CustomLogicProvider;
|
|
||||||
import cz.jzitnik.game.mobs.EntityLogicProvider;
|
import cz.jzitnik.game.mobs.EntityLogicProvider;
|
||||||
import cz.jzitnik.game.threads.ThreadProvider;
|
import cz.jzitnik.game.threads.HealthRegenerationThread;
|
||||||
|
import cz.jzitnik.game.threads.HungerDrainThread;
|
||||||
|
import cz.jzitnik.game.threads.InputHandlerThread;
|
||||||
import cz.jzitnik.game.ui.*;
|
import cz.jzitnik.game.ui.*;
|
||||||
import cz.jzitnik.game.SpriteLoader;
|
import cz.jzitnik.game.SpriteLoader;
|
||||||
import cz.jzitnik.tui.ScreenRenderer;
|
import cz.jzitnik.tui.ScreenRenderer;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
import org.jline.terminal.TerminalBuilder;
|
import org.jline.terminal.TerminalBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
|
||||||
* The main class that starts the whole game. It initializes providers and sets
|
|
||||||
* up a terminal and creates the main game loop.
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
log.info("Setting up terminal");
|
|
||||||
Terminal terminal = TerminalBuilder.terminal();
|
Terminal terminal = TerminalBuilder.terminal();
|
||||||
terminal.enterRawMode();
|
terminal.enterRawMode();
|
||||||
|
terminal.trackMouse(Terminal.MouseTracking.Any);
|
||||||
|
|
||||||
if (!terminal.hasMouseSupport()) {
|
if (!terminal.hasMouseSupport()) {
|
||||||
log.error("This terminal does not support mouse");
|
System.out.println("Error: This terminal does not support mouse.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal.trackMouse(Terminal.MouseTracking.Any);
|
|
||||||
|
|
||||||
var spriteList = SpriteLoader.load();
|
var spriteList = SpriteLoader.load();
|
||||||
var screenRenderer = new ScreenRenderer(spriteList, terminal);
|
var screenRenderer = new ScreenRenderer(spriteList, terminal);
|
||||||
var gameSaver = new GameSaver();
|
var game = new Game();
|
||||||
var game = gameSaver.load();
|
|
||||||
|
|
||||||
final boolean[] isRunning = { true };
|
final boolean[] isRunning = {true};
|
||||||
|
|
||||||
|
Thread inputHandlerThread = new InputHandlerThread(game, terminal, screenRenderer, isRunning);
|
||||||
|
Thread healingThread = new HealthRegenerationThread(game.getPlayer());
|
||||||
|
Thread hungerDrainThread = new HungerDrainThread(game.getPlayer());
|
||||||
EntityLogicProvider entityLogicProvider = new EntityLogicProvider();
|
EntityLogicProvider entityLogicProvider = new EntityLogicProvider();
|
||||||
CustomLogicProvider customLogicProvider = new CustomLogicProvider();
|
|
||||||
|
|
||||||
ThreadProvider threadProvider = new ThreadProvider(game, screenRenderer, terminal, isRunning);
|
// Start all threads
|
||||||
threadProvider.start();
|
healingThread.start();
|
||||||
|
hungerDrainThread.start();
|
||||||
|
inputHandlerThread.start();
|
||||||
|
|
||||||
while (isRunning[0]) {
|
while (isRunning[0]) {
|
||||||
try {
|
try {
|
||||||
@ -52,11 +47,6 @@ public class Main {
|
|||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
// Yeah, yeah I know. Deal with it
|
// Yeah, yeah I know. Deal with it
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
customLogicProvider.update(game, screenRenderer);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (game.getWindow() == Window.WORLD) {
|
if (game.getWindow() == Window.WORLD) {
|
||||||
screenRenderer.render(game);
|
screenRenderer.render(game);
|
||||||
@ -65,10 +55,9 @@ public class Main {
|
|||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Closing terminal");
|
|
||||||
terminal.trackMouse(Terminal.MouseTracking.Off);
|
terminal.trackMouse(Terminal.MouseTracking.Off);
|
||||||
terminal.close();
|
terminal.close();
|
||||||
} catch (IOException | InterruptedException ignored) {
|
} catch (IOException | InterruptedException _) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,92 +1,56 @@
|
|||||||
package cz.jzitnik.game;
|
package cz.jzitnik.game;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import cz.jzitnik.game.entities.Block;
|
import cz.jzitnik.game.entities.Block;
|
||||||
import cz.jzitnik.game.entities.GameStates;
|
import cz.jzitnik.game.entities.GameStates;
|
||||||
import cz.jzitnik.game.entities.Player;
|
import cz.jzitnik.game.entities.Player;
|
||||||
import cz.jzitnik.game.entities.SteveData;
|
|
||||||
import cz.jzitnik.game.generation.Generation;
|
import cz.jzitnik.game.generation.Generation;
|
||||||
import cz.jzitnik.game.entities.items.Item;
|
import cz.jzitnik.game.entities.items.Item;
|
||||||
import cz.jzitnik.game.entities.items.ItemType;
|
import cz.jzitnik.game.entities.items.ItemType;
|
||||||
import cz.jzitnik.game.handlers.place.CustomPlaceHandler;
|
import cz.jzitnik.game.handlers.place.CustomPlaceHandler;
|
||||||
import cz.jzitnik.game.mobs.EntitySpawnProvider;
|
import cz.jzitnik.game.mobs.EntitySpawnProvider;
|
||||||
import cz.jzitnik.game.sprites.Breaking;
|
import cz.jzitnik.game.sprites.Breaking;
|
||||||
import cz.jzitnik.game.sprites.Steve.SteveState;
|
import cz.jzitnik.game.sprites.Steve;
|
||||||
import cz.jzitnik.game.annotations.WalkSound;
|
|
||||||
import cz.jzitnik.game.annotations.BreaksByPlace;
|
|
||||||
import cz.jzitnik.game.annotations.MineSound;
|
|
||||||
import cz.jzitnik.game.annotations.MiningSound;
|
|
||||||
import cz.jzitnik.game.annotations.PlaceSound;
|
|
||||||
import cz.jzitnik.game.blocks.Chest;
|
import cz.jzitnik.game.blocks.Chest;
|
||||||
import cz.jzitnik.game.blocks.Furnace;
|
import cz.jzitnik.game.blocks.Furnace;
|
||||||
import cz.jzitnik.game.config.Configuration;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
import cz.jzitnik.game.ui.Window;
|
import cz.jzitnik.game.ui.Window;
|
||||||
import cz.jzitnik.game.ui.Inventory;
|
import cz.jzitnik.game.ui.Inventory;
|
||||||
import cz.jzitnik.game.handlers.rightclick.RightClickHandlerProvider;
|
import cz.jzitnik.game.handlers.rightclick.RightClickHandlerProvider;
|
||||||
import cz.jzitnik.tui.ScreenMovingCalculationProvider;
|
import cz.jzitnik.tui.ScreenMovingCalculationProvider;
|
||||||
import cz.jzitnik.tui.ScreenRenderer;
|
import cz.jzitnik.tui.ScreenRenderer;
|
||||||
import cz.jzitnik.game.stats.Stats;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main class representing the game world and core logic.
|
|
||||||
* <p>
|
|
||||||
* Manages the game state, player actions, world updates and interactions.
|
|
||||||
*/
|
|
||||||
@Getter
|
@Getter
|
||||||
public class Game {
|
public class Game {
|
||||||
/**
|
|
||||||
* The 2D world grid consisting of block lists for each coordinate.
|
|
||||||
* Dimensions: [height][width] = [256][512].
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private final List<Block>[][] world = (List<Block>[][]) new CopyOnWriteArrayList[256][512];
|
private final List<Block>[][] world = (List<Block>[][]) new ArrayList[256][512];
|
||||||
private final Player player = new Player();
|
private final Player player = new Player();
|
||||||
private transient boolean mining = false;
|
private boolean mining = false;
|
||||||
@Setter
|
@Setter
|
||||||
private transient Window window = Window.WORLD;
|
private Window window = Window.WORLD;
|
||||||
private final Inventory inventory = new Inventory();
|
private final Inventory inventory = new Inventory();
|
||||||
private transient EntitySpawnProvider entitySpawnProvider = new EntitySpawnProvider();
|
|
||||||
private transient GameStates gameStates = new GameStates(this);
|
|
||||||
private Stats stats = new Stats();
|
|
||||||
|
|
||||||
/** Current time of day in the game (0–600 range). */
|
@JsonIgnore
|
||||||
@Setter
|
private final EntitySpawnProvider entitySpawnProvider = new EntitySpawnProvider();
|
||||||
private int daytime = 0;
|
|
||||||
//
|
@JsonIgnore
|
||||||
private Configuration configuration = new Configuration();
|
private final GameStates gameStates = new GameStates(this);
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs the game instance and generates the initial world.
|
|
||||||
*/
|
|
||||||
public Game() {
|
public Game() {
|
||||||
Generation.generateWorld(this);
|
Generation.generateWorld(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current coordinates of the player (bottom half).
|
|
||||||
*
|
|
||||||
* @return int array with x and y coordinates, or null if not found.
|
|
||||||
*/
|
|
||||||
public int[] getPlayerCords() {
|
public int[] getPlayerCords() {
|
||||||
for (int i = 0; i < world.length; i++) {
|
for (int i = 0; i < world.length; i++) {
|
||||||
for (int j = 0; j < world[i].length; j++) {
|
for (int j = 0; j < world[i].length; j++) {
|
||||||
for (Block block : world[i][j]) {
|
for (Block block : world[i][j]) {
|
||||||
if (block.getBlockId().equals("steve")) {
|
if (block.getBlockId().equals("steve") && block.getSpriteState().isPresent() && block.getSpriteState().get() == Steve.SteveState.SECOND) {
|
||||||
var steveData = (SteveData) block.getData();
|
return new int[]{j, i};
|
||||||
|
|
||||||
if (steveData.isTop()) {
|
|
||||||
return new int[] { j, i + 1 };
|
|
||||||
} else {
|
|
||||||
return new int[] { j, i };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,12 +58,6 @@ public class Game {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves the player one block to the right if possible.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
* @param terminal the terminal instance used for layout.
|
|
||||||
*/
|
|
||||||
public void movePlayerRight(ScreenRenderer screenRenderer, Terminal terminal) {
|
public void movePlayerRight(ScreenRenderer screenRenderer, Terminal terminal) {
|
||||||
if (window != Window.WORLD) {
|
if (window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
@ -112,25 +70,15 @@ public class Game {
|
|||||||
|
|
||||||
world[cords[1]][cords[0] + 1].add(player.getPlayerBlock2());
|
world[cords[1]][cords[0] + 1].add(player.getPlayerBlock2());
|
||||||
world[cords[1]][cords[0]].remove(player.getPlayerBlock2());
|
world[cords[1]][cords[0]].remove(player.getPlayerBlock2());
|
||||||
world[cords[1] - 1][cords[0] + 1].add(player.getPlayerBlock1());
|
world[cords[1]-1][cords[0] + 1].add(player.getPlayerBlock1());
|
||||||
world[cords[1] - 1][cords[0]].remove(player.getPlayerBlock1());
|
world[cords[1]-1][cords[0]].remove(player.getPlayerBlock1());
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
|
|
||||||
stats.setBlocksTraveled(stats.getBlocksTraveled() + 1);
|
|
||||||
|
|
||||||
entitySpawnProvider.update(this, terminal);
|
entitySpawnProvider.update(this, terminal);
|
||||||
|
|
||||||
playMovePlayerSound(cords[0] + 1, cords[1]);
|
|
||||||
|
|
||||||
update(screenRenderer);
|
update(screenRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves the player one block to the left if possible.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
* @param terminal the terminal instance used for layout.
|
|
||||||
*/
|
|
||||||
public void movePlayerLeft(ScreenRenderer screenRenderer, Terminal terminal) {
|
public void movePlayerLeft(ScreenRenderer screenRenderer, Terminal terminal) {
|
||||||
if (window != Window.WORLD) {
|
if (window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
@ -143,24 +91,15 @@ public class Game {
|
|||||||
|
|
||||||
world[cords[1]][cords[0] - 1].add(player.getPlayerBlock2());
|
world[cords[1]][cords[0] - 1].add(player.getPlayerBlock2());
|
||||||
world[cords[1]][cords[0]].remove(player.getPlayerBlock2());
|
world[cords[1]][cords[0]].remove(player.getPlayerBlock2());
|
||||||
world[cords[1] - 1][cords[0] - 1].add(player.getPlayerBlock1());
|
world[cords[1]-1][cords[0] - 1].add(player.getPlayerBlock1());
|
||||||
world[cords[1] - 1][cords[0]].remove(player.getPlayerBlock1());
|
world[cords[1]-1][cords[0]].remove(player.getPlayerBlock1());
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
|
|
||||||
stats.setBlocksTraveled(stats.getBlocksTraveled() + 1);
|
|
||||||
|
|
||||||
entitySpawnProvider.update(this, terminal);
|
entitySpawnProvider.update(this, terminal);
|
||||||
|
|
||||||
playMovePlayerSound(cords[0] - 1, cords[1]);
|
|
||||||
|
|
||||||
update(screenRenderer);
|
update(screenRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves the player upward by one block, if jumping is valid.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
*/
|
|
||||||
public void movePlayerUp(ScreenRenderer screenRenderer) {
|
public void movePlayerUp(ScreenRenderer screenRenderer) {
|
||||||
if (window != Window.WORLD) {
|
if (window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
@ -176,8 +115,6 @@ public class Game {
|
|||||||
world[cords[1] - 2][cords[0]].add(player.getPlayerBlock1());
|
world[cords[1] - 2][cords[0]].add(player.getPlayerBlock1());
|
||||||
world[cords[1]][cords[0]].remove(player.getPlayerBlock2());
|
world[cords[1]][cords[0]].remove(player.getPlayerBlock2());
|
||||||
|
|
||||||
stats.setBlocksTraveled(stats.getBlocksTraveled() + 1);
|
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(400);
|
Thread.sleep(400);
|
||||||
@ -189,20 +126,12 @@ public class Game {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attacks mobs at a specified location.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
* @param x x-coordinate.
|
|
||||||
* @param y y-coordinate.
|
|
||||||
*/
|
|
||||||
public void hit(ScreenRenderer screenRenderer, int x, int y) {
|
public void hit(ScreenRenderer screenRenderer, int x, int y) {
|
||||||
if (mining || window != Window.WORLD) {
|
if (mining || window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Block> mobs = world[y][x].stream().filter(Block::isMob).toList();
|
List<Block> mobs = world[y][x].stream().filter(Block::isMob).toList();
|
||||||
gameStates.dependencies.sound.playSound(configuration, SoundKey.HIT, null);
|
|
||||||
|
|
||||||
for (Block mob : mobs) {
|
for (Block mob : mobs) {
|
||||||
int dealDamage = inventory.getItemInHand().map(Item::getDealDamage).orElse(1);
|
int dealDamage = inventory.getItemInHand().map(Item::getDealDamage).orElse(1);
|
||||||
@ -212,8 +141,7 @@ public class Game {
|
|||||||
world[y][x].remove(mob);
|
world[y][x].remove(mob);
|
||||||
} else {
|
} else {
|
||||||
mob.decreaseHp(dealDamage);
|
mob.decreaseHp(dealDamage);
|
||||||
mob.setSpriteState(gameStates.dependencies.entityHurtAnimation.get(mob.getBlockId())
|
mob.setSpriteState(gameStates.dependencies.entityHurtAnimation.get(mob.getBlockId()).setHurtAnimation(true, mob.getSpriteState().get()));
|
||||||
.setHurtAnimation(true, mob.getSpriteState().get()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
@ -226,46 +154,26 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Block mob : mobs) {
|
for (Block mob : mobs) {
|
||||||
mob.setSpriteState(gameStates.dependencies.entityHurtAnimation.get(mob.getBlockId())
|
mob.setSpriteState(gameStates.dependencies.entityHurtAnimation.get(mob.getBlockId()).setHurtAnimation(false, mob.getSpriteState().get()));
|
||||||
.setHurtAnimation(false, mob.getSpriteState().get()));
|
|
||||||
}
|
}
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiates the mining process at a given location.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
* @param x x-coordinate.
|
|
||||||
* @param y y-coordinate.
|
|
||||||
*/
|
|
||||||
public void mine(ScreenRenderer screenRenderer, int x, int y) {
|
public void mine(ScreenRenderer screenRenderer, int x, int y) {
|
||||||
if (mining || window != Window.WORLD) {
|
if (mining || window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block breakingBlock = new Block("breaking", SpriteLoader.SPRITES.BREAKING);
|
Block breakingBlock = new Block("breaking", SpriteLoader.SPRITES.BREAKING);
|
||||||
breakingBlock.setGhost(true);
|
|
||||||
world[y][x].add(breakingBlock);
|
world[y][x].add(breakingBlock);
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
|
|
||||||
double hardness = world[y][x].stream().filter(block -> !block.getBlockId().equals("air")).toList().getFirst()
|
double hardness = world[y][x].stream().filter(block -> !block.isGhost()).toList().getFirst().calculateHardness(inventory);
|
||||||
.calculateHardness(inventory);
|
|
||||||
|
|
||||||
var blocks = world[y][x];
|
|
||||||
|
|
||||||
this.mining = true;
|
this.mining = true;
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
for (Block block : blocks) {
|
|
||||||
if (block.getClass().isAnnotationPresent(MiningSound.class)) {
|
|
||||||
new Thread(() -> {
|
|
||||||
var anot = block.getClass().getAnnotation(MiningSound.class);
|
|
||||||
gameStates.dependencies.sound.playSound(configuration, anot.value(), anot.annotationType());
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep((long) (hardness * 166));
|
Thread.sleep((long) (hardness * 166));
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -273,14 +181,7 @@ public class Game {
|
|||||||
}
|
}
|
||||||
breakingBlock.setSpriteState(Breaking.BreakingState.SECOND);
|
breakingBlock.setSpriteState(Breaking.BreakingState.SECOND);
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
for (Block block : blocks) {
|
|
||||||
if (block.getClass().isAnnotationPresent(MiningSound.class)) {
|
|
||||||
new Thread(() -> {
|
|
||||||
var anot = block.getClass().getAnnotation(MiningSound.class);
|
|
||||||
gameStates.dependencies.sound.playSound(configuration, anot.value(), anot.annotationType());
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep((long) (hardness * 166));
|
Thread.sleep((long) (hardness * 166));
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -288,14 +189,7 @@ public class Game {
|
|||||||
}
|
}
|
||||||
breakingBlock.setSpriteState(Breaking.BreakingState.THIRD);
|
breakingBlock.setSpriteState(Breaking.BreakingState.THIRD);
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
for (Block block : blocks) {
|
|
||||||
if (block.getClass().isAnnotationPresent(MiningSound.class)) {
|
|
||||||
new Thread(() -> {
|
|
||||||
var anot = block.getClass().getAnnotation(MiningSound.class);
|
|
||||||
gameStates.dependencies.sound.playSound(configuration, anot.value(), anot.annotationType());
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep((long) (hardness * 166));
|
Thread.sleep((long) (hardness * 166));
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -304,33 +198,9 @@ public class Game {
|
|||||||
|
|
||||||
mining = false;
|
mining = false;
|
||||||
|
|
||||||
mineInstant(screenRenderer, x, y, true);
|
var blocks = world[y][x];
|
||||||
}).start();
|
for (Block block : blocks) {
|
||||||
}
|
if (!block.isMineable()) {
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantly mines a block without animation delay.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
* @param x x-coordinate.
|
|
||||||
* @param y y-coordinate.
|
|
||||||
* @param minedDirectly whether the block was mined directly by player.
|
|
||||||
*/
|
|
||||||
public void mineInstant(ScreenRenderer screenRenderer, int x, int y, boolean minedDirectly) {
|
|
||||||
var blocks = world[y][x];
|
|
||||||
var blocksCopy = new ArrayList<>(blocks);
|
|
||||||
CustomPlaceHandler customPlaceHandler = gameStates.dependencies.placeHandler
|
|
||||||
.get(blocks.stream().filter(Block::isMineable).toList().getFirst().getBlockId());
|
|
||||||
boolean giveItem = customPlaceHandler.mine(this, x, y);
|
|
||||||
|
|
||||||
blocksCopy.forEach((e) -> {
|
|
||||||
e.setOnFire(false);
|
|
||||||
e.setBurningTime(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (giveItem) {
|
|
||||||
for (Block block : blocksCopy) {
|
|
||||||
if (!block.isMineable()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,57 +211,29 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var toolVariants = block.getToolVariants();
|
var toolVariants = block.getToolVariants();
|
||||||
if (inventory.getItemInHand().isPresent()
|
if (inventory.getItemInHand().isPresent() && inventory.getItemInHand().get().getToolVariant().isPresent() && block.getTool().isPresent() && block.getTool().get().equals(inventory.getItemInHand().get().getType()) && toolVariants.contains(inventory.getItemInHand().get().getToolVariant().get())) {
|
||||||
&& inventory.getItemInHand().get().getToolVariant().isPresent() && block.getTool().isPresent()
|
|
||||||
&& block.getTool().get().equals(inventory.getItemInHand().get().getType())
|
|
||||||
&& toolVariants.contains(inventory.getItemInHand().get().getToolVariant().get())
|
|
||||||
&& minedDirectly) {
|
|
||||||
block.getDrops().forEach(inventory::addItem);
|
block.getDrops().forEach(inventory::addItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (Block block : blocksCopy) {
|
for (Block block : blocks) {
|
||||||
if (block.getBlockId().equals("chest")) {
|
if (block.getBlockId().equals("chest")) {
|
||||||
((Chest) block.getData()).breakBlock(this);
|
((Chest) block.getData()).breakBlock(this);
|
||||||
} else if (block.getBlockId().equals("furnace")) {
|
} else if (block.getBlockId().equals("furnace")) {
|
||||||
((Furnace) block.getData()).breakBlock(this);
|
((Furnace) block.getData()).breakBlock(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (inventory.getItemInHand().isPresent() && inventory.getItemInHand().get().getMaxDurability() != 0) {
|
CustomPlaceHandler customPlaceHandler = gameStates.dependencies.placeHandler.get(blocks.stream().filter(Block::isMineable).toList().getFirst().getBlockId());
|
||||||
boolean broken = inventory.getItemInHand().get().use();
|
customPlaceHandler.mine(this, x, y);
|
||||||
if (broken) {
|
inventory.getItemInHand().ifPresent(Item::use);
|
||||||
inventory.decreaseItemInHand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gameStates.dependencies.eventHandlerProvider.handleMine(screenRenderer, this, x, y);
|
screenRenderer.render(this);
|
||||||
|
|
||||||
for (Block block : blocksCopy) {
|
update(screenRenderer);
|
||||||
if (block.getClass().isAnnotationPresent(MineSound.class)) {
|
}).start();
|
||||||
new Thread(() -> {
|
|
||||||
var anot = block.getClass().getAnnotation(MineSound.class);
|
|
||||||
gameStates.dependencies.sound.playSound(configuration, anot.value(), anot.annotationType());
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stats.setBlocksMined(stats.getBlocksMined() + 1);
|
|
||||||
|
|
||||||
screenRenderer.render(this);
|
|
||||||
|
|
||||||
update(screenRenderer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a block is valid for mining based on proximity and visibility.
|
|
||||||
*
|
|
||||||
* @param x x-coordinate.
|
|
||||||
* @param y y-coordinate.
|
|
||||||
* @param terminal terminal context used to determine screen bounds.
|
|
||||||
* @return true if mineable, false otherwise.
|
|
||||||
*/
|
|
||||||
public boolean isMineable(int x, int y, Terminal terminal) {
|
public boolean isMineable(int x, int y, Terminal terminal) {
|
||||||
List<Block> blocks = world[y][x];
|
List<Block> blocks = world[y][x];
|
||||||
|
|
||||||
@ -403,28 +245,21 @@ public class Game {
|
|||||||
int distanceX = Math.abs(playerX - x);
|
int distanceX = Math.abs(playerX - x);
|
||||||
int distanceY = Math.abs(playerY - y);
|
int distanceY = Math.abs(playerY - y);
|
||||||
|
|
||||||
int[] data = ScreenMovingCalculationProvider.calculate(playerX, playerY, terminal.getHeight(),
|
int[] data = ScreenMovingCalculationProvider.calculate(playerX, playerY, terminal.getHeight(), terminal.getWidth(), world[0].length, world.length);
|
||||||
terminal.getWidth(), world[0].length, world.length);
|
|
||||||
|
|
||||||
int startX = data[0];
|
int startX = data[0];
|
||||||
int endX = data[1];
|
int endX = data[1];
|
||||||
int startY = data[2];
|
int startY = data[2];
|
||||||
int endY = data[3];
|
int endY = data[3];
|
||||||
|
|
||||||
return y >= startY && y < endY - 1 && x >= startX && x < endX - 1 && distanceX <= 5 && distanceY <= 5
|
return
|
||||||
&& !(playerX == x && playerY == y) && !(playerX == x && playerY - 1 == y)
|
y >= startY && y < endY - 1 && x >= startX && x < endX - 1
|
||||||
|
&& distanceX <= 5 && distanceY <= 5
|
||||||
|
&& !(playerX == x && playerY == y)
|
||||||
|
&& !(playerX == x && playerY - 1 == y)
|
||||||
&& blocks.stream().anyMatch(Block::isMineable);
|
&& blocks.stream().anyMatch(Block::isMineable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a block is valid for hitting (attacking).
|
|
||||||
*
|
|
||||||
* @param x x-coordinate.
|
|
||||||
* @param y y-coordinate.
|
|
||||||
* @param terminal terminal context used to determine screen bounds.
|
|
||||||
* @return true if a mob can be hit at the given location.
|
|
||||||
*/
|
|
||||||
public boolean isHitable(int x, int y, Terminal terminal) {
|
public boolean isHitable(int x, int y, Terminal terminal) {
|
||||||
List<Block> blocks = world[y][x];
|
List<Block> blocks = world[y][x];
|
||||||
|
|
||||||
@ -436,24 +271,21 @@ public class Game {
|
|||||||
int distanceX = Math.abs(playerX - x);
|
int distanceX = Math.abs(playerX - x);
|
||||||
int distanceY = Math.abs(playerY - y);
|
int distanceY = Math.abs(playerY - y);
|
||||||
|
|
||||||
int[] data = ScreenMovingCalculationProvider.calculate(playerX, playerY, terminal.getHeight(),
|
int[] data = ScreenMovingCalculationProvider.calculate(playerX, playerY, terminal.getHeight(), terminal.getWidth(), world[0].length, world.length);
|
||||||
terminal.getWidth(), world[0].length, world.length);
|
|
||||||
|
|
||||||
int startX = data[0];
|
int startX = data[0];
|
||||||
int endX = data[1];
|
int endX = data[1];
|
||||||
int startY = data[2];
|
int startY = data[2];
|
||||||
int endY = data[3];
|
int endY = data[3];
|
||||||
|
|
||||||
return y >= startY && y < endY - 1 && x >= startX && x < endX - 1 && distanceX <= 5 && distanceY <= 5
|
return
|
||||||
&& !(playerX == x && playerY == y) && !(playerX == x && playerY - 1 == y)
|
y >= startY && y < endY - 1 && x >= startX && x < endX - 1
|
||||||
|
&& distanceX <= 5 && distanceY <= 5
|
||||||
|
&& !(playerX == x && playerY == y)
|
||||||
|
&& !(playerX == x && playerY - 1 == y)
|
||||||
&& blocks.stream().anyMatch(Block::isMob);
|
&& blocks.stream().anyMatch(Block::isMob);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Periodically checks and updates the player’s falling state due to gravity.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
*/
|
|
||||||
public void update(ScreenRenderer screenRenderer) {
|
public void update(ScreenRenderer screenRenderer) {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
@ -470,31 +302,15 @@ public class Game {
|
|||||||
world[cords2[1]][cords2[0]].remove(player.getPlayerBlock2());
|
world[cords2[1]][cords2[0]].remove(player.getPlayerBlock2());
|
||||||
player.addFalling();
|
player.addFalling();
|
||||||
|
|
||||||
stats.setBlocksTraveled(stats.getBlocksTraveled() + 1);
|
|
||||||
|
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
} else {
|
} else {
|
||||||
ArrayList<Block> combinedList = new ArrayList<>();
|
player.fell();
|
||||||
combinedList.addAll(world[cords2[1]][cords2[0]]);
|
|
||||||
combinedList.addAll(world[cords2[1] + 1][cords2[0]]);
|
|
||||||
if (player.getFallDistance() != 0) {
|
|
||||||
playMovePlayerSound(cords2[0], cords2[1]);
|
|
||||||
}
|
|
||||||
player.fell(combinedList, this, screenRenderer);
|
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to place a block or interact with the environment at a given location.
|
|
||||||
* Also handles eating and tool usage.
|
|
||||||
*
|
|
||||||
* @param x x-coordinate.
|
|
||||||
* @param y y-coordinate.
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
*/
|
|
||||||
public void build(int x, int y, ScreenRenderer screenRenderer) {
|
public void build(int x, int y, ScreenRenderer screenRenderer) {
|
||||||
if (window != Window.WORLD) {
|
if (window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
@ -523,31 +339,8 @@ public class Game {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory.getItemInHand().isPresent() && inventory.getItemInHand().get().getType() == ItemType.PICKUPER) {
|
if (!blocks.stream().allMatch(block -> block.getBlockId().equals("air"))) {
|
||||||
if (gameStates.dependencies.pickupHandlerProvider.get(inventory.getItemInHand().get().getId()).handle(this,
|
RightClickHandlerProvider.handle(x, y, this, screenRenderer);
|
||||||
x, y)) {
|
|
||||||
screenRenderer.render(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!blocks.stream().allMatch(block -> block.getBlockId().equals("air") || block.isFlowing()
|
|
||||||
|| block.getClass().isAnnotationPresent(BreaksByPlace.class))) {
|
|
||||||
boolean toolUsed = false;
|
|
||||||
if (inventory.getItemInHand().isPresent()) {
|
|
||||||
var item = inventory.getItemInHand().get();
|
|
||||||
toolUsed = gameStates.dependencies.toolUseProvider.handle(item.getType(), this, x, y);
|
|
||||||
if (toolUsed) {
|
|
||||||
boolean broken = item.use();
|
|
||||||
if (broken) {
|
|
||||||
inventory.decreaseItemInHand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!toolUsed) {
|
|
||||||
RightClickHandlerProvider.handle(x, y, this, screenRenderer);
|
|
||||||
}
|
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -558,80 +351,22 @@ public class Game {
|
|||||||
|
|
||||||
Item item = inventory.getItemInHand().get();
|
Item item = inventory.getItemInHand().get();
|
||||||
|
|
||||||
CustomPlaceHandler placeHandler = gameStates.dependencies.placeHandler.get(item.getBlock().get().getBlockId());
|
CustomPlaceHandler placeHandler = gameStates.dependencies.placeHandler.get(item.getId());
|
||||||
|
|
||||||
var blocksRemove = blocks.stream().filter(block -> block.getClass().isAnnotationPresent(BreaksByPlace.class))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
if (placeHandler.place(this, x, y)) {
|
if (placeHandler.place(this, x, y)) {
|
||||||
blocks.removeAll(blocksRemove);
|
|
||||||
for (Block block : blocks) {
|
|
||||||
if (block.getClass().isAnnotationPresent(PlaceSound.class)) {
|
|
||||||
var anot = block.getClass().getAnnotation(PlaceSound.class);
|
|
||||||
gameStates.dependencies.sound.playSound(configuration, anot.value(), anot.annotationType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gameStates.dependencies.eventHandlerProvider.handlePlace(screenRenderer, this, x, y);
|
|
||||||
stats.setBlocksPlaced(stats.getBlocksPlaced() + 1);
|
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Switches the selected inventory slot (hotbar).
|
|
||||||
*
|
|
||||||
* @param slot the slot index to switch to.
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
*/
|
|
||||||
public void changeSlot(int slot, ScreenRenderer screenRenderer) {
|
public void changeSlot(int slot, ScreenRenderer screenRenderer) {
|
||||||
if (window != Window.WORLD) {
|
if (window != Window.WORLD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventory.setItemInhHandIndex(slot);
|
inventory.setItemInhHandIndex(slot);
|
||||||
screenRenderer.render(this);
|
screenRenderer.render(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a block list represents a solid space (i.e., not all ghost blocks).
|
|
||||||
*
|
|
||||||
* @param blocks list of blocks at a coordinate.
|
|
||||||
* @return true if any block is not a ghost block.
|
|
||||||
*/
|
|
||||||
public boolean isSolid(List<Block> blocks) {
|
public boolean isSolid(List<Block> blocks) {
|
||||||
return !blocks.stream().allMatch(Block::isGhost);
|
return !blocks.stream().allMatch(Block::isGhost);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Visually and logically triggers the player "hit" (damage) animation.
|
|
||||||
*
|
|
||||||
* @param screenRenderer the renderer used to refresh the screen.
|
|
||||||
*/
|
|
||||||
public void playerHit(ScreenRenderer screenRenderer) {
|
|
||||||
player.getPlayerBlock1().setSpriteState(SteveState.FIRST_HURT);
|
|
||||||
player.getPlayerBlock2().setSpriteState(SteveState.SECOND_HURT);
|
|
||||||
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(500);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
player.getPlayerBlock1().setSpriteState(SteveState.FIRST);
|
|
||||||
player.getPlayerBlock2().setSpriteState(SteveState.SECOND);
|
|
||||||
screenRenderer.render(this);
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void playMovePlayerSound(int x, int y) {
|
|
||||||
var blocks = world[y + 1][x];
|
|
||||||
|
|
||||||
for (Block block : blocks) {
|
|
||||||
if (block.getClass().isAnnotationPresent(WalkSound.class)) {
|
|
||||||
var anot = block.getClass().getAnnotation(WalkSound.class);
|
|
||||||
gameStates.dependencies.sound.playSound(configuration, anot.value(), anot.annotationType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,66 +0,0 @@
|
|||||||
package cz.jzitnik.game;
|
|
||||||
|
|
||||||
import com.esotericsoftware.kryo.Kryo;
|
|
||||||
import com.esotericsoftware.kryo.io.Input;
|
|
||||||
import com.esotericsoftware.kryo.io.Output;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles saving and loading the game state using Kryo serialization.
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class GameSaver {
|
|
||||||
|
|
||||||
private static final String SAVE_FILE = "world.ser";
|
|
||||||
|
|
||||||
private final Kryo kryo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the GameSaver with Kryo serialization setup.
|
|
||||||
*/
|
|
||||||
public GameSaver() {
|
|
||||||
this.kryo = new Kryo();
|
|
||||||
kryo.setRegistrationRequired(false);
|
|
||||||
kryo.setReferences(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the current game state to a file.
|
|
||||||
*
|
|
||||||
* @param game the game instance to be saved
|
|
||||||
*/
|
|
||||||
public void save(Game game) {
|
|
||||||
try (Output output = new Output(new FileOutputStream(SAVE_FILE))) {
|
|
||||||
kryo.writeClassAndObject(output, game);
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("Failed to save game", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the game state from a file. If the save file does not exist,
|
|
||||||
* a new game instance is returned.
|
|
||||||
*
|
|
||||||
* @return the loaded game instance or a new game if no save is found
|
|
||||||
*/
|
|
||||||
public Game load() {
|
|
||||||
log.info("Loading game");
|
|
||||||
|
|
||||||
File file = new File(SAVE_FILE);
|
|
||||||
if (!file.isFile()) {
|
|
||||||
log.info("No save file found, creating new game");
|
|
||||||
return new Game();
|
|
||||||
}
|
|
||||||
|
|
||||||
try (Input input = new Input(new FileInputStream(SAVE_FILE))) {
|
|
||||||
log.info("Loading game from save file");
|
|
||||||
Object object = kryo.readClassAndObject(input);
|
|
||||||
return (Game) object;
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("Failed to load game", e);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +1,19 @@
|
|||||||
package cz.jzitnik.game;
|
package cz.jzitnik.game;
|
||||||
|
|
||||||
import cz.jzitnik.game.sprites.*;
|
import cz.jzitnik.game.sprites.*;
|
||||||
|
import cz.jzitnik.game.sprites.SimpleSprite;
|
||||||
import cz.jzitnik.tui.Sprite;
|
import cz.jzitnik.tui.Sprite;
|
||||||
import cz.jzitnik.tui.SpriteList;
|
import cz.jzitnik.tui.SpriteList;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class SpriteLoader {
|
public class SpriteLoader {
|
||||||
public enum SPRITES {
|
public enum SPRITES {
|
||||||
// BLOCKS
|
// BLOCKS
|
||||||
|
|
||||||
// Blocks
|
// Blocks
|
||||||
AIR,
|
AIR,
|
||||||
WATER,
|
|
||||||
LAVA,
|
|
||||||
DIRT,
|
DIRT,
|
||||||
FARMLAND,
|
|
||||||
GRASS,
|
GRASS,
|
||||||
STONE,
|
STONE,
|
||||||
BEDROCK,
|
BEDROCK,
|
||||||
@ -27,168 +23,92 @@ public class SpriteLoader {
|
|||||||
OAK_LEAF,
|
OAK_LEAF,
|
||||||
OAK_PLANKS,
|
OAK_PLANKS,
|
||||||
OAK_DOOR,
|
OAK_DOOR,
|
||||||
OBSIDIAN,
|
|
||||||
SAND,
|
|
||||||
HAYBALE,
|
|
||||||
GRAVEL,
|
|
||||||
|
|
||||||
// Flowers etc
|
|
||||||
GRASS_BUSH,
|
|
||||||
POPPY,
|
|
||||||
PINK_TULIP,
|
|
||||||
RED_TULIP,
|
|
||||||
ORANGE_TULIP,
|
|
||||||
WHITE_TULIP,
|
|
||||||
DANDELION,
|
|
||||||
CORNFLOWER,
|
|
||||||
ALLIUM,
|
|
||||||
BLUE_ORCHID,
|
|
||||||
OXEYE_DAISY,
|
|
||||||
AZURE_BLUET,
|
|
||||||
LILY_OF_THE_VALLEY,
|
|
||||||
LILAC,
|
|
||||||
PEONY,
|
|
||||||
ROSE_BUSH,
|
|
||||||
SUNFLOWER,
|
|
||||||
|
|
||||||
// Ores
|
// Ores
|
||||||
COAL_ORE,
|
COAL_ORE,
|
||||||
IRON_ORE,
|
IRON_ORE, // NEWW
|
||||||
GOLD_ORE,
|
GOLD_ORE, //NEWW
|
||||||
DIAMOND_ORE,
|
// Add Coal Block
|
||||||
|
IRON_BLOCK, // NEWW
|
||||||
COAL_BLOCK,
|
GOLD_BLOCK, // NEWW
|
||||||
IRON_BLOCK,
|
|
||||||
GOLD_BLOCK,
|
|
||||||
DIAMOND_BLOCK,
|
|
||||||
|
|
||||||
// Work
|
// Work
|
||||||
FURNACE,
|
FURNACE,
|
||||||
CHEST,
|
CHEST,
|
||||||
CRAFTING_TABLE,
|
CRAFTING_TABLE,
|
||||||
BED,
|
|
||||||
|
|
||||||
// Saplings
|
|
||||||
OAK_SAPLING,
|
|
||||||
|
|
||||||
// ENTITIES
|
// ENTITIES
|
||||||
STEVE,
|
STEVE,
|
||||||
PIG,
|
PIG,
|
||||||
SHEEP,
|
SHEEP,
|
||||||
COW,
|
|
||||||
ZOMBIE,
|
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
BREAKING,
|
BREAKING,
|
||||||
HEART,
|
HEART,
|
||||||
HUNGER,
|
HUNGER,
|
||||||
|
|
||||||
// Seeds
|
|
||||||
WHEAT,
|
|
||||||
|
|
||||||
// ITEMS
|
// ITEMS
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
ITEM_STICK,
|
ITEM_STICK,
|
||||||
ITEM_LEATHER,
|
|
||||||
ITEM_DYE,
|
|
||||||
ITEM_FLINT,
|
|
||||||
|
|
||||||
// Block Items
|
// Block Items
|
||||||
ITEM_DIRT,
|
ITEM_DIRT,
|
||||||
ITEM_GRASS,
|
|
||||||
ITEM_OAK_LOG,
|
ITEM_OAK_LOG,
|
||||||
ITEM_OAK_LEAF,
|
|
||||||
ITEM_OAK_PLANKS,
|
ITEM_OAK_PLANKS,
|
||||||
ITEM_COBBLESTONE,
|
ITEM_COBBLESTONE,
|
||||||
ITEM_STONE,
|
ITEM_STONE,
|
||||||
ITEM_OAK_DOOR,
|
ITEM_OAK_DOOR,
|
||||||
ITEM_WOOL,
|
ITEM_WOOL,
|
||||||
ITEM_OBSIDIAN,
|
|
||||||
ITEM_SAND,
|
|
||||||
ITEM_HAYBALE,
|
|
||||||
ITEM_GRAVEL,
|
|
||||||
|
|
||||||
// Tall Flowers
|
|
||||||
ITEM_LILAC,
|
|
||||||
ITEM_PEONY,
|
|
||||||
ITEM_ROSE_BUSH,
|
|
||||||
ITEM_SUNFLOWER,
|
|
||||||
|
|
||||||
// Ore Items
|
// Ore Items
|
||||||
ITEM_COAL_ORE,
|
ITEM_COAL_ORE,//NEWWW
|
||||||
ITEM_IRON_ORE,
|
ITEM_IRON_ORE, //NEWWW
|
||||||
ITEM_GOLD_ORE,
|
ITEM_GOLD_ORE, // NEWW
|
||||||
ITEM_DIAMOND_ORE,
|
|
||||||
|
|
||||||
ITEM_COAL_BLOCK,
|
// Add Item Coal Block
|
||||||
ITEM_IRON_BLOCK,
|
ITEM_IRON_BLOCK, //NEWWW
|
||||||
ITEM_GOLD_BLOCK,
|
ITEM_GOLD_BLOCK, // NEWW
|
||||||
ITEM_DIAMOND_BLOCK,
|
|
||||||
|
|
||||||
COAL,
|
COAL, // NEWW
|
||||||
ITEM_IRON_INGOT,
|
ITEM_IRON_INGOT, //NEWW
|
||||||
ITEM_GOLD_INGOT,
|
ITEM_GOLD_INGOT, // NEWW
|
||||||
DIAMOND,
|
|
||||||
|
|
||||||
// Work Items
|
// Work Items
|
||||||
ITEM_CRAFTING_TABLE,
|
ITEM_CRAFTING_TABLE,
|
||||||
ITEM_CHEST,
|
ITEM_CHEST,
|
||||||
ITEM_FURNACE,
|
ITEM_FURNACE,
|
||||||
ITEM_BED,
|
|
||||||
|
|
||||||
// Tools
|
// Weapons
|
||||||
WOODEN_SWORD,
|
WOODEN_SWORD, //NEWWW
|
||||||
WOODEN_PICKAXE,
|
WOODEN_PICKAXE,
|
||||||
WOODEN_AXE,
|
WOODEN_AXE,
|
||||||
WOODEN_SHOVEL,
|
WOODEN_SHOVEL,
|
||||||
WOODEN_HOE,
|
WOODEN_HOE, //NEWW
|
||||||
|
|
||||||
STONE_SWORD,
|
STONE_SWORD,//NEWWW
|
||||||
STONE_PICKAXE,
|
STONE_PICKAXE,
|
||||||
STONE_AXE,
|
STONE_AXE,
|
||||||
STONE_SHOVEL,
|
STONE_SHOVEL,
|
||||||
STONE_HOE,
|
STONE_HOE, //NEWW
|
||||||
|
|
||||||
IRON_SWORD,
|
IRON_SWORD, //NEWWW
|
||||||
IRON_PICKAXE,
|
IRON_PICKAXE, //NEWWW
|
||||||
IRON_AXE,
|
IRON_AXE, // NEWW
|
||||||
IRON_SHOVEL,
|
IRON_SHOVEL, //NEWWW
|
||||||
IRON_HOE,
|
IRON_HOE, // NEWWW
|
||||||
|
|
||||||
GOLDEN_SWORD,
|
GOLDEN_SWORD, // NEWW
|
||||||
GOLDEN_PICKAXE,
|
GOLDEN_PICKAXE, // NEWWW
|
||||||
GOLDEN_AXE,
|
GOLDEN_AXE, //NEWWW
|
||||||
GOLDEN_SHOVEL,
|
GOLDEN_SHOVEL, //NEWWW
|
||||||
GOLDEN_HOE,
|
GOLDEN_HOE, // NEWW
|
||||||
|
|
||||||
DIAMOND_SWORD,
|
|
||||||
DIAMOND_PICKAXE,
|
|
||||||
DIAMOND_AXE,
|
|
||||||
DIAMOND_SHOVEL,
|
|
||||||
DIAMOND_HOE,
|
|
||||||
|
|
||||||
SHEARS,
|
|
||||||
FLINT_AND_STEEL,
|
|
||||||
|
|
||||||
BUCKET,
|
|
||||||
WATER_BUCKET,
|
|
||||||
LAVA_BUCKET,
|
|
||||||
MILK_BUCKET,
|
|
||||||
|
|
||||||
// Food
|
// Food
|
||||||
ITEM_PORKCHOP,
|
ITEM_PORKCHOP,
|
||||||
ITEM_COOKED_PORKCHOP,
|
ITEM_COOKED_PORKCHOP,
|
||||||
ITEM_MUTTON,
|
ITEM_MUTTON,
|
||||||
ITEM_COOKED_MUTTON,
|
ITEM_COOKED_MUTTON,
|
||||||
ITEM_BEEF,
|
|
||||||
ITEM_STEAK,
|
|
||||||
ITEM_APPLE,
|
|
||||||
ITEM_BREAD,
|
|
||||||
|
|
||||||
// Seeds
|
|
||||||
ITEM_WHEAT_SEEDS,
|
|
||||||
ITEM_WHEAT,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final HashMap<SPRITES, Sprite> SPRITES_MAP = new HashMap<>();
|
public static final HashMap<SPRITES, Sprite> SPRITES_MAP = new HashMap<>();
|
||||||
@ -198,10 +118,7 @@ public class SpriteLoader {
|
|||||||
|
|
||||||
// Block
|
// Block
|
||||||
SPRITES_MAP.put(SPRITES.AIR, new Air());
|
SPRITES_MAP.put(SPRITES.AIR, new Air());
|
||||||
SPRITES_MAP.put(SPRITES.WATER, new Water());
|
|
||||||
SPRITES_MAP.put(SPRITES.LAVA, new Lava());
|
|
||||||
SPRITES_MAP.put(SPRITES.DIRT, new SimpleSprite("dirt.ans"));
|
SPRITES_MAP.put(SPRITES.DIRT, new SimpleSprite("dirt.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.FARMLAND, new Farmland());
|
|
||||||
SPRITES_MAP.put(SPRITES.GRASS, new SimpleSprite("grass.ans"));
|
SPRITES_MAP.put(SPRITES.GRASS, new SimpleSprite("grass.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.STONE, new SimpleSprite("stone.ans"));
|
SPRITES_MAP.put(SPRITES.STONE, new SimpleSprite("stone.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.BEDROCK, new SimpleSprite("bedrock.ans"));
|
SPRITES_MAP.put(SPRITES.BEDROCK, new SimpleSprite("bedrock.ans"));
|
||||||
@ -211,176 +128,103 @@ public class SpriteLoader {
|
|||||||
SPRITES_MAP.put(SPRITES.OAK_DOOR, new OakDoor());
|
SPRITES_MAP.put(SPRITES.OAK_DOOR, new OakDoor());
|
||||||
SPRITES_MAP.put(SPRITES.WOOL, new Wool());
|
SPRITES_MAP.put(SPRITES.WOOL, new Wool());
|
||||||
SPRITES_MAP.put(SPRITES.COBBLESTONE, new SimpleSprite("cobblestone.ans"));
|
SPRITES_MAP.put(SPRITES.COBBLESTONE, new SimpleSprite("cobblestone.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.OBSIDIAN, new SimpleSprite("obsidian.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.SAND, new SimpleSprite("sand.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.HAYBALE, new SimpleSprite("haybale.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.GRAVEL, new SimpleSprite("gravel.ans"));
|
|
||||||
|
|
||||||
// Ores
|
// Ores
|
||||||
SPRITES_MAP.put(SPRITES.COAL_ORE, new SimpleSprite("coal_ore.ans"));
|
SPRITES_MAP.put(SPRITES.COAL_ORE, new SimpleSprite("coal_ore.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.IRON_ORE, new SimpleSprite("iron_ore.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_ORE, new SimpleSprite("iron_ore.ans")); //NEWW
|
||||||
SPRITES_MAP.put(SPRITES.GOLD_ORE, new SimpleSprite("gold_ore.ans"));
|
SPRITES_MAP.put(SPRITES.GOLD_ORE, new SimpleSprite("gold_ore.ans")); //NEWW
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_ORE, new SimpleSprite("diamond_ore.ans"));
|
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.COAL_BLOCK, new SimpleSprite("coal_block.ans"));
|
// Add Coal block
|
||||||
SPRITES_MAP.put(SPRITES.IRON_BLOCK, new SimpleSprite("iron_block.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_BLOCK, new SimpleSprite("iron_block.ans")); //NEWW
|
||||||
SPRITES_MAP.put(SPRITES.GOLD_BLOCK, new SimpleSprite("gold_block.ans"));
|
SPRITES_MAP.put(SPRITES.GOLD_BLOCK, new SimpleSprite("gold_block.ans")); //NEWW
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_BLOCK, new SimpleSprite("diamond_block.ans")); // NEWW
|
|
||||||
|
|
||||||
// Work
|
// Work
|
||||||
SPRITES_MAP.put(SPRITES.CRAFTING_TABLE, new SimpleSprite("crafting_table.ans"));
|
SPRITES_MAP.put(SPRITES.CRAFTING_TABLE, new SimpleSprite("crafting_table.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.FURNACE, new Furnace());
|
SPRITES_MAP.put(SPRITES.FURNACE, new Furnace());
|
||||||
SPRITES_MAP.put(SPRITES.CHEST, new SimpleSprite("chest.ans"));
|
SPRITES_MAP.put(SPRITES.CHEST, new SimpleSprite("chest.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.BED, new Bed());
|
|
||||||
|
|
||||||
// GRASSY THINGS
|
|
||||||
|
|
||||||
// Saplings
|
|
||||||
SPRITES_MAP.put(SPRITES.OAK_SAPLING, new SimpleSprite("oak_sapling.ans"));
|
|
||||||
|
|
||||||
// Flowers
|
|
||||||
SPRITES_MAP.put(SPRITES.POPPY, new SimpleSprite("poppy.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.RED_TULIP, new SimpleSprite("red_tulip.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.PINK_TULIP, new SimpleSprite("pink_tulip.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.WHITE_TULIP, new SimpleSprite("white_tulip.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ORANGE_TULIP, new SimpleSprite("orange_tulip.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.DANDELION, new SimpleSprite("dandelion.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.LILY_OF_THE_VALLEY, new SimpleSprite("lily_of_the_valley.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.CORNFLOWER, new SimpleSprite("cornflower.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ALLIUM, new SimpleSprite("allium.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.BLUE_ORCHID, new SimpleSprite("blue_orchid.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.OXEYE_DAISY, new SimpleSprite("oxeye_daisy.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.AZURE_BLUET, new SimpleSprite("azure_bluet.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.LILAC, new TwoBlockSprite("lilac_top.ans", "lilac_bottom.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.PEONY, new TwoBlockSprite("peony_top.ans", "peony_bottom.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ROSE_BUSH, new TwoBlockSprite("rose_bush_top.ans", "rose_bush_bottom.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.SUNFLOWER, new TwoBlockSprite("sunflower_top.ans", "sunflower_bottom.ans"));
|
|
||||||
|
|
||||||
// Grass
|
|
||||||
SPRITES_MAP.put(SPRITES.GRASS_BUSH, new SimpleSprite("grass_bush.ans"));
|
|
||||||
|
|
||||||
// Seeds
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_WHEAT_SEEDS, new SimpleSprite("items/wheat_seeds.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_WHEAT, new SimpleSprite("items/wheat.ans"));
|
|
||||||
|
|
||||||
// ENTITIES
|
// ENTITIES
|
||||||
SPRITES_MAP.put(SPRITES.STEVE, new Steve());
|
SPRITES_MAP.put(SPRITES.STEVE, new Steve());
|
||||||
SPRITES_MAP.put(SPRITES.PIG, new Pig());
|
SPRITES_MAP.put(SPRITES.PIG, new Pig());
|
||||||
SPRITES_MAP.put(SPRITES.SHEEP, new Sheep());
|
SPRITES_MAP.put(SPRITES.SHEEP, new Sheep());
|
||||||
SPRITES_MAP.put(SPRITES.COW, new Cow());
|
|
||||||
SPRITES_MAP.put(SPRITES.ZOMBIE, new Zombie());
|
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
SPRITES_MAP.put(SPRITES.BREAKING, new Breaking());
|
SPRITES_MAP.put(SPRITES.BREAKING, new Breaking());
|
||||||
SPRITES_MAP.put(SPRITES.HEART, new Heart());
|
SPRITES_MAP.put(SPRITES.HEART, new Heart());
|
||||||
SPRITES_MAP.put(SPRITES.HUNGER, new Hunger());
|
SPRITES_MAP.put(SPRITES.HUNGER, new Hunger());
|
||||||
|
|
||||||
// SEEDS
|
|
||||||
SPRITES_MAP.put(SPRITES.WHEAT, new Farmable("wheat_stage1.ans", "wheat_stage2.ans", "wheat_stage3.ans"));
|
|
||||||
|
|
||||||
// ITEMS
|
// ITEMS
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_STICK, new SimpleSprite("items/stick.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_STICK, new SimpleSprite("items/stick.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_LEATHER, new SimpleSprite("items/leather.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_DYE, new Dye());
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_FLINT, new SimpleSprite("items/flint.ans"));
|
|
||||||
|
|
||||||
// Block Items
|
// Block Items
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_DIRT, new SimpleSprite("items/dirt.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_DIRT, new SimpleSprite("items/dirt.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_GRASS, new SimpleSprite("items/grass.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_OAK_LOG, new SimpleSprite("items/oak_log.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_OAK_LOG, new SimpleSprite("items/oak_log.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_OAK_LEAF, new SimpleSprite("items/oak_leaves.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_OAK_PLANKS, new SimpleSprite("items/oak_planks.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_OAK_PLANKS, new SimpleSprite("items/oak_planks.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_COBBLESTONE, new SimpleSprite("items/cobblestone.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_COBBLESTONE, new SimpleSprite("items/cobblestone.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_STONE, new SimpleSprite("items/stone.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_STONE, new SimpleSprite("items/stone.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_OAK_DOOR, new SimpleSprite("oak_door/items/oak_door.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_OAK_DOOR, new SimpleSprite("oak_door/items/oak_door.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_WOOL, new WoolItem());
|
SPRITES_MAP.put(SPRITES.ITEM_WOOL, new WoolItem());
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_OBSIDIAN, new SimpleSprite("items/obsidian.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_SAND, new SimpleSprite("items/sand.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_HAYBALE, new SimpleSprite("items/haybale.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_GRAVEL, new SimpleSprite("items/gravel.ans"));
|
|
||||||
|
|
||||||
// Tall flowers
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_LILAC, new SimpleSprite("items/lilac.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_PEONY, new SimpleSprite("items/peony.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_ROSE_BUSH, new SimpleSprite("items/rose_bush.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_SUNFLOWER, new SimpleSprite("items/sunflower.ans"));
|
|
||||||
|
|
||||||
// Ore Items
|
// Ore Items
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_COAL_ORE, new SimpleSprite("items/coal_ore.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_COAL_ORE, new SimpleSprite("items/coal_ore.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_IRON_ORE, new SimpleSprite("items/iron_ore.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_IRON_ORE, new SimpleSprite("items/iron_ore.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_GOLD_ORE, new SimpleSprite("items/gold_ore.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_GOLD_ORE, new SimpleSprite("items/gold_ore.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_DIAMOND_ORE, new SimpleSprite("items/diamond_ore.ans"));
|
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_COAL_BLOCK, new SimpleSprite("items/coal_block.ans"));
|
// Add Item Coal Block
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_IRON_BLOCK, new SimpleSprite("items/iron_block.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_IRON_BLOCK, new SimpleSprite("items/iron_block.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_GOLD_BLOCK, new SimpleSprite("items/gold_block.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_GOLD_BLOCK, new SimpleSprite("items/gold_block.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_DIAMOND_BLOCK, new SimpleSprite("items/diamond_block.ans"));
|
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.COAL, new SimpleSprite("items/coal.ans"));
|
SPRITES_MAP.put(SPRITES.COAL, new SimpleSprite("items/coal.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_IRON_INGOT, new SimpleSprite("items/iron_ingot.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_IRON_INGOT, new SimpleSprite("items/iron_ingot.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_GOLD_INGOT, new SimpleSprite("items/gold_ingot.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_GOLD_INGOT, new SimpleSprite("items/gold_ingot.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND, new SimpleSprite("items/diamond.ans"));
|
|
||||||
|
|
||||||
// Work Items
|
// Work Items
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_CRAFTING_TABLE, new SimpleSprite("items/crafting_table.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_CRAFTING_TABLE, new SimpleSprite("items/crafting_table.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_CHEST, new SimpleSprite("items/chest.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_CHEST, new SimpleSprite("items/chest.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_FURNACE, new SimpleSprite("items/furnace.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_FURNACE, new SimpleSprite("items/furnace.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_BED, new SimpleSprite("items/bed.ans"));
|
|
||||||
|
|
||||||
// Tools
|
// Weapons
|
||||||
SPRITES_MAP.put(SPRITES.WOODEN_SWORD, new SimpleSprite("items/wooden_sword.ans"));
|
SPRITES_MAP.put(SPRITES.WOODEN_SWORD, new SimpleSprite("items/wooden_sword.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.WOODEN_PICKAXE, new SimpleSprite("items/wooden_pickaxe.ans"));
|
SPRITES_MAP.put(SPRITES.WOODEN_PICKAXE, new SimpleSprite("items/wooden_pickaxe.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.WOODEN_AXE, new SimpleSprite("items/wooden_axe.ans"));
|
SPRITES_MAP.put(SPRITES.WOODEN_AXE, new SimpleSprite("items/wooden_axe.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.WOODEN_SHOVEL, new SimpleSprite("items/wooden_shovel.ans"));
|
SPRITES_MAP.put(SPRITES.WOODEN_SHOVEL, new SimpleSprite("items/wooden_shovel.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.WOODEN_HOE, new SimpleSprite("items/wooden_hoe.ans"));
|
SPRITES_MAP.put(SPRITES.WOODEN_HOE, new SimpleSprite("items/wooden_hoe.ans")); //NEWWW
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.STONE_SWORD, new SimpleSprite("items/wooden_sword.ans"));
|
SPRITES_MAP.put(SPRITES.STONE_SWORD, new SimpleSprite("items/wooden_sword.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.STONE_PICKAXE, new SimpleSprite("items/stone_pickaxe.ans"));
|
SPRITES_MAP.put(SPRITES.STONE_PICKAXE, new SimpleSprite("items/stone_pickaxe.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.STONE_AXE, new SimpleSprite("items/stone_axe.ans"));
|
SPRITES_MAP.put(SPRITES.STONE_AXE, new SimpleSprite("items/stone_axe.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.STONE_SHOVEL, new SimpleSprite("items/stone_shovel.ans"));
|
SPRITES_MAP.put(SPRITES.STONE_SHOVEL, new SimpleSprite("items/stone_shovel.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.STONE_HOE, new SimpleSprite("items/stone_hoe.ans"));
|
SPRITES_MAP.put(SPRITES.STONE_HOE, new SimpleSprite("items/stone_hoe.ans")); //NEWWW
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.IRON_SWORD, new SimpleSprite("items/iron_sword.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_SWORD, new SimpleSprite("items/iron_sword.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.IRON_PICKAXE, new SimpleSprite("items/iron_pickaxe.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_PICKAXE, new SimpleSprite("items/iron_pickaxe.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.IRON_AXE, new SimpleSprite("items/iron_axe.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_AXE, new SimpleSprite("items/iron_axe.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.IRON_SHOVEL, new SimpleSprite("items/iron_shovel.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_SHOVEL, new SimpleSprite("items/iron_shovel.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.IRON_HOE, new SimpleSprite("items/iron_hoe.ans"));
|
SPRITES_MAP.put(SPRITES.IRON_HOE, new SimpleSprite("items/iron_hoe.ans")); //NEWWW
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.GOLDEN_SWORD, new SimpleSprite("items/golden_sword.ans"));
|
SPRITES_MAP.put(SPRITES.GOLDEN_SWORD, new SimpleSprite("items/golden_sword.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.GOLDEN_PICKAXE, new SimpleSprite("items/golden_pickaxe.ans"));
|
SPRITES_MAP.put(SPRITES.GOLDEN_PICKAXE, new SimpleSprite("items/golden_pickaxe.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.GOLDEN_AXE, new SimpleSprite("items/golden_axe.ans"));
|
SPRITES_MAP.put(SPRITES.GOLDEN_AXE, new SimpleSprite("items/golden_axe.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.GOLDEN_SHOVEL, new SimpleSprite("items/golden_shovel.ans"));
|
SPRITES_MAP.put(SPRITES.GOLDEN_SHOVEL, new SimpleSprite("items/golden_shovel.ans")); //NEWWW
|
||||||
SPRITES_MAP.put(SPRITES.GOLDEN_HOE, new SimpleSprite("items/golden_hoe.ans"));
|
SPRITES_MAP.put(SPRITES.GOLDEN_HOE, new SimpleSprite("items/golden_hoe.ans")); //NEWWW
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_SWORD, new SimpleSprite("items/diamond_sword.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_PICKAXE, new SimpleSprite("items/diamond_pickaxe.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_AXE, new SimpleSprite("items/diamond_axe.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_SHOVEL, new SimpleSprite("items/diamond_shovel.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.DIAMOND_HOE, new SimpleSprite("items/diamond_hoe.ans"));
|
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.SHEARS, new SimpleSprite("items/shears.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.FLINT_AND_STEEL, new SimpleSprite("items/flint_and_steel.ans"));
|
|
||||||
|
|
||||||
SPRITES_MAP.put(SPRITES.BUCKET, new SimpleSprite("items/bucket.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.WATER_BUCKET, new SimpleSprite("items/water_bucket.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.LAVA_BUCKET, new SimpleSprite("items/lava_bucket.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.MILK_BUCKET, new SimpleSprite("items/milk_bucket.ans"));
|
|
||||||
|
|
||||||
// Food
|
// Food
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_PORKCHOP, new SimpleSprite("items/porkchop.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_PORKCHOP, new SimpleSprite("items/porkchop.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_COOKED_PORKCHOP, new SimpleSprite("items/cooked_porkchop.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_COOKED_PORKCHOP, new SimpleSprite("items/cooked_porkchop.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_MUTTON, new SimpleSprite("items/mutton.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_MUTTON, new SimpleSprite("items/mutton.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_COOKED_MUTTON, new SimpleSprite("items/cooked_mutton.ans"));
|
SPRITES_MAP.put(SPRITES.ITEM_COOKED_MUTTON, new SimpleSprite("items/cooked_mutton.ans"));
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_BEEF, new SimpleSprite("items/beef.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_STEAK, new SimpleSprite("items/steak.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_APPLE, new SimpleSprite("items/apple.ans"));
|
|
||||||
SPRITES_MAP.put(SPRITES.ITEM_BREAD, new SimpleSprite("items/bread.ans"));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpriteList<SPRITES> load() {
|
public static SpriteList<SPRITES> load() {
|
||||||
log.info("Loading sprites");
|
|
||||||
return new SpriteList<>(SPRITES.class, SPRITES_MAP);
|
return new SpriteList<>(SPRITES.class, SPRITES_MAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface BlockBreakAction {
|
|
||||||
String value();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface BlockDropPercentage {
|
|
||||||
int value();
|
|
||||||
}
|
|
@ -9,6 +9,5 @@ import java.lang.annotation.ElementType;
|
|||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
public @interface BlockRegistry {
|
public @interface BlockRegistry {
|
||||||
String value();
|
String value();
|
||||||
|
|
||||||
String drops() default "";
|
String drops() default "";
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface BreakableByWater {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface BreaksByPlace {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface BreaksFalling {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface Burning {
|
|
||||||
}
|
|
@ -6,10 +6,6 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface CraftingRecipeRegistry {
|
public @interface CraftingRecipeRegistry {
|
||||||
String[] recipe();
|
String[] recipe();
|
||||||
|
|
||||||
String result();
|
String result();
|
||||||
|
|
||||||
int amount();
|
int amount();
|
||||||
|
|
||||||
boolean usingRegex() default false;
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Repeatable(CustomDrops.class)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface CustomDrop {
|
|
||||||
String tool();
|
|
||||||
String drops();
|
|
||||||
int percentage() default 100;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface CustomDrops {
|
|
||||||
CustomDrop[] value();
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface CustomLogic {
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface FallingBlock {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface Farmable {
|
|
||||||
String value();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface Flamable {
|
|
||||||
boolean value() default true;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(ItemRegistry.class)
|
|
||||||
public @interface Fuel {
|
|
||||||
double value();
|
|
||||||
}
|
|
@ -9,6 +9,4 @@ import java.lang.annotation.ElementType;
|
|||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
public @interface ItemRegistry {
|
public @interface ItemRegistry {
|
||||||
String value();
|
String value();
|
||||||
|
|
||||||
String block() default "";
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface MineEventHandler {
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
@SoundTypeSet(SoundType.BLOCK)
|
|
||||||
public @interface MineSound {
|
|
||||||
SoundKey value();
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
@SoundTypeSet(SoundType.MINING)
|
|
||||||
public @interface MiningSound {
|
|
||||||
SoundKey value();
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface PickupHandler {
|
|
||||||
String value();
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface PlaceEventHandler {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface PlaceOnSolid {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface PlaceOnSolidNoHandler {
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
@SoundTypeSet(SoundType.BLOCK)
|
|
||||||
public @interface PlaceSound {
|
|
||||||
SoundKey value();
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.reducefalldamage.Reducer;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface ReduceFallDamage {
|
|
||||||
Class<? extends Reducer> value();
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Target(ElementType.ANNOTATION_TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface RequireAnnotation {
|
|
||||||
Class<? extends Annotation>[] value();
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface ResetDataOnMine {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface ResetSpriteStateOnMine {
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
public @interface Sapling {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(ItemRegistry.class)
|
|
||||||
public @interface Smeltable {
|
|
||||||
String value();
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface SoundRegistry {
|
|
||||||
SoundKey key();
|
|
||||||
String[] resourceLocation();
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.sound.SoundType;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Target(ElementType.ANNOTATION_TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface SoundTypeSet {
|
|
||||||
SoundType value();
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface ThreadRegistry {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.entities.items.ItemType;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface ToolUse {
|
|
||||||
ItemType value();
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface TwoblockBlock {
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package cz.jzitnik.game.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundType;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@RequireAnnotation(BlockRegistry.class)
|
|
||||||
@SoundTypeSet(SoundType.WALKING)
|
|
||||||
public @interface WalkSound {
|
|
||||||
SoundKey value();
|
|
||||||
}
|
|
@ -11,12 +11,11 @@ import cz.jzitnik.tui.SpriteList;
|
|||||||
import org.jline.terminal.MouseEvent;
|
import org.jline.terminal.MouseEvent;
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@RightClickLogic
|
@RightClickLogic
|
||||||
public class Chest implements RightClickHandler, Serializable {
|
public class Chest implements RightClickHandler {
|
||||||
private static final int ROW_AMOUNT = 4;
|
private static final int ROW_AMOUNT = 4;
|
||||||
private static final int COLUMN_AMOUNT = 6;
|
private static final int COLUMN_AMOUNT = 6;
|
||||||
private static final int CELL_WIDTH = 50;
|
private static final int CELL_WIDTH = 50;
|
||||||
@ -32,7 +31,7 @@ public class Chest implements RightClickHandler, Serializable {
|
|||||||
|
|
||||||
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
||||||
|
|
||||||
List<String> sprites = game.getInventory().getSprites(items, spriteList, inventory.getSelectedItemInv() - 50, game);
|
List<String> sprites = game.getInventory().getSprites(items, spriteList, inventory.getSelectedItemInv() - 50);
|
||||||
|
|
||||||
for (int i = 0; i < ROW_AMOUNT; i++) {
|
for (int i = 0; i < ROW_AMOUNT; i++) {
|
||||||
for (int j = 0; j < CELL_HEIGHT; j++) {
|
for (int j = 0; j < CELL_HEIGHT; j++) {
|
||||||
@ -61,7 +60,7 @@ public class Chest implements RightClickHandler, Serializable {
|
|||||||
|
|
||||||
size = buffer.toString().split("\n").length;
|
size = buffer.toString().split("\n").length;
|
||||||
|
|
||||||
game.getInventory().renderFull(buffer, terminal, spriteList, false, Optional.of(size), game);
|
game.getInventory().renderFull(buffer, terminal, spriteList, false, Optional.of(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void click(Game game, MouseEvent mouseEvent, Terminal terminal, ScreenRenderer screenRenderer) {
|
public void click(Game game, MouseEvent mouseEvent, Terminal terminal, ScreenRenderer screenRenderer) {
|
||||||
@ -71,16 +70,13 @@ public class Chest implements RightClickHandler, Serializable {
|
|||||||
int heightPixels = ROW_AMOUNT * (CELL_HEIGHT) - 10;
|
int heightPixels = ROW_AMOUNT * (CELL_HEIGHT) - 10;
|
||||||
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
||||||
|
|
||||||
if (x > moveLeft && x <= moveLeft + widthPixels && y > 0 && y <= heightPixels
|
if (x > moveLeft && x <= moveLeft + widthPixels && y > 0 && y <= heightPixels && mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
||||||
&& mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
if (mouseEvent.getType() != MouseEvent.Type.Pressed) return;
|
||||||
if (mouseEvent.getType() != MouseEvent.Type.Pressed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int blockX = (x - moveLeft) / 52;
|
int blockX = (x - moveLeft) / 52;
|
||||||
int blockY = y / 26;
|
int blockY = y / 26;
|
||||||
|
|
||||||
InventoryClickHandler.handleItemClick(mouseEvent, game.getInventory(), items,
|
InventoryClickHandler.handleItemClick(mouseEvent, game.getInventory(), items, blockY * COLUMN_AMOUNT + blockX, 50, Optional.of(items));
|
||||||
blockY * COLUMN_AMOUNT + blockX, 50, Optional.of(items));
|
|
||||||
|
|
||||||
screenRenderer.render(game);
|
screenRenderer.render(game);
|
||||||
|
|
||||||
@ -88,8 +84,7 @@ public class Chest implements RightClickHandler, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Why I need to add 20 here. Like wtf
|
// TODO: Why I need to add 20 here. Like wtf
|
||||||
InventoryClickHandler.click(mouseEvent, terminal, screenRenderer, game, Optional.of(size + 20),
|
InventoryClickHandler.click(mouseEvent, terminal, screenRenderer, game, Optional.of(size + 20), Optional.of(items));
|
||||||
Optional.of(items));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void breakBlock(Game game) {
|
public void breakBlock(Game game) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package cz.jzitnik.game.blocks;
|
package cz.jzitnik.game.blocks;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.BlockBreakAction;
|
|
||||||
import cz.jzitnik.game.annotations.RightClickLogic;
|
import cz.jzitnik.game.annotations.RightClickLogic;
|
||||||
import cz.jzitnik.game.entities.Block;
|
import cz.jzitnik.game.entities.Block;
|
||||||
import cz.jzitnik.game.Game;
|
import cz.jzitnik.game.Game;
|
||||||
import cz.jzitnik.game.entities.items.InventoryItem;
|
import cz.jzitnik.game.entities.items.InventoryItem;
|
||||||
import cz.jzitnik.game.entities.items.Item;
|
import cz.jzitnik.game.entities.items.Item;
|
||||||
import cz.jzitnik.game.handlers.rightclick.RightClickHandler;
|
import cz.jzitnik.game.handlers.rightclick.RightClickHandler;
|
||||||
|
import cz.jzitnik.game.smelting.Smelting;
|
||||||
import cz.jzitnik.game.ui.InventoryClickHandler;
|
import cz.jzitnik.game.ui.InventoryClickHandler;
|
||||||
import cz.jzitnik.game.ui.Window;
|
import cz.jzitnik.game.ui.Window;
|
||||||
import cz.jzitnik.tui.ScreenRenderer;
|
import cz.jzitnik.tui.ScreenRenderer;
|
||||||
@ -16,12 +16,11 @@ import cz.jzitnik.tui.utils.SpriteCombiner;
|
|||||||
import org.jline.terminal.MouseEvent;
|
import org.jline.terminal.MouseEvent;
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@RightClickLogic
|
@RightClickLogic
|
||||||
public class Furnace implements RightClickHandler, Serializable {
|
public class Furnace implements RightClickHandler {
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private final InventoryItem[] items = new InventoryItem[2];
|
private final InventoryItem[] items = new InventoryItem[2];
|
||||||
private InventoryItem outputItem;
|
private InventoryItem outputItem;
|
||||||
@ -42,15 +41,14 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
var inventory = game.getInventory();
|
var inventory = game.getInventory();
|
||||||
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
||||||
|
|
||||||
List<String> sprites = game.getInventory().getSprites(items, spriteList, inventory.getSelectedItemInv() - 50, game);
|
List<String> sprites = game.getInventory().getSprites(items, spriteList, inventory.getSelectedItemInv() - 50);
|
||||||
|
|
||||||
String[] outputSprite = outputItem == null ? null
|
String[] outputSprite = outputItem == null ? null : SpriteCombiner.combineTwoSprites(
|
||||||
: SpriteCombiner.combineTwoSprites(
|
outputItem.getItem().getFirst().getSpriteState().isPresent() ?
|
||||||
outputItem.getItem().getFirst().getSpriteState().isPresent()
|
spriteList.getSprite(outputItem.getItem().getFirst().getSprite()).getSprite(outputItem.getItem().getFirst().getSpriteState().get()) :
|
||||||
? spriteList.getSprite(outputItem.getItem().getFirst().getSprite())
|
spriteList.getSprite(outputItem.getItem().getFirst().getSprite()).getSprite() ,
|
||||||
.getSprite(outputItem.getItem().getFirst().getSpriteState().get())
|
Numbers.getNumberSprite(outputItem.getAmount())
|
||||||
: spriteList.getSprite(outputItem.getItem().getFirst().getSprite()).getSprite(),
|
).split("\n");
|
||||||
Numbers.getNumberSprite(outputItem.getAmount(), game)).split("\n");
|
|
||||||
|
|
||||||
for (int j = 0; j < CELL_HEIGHT; j++) {
|
for (int j = 0; j < CELL_HEIGHT; j++) {
|
||||||
buffer.append("\033[0m").append(" ".repeat(moveLeft));
|
buffer.append("\033[0m").append(" ".repeat(moveLeft));
|
||||||
@ -115,7 +113,7 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
|
|
||||||
size = buffer.toString().split("\n").length;
|
size = buffer.toString().split("\n").length;
|
||||||
|
|
||||||
game.getInventory().renderFull(buffer, terminal, spriteList, false, Optional.of(size), game);
|
game.getInventory().renderFull(buffer, terminal, spriteList, false, Optional.of(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void click(Game game, MouseEvent mouseEvent, Terminal terminal, ScreenRenderer screenRenderer) {
|
public void click(Game game, MouseEvent mouseEvent, Terminal terminal, ScreenRenderer screenRenderer) {
|
||||||
@ -124,10 +122,9 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
int widthPixels = COLUMN_AMOUNT * (CELL_WIDTH + BORDER_SIZE) + BORDER_SIZE;
|
int widthPixels = COLUMN_AMOUNT * (CELL_WIDTH + BORDER_SIZE) + BORDER_SIZE;
|
||||||
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
int moveLeft = Math.max(0, (terminal.getWidth() / 2) - (widthPixels / 2));
|
||||||
|
|
||||||
if (x > moveLeft && x <= moveLeft + CELL_WIDTH + BORDER_SIZE && y > 0 && y < CELL_HEIGHT
|
if (x > moveLeft && x <= moveLeft + CELL_WIDTH + BORDER_SIZE && y > 0 && y < CELL_HEIGHT && mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
||||||
&& mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
|
||||||
InventoryItem selectedItem = game.getInventory().getSelectedItemNo(Optional.of(items));
|
InventoryItem selectedItem = game.getInventory().getSelectedItemNo(Optional.of(items));
|
||||||
if (selectedItem != null && !game.getGameStates().dependencies.smelting.smeltingList.containsKey(selectedItem.getItem().getFirst().getId())) {
|
if (selectedItem != null && !Smelting.smeltingList.containsKey(selectedItem.getItem().getFirst().getId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,15 +132,12 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
|
|
||||||
screenRenderer.render(game);
|
screenRenderer.render(game);
|
||||||
checkSmelt(game, screenRenderer);
|
checkSmelt(game, screenRenderer);
|
||||||
} else if (x > moveLeft + (2 * (2 * BORDER_SIZE + CELL_WIDTH))
|
} else if (x > moveLeft + (2 * (2 * BORDER_SIZE + CELL_WIDTH)) && x <= moveLeft + (3 * (2 * BORDER_SIZE + CELL_WIDTH)) && y > CELL_HEIGHT && y <= 2*CELL_HEIGHT && mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
||||||
&& x <= moveLeft + (3 * (2 * BORDER_SIZE + CELL_WIDTH)) && y > CELL_HEIGHT && y <= 2 * CELL_HEIGHT
|
|
||||||
&& mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
|
||||||
pickup(game);
|
pickup(game);
|
||||||
screenRenderer.render(game);
|
screenRenderer.render(game);
|
||||||
} else if (x > moveLeft && x <= moveLeft + CELL_WIDTH + BORDER_SIZE && y > 2 * CELL_HEIGHT
|
} else if (x > moveLeft && x <= moveLeft + CELL_WIDTH + BORDER_SIZE && y > 2 * CELL_HEIGHT && y < 3 * CELL_HEIGHT && mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
||||||
&& y < 3 * CELL_HEIGHT && mouseEvent.getType() == MouseEvent.Type.Pressed) {
|
|
||||||
InventoryItem selectedItem = game.getInventory().getSelectedItemNo(Optional.of(items));
|
InventoryItem selectedItem = game.getInventory().getSelectedItemNo(Optional.of(items));
|
||||||
if (selectedItem != null && !game.getGameStates().dependencies.smelting.fuelList.containsKey(selectedItem.getItem().getFirst().getId())) {
|
if (selectedItem != null && !Smelting.fuelList.containsKey(selectedItem.getItem().getFirst().getId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,15 +146,13 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
screenRenderer.render(game);
|
screenRenderer.render(game);
|
||||||
checkSmelt(game, screenRenderer);
|
checkSmelt(game, screenRenderer);
|
||||||
} else {
|
} else {
|
||||||
InventoryClickHandler.click(mouseEvent, terminal, screenRenderer, game, Optional.of(size + 20),
|
InventoryClickHandler.click(mouseEvent, terminal, screenRenderer, game, Optional.of(size + 20), Optional.of(items));
|
||||||
Optional.of(items));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSmelting(boolean smelting) {
|
public void setSmelting(boolean smelting) {
|
||||||
this.smelting = smelting;
|
this.smelting = smelting;
|
||||||
this.block.setSpriteState(smelting ? cz.jzitnik.game.sprites.Furnace.FurnaceState.ON
|
this.block.setSpriteState(smelting ? cz.jzitnik.game.sprites.Furnace.FurnaceState.ON : cz.jzitnik.game.sprites.Furnace.FurnaceState.OFF);
|
||||||
: cz.jzitnik.game.sprites.Furnace.FurnaceState.OFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkSmelt(Game game, ScreenRenderer screenRenderer) {
|
public void checkSmelt(Game game, ScreenRenderer screenRenderer) {
|
||||||
@ -201,7 +193,7 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (smelting) {
|
if (smelting) {
|
||||||
var supplier = game.getGameStates().dependencies.smelting.smeltingList.get(items[0].getItem().getFirst().getId());
|
var supplier = Smelting.smeltingList.get(items[0].getItem().getFirst().getId());
|
||||||
if (outputItem == null) {
|
if (outputItem == null) {
|
||||||
outputItem = new InventoryItem(1, supplier.get());
|
outputItem = new InventoryItem(1, supplier.get());
|
||||||
} else {
|
} else {
|
||||||
@ -224,7 +216,7 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
Thread thread2 = new Thread(() -> {
|
Thread thread2 = new Thread(() -> {
|
||||||
while (true) {
|
while (true) {
|
||||||
Item fuel = items[1].getItem().getFirst();
|
Item fuel = items[1].getItem().getFirst();
|
||||||
double smelts = game.getGameStates().dependencies.smelting.fuelList.get(fuel.getId());
|
double smelts = Smelting.fuelList.get(fuel.getId());
|
||||||
|
|
||||||
items[1].decrease();
|
items[1].decrease();
|
||||||
if (items[1].getAmount() == 0) {
|
if (items[1].getAmount() == 0) {
|
||||||
@ -252,7 +244,6 @@ public class Furnace implements RightClickHandler, Serializable {
|
|||||||
thread2.start();
|
thread2.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockBreakAction("furnace")
|
|
||||||
public void breakBlock(Game game) {
|
public void breakBlock(Game game) {
|
||||||
for (var i = 0; i < items.length; i++) {
|
for (var i = 0; i < items.length; i++) {
|
||||||
if (items[i] == null) {
|
if (items[i] == null) {
|
||||||
|
@ -8,10 +8,8 @@ import cz.jzitnik.game.sprites.OakDoor;
|
|||||||
|
|
||||||
import cz.jzitnik.tui.ScreenRenderer;
|
import cz.jzitnik.tui.ScreenRenderer;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@RightClickLogic
|
@RightClickLogic
|
||||||
public class OakDoorData implements RightClickHandler, Serializable {
|
public class OakDoorData implements RightClickHandler {
|
||||||
private void change(Block door) {
|
private void change(Block door) {
|
||||||
door.setSpriteState(switch (door.getSpriteState().get()) {
|
door.setSpriteState(switch (door.getSpriteState().get()) {
|
||||||
case OakDoor.OakDoorState.TOP -> OakDoor.OakDoorState.TOPCLOSED;
|
case OakDoor.OakDoorState.TOP -> OakDoor.OakDoorState.TOPCLOSED;
|
||||||
@ -32,14 +30,15 @@ public class OakDoorData implements RightClickHandler, Serializable {
|
|||||||
var blocks = game.getWorld()[y][x];
|
var blocks = game.getWorld()[y][x];
|
||||||
var door = blocks.stream().filter(block -> block.getBlockId().equals("oak_door")).toList().getFirst();
|
var door = blocks.stream().filter(block -> block.getBlockId().equals("oak_door")).toList().getFirst();
|
||||||
|
|
||||||
|
|
||||||
switch (door.getSpriteState().get()) {
|
switch (door.getSpriteState().get()) {
|
||||||
case OakDoor.OakDoorState.TOP, OakDoor.OakDoorState.TOPCLOSED -> {
|
case OakDoor.OakDoorState.TOP, OakDoor.OakDoorState.TOPCLOSED -> {
|
||||||
var blocks2 = game.getWorld()[y + 1][x];
|
var blocks2 = game.getWorld()[y+1][x];
|
||||||
var door2 = blocks2.stream().filter(block -> block.getBlockId().equals("oak_door")).toList().getFirst();
|
var door2 = blocks2.stream().filter(block -> block.getBlockId().equals("oak_door")).toList().getFirst();
|
||||||
change(door2);
|
change(door2);
|
||||||
}
|
}
|
||||||
case OakDoor.OakDoorState.BOTTOM, OakDoor.OakDoorState.BOTTOMCLOSED -> {
|
case OakDoor.OakDoorState.BOTTOM, OakDoor.OakDoorState.BOTTOMCLOSED -> {
|
||||||
var blocks2 = game.getWorld()[y - 1][x];
|
var blocks2 = game.getWorld()[y-1][x];
|
||||||
var door2 = blocks2.stream().filter(block -> block.getBlockId().equals("oak_door")).toList().getFirst();
|
var door2 = blocks2.stream().filter(block -> block.getBlockId().equals("oak_door")).toList().getFirst();
|
||||||
change(door2);
|
change(door2);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
package cz.jzitnik.game.config;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class Configuration {
|
|
||||||
private int soundVolume = 100; // 0-100
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.reducefalldamage;
|
|
||||||
|
|
||||||
public class BedFallDamageReducer implements Reducer {
|
|
||||||
@Override
|
|
||||||
public int reduce(int initial) {
|
|
||||||
return (int) (initial * 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.reducefalldamage;
|
|
||||||
|
|
||||||
public class HaybaleFallDamageReducer implements Reducer {
|
|
||||||
@Override
|
|
||||||
public int reduce(int initial) {
|
|
||||||
return (int) (initial * 0.2);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.reducefalldamage;
|
|
||||||
|
|
||||||
public interface Reducer {
|
|
||||||
int reduce(int initial);
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.reducefalldamage;
|
|
||||||
|
|
||||||
public class WaterFallDamageReducer implements Reducer {
|
|
||||||
@Override
|
|
||||||
public int reduce(int ignored) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.sound.sampled.LineUnavailableException;
|
|
||||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
|
||||||
|
|
||||||
import org.reflections.Reflections;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.annotations.SoundTypeSet;
|
|
||||||
import cz.jzitnik.game.config.Configuration;
|
|
||||||
import cz.jzitnik.tui.SoundPlayer;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Sound {
|
|
||||||
private Random random = new Random();
|
|
||||||
private HashMap<SoundKey, SoundRegistry> map = new HashMap<>();
|
|
||||||
|
|
||||||
public Sound() {
|
|
||||||
register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
Reflections reflections = new Reflections("cz.jzitnik.game.core.sound.registry");
|
|
||||||
Set<Class<?>> handlerClasses = reflections.getTypesAnnotatedWith(SoundRegistry.class);
|
|
||||||
|
|
||||||
for (Class<?> clazz : handlerClasses) {
|
|
||||||
log.info("Loaded sound {}", clazz.getSimpleName());
|
|
||||||
var annotation = clazz.getAnnotation(SoundRegistry.class);
|
|
||||||
|
|
||||||
map.put(annotation.key(), annotation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void playSound(Configuration configuration, SoundKey soundKey, Class<? extends Annotation> anot) {
|
|
||||||
var volume = configuration.getSoundVolume();
|
|
||||||
|
|
||||||
var annotation = map.get(soundKey);
|
|
||||||
|
|
||||||
var resources = annotation.resourceLocation();
|
|
||||||
var resource = resources[random.nextInt(resources.length)];
|
|
||||||
|
|
||||||
var typeVolume = anot == null ? 100 : anot.isAnnotationPresent(SoundTypeSet.class)
|
|
||||||
? anot.getAnnotation(SoundTypeSet.class).value().getVolume()
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
SoundPlayer.playSound(resource, typeVolume, volume);
|
|
||||||
} catch (LineUnavailableException | IOException | UnsupportedAudioFileException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound;
|
|
||||||
|
|
||||||
public enum SoundKey {
|
|
||||||
GRASS,
|
|
||||||
GRASS_WALKING,
|
|
||||||
GRASS_MINING,
|
|
||||||
|
|
||||||
GRAVEL,
|
|
||||||
GRAVEL_WALKING,
|
|
||||||
|
|
||||||
WOOD_DIG,
|
|
||||||
WOOD_WALKING,
|
|
||||||
WOOD_MINING,
|
|
||||||
|
|
||||||
HURT,
|
|
||||||
HIT,
|
|
||||||
|
|
||||||
SAND_DIG,
|
|
||||||
SAND_MINING,
|
|
||||||
SAND_WALKING,
|
|
||||||
|
|
||||||
STONE_DIG,
|
|
||||||
STONE_WALKING,
|
|
||||||
STONE_MINING,
|
|
||||||
|
|
||||||
WOOL_DIG,
|
|
||||||
|
|
||||||
METAL_DIG,
|
|
||||||
METAL_WALKING,
|
|
||||||
METAL_MINING,
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public enum SoundType {
|
|
||||||
BLOCK(100),
|
|
||||||
WALKING(15),
|
|
||||||
MINING(25);
|
|
||||||
|
|
||||||
private final int volume;
|
|
||||||
|
|
||||||
SoundType(int volume) {
|
|
||||||
this.volume = volume;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.GRASS, resourceLocation = {
|
|
||||||
"grass/grass1.ogg",
|
|
||||||
"grass/grass2.ogg",
|
|
||||||
"grass/grass3.ogg",
|
|
||||||
"grass/grass4.ogg"
|
|
||||||
})
|
|
||||||
public class GrassDigSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.GRASS_MINING, resourceLocation = {
|
|
||||||
"grass/mining1.ogg",
|
|
||||||
"grass/mining2.ogg",
|
|
||||||
"grass/mining3.ogg",
|
|
||||||
"grass/mining4.ogg",
|
|
||||||
"grass/mining5.ogg",
|
|
||||||
"grass/mining6.ogg"
|
|
||||||
})
|
|
||||||
public class GrassMiningSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.GRASS_WALKING, resourceLocation = {
|
|
||||||
"grass/walk1.ogg",
|
|
||||||
"grass/walk2.ogg",
|
|
||||||
"grass/walk3.ogg",
|
|
||||||
"grass/walk4.ogg",
|
|
||||||
"grass/walk5.ogg",
|
|
||||||
"grass/walk6.ogg",
|
|
||||||
})
|
|
||||||
public class GrassWalkingSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.GRAVEL, resourceLocation = {
|
|
||||||
"gravel/gravel1.ogg",
|
|
||||||
"gravel/gravel2.ogg",
|
|
||||||
"gravel/gravel3.ogg",
|
|
||||||
"gravel/gravel4.ogg"
|
|
||||||
})
|
|
||||||
public class GravelDigSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.GRAVEL_WALKING, resourceLocation = {
|
|
||||||
"gravel/step1.ogg",
|
|
||||||
"gravel/step2.ogg",
|
|
||||||
"gravel/step3.ogg",
|
|
||||||
"gravel/step4.ogg",
|
|
||||||
})
|
|
||||||
public class GravelWalkingSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.HIT, resourceLocation = {
|
|
||||||
"hit/hit1.ogg",
|
|
||||||
"hit/hit2.ogg",
|
|
||||||
"hit/hit3.ogg",
|
|
||||||
"hit/hit4.ogg",
|
|
||||||
})
|
|
||||||
public class HitSound {
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.HURT, resourceLocation = {
|
|
||||||
"hurt.ogg",
|
|
||||||
})
|
|
||||||
public class HurtSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.METAL_DIG, resourceLocation = {
|
|
||||||
"metal/dig1.ogg",
|
|
||||||
"metal/dig2.ogg",
|
|
||||||
"metal/dig3.ogg",
|
|
||||||
"metal/dig4.ogg"
|
|
||||||
})
|
|
||||||
public class MetalDigSound {
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.METAL_MINING, resourceLocation = {
|
|
||||||
"metal/mining1.ogg",
|
|
||||||
"metal/mining2.ogg",
|
|
||||||
"metal/mining3.ogg",
|
|
||||||
"metal/mining4.ogg",
|
|
||||||
"metal/mining5.ogg",
|
|
||||||
"metal/mining6.ogg"
|
|
||||||
|
|
||||||
})
|
|
||||||
public class MetalMiningSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.METAL_WALKING, resourceLocation = {
|
|
||||||
"metal/step1.ogg",
|
|
||||||
"metal/step2.ogg",
|
|
||||||
"metal/step3.ogg",
|
|
||||||
"metal/step4.ogg",
|
|
||||||
"metal/step5.ogg",
|
|
||||||
"metal/step6.ogg"
|
|
||||||
})
|
|
||||||
public class MetalWalkingSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.SAND_DIG, resourceLocation = {
|
|
||||||
"sand/dig1.ogg",
|
|
||||||
"sand/dig2.ogg",
|
|
||||||
"sand/dig3.ogg",
|
|
||||||
"sand/dig4.ogg"
|
|
||||||
})
|
|
||||||
public class SandDigSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.SAND_MINING, resourceLocation = {
|
|
||||||
"sand/mining1.ogg",
|
|
||||||
"sand/mining2.ogg",
|
|
||||||
"sand/mining3.ogg",
|
|
||||||
"sand/mining4.ogg",
|
|
||||||
"sand/mining5.ogg",
|
|
||||||
|
|
||||||
})
|
|
||||||
public class SandMiningSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.SAND_WALKING, resourceLocation = {
|
|
||||||
"sand/step1.ogg",
|
|
||||||
"sand/step2.ogg",
|
|
||||||
"sand/step3.ogg",
|
|
||||||
"sand/step4.ogg",
|
|
||||||
"sand/step5.ogg",
|
|
||||||
"sand/step6.ogg"
|
|
||||||
})
|
|
||||||
public class SandWalkingSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.STONE_DIG, resourceLocation = {
|
|
||||||
"stone/dig1.ogg",
|
|
||||||
"stone/dig2.ogg",
|
|
||||||
"stone/dig3.ogg",
|
|
||||||
"stone/dig4.ogg"
|
|
||||||
})
|
|
||||||
public class StoneDigSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.STONE_MINING, resourceLocation = {
|
|
||||||
"stone/mine1.ogg",
|
|
||||||
"stone/mine2.ogg",
|
|
||||||
"stone/mine3.ogg",
|
|
||||||
"stone/mine4.ogg",
|
|
||||||
"stone/mine5.ogg",
|
|
||||||
"stone/mine6.ogg"
|
|
||||||
})
|
|
||||||
public class StoneMiningSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.STONE_WALKING, resourceLocation = {
|
|
||||||
"stone/step1.ogg",
|
|
||||||
"stone/step2.ogg",
|
|
||||||
"stone/step3.ogg",
|
|
||||||
"stone/step4.ogg",
|
|
||||||
"stone/step5.ogg",
|
|
||||||
"stone/step6.ogg"
|
|
||||||
})
|
|
||||||
public class StoneWalkingSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.WOOD_DIG, resourceLocation = {
|
|
||||||
"wood/dig1.ogg",
|
|
||||||
"wood/dig2.ogg",
|
|
||||||
"wood/dig3.ogg",
|
|
||||||
"wood/dig4.ogg",
|
|
||||||
})
|
|
||||||
public class WoodDigSound {
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.WOOD_MINING, resourceLocation = {
|
|
||||||
"wood/mining1.ogg",
|
|
||||||
"wood/mining2.ogg",
|
|
||||||
"wood/mining3.ogg",
|
|
||||||
"wood/mining4.ogg",
|
|
||||||
"wood/mining5.ogg",
|
|
||||||
"wood/mining6.ogg"
|
|
||||||
|
|
||||||
})
|
|
||||||
public class WoodMiningSound {
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.WOOD_WALKING, resourceLocation = {
|
|
||||||
"wood/step1.ogg",
|
|
||||||
"wood/step2.ogg",
|
|
||||||
"wood/step3.ogg",
|
|
||||||
"wood/step4.ogg",
|
|
||||||
"wood/step5.ogg",
|
|
||||||
"wood/step6.ogg"
|
|
||||||
})
|
|
||||||
public class WoodWalkingSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.WOOL_DIG, resourceLocation = {
|
|
||||||
"wool/dig1.ogg",
|
|
||||||
"wool/dig2.ogg",
|
|
||||||
"wool/dig3.ogg",
|
|
||||||
"wool/dig4.ogg"
|
|
||||||
})
|
|
||||||
public class WoolDigSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.WOOL_DIG, resourceLocation = {
|
|
||||||
"wool/dig1.ogg",
|
|
||||||
"wool/dig2.ogg",
|
|
||||||
"wool/dig3.ogg",
|
|
||||||
"wool/dig4.ogg"
|
|
||||||
})
|
|
||||||
public class WoolMiningSound {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.sound.registry;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.SoundRegistry;
|
|
||||||
import cz.jzitnik.game.core.sound.SoundKey;
|
|
||||||
|
|
||||||
@SoundRegistry(key = SoundKey.WOOL_DIG, resourceLocation = {
|
|
||||||
"wool/dig1.ogg",
|
|
||||||
"wool/dig2.ogg",
|
|
||||||
"wool/dig3.ogg",
|
|
||||||
"wool/dig4.ogg"
|
|
||||||
})
|
|
||||||
public class WoolWalkingSound {
|
|
||||||
}
|
|
@ -11,5 +11,4 @@ import java.util.function.Supplier;
|
|||||||
public class CraftingRecipe {
|
public class CraftingRecipe {
|
||||||
private String[][] recipe;
|
private String[][] recipe;
|
||||||
private Supplier<InventoryItem> itemSupplier;
|
private Supplier<InventoryItem> itemSupplier;
|
||||||
private boolean usingRegex;
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import org.reflections.Reflections;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class CraftingRecipeList {
|
public class CraftingRecipeList {
|
||||||
public static final List<CraftingRecipe> recipes = new ArrayList<>();
|
private static final List<CraftingRecipe> recipes = new ArrayList<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
registerRecipes();
|
registerRecipes();
|
||||||
@ -24,8 +24,7 @@ public class CraftingRecipeList {
|
|||||||
String[][] recipeGrid = convertTo2DGrid(annotation.recipe());
|
String[][] recipeGrid = convertTo2DGrid(annotation.recipe());
|
||||||
|
|
||||||
recipes.add(new CraftingRecipe(recipeGrid,
|
recipes.add(new CraftingRecipe(recipeGrid,
|
||||||
() -> new InventoryItem(annotation.amount(), ItemBlockSupplier.getItem(annotation.result())),
|
() -> new InventoryItem(annotation.amount(), ItemBlockSupplier.getItem(annotation.result()))));
|
||||||
annotation.usingRegex()));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -54,7 +53,7 @@ public class CraftingRecipeList {
|
|||||||
|
|
||||||
public static Optional<CraftingRecipe> getRecipe(String[] r) {
|
public static Optional<CraftingRecipe> getRecipe(String[] r) {
|
||||||
for (CraftingRecipe recipe : recipes) {
|
for (CraftingRecipe recipe : recipes) {
|
||||||
if (matchesByItemSet(recipe.getRecipe(), r, recipe.isUsingRegex())) {
|
if (matchesByItemSet(recipe.getRecipe(), r)) {
|
||||||
return Optional.of(recipe);
|
return Optional.of(recipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,7 +90,7 @@ public class CraftingRecipeList {
|
|||||||
return trimmedArray;
|
return trimmedArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean are2DArraysIdentical(String[][] array1, String[][] array2, boolean usingRegex) {
|
public static boolean are2DArraysIdentical(String[][] array1, String[][] array2) {
|
||||||
if (array1.length != array2.length) {
|
if (array1.length != array2.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -105,8 +104,7 @@ public class CraftingRecipeList {
|
|||||||
if (array1[i][j] == null && array2[i][j] != null) {
|
if (array1[i][j] == null && array2[i][j] != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (array1[i][j] != null
|
if (array1[i][j] != null && !array1[i][j].equals(array2[i][j])) {
|
||||||
&& (usingRegex ? !array2[i][j].matches(array1[i][j]) : !array1[i][j].equals(array2[i][j]))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +113,7 @@ public class CraftingRecipeList {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean matchesByItemSet(String[][] recipe, String[] grid, boolean usingRegex) {
|
private static boolean matchesByItemSet(String[][] recipe, String[] grid) {
|
||||||
String[][] finalGrid = new String[3][3];
|
String[][] finalGrid = new String[3][3];
|
||||||
|
|
||||||
if (grid.length == 4) {
|
if (grid.length == 4) {
|
||||||
@ -138,6 +136,6 @@ public class CraftingRecipeList {
|
|||||||
var croppedRecipe = trimNullEdges(recipe);
|
var croppedRecipe = trimNullEdges(recipe);
|
||||||
var croppedGrid = trimNullEdges(finalGrid);
|
var croppedGrid = trimNullEdges(finalGrid);
|
||||||
|
|
||||||
return are2DArraysIdentical(croppedRecipe, croppedGrid, usingRegex);
|
return are2DArraysIdentical(croppedRecipe, croppedGrid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.work;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.work;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.work;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.blocks;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.blocks;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.items;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.stone;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.stone;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.stone;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.stone;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.wooden;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.wooden;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
|||||||
"oak_planks", "stick", "_",
|
"oak_planks", "stick", "_",
|
||||||
"_", "stick", "_"
|
"_", "stick", "_"
|
||||||
},
|
},
|
||||||
result = "wooden_axe",
|
result = "oak_planks",
|
||||||
amount = 1
|
amount = 1
|
||||||
)
|
)
|
||||||
public class WoodenAxeRecipe {}
|
public class WoodenAxeRecipe {}
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.wooden;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.tools.wooden;
|
package cz.jzitnik.game.crafting.recipes;
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.blocks;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
|
||||||
|
|
||||||
@CraftingRecipeRegistry(
|
|
||||||
recipe = {
|
|
||||||
"grass_bush", "_", "_",
|
|
||||||
"dirt", "_", "_",
|
|
||||||
"_", "_", "_"
|
|
||||||
},
|
|
||||||
result = "grass",
|
|
||||||
amount = 1
|
|
||||||
)
|
|
||||||
public class GrassBlockRecipe {}
|
|
@ -1,14 +0,0 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.blocks;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
|
||||||
|
|
||||||
@CraftingRecipeRegistry(
|
|
||||||
recipe = {
|
|
||||||
"wheat", "wheat", "wheat",
|
|
||||||
"wheat", "wheat", "wheat",
|
|
||||||
"wheat", "wheat", "wheat"
|
|
||||||
},
|
|
||||||
result = "haybale",
|
|
||||||
amount = 1
|
|
||||||
)
|
|
||||||
public class HaybaleRecipe {}
|
|
@ -1,14 +0,0 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.blocks;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
|
||||||
|
|
||||||
@CraftingRecipeRegistry(
|
|
||||||
recipe = {
|
|
||||||
"haybale", "_", "_",
|
|
||||||
"_", "_", "_",
|
|
||||||
"_", "_", "_"
|
|
||||||
},
|
|
||||||
result = "wheat",
|
|
||||||
amount = 9
|
|
||||||
)
|
|
||||||
public class WheatRecipe {}
|
|
@ -1,14 +0,0 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.dyes;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
|
||||||
|
|
||||||
@CraftingRecipeRegistry(
|
|
||||||
recipe = {
|
|
||||||
"cornflower", "_", "_",
|
|
||||||
"_", "_", "_",
|
|
||||||
"_", "_", "_"
|
|
||||||
},
|
|
||||||
result = "blue_dye",
|
|
||||||
amount = 1
|
|
||||||
)
|
|
||||||
public class BlueDyeRecipe {}
|
|
@ -1,14 +0,0 @@
|
|||||||
package cz.jzitnik.game.crafting.recipes.dyes;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.CraftingRecipeRegistry;
|
|
||||||
|
|
||||||
@CraftingRecipeRegistry(
|
|
||||||
recipe = {
|
|
||||||
"blue_orchid", "_", "_",
|
|
||||||
"_", "_", "_",
|
|
||||||
"_", "_", "_"
|
|
||||||
},
|
|
||||||
result = "light_blue_dye",
|
|
||||||
amount = 1
|
|
||||||
)
|
|
||||||
public class LightBlueDyeRecipe {}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user