Update
This commit is contained in:
parent
6b4dfb054e
commit
cb096ae6a8
65
CREDITS.txt
65
CREDITS.txt
@ -1,65 +0,0 @@
|
|||||||
Minecraft Forge: Credits/Thank You
|
|
||||||
|
|
||||||
Forge is a set of tools and modifications to the Minecraft base game code to assist
|
|
||||||
mod developers in creating new and exciting content. It has been in development for
|
|
||||||
several years now, but I would like to take this time thank a few people who have
|
|
||||||
helped it along it's way.
|
|
||||||
|
|
||||||
First, the people who originally created the Forge projects way back in Minecraft
|
|
||||||
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
|
|
||||||
of me taking over the project, who knows what Minecraft modding would be today.
|
|
||||||
|
|
||||||
Secondly, someone who has worked with me, and developed some of the core features
|
|
||||||
that allow modding to be as functional, and as simple as it is, cpw. For developing
|
|
||||||
FML, which stabelized the client and server modding ecosystem. As well as the base
|
|
||||||
loading system that allows us to modify Minecraft's code as elegently as possible.
|
|
||||||
|
|
||||||
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
|
|
||||||
sane as well as guiding the community into creating better additions to Forge.
|
|
||||||
|
|
||||||
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
|
|
||||||
I am a part}. For creating some of the core tools needed to make Minecraft modding
|
|
||||||
both possible, and as stable as can be.
|
|
||||||
On that note, here is some specific information of the MCP data we use:
|
|
||||||
* Minecraft Coder Pack (MCP) *
|
|
||||||
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
|
|
||||||
download components of MCP and distribute MCP data files. This permission is not
|
|
||||||
transitive and others wishing to redistribute the Minecraft Forge source independently
|
|
||||||
should seek permission of MCP or remove the MCP data files and request their users
|
|
||||||
to download MCP separately.
|
|
||||||
|
|
||||||
And lastly, the countless community members who have spent time submitting bug reports,
|
|
||||||
pull requests, and just helping out the community in general. Thank you.
|
|
||||||
|
|
||||||
--LexManos
|
|
||||||
|
|
||||||
=========================================================================
|
|
||||||
|
|
||||||
This is Forge Mod Loader.
|
|
||||||
|
|
||||||
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
|
|
||||||
|
|
||||||
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
|
|
||||||
and minecraft clients.
|
|
||||||
|
|
||||||
The code is authored by cpw.
|
|
||||||
|
|
||||||
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
|
|
||||||
http://www.minecraftforum.net/topic/75440-
|
|
||||||
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
|
|
||||||
|
|
||||||
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
|
|
||||||
http://www.minecraftforge.net/
|
|
||||||
|
|
||||||
Additionally, it contains an implementation of topological sort based on that
|
|
||||||
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
|
|
||||||
|
|
||||||
It also contains code from the Maven project for performing versioned dependency
|
|
||||||
resolution. http://maven.apache.org/
|
|
||||||
|
|
||||||
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
|
|
||||||
with credit to it's authors.
|
|
||||||
|
|
||||||
Forge Mod Loader downloads components from the Minecraft Coder Pack
|
|
||||||
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
|
|
||||||
|
|
520
LICENSE.txt
520
LICENSE.txt
@ -1,520 +0,0 @@
|
|||||||
Unless noted below, Minecraft Forge, Forge Mod Loader, and all
|
|
||||||
parts herein are licensed under the terms of the LGPL 2.1 found
|
|
||||||
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and
|
|
||||||
copied below.
|
|
||||||
|
|
||||||
Homepage: http://minecraftforge.net/
|
|
||||||
https://github.com/MinecraftForge/MinecraftForge
|
|
||||||
|
|
||||||
|
|
||||||
A note on authorship:
|
|
||||||
All source artifacts are property of their original author, with
|
|
||||||
the exclusion of the contents of the patches directory and others
|
|
||||||
copied from it from time to time. Authorship of the contents of
|
|
||||||
the patches directory is retained by the Minecraft Forge project.
|
|
||||||
This is because the patches are partially machine generated
|
|
||||||
artifacts, and are changed heavily due to the way forge works.
|
|
||||||
Individual attribution within them is impossible.
|
|
||||||
|
|
||||||
Consent:
|
|
||||||
All contributions to Forge must consent to the release of any
|
|
||||||
patch content to the Forge project.
|
|
||||||
|
|
||||||
A note on infectivity:
|
|
||||||
The LGPL is chosen specifically so that projects may depend on Forge
|
|
||||||
features without being infected with its license. That is the
|
|
||||||
purpose of the LGPL. Mods and others using this code via ordinary
|
|
||||||
Java mechanics for referencing libraries are specifically not bound
|
|
||||||
by Forge's license for the Mod code.
|
|
||||||
|
|
||||||
|
|
||||||
=== MCP Data ===
|
|
||||||
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
|
|
||||||
from them. The license to MCP data is not transitive - distribution of this data by
|
|
||||||
third parties requires independent licensing from the MCP team. This data is not
|
|
||||||
redistributable without permission from the MCP team.
|
|
||||||
|
|
||||||
=== Sharing ===
|
|
||||||
I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of
|
|
||||||
the minecraft modding community. All contributions to these parts should be licensed under the same additional grant.
|
|
||||||
|
|
||||||
-- Runtime patcher --
|
|
||||||
License is granted to redistribute the runtime patcher code (src/main/java/net/minecraftforge/fml/common/patcher
|
|
||||||
and subdirectories) under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
|
||||||
|
|
||||||
-- ASM transformers --
|
|
||||||
License is granted to redistribute the ASM transformer code (src/main/java/net/minecraftforge/common/asm/ and subdirectories)
|
|
||||||
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
|
||||||
|
|
||||||
=========================================================================
|
|
||||||
This software includes portions from the Apache Maven project at
|
|
||||||
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
|
||||||
included based on guidelines at
|
|
||||||
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
|
||||||
with notices intact. The only change is a non-functional change of package name.
|
|
||||||
|
|
||||||
This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating
|
|
||||||
binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/
|
|
||||||
authored by genman, heikok, pivot.
|
|
||||||
The only changes are to replace some Trove collection types with standard Java collections, and repackaged.
|
|
||||||
=========================================================================
|
|
||||||
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 2.1, February 1999
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
|
||||||
can use it too, but we suggest you first think carefully about whether
|
|
||||||
this license or the ordinary General Public License is the better
|
|
||||||
strategy to use in any particular case, based on the explanations below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish); that you receive source code or can get
|
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
|
||||||
you if you distribute copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
|
||||||
permission to copy, distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
|
||||||
there is no warranty for the free library. Also, if the library is
|
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
|
||||||
author's reputation will not be affected by problems that might be
|
|
||||||
introduced by others.
|
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
|
||||||
General Public License, applies to certain designated libraries, and
|
|
||||||
is quite different from the ordinary General Public License. We use
|
|
||||||
this license for certain libraries in order to permit linking those
|
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
|
||||||
allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow. Pay close attention to the difference between a
|
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
|
||||||
program which contains a notice placed by the copyright holder or
|
|
||||||
other authorized party saying it may be distributed under the terms of
|
|
||||||
this Lesser General Public License (also called "this License").
|
|
||||||
Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control compilation
|
|
||||||
and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
|
||||||
writing it). Whether that is true depends on what the Library does
|
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty; and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
|
||||||
and you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
|
||||||
of it, thus forming a work based on the Library, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
|
||||||
particular circumstance, the balance of the section is intended to apply,
|
|
||||||
and the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License may add
|
|
||||||
an explicit geographical distribution limitation excluding those countries,
|
|
||||||
so that distribution is permitted only in or among countries not thus
|
|
||||||
excluded. In such case, this License incorporates the limitation as if
|
|
||||||
written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
46
README.txt
46
README.txt
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
Source installation information for modders
|
|
||||||
-------------------------------------------
|
|
||||||
This code follows the Minecraft Forge installation methodology. It will apply
|
|
||||||
some small patches to the vanilla MCP source code, giving you and it access
|
|
||||||
to some of the data and functions you need to build a successful mod.
|
|
||||||
|
|
||||||
Note also that the patches are built against "un-renamed" MCP source code (aka
|
|
||||||
SRG Names) - this means that you will not be able to read them directly against
|
|
||||||
normal code.
|
|
||||||
|
|
||||||
Setup Process:
|
|
||||||
==============================
|
|
||||||
|
|
||||||
Step 1: Open your command-line and browse to the folder where you extracted the zip file.
|
|
||||||
|
|
||||||
Step 2: You're left with a choice.
|
|
||||||
If you prefer to use Eclipse:
|
|
||||||
1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux)
|
|
||||||
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
|
||||||
or run `gradlew eclipse` to generate the project.
|
|
||||||
|
|
||||||
If you prefer to use IntelliJ:
|
|
||||||
1. Open IDEA, and import project.
|
|
||||||
2. Select your build.gradle file and have it import.
|
|
||||||
3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux)
|
|
||||||
4. Refresh the Gradle Project in IDEA if required.
|
|
||||||
|
|
||||||
If at any point you are missing libraries in your IDE, or you've run into problems you can
|
|
||||||
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
|
|
||||||
{this does not affect your code} and then start the process again.
|
|
||||||
|
|
||||||
Mapping Names:
|
|
||||||
=============================
|
|
||||||
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
|
|
||||||
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
|
|
||||||
license, if you do not agree with it you can change your mapping names to other crowdsourced names in your
|
|
||||||
build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here:
|
|
||||||
https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
|
||||||
|
|
||||||
Additional Resources:
|
|
||||||
=========================
|
|
||||||
Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/
|
|
||||||
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
|
|
||||||
Forge Forum: https://forums.minecraftforge.net/
|
|
||||||
Forge Discord: https://discord.gg/UvedJ9m
|
|
590
changelog.txt
590
changelog.txt
@ -1,590 +0,0 @@
|
|||||||
1.19.2 Changelog
|
|
||||||
43.2
|
|
||||||
====
|
|
||||||
- 43.2.4 Fire TickEvent.LevelTickEvent on ClientLevel tick (#9302)
|
|
||||||
- 43.2.3 Disable guiLight3d for generated item models (#9231)
|
|
||||||
- 43.2.2 Fix config key used by resource cache (#9253)
|
|
||||||
This bring it in line with the config key defined in the spec and
|
|
||||||
default config file in ResourceManagerBootCacheConfigurationHandler.
|
|
||||||
Fixes #9252
|
|
||||||
- 43.2.1 [1.19.2] Fix compatibility checker task configuration (#9233)
|
|
||||||
* Fix compatibility checker task configuration
|
|
||||||
The setupCheckJarCompatibility task exists to configure the main
|
|
||||||
compatibility checker task, checkJarCompatibility, because certain
|
|
||||||
configuration steps for that task could not be done until after the
|
|
||||||
configuration phase of Gradle.
|
|
||||||
However, that setup task previously held all the configuration for the
|
|
||||||
main check task in its task action. This caused problems because the
|
|
||||||
main check task's inputs are linked to other tasks, and the previous
|
|
||||||
situation made it so its configuration (by the setup task) happened
|
|
||||||
_after_ Gradle built the task dependency model/tree.
|
|
||||||
This meant that certain tasks which the main check task depended on did
|
|
||||||
not run before that task, because Gradle was unaware of this inter-task
|
|
||||||
dependency until it was too late (when it was already executing tasks).
|
|
||||||
This fixes the issue by moving the bulk of the configuration for the
|
|
||||||
main check task from the action of the setup task to the main
|
|
||||||
buildscript, therefore allowing Gradle to know about those task
|
|
||||||
dependencies and factor them in to its process of determining what tasks
|
|
||||||
to run and in what order.
|
|
||||||
The remaining configuration step in the setup task for the main check
|
|
||||||
task is linked to the setup task, and does not affect the task's
|
|
||||||
dependencies (because it uses a configuration which it resolves
|
|
||||||
immediately), so it stays in the setup task.
|
|
||||||
* Force checker setup task to never be up-to-date
|
|
||||||
The setup task configures the main check task, so it should always run
|
|
||||||
before that task. However, because it has an input and output, the setup
|
|
||||||
task is affected by Gradle's incremental build feature, which leads to
|
|
||||||
the possibility that Gradle considers the setup task as up-to-date,
|
|
||||||
therefore not executing its action and causing errors with the main
|
|
||||||
check task down the line.
|
|
||||||
- 43.2.0 43.2 Recommended Build.
|
|
||||||
|
|
||||||
43.1
|
|
||||||
====
|
|
||||||
- 43.1.65 Allow discovering services from the mods folder that use java's modular definition. (#9143)
|
|
||||||
- 43.1.64 Make Datapack Registries support ICondition(s) (#9113)
|
|
||||||
- 43.1.63 Enable additional build types to handle pull request validation. (#9159)
|
|
||||||
- 43.1.62 Check source permission level before selector permission (#9147)
|
|
||||||
In some situations, such as execution of a function by an advancement as
|
|
||||||
part of its reward, a command source stack may have a backing source of
|
|
||||||
a ServerPlayer which may lack the entity selector permission and have an
|
|
||||||
explicit permission level that should allow the use of entity selectors,
|
|
||||||
through CommandSourceStack#withPermission.
|
|
||||||
We now check if the permission level of the command source stack is
|
|
||||||
sufficient for entity selectors _before_ checking if the source is a
|
|
||||||
player and if they have the requisite permission.
|
|
||||||
This means that an operator permission level of 2 will always override
|
|
||||||
the Forge entity selector permission.
|
|
||||||
Fixes #9137
|
|
||||||
- 43.1.61 Fix fires spreading too/igniting custom portal frames. (#9142)
|
|
||||||
- 43.1.60 Add supplier to FlowerBlock so it works with custom MobEffects (#9139)
|
|
||||||
- 43.1.59 Fix some logical bugs related to the Grindstone Event (#9089)
|
|
||||||
- 43.1.58 Call baked model's `getModelData` before `getRenderTypes` (#9163)
|
|
||||||
- 43.1.57 Make Util.memoize thread-safe (#9155)
|
|
||||||
- 43.1.56 Rendering tweaks and fixes: Part 4 (#9065)
|
|
||||||
- 43.1.55 Fix `Transformation` loading `PoseStack` (#9083)
|
|
||||||
- 43.1.54 Add simple block appearance API (#9066)
|
|
||||||
- 43.1.53 Fix invalidated modded packets when on LAN (#9157)
|
|
||||||
- 43.1.52 Improve extensibility of DetectorRailBlock and PoweredRailBlock (#9130)
|
|
||||||
- 43.1.51 Fix launch handler minecraft classpath locator (#9120)
|
|
||||||
- 43.1.50 Add HitResult to `EntityTeleportEvent$EnderPearl` (#9135)
|
|
||||||
- 43.1.49 Throw aggregate exception for erroneous registry event dispatch (#9111)
|
|
||||||
This means that exceptions occurring during the dispatch of the registry
|
|
||||||
events, such as those from the suppliers of RegistryObjects, properly
|
|
||||||
cause a crash rather than merely being logged and allowing the game to
|
|
||||||
reach the main menu.
|
|
||||||
Fixes #8720
|
|
||||||
- 43.1.48 Add missing semi-colon near the Dist import statement in example mod.
|
|
||||||
- 43.1.47 Fix ClientModEvents example not subscribing to client-sided events (#9097)
|
|
||||||
- 43.1.46 Use GitHub action to lock issues with the `spam` label (#9087)
|
|
||||||
- 43.1.45 Remove structures slave map to Feature registry (#9091)
|
|
||||||
- 43.1.44 Improve logging of missing or unsupported dependencies (#9104)
|
|
||||||
- 43.1.43 [1.19.x] Fix ValueSpec caching the return value incorrectly (#9046)
|
|
||||||
- 43.1.42 [1.19.x] Add event for registering spawn placements, and modifying existing (#9024)
|
|
||||||
- 43.1.41 [1.19.x] Add event for items being stacked or swapped in a GUI. (#9050)
|
|
||||||
- 43.1.40 [1.19.x] Fix PlayerInteractEvent.EntityInteractSpecific not cancelling on a server (#9079)
|
|
||||||
- 43.1.39 Fix canceling phantom spawns preventing any further attempts that tick. (#9041)
|
|
||||||
- 43.1.38 Rename fluid type milk translation keys (#9077)
|
|
||||||
- 43.1.37 Fix minecart speed with water (#9076)
|
|
||||||
- 43.1.36 Add a cancellable event that gets fired when a Totem of Undying is used (#9069)
|
|
||||||
- 43.1.35 Fix performance issue and logging when resource caching is enabled (#9029)
|
|
||||||
- 43.1.34 Fix NPE when feeding wolves and cats (#9074)
|
|
||||||
- 43.1.33 Fix logically breaking change to ForgeConfigSpec.Builder#comment where modders could not add a empty line to the start of comments. (#9061)
|
|
||||||
- 43.1.32 Fix ServiceLoader bug
|
|
||||||
- 43.1.31 Fix ClientChatReceivedEvent for system messages
|
|
||||||
- 43.1.30 Make ForgeConfigSpec$Builder.comment able to be called multiple times for the same entry. (#9056)
|
|
||||||
- 43.1.29 Fix control modifier for mac with `KeyMapping`s using Alt instead of Super (#9057)
|
|
||||||
- 43.1.28 Fix is_desert tag not being applied correctly. (#9051)
|
|
||||||
- 43.1.27 Fix mob griefing event for SmallFireballs not using owner entity. (#9038)
|
|
||||||
- 43.1.26 Fix minecarts on rails not properly slowing down in water (#9033)
|
|
||||||
- 43.1.25 Change codestyle for BookShelves tag. Closes #9027
|
|
||||||
Add IS_CAVE tag Closes #8885
|
|
||||||
Add IS_DESERT tag Closes #8979
|
|
||||||
Simplify Mangrove Swamp tags Closes #8980
|
|
||||||
- 43.1.24 Allow faces of an "elements" model to have disabled ambient occlusion (#9019)
|
|
||||||
- 43.1.23 [1.19.x] Recipe ID-based grouping between modded and vanilla recipes. (#8876)
|
|
||||||
- 43.1.22 Update fence_gates/wooden (#8936)
|
|
||||||
- 43.1.21 [1.19.x] Added event for growing fungus (#8981)
|
|
||||||
- 43.1.20 Added Bookshelves block tag (#8991)
|
|
||||||
- 43.1.19 Create a Forge EntityType Tag for Bosses (#9017)
|
|
||||||
- 43.1.18 Allow mods to specify shader import namespace (#9021)
|
|
||||||
- 43.1.17 Grindstone Events (#8934)
|
|
||||||
One to modify the output, and one to modify the input.
|
|
||||||
- 43.1.16 Fix the serialized names of the enum (#9014)
|
|
||||||
- 43.1.15 Fix `tryEmptyContainerAndStow` duping fluids with stackable containers (#9004)
|
|
||||||
- 43.1.14 Add mod mismatch event (#8989)
|
|
||||||
- 43.1.13 [1.19.x] add methods with more context to tree growers (#8956)
|
|
||||||
- 43.1.12 [1.19.X] Adding more precise events for Advancements (#8360)
|
|
||||||
- 43.1.11 Default IItemHandler capability for shulker box itemstacks (#8827)
|
|
||||||
Co-authored-by: LexManos <LexManos@gmail.com>
|
|
||||||
- 43.1.10 [1.19] Add hook for items to remain in the hotbar when picking blocks/entities (#8872)
|
|
||||||
- 43.1.9 [1.19.x] Block Model Builder Root Transform Support (#8860)
|
|
||||||
Co-authored-by: sciwhiz12 <sciwhiz12@gmail.com>
|
|
||||||
- 43.1.8 [1.19.x] Make LivingSetAttackTargetEvent compatible with the Brain/Behavior system. (Port of PR #8918) (#8954)
|
|
||||||
- 43.1.7 [1.19.x] Add IForgeBlock#onTreeGrow to replace IForgeBlock#onPlantGrow from 1.16 (#8999)
|
|
||||||
- 43.1.6 [1.19.x] Moved Player.resetAttackStrengthTicker() to the end of Player.attack() (#9000)
|
|
||||||
- 43.1.5 fix misplaced patch in sapling block (#9005)
|
|
||||||
- 43.1.4 Fix failed entity interactions consuming the click. (#9007)
|
|
||||||
- 43.1.3 Fix entity selector permission check to check original source (#8995)
|
|
||||||
Permission checks should be against the command source and not the
|
|
||||||
target entity, as is done in vanilla.
|
|
||||||
Fixes #8994
|
|
||||||
- 43.1.2 Hotfix for 1.19.2 item animation bug (#8987)
|
|
||||||
* [HOT FIX]: Fixes #8985 by no-oping for vanilla models instead of throwing error
|
|
||||||
- 43.1.1 Add ability to Auto register capabilities via annotation (#8972)
|
|
||||||
- 43.1.0 1.19.2 RB
|
|
||||||
|
|
||||||
43.0
|
|
||||||
====
|
|
||||||
- 43.0.22 Added ItemDecorator API (#8794)
|
|
||||||
- 43.0.21 [1.19.x] Custom usage animations for items (#8932)
|
|
||||||
- 43.0.20 Allow registering custom `ColorResolver`s (#8880)
|
|
||||||
- 43.0.19 [1.19] Allow custom outline rendering on EntityRenderers and BlockEntityRenderers (#8938)
|
|
||||||
- 43.0.18 Redirect checks for entity selector use to a permission (#8947)
|
|
||||||
This allows greater flexibility for configuring servers with
|
|
||||||
operator-like permissions to user groups through the permissions API and
|
|
||||||
their permissions handler of choice without needing to grant the
|
|
||||||
vanilla operator permission to any player.
|
|
||||||
The new permission is "forge:use_entity_selectors", which is granted by
|
|
||||||
default to players with permission level 2 (GAMEMASTERS) and above.
|
|
||||||
The hook falls back to checking the permission level if the source of
|
|
||||||
the command is not a ServerPlayer, such as for command blocks and
|
|
||||||
functions.
|
|
||||||
- 43.0.17 Allow FakePlayer to report its position (#8963)
|
|
||||||
- 43.0.16 Add alternate version of renderEntityInInventory to allow for directly specifying the angles (#8961)
|
|
||||||
- 43.0.15 Add cancellable ToastAddEvent (#8952)
|
|
||||||
- 43.0.14 Modify ScreenEvent.RenderInventoryMobEffects to allow moving the effect stack left or right (#8951)
|
|
||||||
- 43.0.13 Fix Enchantment#doPostHurt and Enchantment#doPostAttack being called twice for players. Fixes MC-248272 (#8948)
|
|
||||||
- 43.0.12 Remove reflective implementation of ICustomPacket. (#8973)
|
|
||||||
Make vanilla custom packets able to be sent multiple times. Closes #8969
|
|
||||||
- 43.0.11 Filter name spaces to directories only. Closes #8413
|
|
||||||
- 43.0.10 Fix a corner case where the UMLB can not extract a version from a library. (#8967)
|
|
||||||
- 43.0.9 Fix worlds with removed dimension types unable to load. (#8959) Closes #8800
|
|
||||||
- 43.0.8 Fix issue where unknown chunk generators would cause DFU to fail. (#8957)
|
|
||||||
- 43.0.7 Fix comments and documentation that were missed during the review of #8712 (#8945)
|
|
||||||
- 43.0.6 Make AnvilUpdateEvent fire even if the second input is empty, which means it fires even if only changing the item name. (#8905)
|
|
||||||
- 43.0.5 Fix `LivingEntity#isBlocking` to use `ToolActions#SHIELD_BLOCK` instead of `UseAnim#BLOCK` (#8933)
|
|
||||||
- 43.0.4 Add Custom HolderSet Types allowing for logical combining of sets. (#8928)
|
|
||||||
- 43.0.3 Add values to VersionSupportMatrix to support loading mods that restrict versions to 1.19.1 on 1.19.2 (#8946)
|
|
||||||
- 43.0.2 Fix certain particles not updating their bounding box when their position changes (#8925)
|
|
||||||
- 43.0.1 Update EventBus to address concurrency issue in ModLauncher Factory. Closes #8924
|
|
||||||
- 43.0.0 1.19.2
|
|
||||||
|
|
||||||
42.0
|
|
||||||
====
|
|
||||||
- 42.0.9 Remove calls to getStepHeight in Player#maybeBackOffFromEdge (#8927)
|
|
||||||
- 42.0.8 Add forge tags for tools and armors, these DO NOT replace ToolActions, and are designed just for Recipes. (#8914)
|
|
||||||
- 42.0.7 Add Biomes.BEACH to Tags (#8892)
|
|
||||||
- 42.0.6 Let NetworkInstance.isRemotePresent check minecraft:register for channel IDs. (#8921)
|
|
||||||
- 42.0.5 Add an event for when the chunk ticket level is updated (#8909)
|
|
||||||
- 42.0.4 Re-add PotentialSpawns event (#8712)
|
|
||||||
- 42.0.3 Fix misplaced patch in ItemEntityRenderer breaking ItemEntityRenderer#shouldBob() (#8919)
|
|
||||||
- 42.0.2 [1.19] [HotFix] Fix the dedicated server not having access to the JiJ filesystems. (#8931)
|
|
||||||
- 42.0.1 Match Mojang's action bar fix for MC-72687 (#8917)
|
|
||||||
- 42.0.0 Forge 1.19.1
|
|
||||||
Load natives from classpath
|
|
||||||
Make command argument types a forge registry
|
|
||||||
Add `EntityMobGriefingEvent` to `Allay#wantsToPickUp`
|
|
||||||
Overhaul `ServerChatEvent` to use `ChatDecorator` system
|
|
||||||
Remove `ClientChatEvent#setMessage` for now
|
|
||||||
Gradle 7.5
|
|
||||||
|
|
||||||
41.1
|
|
||||||
====
|
|
||||||
- 41.1.0 Mark 1.19 RB
|
|
||||||
|
|
||||||
41.0
|
|
||||||
====
|
|
||||||
- 41.0.113 Allow faces of an "elements" model to be made emissive (#8890)
|
|
||||||
- 41.0.112 Fix invalid channel names sent from the server causing the network thread to error. (#8902)
|
|
||||||
- 41.0.111 Fix PlayerEvent.BreakSpeed using magic block position to signify invalid position. Closes #8906
|
|
||||||
- 41.0.110 Fix cases where URIs would not work properly with JarInJar (#8900)
|
|
||||||
- 41.0.109 Add new hook to allow modification of lightmap via Dimension special effects (#8863)
|
|
||||||
- 41.0.108 Fix Forge's packet handling on play messages. (#8875)
|
|
||||||
- 41.0.107 Add API for tab list header/footer (#8803)
|
|
||||||
- 41.0.106 Allow modded blocks overriding canStickTo prevent sticking to vanilla blocks/other modded blocks (#8837)
|
|
||||||
- 41.0.105 Multiple tweaks and fixes to the recent changes in the client refactor PR: Part 3 (#8864)
|
|
||||||
Fix weighted baked models not respecting children render types
|
|
||||||
Allow fluid container model to use base texture as particle
|
|
||||||
Fix inverted behavior in composite model building. Fixes #8871
|
|
||||||
- 41.0.104 Fix crossbows not firing ArrowLooseEvent (#8887)
|
|
||||||
- 41.0.103 Add User-Agent header to requests made by the update checker (#8881)
|
|
||||||
Format: Java-http-client/<Java version> MinecraftForge/<ForgeVer> <ModId>/<ModVersion>
|
|
||||||
- 41.0.102 Output the full path in a crash report so it is easier to find the outer mod when a crash in Jar-In-Jar occurs. (#8856)
|
|
||||||
- 41.0.101 Clean up the pick item ("middle mouse click") patches (#8870)
|
|
||||||
- 41.0.100 [1.19.x] Hotfix for test mods while the refactor is ongoing
|
|
||||||
- 41.0.99 add event to SugarCaneBlock (#8877)
|
|
||||||
- 41.0.98 Fix Global Loot Modifiers not using Dispatch Codec (#8859)
|
|
||||||
- 41.0.97 Allow block render types to be set in datagen (#8852)
|
|
||||||
- 41.0.96 Fix renderBreakingTexture not using the target's model data (#8849)
|
|
||||||
- 41.0.95 Multiple tweaks and fixes to the recent changes in the client refactor PR: Part 2 (#8854)
|
|
||||||
* Add getter for the component names in an unbaked geometry
|
|
||||||
* Fix render type hint not being copied in BlockGeometryBakingContext
|
|
||||||
* Ensure BlockRenderDispatches's renderSingleBlock uses the correct buffer
|
|
||||||
- 41.0.94 [1.19.x] Apply general renames, A SRG is provided for modders. (#8840)
|
|
||||||
See https://gist.github.com/SizableShrimp/882a671ff74256d150776da08c89ef72
|
|
||||||
- 41.0.93 Fix mob block breaking AI not working correctly when chunk 0,0 is unloaded. Closes #8853
|
|
||||||
- 41.0.92 Fix crash when breaking blocks with multipart models and remove caching. Closes #8850
|
|
||||||
- 41.0.91 Fixed `CompositeModel.Baked.Builder.build()` passing arguments in the wrong order (#8846)
|
|
||||||
- 41.0.90 Make cutout mipmaps explicitly opt-in for item/entity rendering (#8845)
|
|
||||||
* Make cutout mipmaps explicitly opt-in for item/entity rendering
|
|
||||||
* Default render type domain to "minecraft" in model datagens
|
|
||||||
- 41.0.89 Fixed multipart block models not using the new model driven render type system. (#8844)
|
|
||||||
- 41.0.88 Update to the latest JarJar to fix a collision issue where multiple jars could provide an exact match. (#8847)
|
|
||||||
- 41.0.87 Add FML config to disable DFU optimizations client-side. (#8842)
|
|
||||||
* Add client-side command line argument to disable DFU optimizations.
|
|
||||||
* Switch to using FMLConfig value instead.
|
|
||||||
- 41.0.86 [1.19] Fixed broken BufferBuilder.putBulkData(ByteBuffer) added by Forge (#8819)
|
|
||||||
* Fixes BufferBuilder.putBulkData(ByteBuffer)
|
|
||||||
* use nextElementByte
|
|
||||||
* Fixed merge conflict
|
|
||||||
- 41.0.85 [1.19.x] Fix shulker boxes allowing input of items, that return false for Item#canFitInsideContainerItems, through hoppers. (#8823)
|
|
||||||
* Make ShulkerBoxBlockEntity#canPlaceItemThroughFace delegate to Item#canFitInsideContainerItems.
|
|
||||||
* Switch to using Or and add comment.
|
|
||||||
* Switch Or to And.
|
|
||||||
- 41.0.84 [1.19.x] Added RenderLevelStageEvent to replace RenderLevelLastEvent (#8820)
|
|
||||||
* Ported RenderLevelStageEvent from 1.18.2
|
|
||||||
* Updated to fix merge conflicts
|
|
||||||
- 41.0.83 [1.19.x] Fix door datagenerator (#8821)
|
|
||||||
* Fix door datagenerator
|
|
||||||
Fix datagenerator for door blocks. Successor to #8687, addresses comments made there about statement complexity.
|
|
||||||
* Fix extra space around parameter
|
|
||||||
Fix extra space before comma around a parameter.
|
|
||||||
- 41.0.82 Create PieceBeardifierModifier to re-enable piecewise beardifier definitions (#8798)
|
|
||||||
- 41.0.81 Allow blocks to provide a dynamic MaterialColor for display on maps (#8812)
|
|
||||||
- 41.0.80 [1.19.x] BiomeTags Fixes/Improvements (#8711)
|
|
||||||
* dimension specific tag fix
|
|
||||||
* remove forge:is_beach cause vanilla has it already
|
|
||||||
* remove forge tags for new 1.19 vanilla tags (savanna, beach, overworld, end)
|
|
||||||
Co-authored-by: Flemmli97 <Flemmli97@users.noreply.github.com>
|
|
||||||
- 41.0.79 1.19 - Remove GlobalLootModifierSerializer and move to Codecs (#8721)
|
|
||||||
* convert GLM serializer class to codec
|
|
||||||
* cleanup
|
|
||||||
* GLM list needs to be sorted
|
|
||||||
* datagen
|
|
||||||
* simplify serialization
|
|
||||||
* fix test mods (oops)
|
|
||||||
* properly use suppliers for codec as they are registry obj
|
|
||||||
- 41.0.78 Implement item hooks for potions and enchantments (#8718)
|
|
||||||
* Implement item hooks for potions and enchantments
|
|
||||||
* code style fixes
|
|
||||||
- 41.0.77 Re-apply missing patch to ServerLevel.EntityCallbacks#onTrackingEnd() (#8828)
|
|
||||||
- 41.0.76 Double Bar Rendering fixed (#8806) (#8807)
|
|
||||||
* Double Bar Rendering fixed (#8806)
|
|
||||||
* Added requested changes by sciwhiz12
|
|
||||||
- 41.0.75 Multiple tweaks and fixes to the recent changes in the client refactor PR (#8836)
|
|
||||||
* Add an easy way to get the NamedGuiOverlay from a vanilla overlay
|
|
||||||
* Fix static member ordering crash in UnitTextureAtlasSprite
|
|
||||||
* Allow boss bar rendering to be cancelled
|
|
||||||
* Make fluid container datagen use the new name
|
|
||||||
- 41.0.74 Add FogMode to ViewportEvent.RenderFog (#8825)
|
|
||||||
- 41.0.73 Provide additional context to the getFieldOfView event (#8830)
|
|
||||||
- 41.0.72 Pass renderType to IForgeBakedModel.useAmbientOcclusion (#8834)
|
|
||||||
- 41.0.71 Load custom ITransformationServices from the classpath in dev (#8818)
|
|
||||||
* Add a classpath transformer discoverer to load custom transformation services from the classpath
|
|
||||||
* Update ClasspathTransformerDiscoverer to 1.18
|
|
||||||
* Update license year
|
|
||||||
* Update license header
|
|
||||||
* Fix the other license headers
|
|
||||||
* Update ClasspathTransformerDiscoverer to 1.19
|
|
||||||
- 41.0.70 Handle modded packets on the network thread (#8703)
|
|
||||||
* Handle modded packets on the network thread
|
|
||||||
- On the server we simply need to remove the call to
|
|
||||||
ensureRunningOnSameThread.
|
|
||||||
- On the client side, we now handle the packet at the very start of the
|
|
||||||
call. We make sure we're running from a network thread to prevent
|
|
||||||
calling the handling code twice.
|
|
||||||
While this does mean we no longer call .release(), in practice this
|
|
||||||
doesn't cause any leaks as ClientboundCustomPayloadPacket releases
|
|
||||||
for us.
|
|
||||||
* Clarify behaviour a little in the documentation
|
|
||||||
* Javadoc formatting
|
|
||||||
* Add a helper method for handling packets on the main thread
|
|
||||||
Also rename the network thread one. Should make it clearer the expected
|
|
||||||
behaviour of the two, and make it clearer there's a potentially breaking
|
|
||||||
change.
|
|
||||||
* Add back consumer() methods
|
|
||||||
Also document EventNetworkChannel, to clarify the thread behaviour
|
|
||||||
there.
|
|
||||||
* Add since = "1.19" to deprecated annotations
|
|
||||||
- 41.0.69 Cache resource listing calls in resource packs (#8829)
|
|
||||||
* Make the resource lookups cached.
|
|
||||||
* Include configurability and handle patch cleanup.
|
|
||||||
* Document and comment the cache manager.
|
|
||||||
* Make thread selection configurable.
|
|
||||||
* Implement a configurable loading mechanic that falls back to default behaviour when the config is not bound yet.
|
|
||||||
* Use boolean supplier and fix wildcard import.
|
|
||||||
* Clean up the VPR since this is more elegant.
|
|
||||||
* Clean up the VPR since this is more elegant.
|
|
||||||
* Address review comments.
|
|
||||||
* Address more review comments.
|
|
||||||
* Fix formatting on `getSource`
|
|
||||||
* Address comments by ichtt
|
|
||||||
* Adapt to pups requests.
|
|
||||||
* Stupid idea.
|
|
||||||
* Attempt this again with a copy on write list.
|
|
||||||
* Fix a concurrency and loading issue.
|
|
||||||
* Fix #8813
|
|
||||||
Checks if the paths are valid resource paths.
|
|
||||||
* Move the new methods on vanilla Patch.
|
|
||||||
- 41.0.68 Update SJH and JIJ
|
|
||||||
- 41.0.67 Fix #8833 (#8835)
|
|
||||||
- 41.0.66 Fix backwards fabulous check in SimpleBakedModel (#8832)
|
|
||||||
Yet another blunder we missed during the review of #8786.
|
|
||||||
- 41.0.65 Make texture atlas in StandaloneGeometryBakingContext configurable (#8831)
|
|
||||||
- 41.0.64 [1.19.X] Client code cleanup, updates, and other refactors (#8786)
|
|
||||||
* Revert "Allow safely registering RenderType predicates at any time (#8685)"
|
|
||||||
This reverts commit be7275443fd939db9c58bcad47079c3767789ac1.
|
|
||||||
* Renderable API refactors
|
|
||||||
- Rename "render values" to "context"
|
|
||||||
- Rename SimpleRenderable to CompositeRenderable to better reflect its use
|
|
||||||
- Remove IMultipartRenderValues since it doesn't have any real use
|
|
||||||
- Add extensive customization options to BakedModelRenderable
|
|
||||||
* ClientRegistry and MinecraftForgeClient refactors
|
|
||||||
- Add sprite loader manager and registration event
|
|
||||||
- Add spectator shader manager and registration event
|
|
||||||
- Add client tooltip factory manager and registration event
|
|
||||||
- Add recipe book manager and registration event
|
|
||||||
- Add key mapping registration event
|
|
||||||
- Remove ClientRegistry, as everything has been moved out of it
|
|
||||||
- Remove registration methods from MinecraftForgeClient, as they have dedicated events now
|
|
||||||
* Dimension special effects refactors
|
|
||||||
- Fold handlers into an extension class and remove public mutable fields
|
|
||||||
- Add dimension special effects manager and registration event
|
|
||||||
* HUD overlay refactors
|
|
||||||
- Rename to IGuiOverlay match vanilla (instead of Ingame)
|
|
||||||
- Add overlay manager and registration event
|
|
||||||
- Move vanilla overlays to a standalone enum
|
|
||||||
* Model loader refactors
|
|
||||||
- Rename IModelLoader to IGeometryLoader
|
|
||||||
- Add loader manager and registration event
|
|
||||||
- Fold all model events into one
|
|
||||||
- Move registration of additionally loaded models to an event
|
|
||||||
- Remove ForgeModelBakery and related classes as they served no purpose anymore
|
|
||||||
* Render properties refactors
|
|
||||||
- Rename all render properties to client extensions and relocate accordingly
|
|
||||||
- Move lookups to the respective interfaces
|
|
||||||
* Model data refactors
|
|
||||||
- Convert model data to a final class backed by an immutable map and document mutability requirements. This addresses several thread-safety issues in the current implementation which could result in race conditions
|
|
||||||
- Transfer ownership of the data manager to the client level. This addresses several issues that arise when multiple levels are used at once
|
|
||||||
* GUI and widget refactors
|
|
||||||
- Move all widgets to the correct package
|
|
||||||
- Rename GuiUtils and children to match vanilla naming
|
|
||||||
* New vertex pipeline API
|
|
||||||
- Move to vanilla's VertexConsumer
|
|
||||||
- Roll back recent PR making VertexConsumer format-aware. This is the opposite of what vanilla does, and should not be relevant with the updated lighting pipeline
|
|
||||||
* Lighting pipeline refactors
|
|
||||||
- Move to dedicated lighting package
|
|
||||||
- Separate flat and smooth lighters
|
|
||||||
- Convert from a vertex pipeline transformer to a pure vertex source (input is baked quads)
|
|
||||||
* Model geometry API refactors
|
|
||||||
- Rename IModelGeometry to IUnbakedGeometry
|
|
||||||
- Rename IModelConfiguration to IGeometryBakingContext
|
|
||||||
- Rename other elements to match vanilla naming
|
|
||||||
- Remove current changes to ModelState, as they do not belong there. Transforms should be specified through vanilla's system. ModelState is intended to transfer state from the blockstate JSON
|
|
||||||
- Remove multipart geometries and geometry parts. After some discussion, these should not be exposed. Instead, geometries should be baked with only the necessary parts enabled
|
|
||||||
* Make render types a first-class citizen in baked models
|
|
||||||
- Add named render types (block + entity + fabulous entity)
|
|
||||||
- Add named render type manager + registration event
|
|
||||||
- Make BakedModel aware of render types and transfer control over which ones are used to it instead of ItemBlockRenderTypes (fallback)
|
|
||||||
- (additional) Add concatenated list view. A wrapper for multiple lists that iterates through them in order without the cost of merging them. Useful for merging lists of baked quads
|
|
||||||
* General event refactors
|
|
||||||
- Several renames to either match vanilla or improve clarity
|
|
||||||
- Relocate client chat event dispatching out of common code
|
|
||||||
* Forge model type refactors
|
|
||||||
- Rename SeparatePerspectiveModel to SeparateTransformsModel
|
|
||||||
- Rename ItemModelMesherForge to ForgeItemModelShaper
|
|
||||||
- Rename DynamicBucketModel to DynamicFluidContainerModel
|
|
||||||
- Prefix all OBJ-related classes with "Obj" and decouple parsing from construction
|
|
||||||
- Extract ElementsModel from model loader registry
|
|
||||||
- Add EmptyModel (baked, unbaked and loader)
|
|
||||||
- Refactor CompositeModel to take over ItemMultiLayerBakedModel
|
|
||||||
- Remove FluidModel as it's not used and isn't compatible with the new fluid rendering in modern versions
|
|
||||||
- Move model loader registration to a proper event handler
|
|
||||||
- Update names of several JSON fields (backwards-compatible)
|
|
||||||
- Update datagens to match
|
|
||||||
* Miscellaneous changes and overlapping patches
|
|
||||||
- Dispatch all new registration events
|
|
||||||
- Convert ExtendedServerListData to a record
|
|
||||||
- Add/remove hooks from ForgeHooksClient as necessary
|
|
||||||
* Update test mods
|
|
||||||
* Fix VertexConsumerWrapper returning parent instead of itself
|
|
||||||
* Additional event cleanup pass
|
|
||||||
As discussed on Discord:
|
|
||||||
- Remove "@hidden" and "@see <callsite>" javadoc annotations from all client events and replace them with @ApiStatus.Internal annotation
|
|
||||||
- Make all events that shouldn't be fired directly into abstract classes with protected constructors
|
|
||||||
- Another styling pass, just in case (caught some missed classes)
|
|
||||||
* Add proper deprecation javadocs and de-dupe some vertex consumer code
|
|
||||||
* Replace sets of chunk render types with a faster BitSet-backed collection
|
|
||||||
This largely addresses potential performance concerns that using a plain HashSet might involve by making lookups and iteration as linear as they can likely be (aside from using a plain byte/int/long for bit storage). Further performance concerns related to the implementation may be addressed separately, as all the implementation details are hidden from the end user
|
|
||||||
* Requested changes
|
|
||||||
- Remove MinecraftForgeClient and move members to Minecraft, IForgeMinecraft and StencilManager
|
|
||||||
- Allow non-default elements to be passed into VertexConsumer and add support to derived classes
|
|
||||||
- Move array instantiation out of quad processing in lighting pipeline
|
|
||||||
- Fix flipped fluid container model
|
|
||||||
- Set default UV1 to the correct values in the remapping pipeline
|
|
||||||
- Minor documentation changes
|
|
||||||
* Add/update EXC entries and fix AT comment
|
|
||||||
* Add test mod as per Orion's request
|
|
||||||
* Additional requested changes
|
|
||||||
* Allow custom model types to request the particle texture to be loaded
|
|
||||||
* Even more requested changes
|
|
||||||
* Improve generics in ConcatenatedListView and add missing fallbacks
|
|
||||||
* Fix fluid render types being bound to the fluid and not its holder
|
|
||||||
* Remove non-contractual nullability in ChunkRenderTypeSet and add isEmpty
|
|
||||||
Additionally, introduce chunk render type checks in ItemBlockRenderTypes
|
|
||||||
Co-authored-by: Dennis C <xfacthd@gmx.de>
|
|
||||||
- 41.0.63 Implement full support for IPv6 (#8742)
|
|
||||||
- 41.0.62 Fix certain user-configured options being overwritten incorrectly due to validators. (#8780)
|
|
||||||
- 41.0.61 Allow safely registering RenderType predicates at any time (#8685)
|
|
||||||
- 41.0.60 Fix crash after loading error due to fluid texture gathering and config lookup (#8802)
|
|
||||||
- 41.0.59 Remove the configuration option for handling empty tags in ingredients. (#8799)
|
|
||||||
Now empty tags are considered broken in all states.
|
|
||||||
- 41.0.58 Fix MC-105317 Structure blocks do not rotate entities correctly when loading (#8792)
|
|
||||||
- 41.0.57 Fire ChunkWatchEvents after sending packets (#8747)
|
|
||||||
- 41.0.56 Add item handler capability to chest boats (#8787)
|
|
||||||
- 41.0.55 Add getter for correct BiomeSpecialEffectsBuilder to BiomeInfo$Builder (#8781)
|
|
||||||
- 41.0.54 Fix BlockToolModificationEvent missing cancelable annotation (#8778)
|
|
||||||
- 41.0.53 Fix ticking chunk tickets from forge's chunk manager not causing chunks to fully tick (#8775)
|
|
||||||
- 41.0.52 Fix default audio device config loading string comparison issue (#8767)
|
|
||||||
- 41.0.51 Fix missed vanilla method overrides in ForgeRegistry (#8766)
|
|
||||||
- 41.0.50 Add MinecraftServer reference to ServerTickEvent (#8765)
|
|
||||||
- 41.0.49 Fix TagsProviders for datapack registries not recognizing existing files (#8761)
|
|
||||||
- 41.0.48 Add callback after a BlockState was changed and the neighbors were updated (#8686)
|
|
||||||
- 41.0.47 Add biome tag entries for 1.19 biomes (#8684)
|
|
||||||
- 41.0.46 Make fishing rods use tool actions for relevant logic (#8681)
|
|
||||||
- 41.0.45 Update BootstrapLauncher to 1.1.1 and remove the forced
|
|
||||||
merge of text2speech since new BSL does it.
|
|
||||||
- 41.0.44 Merge text2speech libs together so the natives are part of the jar
|
|
||||||
- 41.0.43 Make Forge ConfigValues implement Supplier. (#8776)
|
|
||||||
- 41.0.42 Fix merge derp in AbstractModProvider and logic derp in ModDiscoverer
|
|
||||||
- 41.0.41 Add "send to mods in order" method to ModList and use it (#8759)
|
|
||||||
* Add "send to mods in order" method to ModList and use it in RegistryEvents and DataGen..
|
|
||||||
* Also preserve order in runAll
|
|
||||||
* Do better comparator thanks @pupnewfster
|
|
||||||
* postEvent as well.
|
|
||||||
- 41.0.40 Update SJH to 2.0.2.. (#8774)
|
|
||||||
* Update SJH to 2.0.3..
|
|
||||||
- 41.0.39 Sanity check the version specified in the mod file (#8749)
|
|
||||||
* Sanity check the version specified in the mod file to
|
|
||||||
make sure it's compatible with JPMS standards for
|
|
||||||
version strings.
|
|
||||||
Closes #8748
|
|
||||||
Requires SPI 6
|
|
||||||
- 41.0.38 Fix SP-Devtime world loading crash due to missing server configs (#8757)
|
|
||||||
- 41.0.37 Remove ForgeWorldPreset and related code (#8756)
|
|
||||||
Vanilla has a working replacement.
|
|
||||||
- 41.0.36 Change ConfigValue#get() to throw if called before config loaded (#8236)
|
|
||||||
This prevents silent issues where a mod gets the value of the setting
|
|
||||||
before configs are loaded, which means the default value is always
|
|
||||||
returned.
|
|
||||||
As there may be situations where the getting the config setting before
|
|
||||||
configs are loaded is needed, and it is not preferable to hardcode the
|
|
||||||
default value, the original behavior is made available through #getRaw.
|
|
||||||
Implements and closes #7716
|
|
||||||
* Remove getRaw() method
|
|
||||||
This is effectively replaced with the expression `spec.isLoaded() ?
|
|
||||||
configValue.get() : configValue.getDefault()`.
|
|
||||||
* Remove forceSystemNanoTime config setting
|
|
||||||
As implemented, it never had any effect as any place where the config
|
|
||||||
value would be queried happens before the configs are loaded.
|
|
||||||
- 41.0.35 Fix EnumArgument to use enum names for suggestions (#8728)
|
|
||||||
Previously, the suggestions used the string representation of the enum
|
|
||||||
through Enum#toString, which can differ from the name of the enum as
|
|
||||||
required by Enum#valueOf, causing invalid suggestions (both in gui and
|
|
||||||
through the error message).
|
|
||||||
- 41.0.34 Jar-In-Jar (#8715)
|
|
||||||
- 41.0.33 [1.19] Fix data-gen output path of custom data-pack registries (#8724)
|
|
||||||
- 41.0.32 Fix player dive and surface animations in custom fluids (#8738)
|
|
||||||
- 41.0.31 [1.19.x] Affect ItemEntity Motion in Custom Fluids (#8737)
|
|
||||||
- 41.0.30 [1.19] Add support for items to add enchantments without setting them in NBT (#8719)
|
|
||||||
- 41.0.29 [1.19.x] Add stock biome modifier types for adding features and spawns (#8697)
|
|
||||||
- 41.0.28 [1.19.x] Fluid API Overhaul (#8695)
|
|
||||||
- 41.0.27 Replace StructureSpawnListGatherEvent with StructureModifiers (#8717)
|
|
||||||
- 41.0.26 Use stack sensitive translation key by default for FluidAttributes. (#8707)
|
|
||||||
- 41.0.25 Delete LootItemRandomChanceCondition which added looting bonus enchantment incorrectly. (#8733)
|
|
||||||
- 41.0.24 Update EventBus to 6.0, ModLauncher to 10.0.1 and BootstrapLauncher to 1.1 (#8725)
|
|
||||||
- 41.0.23 Replace support bot with support action (#8700)
|
|
||||||
- 41.0.22 Fix Reach Distance / Attack Range being clamped at 6.0 (#8699)
|
|
||||||
- 41.0.21 [1.19.x] Fix mods' worldgen data not being loaded when creating new singleplayer worlds (#8693)
|
|
||||||
- 41.0.20 [1.19.x] Fix experimental confirmation screen (#8727)
|
|
||||||
- 41.0.19 Move is_mountain to forge's tag instead of vanilla's (#8726)
|
|
||||||
- 41.0.18 [1.19.x] Add CommandBuildContext to Register Command Events (#8716)
|
|
||||||
- 41.0.17 Only rewrite datagen cache when needed (#8709)
|
|
||||||
- 41.0.16 Implement a simple feature system for Forge (#8670)
|
|
||||||
* Implement a simple feature system for Forge. Allows mods to demand certain features are available in the loading system. An example for java_version is provided, but not expected to be used widely. This is more targeted to properties of the display, such as GL version and glsl profile.
|
|
||||||
Requires https://github.com/MinecraftForge/ForgeSPI/pull/13 to be merged first in ForgeSPI, and the SPI to be updated appropriately in build.gradle files.
|
|
||||||
* rebase onto 1.19 and add in SPI update
|
|
||||||
- 41.0.15 displayTest option in mods.toml (#8656)
|
|
||||||
* displayTest option in mods.toml
|
|
||||||
* "MATCH_VERSION" (or none) is existing match version string behaviour
|
|
||||||
* "IGNORE_SERVER_VERSION" accepts anything and sends special SERVERONLY string
|
|
||||||
* "IGNORE_ALL_VERSION" accepts anything and sends an empty string
|
|
||||||
* "NONE" allows the mod to supply their own displaytest using the IExtensionPoint mechanism.
|
|
||||||
* Update display test with feedback and added the mods.toml discussion in mdk.
|
|
||||||
- 41.0.14 Update forgeSPI to v5 (#8696)
|
|
||||||
- 41.0.13 Make IVertexConsumers such as the lighting pipeline, be aware of which format they are dealing with. (#8692)
|
|
||||||
Also fix Lighting pipeline ignoring the overlay coords from the block renderer.
|
|
||||||
- 41.0.12 Fixed misaligned patch to invalidateCaps in Entity (#8705)
|
|
||||||
- 41.0.11 Fix readAdditionalLevelSaveData (#8704)
|
|
||||||
- 41.0.10 Fixes setPos to syncPacketPositionCodec (#8702)
|
|
||||||
- 41.0.9 Fix wrong param passed to PlayLevelSoundEvent.AtEntity (#8688)
|
|
||||||
- 41.0.8 Override initialize in SlotItemHandler, so it uses the itemhandler instead of container (#8679)
|
|
||||||
- 41.0.7 Update MDK for 1.19 changes (#8675)
|
|
||||||
- 41.0.6 Add helper to RecipeType, and fix eclipse compiler error in test class.
|
|
||||||
- 41.0.5 Update modlauncher to latest (#8691)
|
|
||||||
- 41.0.4 Fix getting entity data serializer id crashing due to improper port to new registry system (#8678)
|
|
||||||
- 41.0.3 Fire registry events in the order vanilla registers to registries (#8677)
|
|
||||||
Custom registries are still fired in alphabetical order, after all vanilla registries.
|
|
||||||
Move forge's data_serializers registry to forge namespace.
|
|
||||||
- 41.0.2 Add method with pre/post wrap to allow setting/clearing mod context. (#8682)
|
|
||||||
Fixes ActiveContainer in ModContext not being present in registry events. Closes #8680
|
|
||||||
- 41.0.1 Fix the Curlie oopsie
|
|
||||||
- 41.0.0 Forge 1.19
|
|
||||||
* Bump pack.mcmeta formats
|
|
||||||
* 1.19 biome modifiers
|
|
||||||
* Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable
|
|
||||||
* Add docs and package-info to client extension interfaces package
|
|
||||||
* Move RenderBlockOverlayEvent hooks to ForgeHooksClient
|
|
||||||
* Add package-infos to client events package
|
|
||||||
* Rename SoundLoadEvent to SoundEngineLoadEvent
|
|
||||||
This reduces confusion from consumers which may think the
|
|
||||||
name SoundLoadEvent refers to an individual sound being loaded rather
|
|
||||||
than the sound engine.
|
|
||||||
* Document and change SoundLoadEvent to fire on mod bus
|
|
||||||
Previously, it fired on both the mod bus and the Forge bus, which is
|
|
||||||
confusing for consumers.
|
|
||||||
* Delete SoundSetupEvent
|
|
||||||
Looking at its original implementation shows that there isn't an
|
|
||||||
appropriate place in the new sound code to reinsert the event, and the
|
|
||||||
place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent.
|
|
||||||
* Perform some cleanup on client events
|
|
||||||
- Removed nullable annotations from ClientPlayerNetworkEvent
|
|
||||||
- Renamed #getPartialTicks methods to #getPartialTick, to be consistent
|
|
||||||
with vanilla's naming of the partial tick
|
|
||||||
- Cleanup documentation to remove line breaks, use the
|
|
||||||
spelling 'cancelled' over
|
|
||||||
'canceled', and improve docs on existing and
|
|
||||||
new methods.
|
|
||||||
* Remove EntityEvent.CanUpdate
|
|
||||||
Closes MinecraftForge/MinecraftForge#6394
|
|
||||||
* Switch to Jetbrains nullability annotations
|
|
||||||
* New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent
|
|
||||||
* Remove ForgeWorldPresetScreens
|
|
||||||
* Remove IForgeRegistryEntry
|
|
||||||
* Remove use of List<Throwable> in FML's CompletableFutures
|
|
||||||
* Add docs to mod loading stages, stages, and phases
|
|
||||||
* Gradle 7.4.2
|
|
||||||
* Use SLF4J in FMLLoader and other subprojects
|
|
||||||
* Switch dynamic versions in subprojects to pinned ones
|
|
||||||
* Switch ForgeRoot and MDK to FG plugin markers
|
|
||||||
* Configure Forge javadoc task
|
|
||||||
The task now uses a custom stylesheet with MCForge elements, and
|
|
||||||
configured to combine the generation from the four FML subprojects
|
|
||||||
(fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project
|
|
||||||
into the javadoc output.
|
|
||||||
* Update docs/md files, for 1.19 update and the move away from IRC to Discord.
|
|
||||||
* Make "Potentially dangerous alternative prefix" a debug warning, not info.
|
|
||||||
Co-authored-by: Curle <curle@gemwire.uk>
|
|
||||||
Co-authored-by: sciwhiz12 <arnoldnunag12@gmail.com>
|
|
||||||
|
|
@ -1,28 +1,25 @@
|
|||||||
package ru.magistu.siegemachines;
|
package ru.magistu.siegemachines;
|
||||||
|
|
||||||
import net.minecraftforge.fml.event.lifecycle.*;
|
|
||||||
import ru.magistu.siegemachines.block.ModBlocks;
|
|
||||||
import ru.magistu.siegemachines.client.ClientProxy;
|
|
||||||
import ru.magistu.siegemachines.client.SoundTypes;
|
|
||||||
import ru.magistu.siegemachines.config.SpecsConfig;
|
|
||||||
import ru.magistu.siegemachines.item.recipes.ModRecipes;
|
|
||||||
import ru.magistu.siegemachines.entity.EntityTypes;
|
|
||||||
import ru.magistu.siegemachines.client.gui.ModMenuTypes;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import ru.magistu.siegemachines.network.PacketHandler;
|
|
||||||
import ru.magistu.siegemachines.proxy.IProxy;
|
|
||||||
import ru.magistu.siegemachines.server.ServerProxy;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import ru.magistu.siegemachines.block.ModBlocks;
|
||||||
|
import ru.magistu.siegemachines.client.ClientProxy;
|
||||||
|
import ru.magistu.siegemachines.client.SoundTypes;
|
||||||
|
import ru.magistu.siegemachines.client.gui.ModMenuTypes;
|
||||||
|
import ru.magistu.siegemachines.config.SpecsConfig;
|
||||||
|
import ru.magistu.siegemachines.entity.EntityTypes;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
import ru.magistu.siegemachines.item.recipes.ModRecipes;
|
||||||
|
import ru.magistu.siegemachines.network.PacketHandler;
|
||||||
|
import ru.magistu.siegemachines.proxy.IProxy;
|
||||||
|
import ru.magistu.siegemachines.server.ServerProxy;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
// The value here should match an entry in the META-INF/mods.toml file
|
|
||||||
@Mod(SiegeMachines.ID)
|
@Mod(SiegeMachines.ID)
|
||||||
public class SiegeMachines {
|
public class SiegeMachines {
|
||||||
public static final String ID = "siegemachines";
|
public static final String ID = "siegemachines";
|
||||||
@ -32,19 +29,10 @@ public class SiegeMachines {
|
|||||||
public static final int RENDER_UPDATE_TIME = 20;
|
public static final int RENDER_UPDATE_TIME = 20;
|
||||||
public static final int RENDER_UPDATE_RANGE_SQR = RENDER_UPDATE_RANGE * RENDER_UPDATE_RANGE;
|
public static final int RENDER_UPDATE_RANGE_SQR = RENDER_UPDATE_RANGE * RENDER_UPDATE_RANGE;
|
||||||
|
|
||||||
// Directly reference a log4j logger.
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
||||||
IEventBus eventBus;
|
public SiegeMachines() {
|
||||||
|
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
|
|
||||||
public SiegeMachines()
|
|
||||||
{
|
|
||||||
eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
|
||||||
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
||||||
|
|
||||||
EntityTypes.register(eventBus);
|
EntityTypes.register(eventBus);
|
||||||
@ -60,32 +48,7 @@ public class SiegeMachines {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doClientStuff(final FMLClientSetupEvent event) {
|
||||||
private void setup(final FMLCommonSetupEvent event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doClientStuff(final FMLClientSetupEvent event)
|
|
||||||
{
|
|
||||||
PROXY.clientSetup(event);
|
PROXY.clientSetup(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processIMC(final InterModProcessEvent event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
|
|
||||||
// Event bus for receiving Registry Events)
|
|
||||||
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
|
|
||||||
public static class RegistryEvents
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ru.magistu.siegemachines.block;
|
package ru.magistu.siegemachines.block;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@ -12,20 +10,21 @@ import net.minecraftforge.eventbus.api.IEventBus;
|
|||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ModBlocks
|
public class ModBlocks {
|
||||||
{
|
|
||||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, SiegeMachines.ID);
|
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, SiegeMachines.ID);
|
||||||
|
|
||||||
public static final RegistryObject<SiegeWorkbench> SIEGE_WORKBENCH = registerBlock("siege_workbench", () -> new SiegeWorkbench(BlockBehaviour.Properties.copy(Blocks.CRAFTING_TABLE).noOcclusion()), ModItems.GROUP_SM);
|
public static final RegistryObject<SiegeWorkbench> SIEGE_WORKBENCH = registerBlock("siege_workbench", () -> new SiegeWorkbench(BlockBehaviour.Properties.copy(Blocks.CRAFTING_TABLE).noOcclusion()), ModItems.GROUP_SM);
|
||||||
|
|
||||||
private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab, String tooltipKey) {
|
private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab, String tooltipKey) {
|
||||||
return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
||||||
new Item.Properties().tab(tab)) {
|
new Item.Properties()) {
|
||||||
@Override
|
@Override
|
||||||
public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltip, TooltipFlag pFlag) {
|
public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltip, TooltipFlag pFlag) {
|
||||||
pTooltip.add(Component.translatable(tooltipKey));
|
pTooltip.add(Component.translatable(tooltipKey));
|
||||||
@ -41,7 +40,7 @@ public class ModBlocks
|
|||||||
|
|
||||||
private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab) {
|
private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab) {
|
||||||
return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
||||||
new Item.Properties().tab(tab)));
|
new Item.Properties()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(IEventBus eventBus) {
|
public static void register(IEventBus eventBus) {
|
||||||
|
@ -17,34 +17,25 @@ import net.minecraftforge.network.NetworkHooks;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.magistu.siegemachines.client.gui.workbench.SiegeWorkbenchContainer;
|
import ru.magistu.siegemachines.client.gui.workbench.SiegeWorkbenchContainer;
|
||||||
|
|
||||||
public class SiegeWorkbench extends CraftingTableBlock
|
public class SiegeWorkbench extends CraftingTableBlock {
|
||||||
{
|
|
||||||
private static final Component CONTAINER_TITLE = Component.translatable("container.crafting");
|
private static final Component CONTAINER_TITLE = Component.translatable("container.crafting");
|
||||||
|
|
||||||
public SiegeWorkbench(Properties p_i48422_1_)
|
public SiegeWorkbench(Properties p_i48422_1_) {
|
||||||
{
|
|
||||||
super(p_i48422_1_);
|
super(p_i48422_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull InteractionResult use(@NotNull BlockState blockstate, Level level, @NotNull BlockPos blockpos, @NotNull Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult result)
|
public @NotNull InteractionResult use(@NotNull BlockState blockstate, Level level, @NotNull BlockPos blockpos, @NotNull Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult result) {
|
||||||
{
|
if (level.isClientSide) {
|
||||||
if (level.isClientSide)
|
|
||||||
{
|
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
NetworkHooks.openScreen((ServerPlayer) player, this.getMenuProvider(blockstate, level, blockpos));
|
NetworkHooks.openScreen((ServerPlayer) player, this.getMenuProvider(blockstate, level, blockpos));
|
||||||
return InteractionResult.CONSUME;
|
return InteractionResult.CONSUME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MenuProvider getMenuProvider(@NotNull BlockState blockstate, @NotNull Level level, @NotNull BlockPos blockpos)
|
public MenuProvider getMenuProvider(@NotNull BlockState blockstate, @NotNull Level level, @NotNull BlockPos blockpos) {
|
||||||
{
|
|
||||||
return new SimpleMenuProvider((p_220270_2_, p_220270_3_, p_220270_4_) ->
|
return new SimpleMenuProvider((p_220270_2_, p_220270_3_, p_220270_4_) ->
|
||||||
new SiegeWorkbenchContainer(p_220270_2_, p_220270_3_, ContainerLevelAccess.create(level, blockpos)), CONTAINER_TITLE);
|
new SiegeWorkbenchContainer(p_220270_2_, p_220270_3_, ContainerLevelAccess.create(level, blockpos)), CONTAINER_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
package ru.magistu.siegemachines.client;
|
package ru.magistu.siegemachines.client;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
|
||||||
import ru.magistu.siegemachines.client.renderer.*;
|
|
||||||
import ru.magistu.siegemachines.entity.EntityTypes;
|
|
||||||
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
|
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
|
||||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
|
import ru.magistu.siegemachines.client.renderer.*;
|
||||||
|
import ru.magistu.siegemachines.entity.EntityTypes;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid = SiegeMachines.ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = SiegeMachines.ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class ClientListener
|
public class ClientListener {
|
||||||
{
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void registerRenderers(final EntityRenderersEvent.RegisterRenderers event)
|
public static void registerRenderers(final EntityRenderersEvent.RegisterRenderers event) {
|
||||||
{
|
|
||||||
event.registerEntityRenderer(EntityTypes.MORTAR.get(), MortarGeoRenderer::new);
|
event.registerEntityRenderer(EntityTypes.MORTAR.get(), MortarGeoRenderer::new);
|
||||||
event.registerEntityRenderer(EntityTypes.CULVERIN.get(), CulverinGeoRenderer::new);
|
event.registerEntityRenderer(EntityTypes.CULVERIN.get(), CulverinGeoRenderer::new);
|
||||||
event.registerEntityRenderer(EntityTypes.TREBUCHET.get(), TrebuchetGeoRenderer::new);
|
event.registerEntityRenderer(EntityTypes.TREBUCHET.get(), TrebuchetGeoRenderer::new);
|
||||||
|
@ -1,25 +1,23 @@
|
|||||||
package ru.magistu.siegemachines.client;
|
package ru.magistu.siegemachines.client;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.client.gui.ModMenuTypes;
|
|
||||||
import ru.magistu.siegemachines.client.gui.workbench.SiegeWorkbenchScreen;
|
|
||||||
import ru.magistu.siegemachines.client.gui.machine.MachineInventoryScreen;
|
|
||||||
import ru.magistu.siegemachines.proxy.IProxy;
|
|
||||||
import net.minecraft.client.gui.screens.MenuScreens;
|
import net.minecraft.client.gui.screens.MenuScreens;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
import ru.magistu.siegemachines.client.gui.ModMenuTypes;
|
||||||
|
import ru.magistu.siegemachines.client.gui.machine.MachineInventoryScreen;
|
||||||
|
import ru.magistu.siegemachines.client.gui.workbench.SiegeWorkbenchScreen;
|
||||||
|
import ru.magistu.siegemachines.proxy.IProxy;
|
||||||
|
|
||||||
public class ClientProxy implements IProxy
|
public class ClientProxy implements IProxy {
|
||||||
{
|
public void setup(IEventBus modEventBus, IEventBus forgeEventBus) {
|
||||||
public void setup(IEventBus modEventBus, IEventBus forgeEventBus)
|
|
||||||
{
|
|
||||||
modEventBus.addListener(this::clientSetup);
|
modEventBus.addListener(this::clientSetup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientSetup(FMLClientSetupEvent event)
|
public void clientSetup(FMLClientSetupEvent event) {
|
||||||
{
|
|
||||||
MenuScreens.register(ModMenuTypes.MACHINE_CONTAINER.get(), MachineInventoryScreen::new);
|
MenuScreens.register(ModMenuTypes.MACHINE_CONTAINER.get(), MachineInventoryScreen::new);
|
||||||
MenuScreens.register(ModMenuTypes.SIEGE_WORKBENCH_CONTAINER.get(), SiegeWorkbenchScreen::new);
|
MenuScreens.register(ModMenuTypes.SIEGE_WORKBENCH_CONTAINER.get(), SiegeWorkbenchScreen::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPreInit() {}
|
public void onPreInit() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
package ru.magistu.siegemachines.client;
|
package ru.magistu.siegemachines.client;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
import ru.magistu.siegemachines.entity.machine.MachineType;
|
import ru.magistu.siegemachines.entity.machine.MachineType;
|
||||||
|
|
||||||
public class KeyBindings
|
public class KeyBindings {
|
||||||
{
|
|
||||||
public static KeyMapping MACHINE_USE = new KeyMapping(SiegeMachines.ID + ".machine_use", 70, SiegeMachines.ID + ".category");
|
public static KeyMapping MACHINE_USE = new KeyMapping(SiegeMachines.ID + ".machine_use", 70, SiegeMachines.ID + ".category");
|
||||||
public static KeyMapping LADDER_CLIMB = new KeyMapping(SiegeMachines.ID + ".ladder_climb", 32, SiegeMachines.ID + ".category");
|
public static KeyMapping LADDER_CLIMB = new KeyMapping(SiegeMachines.ID + ".ladder_climb", 32, SiegeMachines.ID + ".category");
|
||||||
public static KeyMapping MACHINE_INVENTORY = new KeyMapping(SiegeMachines.ID + ".machine_inventory", 73, SiegeMachines.ID + ".category");
|
public static KeyMapping MACHINE_INVENTORY = new KeyMapping(SiegeMachines.ID + ".machine_inventory", 73, SiegeMachines.ID + ".category");
|
||||||
|
|
||||||
public static KeyMapping getUseKey(MachineType type)
|
public static KeyMapping getUseKey(MachineType type) {
|
||||||
{
|
|
||||||
if (type == MachineType.SIEGE_LADDER)
|
if (type == MachineType.SIEGE_LADDER)
|
||||||
return LADDER_CLIMB;
|
return LADDER_CLIMB;
|
||||||
return MACHINE_USE;
|
return MACHINE_USE;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ru.magistu.siegemachines.client.gui.machine;
|
package ru.magistu.siegemachines.client.gui.machine;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
@ -8,67 +7,50 @@ import net.minecraft.world.entity.player.Player;
|
|||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.magistu.siegemachines.client.gui.ModMenuTypes;
|
import ru.magistu.siegemachines.client.gui.ModMenuTypes;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class MachineContainer extends AbstractContainerMenu
|
public class MachineContainer extends AbstractContainerMenu {
|
||||||
{
|
|
||||||
private Player player;
|
|
||||||
private Machine machine;
|
private Machine machine;
|
||||||
int x, y, z;
|
|
||||||
private IItemHandler internal;
|
|
||||||
private boolean bound = false;
|
|
||||||
|
|
||||||
|
public MachineContainer(final int id, final Inventory inv, final Machine machine) {
|
||||||
public MachineContainer(final int id, final Inventory inv, final Machine machine)
|
|
||||||
{
|
|
||||||
super(ModMenuTypes.MACHINE_CONTAINER.get(), id);
|
super(ModMenuTypes.MACHINE_CONTAINER.get(), id);
|
||||||
if (machine == null)
|
if (machine == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.machine = machine;
|
this.machine = machine;
|
||||||
|
|
||||||
for (int row = 0; row < 3; row++)
|
for (int row = 0; row < 3; row++) {
|
||||||
{
|
for (int col = 0; col < 9; col++) {
|
||||||
for (int col = 0; col < 9; col++)
|
|
||||||
{
|
|
||||||
this.addSlot(new Slot(inv, col + row * 9 + 9, 8 + col * 18, 166 - (4 - row) * 18 - 10));
|
this.addSlot(new Slot(inv, col + row * 9 + 9, 8 + col * 18, 166 - (4 - row) * 18 - 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int col = 0; col < 9; col++)
|
for (int col = 0; col < 9; col++) {
|
||||||
{
|
|
||||||
this.addSlot(new Slot(inv, col, 8 + col * 18, 142));
|
this.addSlot(new Slot(inv, col, 8 + col * 18, 142));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int row = 0; row < 1; row++)
|
for (int row = 0; row < 1; row++) {
|
||||||
{
|
for (int col = 0; col < 9; col++) {
|
||||||
for (int col = 0; col < 9; col++)
|
|
||||||
{
|
|
||||||
this.addSlot(new Slot(machine.inventory, col + row * 9, 8 + col * 18, 18 + row * 18));
|
this.addSlot(new Slot(machine.inventory, col + row * 9, 8 + col * 18, 18 + row * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MachineContainer(final int id, final Inventory inv, final FriendlyByteBuf data)
|
public MachineContainer(final int id, final Inventory inv, final FriendlyByteBuf data) {
|
||||||
{
|
|
||||||
this(id, inv, getMachine(inv));
|
this(id, inv, getMachine(inv));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Machine getMachine(final Inventory inv)
|
private static Machine getMachine(final Inventory inv) {
|
||||||
{
|
|
||||||
Objects.requireNonNull(inv, "Player Inventory Cannot Be Null.");
|
Objects.requireNonNull(inv, "Player Inventory Cannot Be Null.");
|
||||||
Player player = inv.player;
|
Player player = inv.player;
|
||||||
Entity entity;
|
Entity entity;
|
||||||
if (player.isPassenger())
|
if (player.isPassenger()) {
|
||||||
{
|
|
||||||
entity = player.getVehicle();
|
entity = player.getVehicle();
|
||||||
if (entity instanceof Machine)
|
if (entity instanceof Machine) {
|
||||||
{
|
|
||||||
return (Machine) player.getVehicle();
|
return (Machine) player.getVehicle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,56 +59,40 @@ public class MachineContainer extends AbstractContainerMenu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stillValid(Player player)
|
public boolean stillValid(Player player) {
|
||||||
{
|
|
||||||
return machine.inventory.stillValid(player);
|
return machine.inventory.stillValid(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ItemStack quickMoveStack(@NotNull Player player, int index)
|
public @NotNull ItemStack quickMoveStack(@NotNull Player player, int index) {
|
||||||
{
|
|
||||||
ItemStack itemstack = ItemStack.EMPTY;
|
ItemStack itemstack = ItemStack.EMPTY;
|
||||||
Slot slot = this.slots.get(index);
|
Slot slot = this.slots.get(index);
|
||||||
if (slot != null && slot.hasItem())
|
if (slot != null && slot.hasItem()) {
|
||||||
{
|
|
||||||
ItemStack itemstack1 = slot.getItem();
|
ItemStack itemstack1 = slot.getItem();
|
||||||
itemstack = itemstack1.copy();
|
itemstack = itemstack1.copy();
|
||||||
if (index < 9)
|
if (index < 9) {
|
||||||
{
|
if (!this.moveItemStackTo(itemstack1, 9, this.slots.size(), true)) {
|
||||||
if (!this.moveItemStackTo(itemstack1, 9, this.slots.size(), true))
|
|
||||||
{
|
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
slot.onQuickCraft(itemstack1, itemstack);
|
slot.onQuickCraft(itemstack1, itemstack);
|
||||||
}
|
} else if (!this.moveItemStackTo(itemstack1, 0, 9, false)) {
|
||||||
else if (!this.moveItemStackTo(itemstack1, 0, 9, false))
|
if (index < 9 + 27) {
|
||||||
{
|
if (!this.moveItemStackTo(itemstack1, 9 + 27, this.slots.size(), true)) {
|
||||||
if (index < 9 + 27)
|
|
||||||
{
|
|
||||||
if (!this.moveItemStackTo(itemstack1, 9 + 27, this.slots.size(), true))
|
|
||||||
{
|
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (!this.moveItemStackTo(itemstack1, 9, 9 + 27, false)) {
|
||||||
{
|
|
||||||
if (!this.moveItemStackTo(itemstack1, 9, 9 + 27, false))
|
|
||||||
{
|
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
if (itemstack1.getCount() == 0)
|
if (itemstack1.getCount() == 0) {
|
||||||
{
|
|
||||||
slot.set(ItemStack.EMPTY);
|
slot.set(ItemStack.EMPTY);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
slot.setChanged();
|
slot.setChanged();
|
||||||
}
|
}
|
||||||
if (itemstack1.getCount() == itemstack.getCount())
|
if (itemstack1.getCount() == itemstack.getCount()) {
|
||||||
{
|
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
slot.onTake(player, itemstack1);
|
slot.onTake(player, itemstack1);
|
||||||
|
@ -2,14 +2,12 @@ package ru.magistu.siegemachines.config;
|
|||||||
|
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
|
||||||
public class MissileSpecs
|
public class MissileSpecs {
|
||||||
{
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Float> mass;
|
public final ForgeConfigSpec.ConfigValue<Float> mass;
|
||||||
public final ForgeConfigSpec.ConfigValue<Float> explosionpower;
|
public final ForgeConfigSpec.ConfigValue<Float> explosionpower;
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> destroysground;
|
public final ForgeConfigSpec.ConfigValue<Boolean> destroysground;
|
||||||
|
|
||||||
public MissileSpecs(ForgeConfigSpec.Builder builder, String name, float mass, float explosionpower, boolean destroysground)
|
public MissileSpecs(ForgeConfigSpec.Builder builder, String name, float mass, float explosionpower, boolean destroysground) {
|
||||||
{
|
|
||||||
builder.push(name);
|
builder.push(name);
|
||||||
|
|
||||||
this.mass = builder.define("mass", mass);
|
this.mass = builder.define("mass", mass);
|
||||||
|
@ -2,8 +2,7 @@ package ru.magistu.siegemachines.config;
|
|||||||
|
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
|
||||||
public final class SiegeMachineSpecs
|
public final class SiegeMachineSpecs {
|
||||||
{
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Integer> durability;
|
public final ForgeConfigSpec.ConfigValue<Integer> durability;
|
||||||
@ -12,8 +11,7 @@ public final class SiegeMachineSpecs
|
|||||||
public final ForgeConfigSpec.ConfigValue<Float> inaccuracy;
|
public final ForgeConfigSpec.ConfigValue<Float> inaccuracy;
|
||||||
public final ForgeConfigSpec.ConfigValue<Float> damagemultiplier;
|
public final ForgeConfigSpec.ConfigValue<Float> damagemultiplier;
|
||||||
|
|
||||||
public SiegeMachineSpecs(ForgeConfigSpec.Builder builder, String name, int durability, int delaytime, float projectilespeed, float inaccuracy, float damagemultiplier)
|
public SiegeMachineSpecs(ForgeConfigSpec.Builder builder, String name, int durability, int delaytime, float projectilespeed, float inaccuracy, float damagemultiplier) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
builder.push(name);
|
builder.push(name);
|
||||||
|
@ -4,8 +4,7 @@ import net.minecraftforge.common.ForgeConfigSpec;
|
|||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
|
|
||||||
public final class SpecsConfig
|
public final class SpecsConfig {
|
||||||
{
|
|
||||||
public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
||||||
public static final ForgeConfigSpec SPEC;
|
public static final ForgeConfigSpec SPEC;
|
||||||
|
|
||||||
@ -21,8 +20,7 @@ public final class SpecsConfig
|
|||||||
public static final MissileSpecs STONE;
|
public static final MissileSpecs STONE;
|
||||||
public static final MissileSpecs GIANT_STONE;
|
public static final MissileSpecs GIANT_STONE;
|
||||||
|
|
||||||
static
|
static {
|
||||||
{
|
|
||||||
BUILDER.push("siege_machines");
|
BUILDER.push("siege_machines");
|
||||||
|
|
||||||
MORTAR = new SiegeMachineSpecs(BUILDER, "mortar", 80, 200, 2.5f, 0.2f, 1.5f);
|
MORTAR = new SiegeMachineSpecs(BUILDER, "mortar", 80, 200, 2.5f, 0.2f, 1.5f);
|
||||||
@ -46,8 +44,7 @@ public final class SpecsConfig
|
|||||||
SPEC = BUILDER.build();
|
SPEC = BUILDER.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register()
|
public static void register() {
|
||||||
{
|
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, SPEC, "siege-machines-specs.toml");
|
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, SPEC, "siege-machines-specs.toml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
package ru.magistu.siegemachines.entity;
|
package ru.magistu.siegemachines.entity;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
@ -21,7 +16,6 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.item.PrimedTnt;
|
import net.minecraft.world.entity.item.PrimedTnt;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.projectile.Projectile;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
|
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
|
||||||
import net.minecraft.world.level.*;
|
import net.minecraft.world.level.*;
|
||||||
@ -31,14 +25,19 @@ import net.minecraft.world.level.block.FireBlock;
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootParams;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class Breakdown
|
import javax.annotation.Nullable;
|
||||||
{
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class Breakdown {
|
||||||
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
||||||
private final boolean fire;
|
private final boolean fire;
|
||||||
private final Explosion.BlockInteraction blockInteraction;
|
private final Explosion.BlockInteraction blockInteraction;
|
||||||
@ -75,7 +74,8 @@ public class Breakdown
|
|||||||
this.fire = p_i231610_12_;
|
this.fire = p_i231610_12_;
|
||||||
this.power = power;
|
this.power = power;
|
||||||
this.blockInteraction = p_i231610_13_;
|
this.blockInteraction = p_i231610_13_;
|
||||||
this.damageSource = p_i231610_3_ == null && p_i231610_2_ instanceof LivingEntity ? DamageSource.explosion((LivingEntity) p_i231610_2_) : p_i231610_3_;
|
// this.damageSource = p_i231610_3_ == null && p_i231610_2_ instanceof LivingEntity ? DamageSource.explosion((LivingEntity) p_i231610_2_) : p_i231610_3_;
|
||||||
|
this.damageSource = p_i231610_3_ == null && p_i231610_2_ instanceof LivingEntity ? level.damageSources().explosion(p_i231610_2_, p_i231610_2_) : p_i231610_3_; //TODO Возможно неправильно
|
||||||
this.damageCalculator = p_i231610_4_ == null ? this.makeDamageCalculator(p_i231610_2_) : p_i231610_4_;
|
this.damageCalculator = p_i231610_4_ == null ? this.makeDamageCalculator(p_i231610_2_) : p_i231610_4_;
|
||||||
this.position = new Vec3(this.x, this.y, this.z);
|
this.position = new Vec3(this.x, this.y, this.z);
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ public class Breakdown
|
|||||||
double d6 = Mth.lerp((double) f1, axisalignedbb.minY, axisalignedbb.maxY);
|
double d6 = Mth.lerp((double) f1, axisalignedbb.minY, axisalignedbb.maxY);
|
||||||
double d7 = Mth.lerp((double) f2, axisalignedbb.minZ, axisalignedbb.maxZ);
|
double d7 = Mth.lerp((double) f2, axisalignedbb.minZ, axisalignedbb.maxZ);
|
||||||
Vec3 vector3d = new Vec3(d5 + d3, d6, d7 + d4);
|
Vec3 vector3d = new Vec3(d5 + d3, d6, d7 + d4);
|
||||||
if (p_222259_1_.level.clip(new ClipContext(vector3d, p_222259_0_, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, p_222259_1_)).getType() == HitResult.Type.MISS) {
|
if (p_222259_1_.level().clip(new ClipContext(vector3d, p_222259_0_, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, p_222259_1_)).getType() == HitResult.Type.MISS) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,8 +117,7 @@ public class Breakdown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void explode()
|
public void explode() {
|
||||||
{
|
|
||||||
Set<BlockPos> set = Sets.newHashSet();
|
Set<BlockPos> set = Sets.newHashSet();
|
||||||
int i = 16;
|
int i = 16;
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ public class Breakdown
|
|||||||
double d8 = this.z;
|
double d8 = this.z;
|
||||||
|
|
||||||
for (float f1 = 0.3F; f > 0.0F; f -= this.power * 0.5F) {
|
for (float f1 = 0.3F; f > 0.0F; f -= this.power * 0.5F) {
|
||||||
BlockPos blockpos = new BlockPos(d4, d6, d8);
|
BlockPos blockpos = new BlockPos((int) d4, (int) d6, (int) d8); //TODO ранее был double
|
||||||
BlockState blockstate = this.level.getBlockState(blockpos);
|
BlockState blockstate = this.level.getBlockState(blockpos);
|
||||||
FluidState fluidstate = this.level.getFluidState(blockpos);
|
FluidState fluidstate = this.level.getFluidState(blockpos);
|
||||||
Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this.explosion, this.level, blockpos, blockstate, fluidstate);
|
Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this.explosion, this.level, blockpos, blockstate, fluidstate);
|
||||||
@ -209,11 +208,7 @@ public class Breakdown
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finalizeExplosion(boolean p_77279_1_) {
|
public void finalizeExplosion(boolean p_77279_1_) {
|
||||||
if (this.level.isClientSide) {
|
boolean flag = this.blockInteraction != Explosion.BlockInteraction.KEEP; //TODO Стоял NONE, поставил KEEP, возможно неверно
|
||||||
//this.level.playLocalSound(this.x, this.y, this.z, SoundEvents.GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean flag = this.blockInteraction != Explosion.BlockInteraction.NONE;
|
|
||||||
if (p_77279_1_) {
|
if (p_77279_1_) {
|
||||||
if (!(this.radius < 2.0F) && flag) {
|
if (!(this.radius < 2.0F) && flag) {
|
||||||
this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||||
@ -234,7 +229,7 @@ public class Breakdown
|
|||||||
this.level.getProfiler().push("explosion_blocks");
|
this.level.getProfiler().push("explosion_blocks");
|
||||||
if (this.level instanceof ServerLevel) {
|
if (this.level instanceof ServerLevel) {
|
||||||
BlockEntity tileentity = blockstate.hasBlockEntity() ? this.level.getBlockEntity(blockpos) : null;
|
BlockEntity tileentity = blockstate.hasBlockEntity() ? this.level.getBlockEntity(blockpos) : null;
|
||||||
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.level)).withRandom(this.level.random).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockpos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParams.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParams.THIS_ENTITY, this.source);
|
LootParams.Builder lootcontext$builder = (new LootParams.Builder((ServerLevel) this.level)).withLuck(this.level.random.nextFloat()).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockpos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParams.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParams.THIS_ENTITY, this.source);
|
||||||
if (this.blockInteraction == Explosion.BlockInteraction.DESTROY) {
|
if (this.blockInteraction == Explosion.BlockInteraction.DESTROY) {
|
||||||
lootcontext$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, this.radius);
|
lootcontext$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, this.radius);
|
||||||
}
|
}
|
||||||
@ -286,44 +281,7 @@ public class Breakdown
|
|||||||
return this.damageSource;
|
return this.damageSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Player, Vec3> getHitPlayers() {
|
|
||||||
return this.hitPlayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public LivingEntity getSourceMob() {
|
|
||||||
if (this.source == null) {
|
|
||||||
return null;
|
|
||||||
} else if (this.source instanceof PrimedTnt) {
|
|
||||||
return ((PrimedTnt)this.source).getOwner();
|
|
||||||
} else if (this.source instanceof LivingEntity) {
|
|
||||||
return (LivingEntity)this.source;
|
|
||||||
} else {
|
|
||||||
if (this.source instanceof Projectile) {
|
|
||||||
Entity entity = ((Projectile)this.source).getOwner();
|
|
||||||
if (entity instanceof LivingEntity) {
|
|
||||||
return (LivingEntity)entity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearToBlow() {
|
|
||||||
this.toBlow.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<BlockPos> getToBlow() {
|
|
||||||
return this.toBlow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vec3 getPosition() {
|
public Vec3 getPosition() {
|
||||||
return this.position;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public Entity getExploder() {
|
|
||||||
return this.source;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
package ru.magistu.siegemachines.entity;
|
package ru.magistu.siegemachines.entity;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
|
||||||
import ru.magistu.siegemachines.entity.machine.*;
|
|
||||||
import ru.magistu.siegemachines.entity.projectile.Cannonball;
|
|
||||||
import ru.magistu.siegemachines.entity.projectile.GiantArrow;
|
|
||||||
import ru.magistu.siegemachines.entity.projectile.GiantStone;
|
|
||||||
import ru.magistu.siegemachines.entity.projectile.Stone;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
@ -14,9 +8,14 @@ import net.minecraftforge.eventbus.api.IEventBus;
|
|||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.*;
|
||||||
|
import ru.magistu.siegemachines.entity.projectile.Cannonball;
|
||||||
|
import ru.magistu.siegemachines.entity.projectile.GiantArrow;
|
||||||
|
import ru.magistu.siegemachines.entity.projectile.GiantStone;
|
||||||
|
import ru.magistu.siegemachines.entity.projectile.Stone;
|
||||||
|
|
||||||
public class EntityTypes
|
public class EntityTypes {
|
||||||
{
|
|
||||||
public static final DeferredRegister<EntityType<?>> DEFERRED_REGISTER = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, SiegeMachines.ID);
|
public static final DeferredRegister<EntityType<?>> DEFERRED_REGISTER = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, SiegeMachines.ID);
|
||||||
|
|
||||||
public static final RegistryObject<EntityType<Cannonball>> CANNONBALL = addRegistry("cannonball", Cannonball::new, 0.5f, 0.5f);
|
public static final RegistryObject<EntityType<Cannonball>> CANNONBALL = addRegistry("cannonball", Cannonball::new, 0.5f, 0.5f);
|
||||||
@ -34,18 +33,15 @@ public class EntityTypes
|
|||||||
|
|
||||||
public static final RegistryObject<EntityType<Seat>> SEAT = addRegistry("seat", Seat::new, 0.0f, 0.0f);
|
public static final RegistryObject<EntityType<Seat>> SEAT = addRegistry("seat", Seat::new, 0.0f, 0.0f);
|
||||||
|
|
||||||
public static <T extends Entity> RegistryObject<EntityType<T>> addRegistry(String name, EntityType.EntityFactory<T> constructor, float sizex, float sizey)
|
public static <T extends Entity> RegistryObject<EntityType<T>> addRegistry(String name, EntityType.EntityFactory<T> constructor, float sizex, float sizey) {
|
||||||
{
|
|
||||||
return addRegistry(name, constructor, sizex, sizey, 1);
|
return addRegistry(name, constructor, sizex, sizey, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends Entity> RegistryObject<EntityType<T>> addRegistry(String name, EntityType.EntityFactory<T> constructor, float sizex, float sizey, int trackingrange)
|
public static <T extends Entity> RegistryObject<EntityType<T>> addRegistry(String name, EntityType.EntityFactory<T> constructor, float sizex, float sizey, int trackingrange) {
|
||||||
{
|
|
||||||
return DEFERRED_REGISTER.register(name, () -> EntityType.Builder.of(constructor, MobCategory.MISC).clientTrackingRange(trackingrange).sized(sizex, sizey).build(new ResourceLocation(SiegeMachines.ID, name).toString()));
|
return DEFERRED_REGISTER.register(name, () -> EntityType.Builder.of(constructor, MobCategory.MISC).clientTrackingRange(trackingrange).sized(sizex, sizey).build(new ResourceLocation(SiegeMachines.ID, name).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(IEventBus eventBus)
|
public static void register(IEventBus eventBus) {
|
||||||
{
|
|
||||||
DEFERRED_REGISTER.register(eventBus);
|
DEFERRED_REGISTER.register(eventBus);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,10 @@
|
|||||||
package ru.magistu.siegemachines.entity;
|
package ru.magistu.siegemachines.entity;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.client.gui.machine.crosshair.Crosshair;
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import ru.magistu.siegemachines.client.gui.machine.crosshair.Crosshair;
|
||||||
|
|
||||||
public interface IReloading
|
public interface IReloading {
|
||||||
{
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
Crosshair createCrosshair();
|
Crosshair createCrosshair();
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
public class Cannonball extends Missile
|
public class Cannonball extends Missile {
|
||||||
{
|
public Cannonball(EntityType<Cannonball> type, Level level) {
|
||||||
public Cannonball(EntityType<Cannonball> type, Level level)
|
|
||||||
{
|
|
||||||
super(type, level);
|
super(type, level);
|
||||||
this.item = ModItems.CANNONBALL.get();
|
this.item = ModItems.CANNONBALL.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cannonball(EntityType<Cannonball> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item)
|
public Cannonball(EntityType<Cannonball> entitytype, Level level, Vec3 pos, LivingEntity entity, Item item) {
|
||||||
{
|
|
||||||
super(entitytype, level, pos, entity, MissileType.CANNONBALL, item);
|
super(entitytype, level, pos, entity, MissileType.CANNONBALL, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
public enum FlightType
|
public enum FlightType {
|
||||||
{
|
|
||||||
NONE,
|
NONE,
|
||||||
AHEAD,
|
AHEAD,
|
||||||
SPINNING
|
SPINNING
|
||||||
|
@ -1,42 +1,38 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
public class GiantArrow extends AbstractArrow
|
public class GiantArrow extends AbstractArrow {
|
||||||
{
|
private final Packet<ClientGamePacketListener> spawningpacket = NetworkHooks.getEntitySpawningPacket(this);
|
||||||
private final Packet<?> spawningpacket = NetworkHooks.getEntitySpawningPacket(this);
|
|
||||||
|
|
||||||
public GiantArrow(EntityType<GiantArrow> type, Level level)
|
public GiantArrow(EntityType<GiantArrow> type, Level level) {
|
||||||
{
|
|
||||||
super(type, level);
|
super(type, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GiantArrow(EntityType<GiantArrow> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item)
|
public GiantArrow(EntityType<GiantArrow> entitytype, Level level, Vec3 pos, LivingEntity entity, Item item) {
|
||||||
{
|
|
||||||
super(entitytype, entity, level);
|
super(entitytype, entity, level);
|
||||||
this.setPos(pos.x, pos.y, pos.z);
|
this.setPos(pos.x, pos.y, pos.z);
|
||||||
this.setBaseDamage(5.0F);
|
this.setBaseDamage(5.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull ItemStack getPickupItem()
|
protected @NotNull ItemStack getPickupItem() {
|
||||||
{
|
|
||||||
return new ItemStack(ModItems.GIANT_ARROW.get());
|
return new ItemStack(ModItems.GIANT_ARROW.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Packet<?> getAddEntityPacket()
|
public @NotNull Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||||
{
|
|
||||||
return spawningpacket;
|
return spawningpacket;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,23 +1,20 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
public class GiantStone extends Missile
|
public class GiantStone extends Missile {
|
||||||
{
|
public GiantStone(EntityType<GiantStone> entitytype, Level level) {
|
||||||
public GiantStone(EntityType<GiantStone> entitytype, Level level)
|
|
||||||
{
|
|
||||||
super(entitytype, level);
|
super(entitytype, level);
|
||||||
this.item = ModItems.GIANT_STONE.get();
|
this.item = ModItems.GIANT_STONE.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GiantStone(EntityType<GiantStone> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item)
|
public GiantStone(EntityType<GiantStone> entitytype, Level level, Vec3 pos, LivingEntity entity, Item item) {
|
||||||
{
|
|
||||||
super(entitytype, level, pos, entity, MissileType.GIANT_STONE, item);
|
super(entitytype, level, pos, entity, MissileType.GIANT_STONE, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.projectile.Projectile;
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public interface IProjectileFactory<T extends Projectile>
|
public interface IProjectileFactory<T extends Projectile> {
|
||||||
{
|
T create(EntityType<T> entitytype, Level level, Vec3 pos, LivingEntity entity, Item item);
|
||||||
T create(EntityType<T> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item);
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.particles.BlockParticleOption;
|
import net.minecraft.core.particles.BlockParticleOption;
|
||||||
import net.minecraft.core.particles.ParticleOptions;
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
@ -23,6 +21,7 @@ import net.minecraft.world.item.Item;
|
|||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.ShieldItem;
|
import net.minecraft.world.item.ShieldItem;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
|
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
@ -32,21 +31,19 @@ import net.minecraft.world.phys.HitResult;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class Missile extends ThrowableItemProjectile
|
public abstract class Missile extends ThrowableItemProjectile {
|
||||||
{
|
|
||||||
public MissileType type = MissileType.STONE;
|
public MissileType type = MissileType.STONE;
|
||||||
public Item item = ModItems.STONE.get();
|
public Item item = ModItems.STONE.get();
|
||||||
|
|
||||||
public Missile(EntityType<? extends Missile> entitytype, Level level)
|
public Missile(EntityType<? extends Missile> entitytype, Level level) {
|
||||||
{
|
|
||||||
super(entitytype, level);
|
super(entitytype, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Missile(EntityType<? extends Missile> entitytype, Level level, Vector3d pos, LivingEntity entity, MissileType type, Item item)
|
public Missile(EntityType<? extends Missile> entitytype, Level level, Vec3 pos, LivingEntity entity, MissileType type, Item item) {
|
||||||
{
|
|
||||||
super(entitytype, entity, level);
|
super(entitytype, entity, level);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
@ -54,35 +51,29 @@ public abstract class Missile extends ThrowableItemProjectile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Item getDefaultItem()
|
public @NotNull Item getDefaultItem() {
|
||||||
{
|
|
||||||
return this.item;
|
return this.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Packet<?> getAddEntityPacket()
|
public @NotNull Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||||
{
|
|
||||||
return NetworkHooks.getEntitySpawningPacket(this);
|
return NetworkHooks.getEntitySpawningPacket(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHit(HitResult result)
|
public void onHit(HitResult result) {
|
||||||
{
|
|
||||||
float f = 2.0F;
|
float f = 2.0F;
|
||||||
if (result.getType() == HitResult.Type.ENTITY)
|
if (result.getType() == HitResult.Type.ENTITY) {
|
||||||
{
|
|
||||||
EntityHitResult entityRTR = (EntityHitResult) result;
|
EntityHitResult entityRTR = (EntityHitResult) result;
|
||||||
Vec3 pos = entityRTR.getLocation();
|
Vec3 pos = entityRTR.getLocation();
|
||||||
Entity entity = entityRTR.getEntity();
|
Entity entity = entityRTR.getEntity();
|
||||||
float damage = this.type.specs.mass.get() * (float) this.getDeltaMovement().length();
|
float damage = this.type.specs.mass.get() * (float) this.getDeltaMovement().length();
|
||||||
|
|
||||||
DamageSource damagesource = DamageSource.thrown(this, this.getOwner());
|
// DamageSource damagesource = DamageSource.thrown(this, this.getOwner()); //TODO
|
||||||
if (this.type.armorpiercing >= 1.0f)
|
DamageSource damagesource = level().damageSources().thrown(this, this.getOwner());
|
||||||
{
|
if (this.type.armorpiercing >= 1.0f) {
|
||||||
damagesource = damagesource.bypassArmor();
|
// damagesource = damagesource.bypassArmor(); TODO хз что тут
|
||||||
}
|
} else if (this.type.armorpiercing > 0.0f && entity instanceof LivingEntity livingentity) {
|
||||||
else if (this.type.armorpiercing > 0.0f && entity instanceof LivingEntity livingentity)
|
|
||||||
{
|
|
||||||
if (livingentity instanceof Player player) {
|
if (livingentity instanceof Player player) {
|
||||||
if (player.isBlocking() && (item == ModItems.GIANT_ARROW.get() || item == Items.ARROW) && (player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ShieldItem || player.isBlocking() && player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ShieldItem)) {
|
if (player.isBlocking() && (item == ModItems.GIANT_ARROW.get() || item == Items.ARROW) && (player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ShieldItem || player.isBlocking() && player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ShieldItem)) {
|
||||||
return;
|
return;
|
||||||
@ -91,25 +82,22 @@ public abstract class Missile extends ThrowableItemProjectile
|
|||||||
damage -= (1.0f - this.type.armorpiercing) * (damage - CombatRules.getDamageAfterAbsorb(damage, 0, 0));
|
damage -= (1.0f - this.type.armorpiercing) * (damage - CombatRules.getDamageAfterAbsorb(damage, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.level.isClientSide() && this.type.explosive)
|
if (!this.level().isClientSide() && this.type.explosive) {
|
||||||
{
|
this.explode(pos.x, pos.y, pos.z, 3.0F, Explosion.BlockInteraction.KEEP); //TODO
|
||||||
this.explode(pos.x, pos.y, pos.z, 3.0F, Explosion.BlockInteraction.NONE);
|
|
||||||
this.remove(RemovalReason.KILLED);
|
this.remove(RemovalReason.KILLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.hurt(damagesource, damage);
|
entity.hurt(damagesource, damage);
|
||||||
Vec3 vector3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) this.type.knockback * 0.6D);
|
Vec3 vector3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) this.type.knockback * 0.6D);
|
||||||
if (vector3d.lengthSqr() > 0.0D)
|
if (vector3d.lengthSqr() > 0.0D) {
|
||||||
{
|
|
||||||
entity.push(vector3d.x, 0.1D, vector3d.z);
|
entity.push(vector3d.x, 0.1D, vector3d.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.getType() == HitResult.Type.BLOCK)
|
if (result.getType() == HitResult.Type.BLOCK) {
|
||||||
{
|
|
||||||
BlockHitResult blockRTR = (BlockHitResult) result;
|
BlockHitResult blockRTR = (BlockHitResult) result;
|
||||||
BlockPos blockpos = blockRTR.getBlockPos();
|
BlockPos blockpos = blockRTR.getBlockPos();
|
||||||
BlockState blockstate = this.level.getBlockState(blockpos);
|
BlockState blockstate = this.level().getBlockState(blockpos);
|
||||||
boolean smoothimpact = (blockstate == Blocks.SAND.defaultBlockState() ||
|
boolean smoothimpact = (blockstate == Blocks.SAND.defaultBlockState() ||
|
||||||
blockstate == Blocks.RED_SAND.defaultBlockState() ||
|
blockstate == Blocks.RED_SAND.defaultBlockState() ||
|
||||||
blockstate == Blocks.DIRT.defaultBlockState() ||
|
blockstate == Blocks.DIRT.defaultBlockState() ||
|
||||||
@ -119,96 +107,76 @@ public abstract class Missile extends ThrowableItemProjectile
|
|||||||
blockstate == Blocks.SNOW_BLOCK.defaultBlockState()) &&
|
blockstate == Blocks.SNOW_BLOCK.defaultBlockState()) &&
|
||||||
blockRTR.getDirection() == Direction.UP;
|
blockRTR.getDirection() == Direction.UP;
|
||||||
|
|
||||||
if (blockRTR.getDirection() == Direction.UP)
|
if (blockRTR.getDirection() == Direction.UP) {
|
||||||
{
|
if (this.type.explosive) {
|
||||||
if (this.type.explosive)
|
for (int r = 0; r < this.type.specs.explosionpower.get(); ++r) {
|
||||||
{
|
for (float a = 0; a < 2 * Math.PI; a += Math.PI / 4) {
|
||||||
for (int r = 0; r < this.type.specs.explosionpower.get(); ++r)
|
BlockPos pos = blockRTR.getBlockPos().offset((int) (r * Math.cos(a)), 0, (int) (-r * Math.sin(a))); //TODO был не int
|
||||||
{
|
if (this.level().getBlockState(pos) == Blocks.GRASS_BLOCK.defaultBlockState()) {
|
||||||
for (float a = 0; a < 2 * Math.PI; a += Math.PI / 4)
|
this.level().setBlockAndUpdate(pos, Blocks.DIRT.defaultBlockState());
|
||||||
{
|
|
||||||
BlockPos pos = blockRTR.getBlockPos().offset(r * Math.cos(a), 0, -r * Math.sin(a));
|
|
||||||
if (this.level.getBlockState(pos) == Blocks.GRASS_BLOCK.defaultBlockState())
|
|
||||||
{
|
|
||||||
this.level.setBlockAndUpdate(pos, Blocks.DIRT.defaultBlockState());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.level.isClientSide())
|
if (!this.level().isClientSide()) {
|
||||||
{
|
|
||||||
this.remove(RemovalReason.KILLED);
|
this.remove(RemovalReason.KILLED);
|
||||||
if (smoothimpact && this.type.explosive)
|
if (smoothimpact && this.type.explosive) {
|
||||||
{
|
|
||||||
|
|
||||||
this.explode(blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.type.specs.explosionpower.get() * f, Explosion.BlockInteraction.NONE);
|
this.explode(blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.type.specs.explosionpower.get() * f, Explosion.BlockInteraction.KEEP); //TODO
|
||||||
}
|
}
|
||||||
}
|
} else if (smoothimpact) {
|
||||||
else if (smoothimpact)
|
|
||||||
{
|
|
||||||
this.dustExplosion(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(blockpos), blockpos, this.type.specs.explosionpower.get() / 2, 50);
|
this.dustExplosion(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(blockpos), blockpos, this.type.specs.explosionpower.get() / 2, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.level.isClientSide() && !smoothimpact && this.type.explosive)
|
if (!this.level().isClientSide() && !smoothimpact && this.type.explosive) {
|
||||||
{
|
this.explode(blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.type.specs.explosionpower.get() * f, Explosion.BlockInteraction.DESTROY);
|
||||||
this.explode(blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.type.specs.explosionpower.get() * f, Explosion.BlockInteraction.BREAK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.getType() == HitResult.Type.MISS)
|
if (result.getType() == HitResult.Type.MISS) {
|
||||||
{
|
this.level().playSound((Player) this.getOwner(), this.getOnPos(), SoundEvents.ANVIL_BREAK, SoundSource.AMBIENT, 1.0f, 1.0f);
|
||||||
this.level.playSound((Player)this.getOwner(), this.getOnPos(), SoundEvents.ANVIL_BREAK, SoundSource.AMBIENT, 1.0f, 1.0f);
|
if (!this.level().isClientSide()) {
|
||||||
if(!this.level.isClientSide())
|
|
||||||
{
|
|
||||||
this.remove(RemovalReason.KILLED);
|
this.remove(RemovalReason.KILLED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.level.isClientSide())
|
if (!this.level().isClientSide()) {
|
||||||
{
|
|
||||||
this.remove(RemovalReason.KILLED);
|
this.remove(RemovalReason.KILLED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dustExplosion(ParticleOptions particle, BlockPos blockpos, double speed, int amount)
|
private void dustExplosion(ParticleOptions particle, BlockPos blockpos, double speed, int amount) {
|
||||||
{
|
|
||||||
this.dustExplosion(particle, blockpos.getX(), blockpos.getY(), blockpos.getZ(), speed, amount);
|
this.dustExplosion(particle, blockpos.getX(), blockpos.getY(), blockpos.getZ(), speed, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dustExplosion(ParticleOptions particle, double x, double y, double z, double speed, int amount)
|
private void dustExplosion(ParticleOptions particle, double x, double y, double z, double speed, int amount) {
|
||||||
{
|
for (int i = 0; i < amount; ++i) {
|
||||||
for (int i = 0; i < amount; ++i)
|
|
||||||
{
|
|
||||||
Vec3 movement = this.getDeltaMovement();
|
Vec3 movement = this.getDeltaMovement();
|
||||||
double d0 = x - 0.05 + this.level.random.nextDouble() * 0.3;
|
double d0 = x - 0.05 + this.level().random.nextDouble() * 0.3;
|
||||||
double d1 = y + 1.0;
|
double d1 = y + 1.0;
|
||||||
double d2 = z - 0.05 + this.level.random.nextDouble() * 0.3;
|
double d2 = z - 0.05 + this.level().random.nextDouble() * 0.3;
|
||||||
double d3 = movement.x * this.level.random.nextDouble() * speed;
|
double d3 = movement.x * this.level().random.nextDouble() * speed;
|
||||||
double d4 = -movement.y * this.level.random.nextDouble() * speed * 10.0f;
|
double d4 = -movement.y * this.level().random.nextDouble() * speed * 10.0f;
|
||||||
double d5 = movement.z * this.level.random.nextDouble() * speed;
|
double d5 = movement.z * this.level().random.nextDouble() * speed;
|
||||||
this.level.addParticle(particle, d0, d1, d2, d3, d4, d5);
|
this.level().addParticle(particle, d0, d1, d2, d3, d4, d5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick()
|
public void tick() {
|
||||||
{
|
if (this.type.flighttype == FlightType.SPINNING) {
|
||||||
if (this.type.flighttype == FlightType.SPINNING)
|
|
||||||
{
|
|
||||||
this.setXRot(this.getXRot() + 0.5f);
|
this.setXRot(this.getXRot() + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.tick();
|
super.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissileExplosion explode(double x, double y, double z, float radius, Explosion.BlockInteraction mode)
|
public MissileExplosion explode(double x, double y, double z, float radius, Explosion.BlockInteraction mode) {
|
||||||
{
|
|
||||||
return this.explode(null, null, x, y, z, radius, false, mode);
|
return this.explode(null, null, x, y, z, radius, false, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissileExplosion explode(@Nullable DamageSource source, @Nullable ExplosionDamageCalculator context, double x, double y, double z, float size, boolean fired, Explosion.BlockInteraction mode)
|
public MissileExplosion explode(@Nullable DamageSource source, @Nullable ExplosionDamageCalculator context, double x, double y, double z, float size, boolean fired, Explosion.BlockInteraction mode) {
|
||||||
{
|
MissileExplosion explosion = new MissileExplosion(this.level(), this.getOwner(), source, context, x, y, z, size, fired, mode);
|
||||||
MissileExplosion explosion = new MissileExplosion(this.level, this.getOwner(), source, context, x, y, z, size, fired, mode);
|
if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(level(), explosion)) return explosion;
|
||||||
if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(level, explosion)) return explosion;
|
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
explosion.finalizeExplosion(true);
|
explosion.finalizeExplosion(true);
|
||||||
return explosion;
|
return explosion;
|
||||||
|
@ -17,7 +17,6 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.item.PrimedTnt;
|
import net.minecraft.world.entity.item.PrimedTnt;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.projectile.Projectile;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
|
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
|
||||||
import net.minecraft.world.level.*;
|
import net.minecraft.world.level.*;
|
||||||
@ -27,7 +26,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.gameevent.GameEvent;
|
import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootParams;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
@ -37,8 +36,7 @@ import ru.magistu.siegemachines.entity.machine.Machine;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class MissileExplosion extends Explosion
|
public class MissileExplosion extends Explosion {
|
||||||
{
|
|
||||||
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
||||||
private final boolean fire;
|
private final boolean fire;
|
||||||
private final BlockInteraction blockInteraction;
|
private final BlockInteraction blockInteraction;
|
||||||
@ -57,29 +55,24 @@ public class MissileExplosion extends Explosion
|
|||||||
private final Vec3 position;
|
private final Vec3 position;
|
||||||
private float damagemultiplier = 1.0f;
|
private float damagemultiplier = 1.0f;
|
||||||
|
|
||||||
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius)
|
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius) {
|
||||||
{
|
|
||||||
this(level, source, x, y, z, radius, false, BlockInteraction.DESTROY);
|
this(level, source, x, y, z, radius, false, BlockInteraction.DESTROY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, List<BlockPos> pPositions)
|
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, List<BlockPos> pPositions) {
|
||||||
{
|
|
||||||
this(level, source, x, y, z, radius, false, BlockInteraction.DESTROY, pPositions);
|
this(level, source, x, y, z, radius, false, BlockInteraction.DESTROY, pPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, boolean fired, BlockInteraction blockinteraction, List<BlockPos> pPositions)
|
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, boolean fired, BlockInteraction blockinteraction, List<BlockPos> pPositions) {
|
||||||
{
|
|
||||||
this(level, source, x, y, z, radius, fired, blockinteraction);
|
this(level, source, x, y, z, radius, fired, blockinteraction);
|
||||||
this.toBlow.addAll(pPositions);
|
this.toBlow.addAll(pPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, boolean fired, BlockInteraction blockinteraction)
|
public MissileExplosion(Level level, @Nullable Entity source, double x, double y, double z, float radius, boolean fired, BlockInteraction blockinteraction) {
|
||||||
{
|
|
||||||
this(level, source, null, null, x, y, z, radius, fired, blockinteraction);
|
this(level, source, null, null, x, y, z, radius, fired, blockinteraction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissileExplosion(Level level, @Nullable Entity source, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator damagecalculator, double x, double y, double z, float radius, boolean fired, BlockInteraction blockinteraction)
|
public MissileExplosion(Level level, @Nullable Entity source, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator damagecalculator, double x, double y, double z, float radius, boolean fired, BlockInteraction blockinteraction) {
|
||||||
{
|
|
||||||
super(level, source, damagesource, damagecalculator, x, y, z, radius, fired, blockinteraction);
|
super(level, source, damagesource, damagecalculator, x, y, z, radius, fired, blockinteraction);
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
@ -89,49 +82,41 @@ public class MissileExplosion extends Explosion
|
|||||||
this.z = z;
|
this.z = z;
|
||||||
this.fire = fired;
|
this.fire = fired;
|
||||||
this.blockInteraction = blockinteraction;
|
this.blockInteraction = blockinteraction;
|
||||||
this.damageSource = damagesource == null ? DamageSource.explosion(this) : damagesource;
|
// this.damageSource = damagesource == null ? DamageSource.explosion(this) : damagesource; TODO
|
||||||
|
this.damageSource = damagesource == null ? level.damageSources().explosion(this) : damagesource;
|
||||||
this.damageCalculator = damagecalculator == null ? this.makeDamageCalculator(source) : damagecalculator;
|
this.damageCalculator = damagecalculator == null ? this.makeDamageCalculator(source) : damagecalculator;
|
||||||
this.position = new Vec3(this.x, this.y, this.z);
|
this.position = new Vec3(this.x, this.y, this.z);
|
||||||
if (source != null && source.isPassenger())
|
if (source != null && source.isPassenger()) {
|
||||||
{
|
|
||||||
Entity vehicle = source.getVehicle();
|
Entity vehicle = source.getVehicle();
|
||||||
if (vehicle instanceof Machine)
|
if (vehicle instanceof Machine) {
|
||||||
{
|
|
||||||
this.damagemultiplier = ((Machine) vehicle).type.specs.damagemultiplier.get();
|
this.damagemultiplier = ((Machine) vehicle).type.specs.damagemultiplier.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity pEntity)
|
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity pEntity) {
|
||||||
{
|
|
||||||
return pEntity == null ? EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(pEntity);
|
return pEntity == null ? EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(pEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getSeenPercent(Vec3 pExplosionVector, Entity pEntity)
|
public static float getSeenPercent(Vec3 pExplosionVector, Entity pEntity) {
|
||||||
{
|
|
||||||
AABB aabb = pEntity.getBoundingBox();
|
AABB aabb = pEntity.getBoundingBox();
|
||||||
double d0 = 1.0D / ((aabb.maxX - aabb.minX) * 2.0D + 1.0D);
|
double d0 = 1.0D / ((aabb.maxX - aabb.minX) * 2.0D + 1.0D);
|
||||||
double d1 = 1.0D / ((aabb.maxY - aabb.minY) * 2.0D + 1.0D);
|
double d1 = 1.0D / ((aabb.maxY - aabb.minY) * 2.0D + 1.0D);
|
||||||
double d2 = 1.0D / ((aabb.maxZ - aabb.minZ) * 2.0D + 1.0D);
|
double d2 = 1.0D / ((aabb.maxZ - aabb.minZ) * 2.0D + 1.0D);
|
||||||
double d3 = (1.0D - Math.floor(1.0D / d0) * d0) / 2.0D;
|
double d3 = (1.0D - Math.floor(1.0D / d0) * d0) / 2.0D;
|
||||||
double d4 = (1.0D - Math.floor(1.0D / d2) * d2) / 2.0D;
|
double d4 = (1.0D - Math.floor(1.0D / d2) * d2) / 2.0D;
|
||||||
if (!(d0 < 0.0D) && !(d1 < 0.0D) && !(d2 < 0.0D))
|
if (!(d0 < 0.0D) && !(d1 < 0.0D) && !(d2 < 0.0D)) {
|
||||||
{
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
for (double d5 = 0.0D; d5 <= 1.0D; d5 += d0)
|
for (double d5 = 0.0D; d5 <= 1.0D; d5 += d0) {
|
||||||
{
|
for (double d6 = 0.0D; d6 <= 1.0D; d6 += d1) {
|
||||||
for (double d6 = 0.0D; d6 <= 1.0D; d6 += d1)
|
for (double d7 = 0.0D; d7 <= 1.0D; d7 += d2) {
|
||||||
{
|
|
||||||
for (double d7 = 0.0D; d7 <= 1.0D; d7 += d2)
|
|
||||||
{
|
|
||||||
double d8 = Mth.lerp(d5, aabb.minX, aabb.maxX);
|
double d8 = Mth.lerp(d5, aabb.minX, aabb.maxX);
|
||||||
double d9 = Mth.lerp(d6, aabb.minY, aabb.maxY);
|
double d9 = Mth.lerp(d6, aabb.minY, aabb.maxY);
|
||||||
double d10 = Mth.lerp(d7, aabb.minZ, aabb.maxZ);
|
double d10 = Mth.lerp(d7, aabb.minZ, aabb.maxZ);
|
||||||
Vec3 vec3 = new Vec3(d8 + d3, d9, d10 + d4);
|
Vec3 vec3 = new Vec3(d8 + d3, d9, d10 + d4);
|
||||||
if (pEntity.level.clip(new ClipContext(vec3, pExplosionVector, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, pEntity)).getType() == HitResult.Type.MISS)
|
if (pEntity.level().clip(new ClipContext(vec3, pExplosionVector, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, pEntity)).getType() == HitResult.Type.MISS) {
|
||||||
{
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +126,7 @@ public class MissileExplosion extends Explosion
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (float) i / (float) j;
|
return (float) i / (float) j;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0.0F;
|
return 0.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,19 +135,14 @@ public class MissileExplosion extends Explosion
|
|||||||
* Does the first part of the explosion (destroy blocks)
|
* Does the first part of the explosion (destroy blocks)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void explode()
|
public void explode() {
|
||||||
{
|
this.level.gameEvent(this.source, GameEvent.EXPLODE, new BlockPos((int) this.x, (int) this.y, (int) this.z));
|
||||||
this.level.gameEvent(this.source, GameEvent.EXPLODE, new BlockPos(this.x, this.y, this.z));
|
|
||||||
Set<BlockPos> set = Sets.newHashSet();
|
Set<BlockPos> set = Sets.newHashSet();
|
||||||
|
|
||||||
for (int j = 0; j < 16; ++j)
|
for (int j = 0; j < 16; ++j) {
|
||||||
{
|
for (int k = 0; k < 16; ++k) {
|
||||||
for (int k = 0; k < 16; ++k)
|
for (int l = 0; l < 16; ++l) {
|
||||||
{
|
if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) {
|
||||||
for (int l = 0; l < 16; ++l)
|
|
||||||
{
|
|
||||||
if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15)
|
|
||||||
{
|
|
||||||
double d0 = (float) j / 15.0F * 2.0F - 1.0F;
|
double d0 = (float) j / 15.0F * 2.0F - 1.0F;
|
||||||
double d1 = (float) k / 15.0F * 2.0F - 1.0F;
|
double d1 = (float) k / 15.0F * 2.0F - 1.0F;
|
||||||
double d2 = (float) l / 15.0F * 2.0F - 1.0F;
|
double d2 = (float) l / 15.0F * 2.0F - 1.0F;
|
||||||
@ -177,24 +155,20 @@ public class MissileExplosion extends Explosion
|
|||||||
double d6 = this.y;
|
double d6 = this.y;
|
||||||
double d8 = this.z;
|
double d8 = this.z;
|
||||||
|
|
||||||
for (; f > 0.0F; f -= 0.22500001F)
|
for (; f > 0.0F; f -= 0.22500001F) {
|
||||||
{
|
BlockPos blockpos = new BlockPos((int) d4, (int) d6, (int) d8); //TODO
|
||||||
BlockPos blockpos = new BlockPos(d4, d6, d8);
|
|
||||||
BlockState blockstate = this.level.getBlockState(blockpos);
|
BlockState blockstate = this.level.getBlockState(blockpos);
|
||||||
FluidState fluidstate = this.level.getFluidState(blockpos);
|
FluidState fluidstate = this.level.getFluidState(blockpos);
|
||||||
if (!this.level.isInWorldBounds(blockpos))
|
if (!this.level.isInWorldBounds(blockpos)) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this, this.level, blockpos, blockstate, fluidstate);
|
Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this, this.level, blockpos, blockstate, fluidstate);
|
||||||
if (optional.isPresent())
|
if (optional.isPresent()) {
|
||||||
{
|
|
||||||
f -= (optional.get() + 0.3F) * 0.3F;
|
f -= (optional.get() + 0.3F) * 0.3F;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockpos, blockstate, f))
|
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockpos, blockstate, f)) {
|
||||||
{
|
|
||||||
set.add(blockpos);
|
set.add(blockpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,19 +193,15 @@ public class MissileExplosion extends Explosion
|
|||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.level, this, list, f2);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.level, this, list, f2);
|
||||||
Vec3 vec3 = new Vec3(this.x, this.y, this.z);
|
Vec3 vec3 = new Vec3(this.x, this.y, this.z);
|
||||||
|
|
||||||
for (Entity entity : list)
|
for (Entity entity : list) {
|
||||||
{
|
if (!entity.ignoreExplosion()) {
|
||||||
if (!entity.ignoreExplosion())
|
|
||||||
{
|
|
||||||
double d12 = Math.sqrt(entity.distanceToSqr(vec3)) / (double) f2;
|
double d12 = Math.sqrt(entity.distanceToSqr(vec3)) / (double) f2;
|
||||||
if (d12 <= 1.0D)
|
if (d12 <= 1.0D) {
|
||||||
{
|
|
||||||
double d5 = entity.getX() - this.x;
|
double d5 = entity.getX() - this.x;
|
||||||
double d7 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.y;
|
double d7 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.y;
|
||||||
double d9 = entity.getZ() - this.z;
|
double d9 = entity.getZ() - this.z;
|
||||||
double d13 = Math.sqrt(d5 * d5 + d7 * d7 + d9 * d9);
|
double d13 = Math.sqrt(d5 * d5 + d7 * d7 + d9 * d9);
|
||||||
if (d13 != 0.0D)
|
if (d13 != 0.0D) {
|
||||||
{
|
|
||||||
d5 /= d13;
|
d5 /= d13;
|
||||||
d7 /= d13;
|
d7 /= d13;
|
||||||
d9 /= d13;
|
d9 /= d13;
|
||||||
@ -239,17 +209,14 @@ public class MissileExplosion extends Explosion
|
|||||||
double d10 = (1.0D - d12) * d14;
|
double d10 = (1.0D - d12) * d14;
|
||||||
entity.hurt(this.getDamageSource(), this.damagemultiplier * (int) ((d10 * d10 + d10) / 2.0D * 7.0D * (double) f2 + 1.0D));
|
entity.hurt(this.getDamageSource(), this.damagemultiplier * (int) ((d10 * d10 + d10) / 2.0D * 7.0D * (double) f2 + 1.0D));
|
||||||
double d11 = d10;
|
double d11 = d10;
|
||||||
if (entity instanceof LivingEntity)
|
if (entity instanceof LivingEntity) {
|
||||||
{
|
|
||||||
d11 = ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d10);
|
d11 = ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d10);
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setDeltaMovement(entity.getDeltaMovement().add(d5 * d11, d7 * d11, d9 * d11));
|
entity.setDeltaMovement(entity.getDeltaMovement().add(d5 * d11, d7 * d11, d9 * d11));
|
||||||
if (entity instanceof Player)
|
if (entity instanceof Player) {
|
||||||
{
|
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
if (!player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying))
|
if (!player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying)) {
|
||||||
{
|
|
||||||
this.hitPlayers.put(player, new Vec3(d5 * d10, d7 * d10, d9 * d10));
|
this.hitPlayers.put(player, new Vec3(d5 * d10, d7 * d10, d9 * d10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,45 +231,34 @@ public class MissileExplosion extends Explosion
|
|||||||
* Does the second part of the explosion (sound, particles, drop spawn)
|
* Does the second part of the explosion (sound, particles, drop spawn)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void finalizeExplosion(boolean pSpawnParticles)
|
public void finalizeExplosion(boolean pSpawnParticles) {
|
||||||
{
|
if (this.level.isClientSide) {
|
||||||
if (this.level.isClientSide)
|
|
||||||
{
|
|
||||||
this.level.playLocalSound(this.x, this.y, this.z, SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 4.0F, (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, false);
|
this.level.playLocalSound(this.x, this.y, this.z, SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 4.0F, (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean flag = this.blockInteraction != BlockInteraction.NONE;
|
boolean flag = this.blockInteraction != BlockInteraction.KEEP; //TODO
|
||||||
if (pSpawnParticles)
|
if (pSpawnParticles) {
|
||||||
{
|
if (!(this.radius < 2.0F) && flag) {
|
||||||
if (!(this.radius < 2.0F) && flag)
|
|
||||||
{
|
|
||||||
this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.level.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
this.level.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag)
|
if (flag) {
|
||||||
{
|
|
||||||
ObjectArrayList<Pair<ItemStack, BlockPos>> objectarraylist = new ObjectArrayList<>();
|
ObjectArrayList<Pair<ItemStack, BlockPos>> objectarraylist = new ObjectArrayList<>();
|
||||||
Collections.shuffle(this.toBlow, new Random(this.level.random.nextInt()));
|
Collections.shuffle(this.toBlow, new Random(this.level.random.nextInt()));
|
||||||
|
|
||||||
for (BlockPos blockpos : this.toBlow)
|
for (BlockPos blockpos : this.toBlow) {
|
||||||
{
|
|
||||||
BlockState blockstate = this.level.getBlockState(blockpos);
|
BlockState blockstate = this.level.getBlockState(blockpos);
|
||||||
Block block = blockstate.getBlock();
|
Block block = blockstate.getBlock();
|
||||||
if (!blockstate.isAir())
|
if (!blockstate.isAir()) {
|
||||||
{
|
|
||||||
BlockPos blockpos1 = blockpos.immutable();
|
BlockPos blockpos1 = blockpos.immutable();
|
||||||
this.level.getProfiler().push("explosion_blocks");
|
this.level.getProfiler().push("explosion_blocks");
|
||||||
if (blockstate.canDropFromExplosion(this.level, blockpos, this) && this.level instanceof ServerLevel)
|
if (blockstate.canDropFromExplosion(this.level, blockpos, this) && this.level instanceof ServerLevel) {
|
||||||
{
|
|
||||||
BlockEntity blockentity = blockstate.hasBlockEntity() ? this.level.getBlockEntity(blockpos) : null;
|
BlockEntity blockentity = blockstate.hasBlockEntity() ? this.level.getBlockEntity(blockpos) : null;
|
||||||
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.level)).withRandom(this.level.random).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockpos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParams.BLOCK_ENTITY, blockentity).withOptionalParameter(LootContextParams.THIS_ENTITY, this.source);
|
LootParams.Builder lootcontext$builder = (new LootParams.Builder((ServerLevel) this.level)).withLuck(this.level.random.nextFloat()).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockpos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParams.BLOCK_ENTITY, blockentity).withOptionalParameter(LootContextParams.THIS_ENTITY, this.source);
|
||||||
if (this.blockInteraction == BlockInteraction.DESTROY)
|
if (this.blockInteraction == BlockInteraction.DESTROY) {
|
||||||
{
|
|
||||||
lootcontext$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, this.radius);
|
lootcontext$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, this.radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,18 +272,14 @@ public class MissileExplosion extends Explosion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Pair<ItemStack, BlockPos> pair : objectarraylist)
|
for (Pair<ItemStack, BlockPos> pair : objectarraylist) {
|
||||||
{
|
|
||||||
Block.popResource(this.level, pair.getSecond(), pair.getFirst());
|
Block.popResource(this.level, pair.getSecond(), pair.getFirst());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fire)
|
if (this.fire) {
|
||||||
{
|
for (BlockPos blockpos2 : this.toBlow) {
|
||||||
for (BlockPos blockpos2 : this.toBlow)
|
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockpos2).isAir() && this.level.getBlockState(blockpos2.below()).isSolidRender(this.level, blockpos2.below())) {
|
||||||
{
|
|
||||||
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockpos2).isAir() && this.level.getBlockState(blockpos2.below()).isSolidRender(this.level, blockpos2.below()))
|
|
||||||
{
|
|
||||||
this.level.setBlockAndUpdate(blockpos2, BaseFireBlock.getState(this.level, blockpos2));
|
this.level.setBlockAndUpdate(blockpos2, BaseFireBlock.getState(this.level, blockpos2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,20 +287,16 @@ public class MissileExplosion extends Explosion
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPos>> pDropPositionArray, ItemStack pStack, BlockPos pPos)
|
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPos>> pDropPositionArray, ItemStack pStack, BlockPos pPos) {
|
||||||
{
|
|
||||||
int i = pDropPositionArray.size();
|
int i = pDropPositionArray.size();
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j)
|
for (int j = 0; j < i; ++j) {
|
||||||
{
|
|
||||||
Pair<ItemStack, BlockPos> pair = pDropPositionArray.get(j);
|
Pair<ItemStack, BlockPos> pair = pDropPositionArray.get(j);
|
||||||
ItemStack itemstack = pair.getFirst();
|
ItemStack itemstack = pair.getFirst();
|
||||||
if (ItemEntity.areMergable(itemstack, pStack))
|
if (ItemEntity.areMergable(itemstack, pStack)) {
|
||||||
{
|
|
||||||
ItemStack itemstack1 = ItemEntity.merge(itemstack, pStack, 16);
|
ItemStack itemstack1 = ItemEntity.merge(itemstack, pStack, 16);
|
||||||
pDropPositionArray.set(j, Pair.of(itemstack1, pair.getSecond()));
|
pDropPositionArray.set(j, Pair.of(itemstack1, pair.getSecond()));
|
||||||
if (pStack.isEmpty())
|
if (pStack.isEmpty()) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -358,73 +306,57 @@ public class MissileExplosion extends Explosion
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DamageSource getDamageSource()
|
public DamageSource getDamageSource() {
|
||||||
{
|
|
||||||
return this.damageSource;
|
return this.damageSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Player, Vec3> getHitPlayers()
|
public Map<Player, Vec3> getHitPlayers() {
|
||||||
{
|
|
||||||
return this.hitPlayers;
|
return this.hitPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Returns either the entity that placed the explosive block, the entity that caused the explosion or null.
|
// * Returns either the entity that placed the explosive block, the entity that caused the explosion or null.
|
||||||
*/
|
// */
|
||||||
@Nullable
|
// @Nullable
|
||||||
@Override
|
// @Override
|
||||||
public LivingEntity getSourceMob()
|
// public LivingEntity getSourceMob() {
|
||||||
{
|
// if (this.source == null) {
|
||||||
if (this.source == null)
|
// return null;
|
||||||
{
|
// } else if (this.source instanceof PrimedTnt) {
|
||||||
return null;
|
// return ((PrimedTnt) this.source).getOwner();
|
||||||
}
|
// } else if (this.source instanceof LivingEntity) {
|
||||||
else if (this.source instanceof PrimedTnt)
|
// return (LivingEntity) this.source;
|
||||||
{
|
// } else {
|
||||||
return ((PrimedTnt)this.source).getOwner();
|
// if (this.source instanceof Projectile) {
|
||||||
}
|
// Entity entity = ((Projectile) this.source).getOwner();
|
||||||
else if (this.source instanceof LivingEntity)
|
// if (entity instanceof LivingEntity) {
|
||||||
{
|
// return (LivingEntity) entity;
|
||||||
return (LivingEntity)this.source;
|
// }
|
||||||
}
|
// }
|
||||||
else
|
//
|
||||||
{
|
// return null;
|
||||||
if (this.source instanceof Projectile)
|
// }
|
||||||
{
|
// }
|
||||||
Entity entity = ((Projectile)this.source).getOwner();
|
|
||||||
if (entity instanceof LivingEntity)
|
|
||||||
{
|
|
||||||
return (LivingEntity)entity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearToBlow()
|
public void clearToBlow() {
|
||||||
{
|
|
||||||
this.toBlow.clear();
|
this.toBlow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BlockPos> getToBlow()
|
public List<BlockPos> getToBlow() {
|
||||||
{
|
|
||||||
return this.toBlow;
|
return this.toBlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getPosition()
|
public Vec3 getPosition() {
|
||||||
{
|
|
||||||
return this.position;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Entity getExploder()
|
public Entity getExploder() {
|
||||||
{
|
|
||||||
return this.source;
|
return this.source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,10 @@ package ru.magistu.siegemachines.entity.projectile;
|
|||||||
import ru.magistu.siegemachines.config.MissileSpecs;
|
import ru.magistu.siegemachines.config.MissileSpecs;
|
||||||
import ru.magistu.siegemachines.config.SpecsConfig;
|
import ru.magistu.siegemachines.config.SpecsConfig;
|
||||||
|
|
||||||
public enum MissileType
|
public enum MissileType {
|
||||||
{
|
|
||||||
CANNONBALL(SpecsConfig.CANNONBALL, 1.5f, true, FlightType.SPINNING, 1.0f),
|
CANNONBALL(SpecsConfig.CANNONBALL, 1.5f, true, FlightType.SPINNING, 1.0f),
|
||||||
STONE(SpecsConfig.STONE, 1.5f, true, FlightType.SPINNING, 1.0f),
|
STONE(SpecsConfig.STONE, 1.5f, true, FlightType.SPINNING, 1.0f),
|
||||||
GIANT_STONE(SpecsConfig.GIANT_STONE, 3.0f, true, FlightType.SPINNING, 1.0f);
|
GIANT_STONE(SpecsConfig.GIANT_STONE, 3.0f, true, FlightType.SPINNING, 1.0f);
|
||||||
//GIANT_ARROW(SpecsConfig.GIANT_ARROW, 1.5f, false, FlightType.AHEAD, 0.5f);
|
|
||||||
|
|
||||||
public final MissileSpecs specs;
|
public final MissileSpecs specs;
|
||||||
public final float knockback;
|
public final float knockback;
|
||||||
@ -16,8 +14,7 @@ public enum MissileType
|
|||||||
public final FlightType flighttype;
|
public final FlightType flighttype;
|
||||||
public final float armorpiercing;
|
public final float armorpiercing;
|
||||||
|
|
||||||
MissileType(MissileSpecs specs, float knockback, boolean explosive, FlightType headingtype, float armorpiercing)
|
MissileType(MissileSpecs specs, float knockback, boolean explosive, FlightType headingtype, float armorpiercing) {
|
||||||
{
|
|
||||||
this.specs = specs;
|
this.specs = specs;
|
||||||
this.knockback = knockback;
|
this.knockback = knockback;
|
||||||
this.explosive = explosive;
|
this.explosive = explosive;
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import ru.magistu.siegemachines.entity.EntityTypes;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.projectile.Arrow;
|
import net.minecraft.world.entity.projectile.Arrow;
|
||||||
import net.minecraft.world.entity.projectile.Projectile;
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import ru.magistu.siegemachines.entity.EntityTypes;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
|
|
||||||
public class ProjectileBuilder<T extends Projectile>
|
public class ProjectileBuilder<T extends Projectile> {
|
||||||
{
|
|
||||||
public final static ProjectileBuilder<Stone> NONE = new ProjectileBuilder<>(Items.AIR, EntityTypes.STONE.get(), Stone::new);
|
public final static ProjectileBuilder<Stone> NONE = new ProjectileBuilder<>(Items.AIR, EntityTypes.STONE.get(), Stone::new);
|
||||||
|
|
||||||
public final static ProjectileBuilder<?>[] NO_AMMO = new ProjectileBuilder[]{};
|
public final static ProjectileBuilder<?>[] NO_AMMO = new ProjectileBuilder[]{};
|
||||||
@ -37,21 +36,18 @@ public class ProjectileBuilder<T extends Projectile>
|
|||||||
public final EntityType<T> entitytype;
|
public final EntityType<T> entitytype;
|
||||||
public final IProjectileFactory<T> factory;
|
public final IProjectileFactory<T> factory;
|
||||||
|
|
||||||
public ProjectileBuilder(Item item, EntityType<T> entitytype, IProjectileFactory<T> factory)
|
public ProjectileBuilder(Item item, EntityType<T> entitytype, IProjectileFactory<T> factory) {
|
||||||
{
|
|
||||||
this(item, item, entitytype, factory);
|
this(item, item, entitytype, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectileBuilder(Item item, Item projectilitem, EntityType<T> entitytype, IProjectileFactory<T> factory)
|
public ProjectileBuilder(Item item, Item projectilitem, EntityType<T> entitytype, IProjectileFactory<T> factory) {
|
||||||
{
|
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.projectilitem = projectilitem;
|
this.projectilitem = projectilitem;
|
||||||
this.entitytype = entitytype;
|
this.entitytype = entitytype;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T build(Level level, Vector3d pos, LivingEntity entity)
|
public T build(Level level, Vec3 pos, LivingEntity entity) {
|
||||||
{
|
|
||||||
return this.factory.create(this.entitytype, level, pos, entity, this.item);
|
return this.factory.create(this.entitytype, level, pos, entity, this.item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
package ru.magistu.siegemachines.entity.projectile;
|
package ru.magistu.siegemachines.entity.projectile;
|
||||||
|
|
||||||
import com.mojang.math.Vector3d;
|
|
||||||
import ru.magistu.siegemachines.item.ModItems;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import ru.magistu.siegemachines.item.ModItems;
|
||||||
|
|
||||||
public class Stone extends Missile
|
public class Stone extends Missile {
|
||||||
{
|
public Stone(EntityType<Stone> entitytype, Level level) {
|
||||||
public Stone(EntityType<Stone> entitytype, Level level)
|
|
||||||
{
|
|
||||||
super(entitytype, level);
|
super(entitytype, level);
|
||||||
this.item = ModItems.STONE.get();
|
this.item = ModItems.STONE.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stone(EntityType<Stone> entitytype, Level level, Vector3d pos, LivingEntity entity, Item item)
|
public Stone(EntityType<Stone> entitytype, Level level, Vec3 pos, LivingEntity entity, Item item) {
|
||||||
{
|
|
||||||
super(entitytype, level, pos, entity, MissileType.STONE, item);
|
super(entitytype, level, pos, entity, MissileType.STONE, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,21 @@ import net.minecraft.network.chat.Component;
|
|||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.stats.Stats;
|
import net.minecraft.stats.Stats;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.InteractionResultHolder;
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
import net.minecraft.world.entity.*;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.MobSpawnType;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.TooltipFlag;
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
import net.minecraft.world.level.*;
|
import net.minecraft.world.level.BaseSpawner;
|
||||||
|
import net.minecraft.world.level.ClipContext;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
||||||
@ -39,10 +44,10 @@ import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer;
|
|||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
import ru.magistu.siegemachines.entity.machine.MachineType;
|
import ru.magistu.siegemachines.entity.machine.MachineType;
|
||||||
import ru.magistu.siegemachines.entity.projectile.ProjectileBuilder;
|
import ru.magistu.siegemachines.entity.projectile.ProjectileBuilder;
|
||||||
import software.bernie.geckolib3.core.IAnimatable;
|
import software.bernie.geckolib.core.animatable.GeoAnimatable;
|
||||||
import software.bernie.geckolib3.core.manager.AnimationData;
|
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib3.core.manager.AnimationFactory;
|
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||||
import software.bernie.geckolib3.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -50,40 +55,33 @@ import java.util.Objects;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
public class MachineItem<T extends Machine> extends Item implements GeoAnimatable {
|
||||||
{
|
private final AnimatableInstanceCache factory = GeckoLibUtil.createInstanceCache(this);
|
||||||
private final AnimationFactory factory = GeckoLibUtil.createFactory(this);
|
|
||||||
|
|
||||||
private final Supplier<EntityType<T>> entitytype;
|
private final Supplier<EntityType<T>> entitytype;
|
||||||
private final Supplier<MachineType> machinetype;
|
private final Supplier<MachineType> machinetype;
|
||||||
|
|
||||||
public MachineItem(Properties prop, Supplier<EntityType<T>> entitytype, Supplier<MachineType> machinetype)
|
public MachineItem(Properties prop, Supplier<EntityType<T>> entitytype, Supplier<MachineType> machinetype) {
|
||||||
{
|
|
||||||
super(prop.stacksTo(1));
|
super(prop.stacksTo(1));
|
||||||
this.entitytype = entitytype;
|
this.entitytype = entitytype;
|
||||||
this.machinetype = machinetype;
|
this.machinetype = machinetype;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public MachineItemGeoRenderer<T> getRenderer()
|
public MachineItemGeoRenderer<T> getRenderer() {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltip, TooltipFlag flag)
|
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltip, TooltipFlag flag) {
|
||||||
{
|
|
||||||
if (KeyBindings.getUseKey(this.machinetype.get()) != null)
|
if (KeyBindings.getUseKey(this.machinetype.get()) != null)
|
||||||
tooltip.add(Component.translatable(SiegeMachines.ID + ".usage", KeyBindings.getUseKey(this.machinetype.get()).getKey().getDisplayName()).withStyle(ChatFormatting.BLUE));
|
tooltip.add(Component.translatable(SiegeMachines.ID + ".usage", KeyBindings.getUseKey(this.machinetype.get()).getKey().getDisplayName()).withStyle(ChatFormatting.BLUE));
|
||||||
|
|
||||||
ProjectileBuilder<?>[] ammo = this.machinetype.get().ammo;
|
ProjectileBuilder<?>[] ammo = this.machinetype.get().ammo;
|
||||||
if (ammo.length > 0)
|
if (ammo.length > 0) {
|
||||||
{
|
|
||||||
tooltip.add(Component.translatable(SiegeMachines.ID + ".ammo").withStyle(ChatFormatting.BLUE));
|
tooltip.add(Component.translatable(SiegeMachines.ID + ".ammo").withStyle(ChatFormatting.BLUE));
|
||||||
for (ProjectileBuilder<?> builder : ammo)
|
for (ProjectileBuilder<?> builder : ammo) {
|
||||||
{
|
if (this.machinetype.get().usesgunpowder) {
|
||||||
if (this.machinetype.get().usesgunpowder)
|
|
||||||
{
|
|
||||||
tooltip.add(Component.translatable(SiegeMachines.ID + ".uses_gunpowder").withStyle(ChatFormatting.BLUE));
|
tooltip.add(Component.translatable(SiegeMachines.ID + ".uses_gunpowder").withStyle(ChatFormatting.BLUE));
|
||||||
}
|
}
|
||||||
tooltip.add(Component.literal(" ").append(Component.translatable(builder.item.getDescriptionId())).withStyle(ChatFormatting.BLUE));
|
tooltip.add(Component.literal(" ").append(Component.translatable(builder.item.getDescriptionId())).withStyle(ChatFormatting.BLUE));
|
||||||
@ -94,19 +92,16 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
@Override
|
@Override
|
||||||
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
|
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
|
||||||
super.initializeClient(consumer);
|
super.initializeClient(consumer);
|
||||||
consumer.accept(new IClientItemExtensions()
|
consumer.accept(new IClientItemExtensions() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntityWithoutLevelRenderer getCustomRenderer()
|
public BlockEntityWithoutLevelRenderer getCustomRenderer() {
|
||||||
{
|
|
||||||
return MachineItem.this.getRenderer();
|
return MachineItem.this.getRenderer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull InteractionResult useOn(UseOnContext context)
|
public @NotNull InteractionResult useOn(UseOnContext context) {
|
||||||
{
|
|
||||||
Level world = context.getLevel();
|
Level world = context.getLevel();
|
||||||
if (!(world instanceof ServerLevel))
|
if (!(world instanceof ServerLevel))
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
@ -115,14 +110,12 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
BlockPos blockpos = context.getClickedPos();
|
BlockPos blockpos = context.getClickedPos();
|
||||||
Direction direction = context.getClickedFace();
|
Direction direction = context.getClickedFace();
|
||||||
BlockState blockstate = world.getBlockState(blockpos);
|
BlockState blockstate = world.getBlockState(blockpos);
|
||||||
if (blockstate.is(Blocks.SPAWNER))
|
if (blockstate.is(Blocks.SPAWNER)) {
|
||||||
{
|
|
||||||
BlockEntity tileentity = world.getBlockEntity(blockpos);
|
BlockEntity tileentity = world.getBlockEntity(blockpos);
|
||||||
if (tileentity instanceof SpawnerBlockEntity)
|
if (tileentity instanceof SpawnerBlockEntity) {
|
||||||
{
|
|
||||||
BaseSpawner abstractspawner = ((SpawnerBlockEntity) tileentity).getSpawner();
|
BaseSpawner abstractspawner = ((SpawnerBlockEntity) tileentity).getSpawner();
|
||||||
EntityType<T> entitytype1 = this.getType(itemstack.getTag());
|
EntityType<T> entitytype1 = this.getType(itemstack.getTag());
|
||||||
abstractspawner.setEntityId(entitytype1);
|
abstractspawner.setEntityId(entitytype1, world, RandomSource.create().fork(), blockpos); //RandomSource возможно не такой
|
||||||
tileentity.setChanged();
|
tileentity.setChanged();
|
||||||
world.sendBlockUpdated(blockpos, blockstate, blockstate, 3);
|
world.sendBlockUpdated(blockpos, blockstate, blockstate, 3);
|
||||||
itemstack.shrink(1);
|
itemstack.shrink(1);
|
||||||
@ -139,8 +132,7 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
EntityType<T> entitytype = this.getType(itemstack.getTag());
|
EntityType<T> entitytype = this.getType(itemstack.getTag());
|
||||||
Machine entity = this.spawn(entitytype, (ServerLevel) world, itemstack, context.getPlayer(), blockpos2, MobSpawnType.SPAWN_EGG, true, !Objects.equals(blockpos, blockpos2) && direction == Direction.UP, context.getRotation());
|
Machine entity = this.spawn(entitytype, (ServerLevel) world, itemstack, context.getPlayer(), blockpos2, MobSpawnType.SPAWN_EGG, true, !Objects.equals(blockpos, blockpos2) && direction == Direction.UP, context.getRotation());
|
||||||
|
|
||||||
if (entity != null)
|
if (entity != null) {
|
||||||
{
|
|
||||||
entity.deploymentticks = 200;
|
entity.deploymentticks = 200;
|
||||||
itemstack.shrink(1);
|
itemstack.shrink(1);
|
||||||
}
|
}
|
||||||
@ -148,8 +140,7 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
return InteractionResult.CONSUME;
|
return InteractionResult.CONSUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static double getYOffset(LevelReader reader, BlockPos pos, boolean bl, AABB aabb)
|
protected static double getYOffset(LevelReader reader, BlockPos pos, boolean bl, AABB aabb) {
|
||||||
{
|
|
||||||
AABB axisalignedbb = new AABB(pos);
|
AABB axisalignedbb = new AABB(pos);
|
||||||
if (bl)
|
if (bl)
|
||||||
axisalignedbb = axisalignedbb.expandTowards(0.0D, -1.0D, 0.0D);
|
axisalignedbb = axisalignedbb.expandTowards(0.0D, -1.0D, 0.0D);
|
||||||
@ -159,38 +150,43 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Machine spawn(EntityType<T> entitytype, ServerLevel level, @Nullable ItemStack stack, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw)
|
public Machine spawn(EntityType<T> entitytype, ServerLevel level, @Nullable ItemStack stack, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw) {
|
||||||
{
|
|
||||||
return this.spawn(entitytype, level, stack == null ? null : stack.getTag(), stack != null && stack.hasCustomHoverName() ? stack.getHoverName() : null, player, pos, type, bl, bl2, yaw);
|
return this.spawn(entitytype, level, stack == null ? null : stack.getTag(), stack != null && stack.hasCustomHoverName() ? stack.getHoverName() : null, player, pos, type, bl, bl2, yaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Machine spawn(EntityType<T> entitytype, ServerLevel level, @Nullable CompoundTag nbt, @Nullable Component component, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw)
|
public Machine spawn(EntityType<T> entitytype, ServerLevel level, @Nullable CompoundTag nbt, @Nullable Component component, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw) {
|
||||||
{
|
|
||||||
Machine machine = this.create(entitytype, level, nbt, component, player, pos, type, bl, bl2, yaw);
|
Machine machine = this.create(entitytype, level, nbt, component, player, pos, type, bl, bl2, yaw);
|
||||||
if (machine != null)
|
if (machine != null) {
|
||||||
{
|
|
||||||
if (net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(machine, (LevelAccessor)level, pos.getX(), pos.getY(), pos.getZ(), null, type)) return null;
|
|
||||||
level.addFreshEntityWithPassengers(machine);
|
level.addFreshEntityWithPassengers(machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
return machine;
|
return machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Nullable
|
||||||
|
// public Machine spawn(EntityType<T> entitytype, ServerLevel level, @Nullable CompoundTag nbt, @Nullable Component component, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw) {
|
||||||
|
// Machine machine = this.create(entitytype, level, nbt, component, player, pos, type, bl, bl2, yaw);
|
||||||
|
// if (machine != null) {
|
||||||
|
// if (ForgeEventFactory.doSpecialSpawn(machine, (LevelAccessor) level, pos.getX(), pos.getY(), pos.getZ(), null, type))
|
||||||
|
// return null;
|
||||||
|
// level.addFreshEntityWithPassengers(machine);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return machine;
|
||||||
|
// }
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Machine create(EntityType<T> entitytype, ServerLevel level, @Nullable CompoundTag nbt, @Nullable Component component, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw)
|
public Machine create(EntityType<T> entitytype, ServerLevel level, @Nullable CompoundTag nbt, @Nullable Component component, @Nullable Player player, BlockPos pos, MobSpawnType type, boolean bl, boolean bl2, float yaw) {
|
||||||
{
|
|
||||||
Machine machine = entitytype.create(level);
|
Machine machine = entitytype.create(level);
|
||||||
if (machine == null)
|
if (machine == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
double d0;
|
double d0;
|
||||||
if (bl)
|
if (bl) {
|
||||||
{
|
|
||||||
machine.setPos((double) pos.getX() + 0.5D, pos.getY() + 1, (double) pos.getZ() + 0.5D);
|
machine.setPos((double) pos.getX() + 0.5D, pos.getY() + 1, (double) pos.getZ() + 0.5D);
|
||||||
d0 = getYOffset(level, pos, bl2, machine.getBoundingBox());
|
d0 = getYOffset(level, pos, bl2, machine.getBoundingBox());
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
d0 = 0.0D;
|
d0 = 0.0D;
|
||||||
|
|
||||||
EntityType.updateCustomEntityTag(level, player, machine, nbt);
|
EntityType.updateCustomEntityTag(level, player, machine, nbt);
|
||||||
@ -208,8 +204,7 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull InteractionResultHolder<ItemStack> use(@NotNull Level level, Player player, @NotNull InteractionHand hand)
|
public @NotNull InteractionResultHolder<ItemStack> use(@NotNull Level level, Player player, @NotNull InteractionHand hand) {
|
||||||
{
|
|
||||||
ItemStack itemstack = player.getItemInHand(hand);
|
ItemStack itemstack = player.getItemInHand(hand);
|
||||||
BlockHitResult raytraceresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY);
|
BlockHitResult raytraceresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY);
|
||||||
|
|
||||||
@ -223,33 +218,27 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
if (!(level.getBlockState(blockpos).getBlock() instanceof IFluidBlock))
|
if (!(level.getBlockState(blockpos).getBlock() instanceof IFluidBlock))
|
||||||
return InteractionResultHolder.pass(itemstack);
|
return InteractionResultHolder.pass(itemstack);
|
||||||
|
|
||||||
if (level.mayInteract(player, blockpos) && player.mayUseItemAt(blockpos, raytraceresult.getDirection(), itemstack))
|
if (level.mayInteract(player, blockpos) && player.mayUseItemAt(blockpos, raytraceresult.getDirection(), itemstack)) {
|
||||||
{
|
|
||||||
EntityType<T> entitytype = this.getType(itemstack.getTag());
|
EntityType<T> entitytype = this.getType(itemstack.getTag());
|
||||||
Machine machine = this.spawn(entitytype, (ServerLevel) level, itemstack, player, blockpos, MobSpawnType.SPAWN_EGG, false, false, player.getYRot());
|
Machine machine = this.spawn(entitytype, (ServerLevel) level, itemstack, player, blockpos, MobSpawnType.SPAWN_EGG, false, false, player.getYRot());
|
||||||
if (machine != null)
|
if (machine != null) {
|
||||||
{
|
|
||||||
machine.deploymentticks = 200;
|
machine.deploymentticks = 200;
|
||||||
if (!player.isCreative())
|
if (!player.isCreative())
|
||||||
itemstack.shrink(1);
|
itemstack.shrink(1);
|
||||||
player.awardStat(Stats.ITEM_USED.get(this));
|
player.awardStat(Stats.ITEM_USED.get(this));
|
||||||
return InteractionResultHolder.consume(itemstack);
|
return InteractionResultHolder.consume(itemstack);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return InteractionResultHolder.pass(itemstack);
|
return InteractionResultHolder.pass(itemstack);
|
||||||
|
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return InteractionResultHolder.fail(itemstack);
|
return InteractionResultHolder.fail(itemstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public EntityType<T> getType(@Nullable CompoundTag nbt)
|
public EntityType<T> getType(@Nullable CompoundTag nbt) {
|
||||||
{
|
|
||||||
EntityType<T> defaulttype = this.entitytype.get();
|
EntityType<T> defaulttype = this.entitytype.get();
|
||||||
|
|
||||||
if (nbt != null && nbt.contains("EntityTag", 10))
|
if (nbt != null && nbt.contains("EntityTag", 10)) {
|
||||||
{
|
|
||||||
CompoundTag compoundnbt = nbt.getCompound("EntityTag");
|
CompoundTag compoundnbt = nbt.getCompound("EntityTag");
|
||||||
if (compoundnbt.contains("id", 8))
|
if (compoundnbt.contains("id", 8))
|
||||||
return (EntityType<T>) EntityType.byString(compoundnbt.getString("id")).orElse(defaulttype);
|
return (EntityType<T>) EntityType.byString(compoundnbt.getString("id")).orElse(defaulttype);
|
||||||
@ -259,14 +248,16 @@ public class MachineItem<T extends Machine> extends Item implements IAnimatable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimationData data)
|
public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnimationFactory getFactory()
|
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||||
{
|
|
||||||
return this.factory;
|
return this.factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getTick(Object o) { //Я хз что это
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,13 @@ import net.minecraftforge.registries.DeferredRegister;
|
|||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
import ru.magistu.siegemachines.client.renderer.*;
|
import ru.magistu.siegemachines.client.renderer.MachineItemGeoRenderer;
|
||||||
import ru.magistu.siegemachines.client.renderer.model.MachineItemModel;
|
import ru.magistu.siegemachines.client.renderer.model.MachineItemModel;
|
||||||
import ru.magistu.siegemachines.entity.EntityTypes;
|
import ru.magistu.siegemachines.entity.EntityTypes;
|
||||||
import ru.magistu.siegemachines.entity.machine.*;
|
import ru.magistu.siegemachines.entity.machine.*;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class ModItems
|
public class ModItems {
|
||||||
{
|
|
||||||
public static final CreativeModeTab GROUP_SM = new CreativeModeTab(SiegeMachines.ID + ".medieval_siege_machines") {
|
public static final CreativeModeTab GROUP_SM = new CreativeModeTab(SiegeMachines.ID + ".medieval_siege_machines") {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack makeIcon() {
|
public ItemStack makeIcon() {
|
||||||
@ -28,34 +27,68 @@ public class ModItems
|
|||||||
|
|
||||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SiegeMachines.ID);
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SiegeMachines.ID);
|
||||||
|
|
||||||
public static final RegistryObject<Item> MORTAR = ITEMS.register("mortar", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.MORTAR, () -> MachineType.MORTAR)
|
public static final RegistryObject<Item> MORTAR = ITEMS.register("mortar", () -> new MachineItem<>(new Item.Properties(), EntityTypes.MORTAR, () -> MachineType.MORTAR) {
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<Mortar> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("mortar"));}});
|
@Override
|
||||||
public static final RegistryObject<Item> CULVERIN = ITEMS.register("culverin", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.CULVERIN, () -> MachineType.CULVERIN)
|
@OnlyIn(Dist.CLIENT)
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<Culverin> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("culverin"));}});
|
public MachineItemGeoRenderer<Mortar> getRenderer() {
|
||||||
public static final RegistryObject<Item> CATAPULT = ITEMS.register("catapult", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.CATAPULT, () -> MachineType.CATAPULT)
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("mortar"));
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<Catapult> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("catapult"));}});
|
}
|
||||||
public static final RegistryObject<Item> TREBUCHET = ITEMS.register("trebuchet", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.TREBUCHET, () -> MachineType.TREBUCHET)
|
});
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<Trebuchet> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("trebuchet"));}});
|
public static final RegistryObject<Item> CULVERIN = ITEMS.register("culverin", () -> new MachineItem<>(new Item.Properties(), EntityTypes.CULVERIN, () -> MachineType.CULVERIN) {
|
||||||
public static final RegistryObject<Item> BALLISTA = ITEMS.register("ballista", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.BALLISTA, () -> MachineType.BALLISTA)
|
@Override
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<Ballista> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("ballista"));}});
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static final RegistryObject<Item> BATTERING_RAM = ITEMS.register("battering_ram", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.BATTERING_RAM, () -> MachineType.BATTERING_RAM)
|
public MachineItemGeoRenderer<Culverin> getRenderer() {
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<BatteringRam> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("battering_ram"));}});
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("culverin"));
|
||||||
public static final RegistryObject<Item> SIEGE_LADDER = ITEMS.register("siege_ladder", () -> new MachineItem<>(new Item.Properties().tab(ModItems.GROUP_SM), EntityTypes.SIEGE_LADDER, () -> MachineType.SIEGE_LADDER)
|
}
|
||||||
{@Override @OnlyIn(Dist.CLIENT) public MachineItemGeoRenderer<SiegeLadder> getRenderer() {return new MachineItemGeoRenderer<>(new MachineItemModel<>("siege_ladder"));}});
|
});
|
||||||
|
public static final RegistryObject<Item> CATAPULT = ITEMS.register("catapult", () -> new MachineItem<>(new Item.Properties(), EntityTypes.CATAPULT, () -> MachineType.CATAPULT) {
|
||||||
|
@Override
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public MachineItemGeoRenderer<Catapult> getRenderer() {
|
||||||
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("catapult"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
public static final RegistryObject<Item> TREBUCHET = ITEMS.register("trebuchet", () -> new MachineItem<>(new Item.Properties(), EntityTypes.TREBUCHET, () -> MachineType.TREBUCHET) {
|
||||||
|
@Override
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public MachineItemGeoRenderer<Trebuchet> getRenderer() {
|
||||||
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("trebuchet"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
public static final RegistryObject<Item> BALLISTA = ITEMS.register("ballista", () -> new MachineItem<>(new Item.Properties(), EntityTypes.BALLISTA, () -> MachineType.BALLISTA) {
|
||||||
|
@Override
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public MachineItemGeoRenderer<Ballista> getRenderer() {
|
||||||
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("ballista"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
public static final RegistryObject<Item> BATTERING_RAM = ITEMS.register("battering_ram", () -> new MachineItem<>(new Item.Properties(), EntityTypes.BATTERING_RAM, () -> MachineType.BATTERING_RAM) {
|
||||||
|
@Override
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public MachineItemGeoRenderer<BatteringRam> getRenderer() {
|
||||||
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("battering_ram"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
public static final RegistryObject<Item> SIEGE_LADDER = ITEMS.register("siege_ladder", () -> new MachineItem<>(new Item.Properties(), EntityTypes.SIEGE_LADDER, () -> MachineType.SIEGE_LADDER) {
|
||||||
|
@Override
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public MachineItemGeoRenderer<SiegeLadder> getRenderer() {
|
||||||
|
return new MachineItemGeoRenderer<>(new MachineItemModel<>("siege_ladder"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public static final RegistryObject<Item> CANNONBALL = ITEMS.register("cannonball", () -> new Item(new Item.Properties().stacksTo(16).tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> CANNONBALL = ITEMS.register("cannonball", () -> new Item(new Item.Properties().stacksTo(16)));
|
||||||
public static final RegistryObject<Item> STONE = ITEMS.register("stone", () -> new Item(new Item.Properties().stacksTo(16)));
|
public static final RegistryObject<Item> STONE = ITEMS.register("stone", () -> new Item(new Item.Properties().stacksTo(16)));
|
||||||
public static final RegistryObject<Item> GIANT_STONE = ITEMS.register("giant_stone", () -> new Item(new Item.Properties().stacksTo(16)));
|
public static final RegistryObject<Item> GIANT_STONE = ITEMS.register("giant_stone", () -> new Item(new Item.Properties().stacksTo(16)));
|
||||||
public static final RegistryObject<Item> GIANT_ARROW = ITEMS.register("giant_arrow", () -> new Item(new Item.Properties().stacksTo(16).tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> GIANT_ARROW = ITEMS.register("giant_arrow", () -> new Item(new Item.Properties().stacksTo(16)));
|
||||||
|
|
||||||
public static final RegistryObject<Item> TURRET_BASE = ITEMS.register("turret_base", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> TURRET_BASE = ITEMS.register("turret_base", () -> new Item(new Item.Properties()));
|
||||||
public static final RegistryObject<Item> BEAM = ITEMS.register("beam", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> BEAM = ITEMS.register("beam", () -> new Item(new Item.Properties()));
|
||||||
public static final RegistryObject<Item> COUNTERWEIGHT = ITEMS.register("counterweight", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> COUNTERWEIGHT = ITEMS.register("counterweight", () -> new Item(new Item.Properties()));
|
||||||
public static final RegistryObject<Item> BARREL = ITEMS.register("barrel", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> BARREL = ITEMS.register("barrel", () -> new Item(new Item.Properties()));
|
||||||
public static final RegistryObject<Item> WHEEL = ITEMS.register("wheel", () -> new Item(new Item.Properties().tab(ModItems.GROUP_SM)));
|
public static final RegistryObject<Item> WHEEL = ITEMS.register("wheel", () -> new Item(new Item.Properties());
|
||||||
|
|
||||||
public static void register(IEventBus eventBus)
|
public static void register(IEventBus eventBus) {
|
||||||
{
|
|
||||||
ITEMS.register(eventBus);
|
ITEMS.register(eventBus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,26 @@ package ru.magistu.siegemachines.item.recipes;
|
|||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.gson.*;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.GsonHelper;
|
||||||
import net.minecraft.world.inventory.CraftingContainer;
|
import net.minecraft.world.inventory.CraftingContainer;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.item.crafting.*;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import ru.magistu.siegemachines.block.ModBlocks;
|
import ru.magistu.siegemachines.block.ModBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -24,8 +30,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer> {
|
||||||
{
|
|
||||||
static ResourceLocation TYPE_ID = new ResourceLocation(SiegeMachines.ID, "siege_workbench");
|
static ResourceLocation TYPE_ID = new ResourceLocation(SiegeMachines.ID, "siege_workbench");
|
||||||
|
|
||||||
static int MAX_WIDTH = 3;
|
static int MAX_WIDTH = 3;
|
||||||
@ -46,13 +51,11 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Type implements RecipeType<SiegeWorkbenchRecipe>
|
public static class Type implements RecipeType<SiegeWorkbenchRecipe> {
|
||||||
{
|
|
||||||
public static final Type INSTANCE = new Type();
|
public static final Type INSTANCE = new Type();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return SiegeWorkbenchRecipe.TYPE_ID.toString();
|
return SiegeWorkbenchRecipe.TYPE_ID.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,8 +72,7 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public RecipeType<?> getType()
|
public RecipeType<?> getType() {
|
||||||
{
|
|
||||||
return Type.INSTANCE;
|
return Type.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,23 +87,16 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the result of this recipe, usually for display purposes (e.g. recipe book). If your recipe has more than one
|
|
||||||
* possible result (e.g. it's dynamic and depends on its inputs), then return an empty stack.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ItemStack getResultItem() {
|
public ItemStack getResultItem() {
|
||||||
return this.result;
|
return this.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CountIngredient> getRecipeItems()
|
public List<CountIngredient> getRecipeItems() {
|
||||||
{
|
|
||||||
return this.recipeitems;
|
return this.recipeitems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NonNullList<Ingredient> getIngredients()
|
public NonNullList<Ingredient> getIngredients() {
|
||||||
{
|
|
||||||
NonNullList<Ingredient> list = NonNullList.create();
|
NonNullList<Ingredient> list = NonNullList.create();
|
||||||
for (CountIngredient ingredient : this.recipeitems)
|
for (CountIngredient ingredient : this.recipeitems)
|
||||||
list.add(ingredient.get());
|
list.add(ingredient.get());
|
||||||
@ -115,6 +110,11 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
return width >= this.width && height >= this.height;
|
return width >= this.width && height >= this.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getResultItem(RegistryAccess registryAccess) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public NonNullList<ItemStack> getRemainingItems(CraftingContainer container) {
|
public NonNullList<ItemStack> getRemainingItems(CraftingContainer container) {
|
||||||
@ -133,8 +133,7 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
return NonNullList.withSize(container.getContainerSize(), ItemStack.EMPTY);
|
return NonNullList.withSize(container.getContainerSize(), ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NonNullList<ItemStack> getRemainingItems(CraftingContainer container, int width, int height, boolean mirrored)
|
private NonNullList<ItemStack> getRemainingItems(CraftingContainer container, int width, int height, boolean mirrored) {
|
||||||
{
|
|
||||||
NonNullList<ItemStack> nonnulllist = NonNullList.withSize(container.getContainerSize(), ItemStack.EMPTY);
|
NonNullList<ItemStack> nonnulllist = NonNullList.withSize(container.getContainerSize(), ItemStack.EMPTY);
|
||||||
|
|
||||||
for (int i = 0; i < container.getWidth(); ++i) {
|
for (int i = 0; i < container.getWidth(); ++i) {
|
||||||
@ -179,6 +178,11 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack assemble(CraftingContainer craftingContainer, RegistryAccess registryAccess) {
|
||||||
|
return this.getResultItem().copy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the region of a crafting inventory is match for the recipe.
|
* Checks if the region of a crafting inventory is match for the recipe.
|
||||||
*/
|
*/
|
||||||
@ -205,13 +209,6 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an Item that is the result of this recipe
|
|
||||||
*/
|
|
||||||
public ItemStack assemble(CraftingContainer container) {
|
|
||||||
return this.getResultItem().copy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return this.width;
|
return this.width;
|
||||||
}
|
}
|
||||||
@ -239,8 +236,7 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
for (int j = 0; j < pattern[i].length(); ++j) {
|
for (int j = 0; j < pattern[i].length(); ++j) {
|
||||||
String s = pattern[i].substring(j, j + 1);
|
String s = pattern[i].substring(j, j + 1);
|
||||||
CountIngredient ingredient = keys.get(s);
|
CountIngredient ingredient = keys.get(s);
|
||||||
if (ingredient == null)
|
if (ingredient == null) {
|
||||||
{
|
|
||||||
throw new JsonSyntaxException("Pattern references symbol '" + s + "' but it's not defined in the key");
|
throw new JsonSyntaxException("Pattern references symbol '" + s + "' but it's not defined in the key");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +305,8 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
|
|
||||||
private static int lastNonSpace(String entry) {
|
private static int lastNonSpace(String entry) {
|
||||||
int i;
|
int i;
|
||||||
for(i = entry.length() - 1; i >= 0 && entry.charAt(i) == ' '; --i) {}
|
for (i = entry.length() - 1; i >= 0 && entry.charAt(i) == ' '; --i) {
|
||||||
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -360,19 +357,16 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack itemStackFromJson(JsonObject stackobject)
|
public static ItemStack itemStackFromJson(JsonObject stackobject) {
|
||||||
{
|
|
||||||
return CraftingHelper.getItemStack(stackobject, true, true);
|
return CraftingHelper.getItemStack(stackobject, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<SiegeWorkbenchRecipe>
|
public static class Serializer implements RecipeSerializer<SiegeWorkbenchRecipe> {
|
||||||
{
|
|
||||||
public static final Serializer INSTANCE = new Serializer();
|
public static final Serializer INSTANCE = new Serializer();
|
||||||
public static final ResourceLocation ID = new ResourceLocation(SiegeMachines.ID, "siege_workbench");
|
public static final ResourceLocation ID = new ResourceLocation(SiegeMachines.ID, "siege_workbench");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SiegeWorkbenchRecipe fromJson(ResourceLocation recipeid, JsonObject json)
|
public SiegeWorkbenchRecipe fromJson(ResourceLocation recipeid, JsonObject json) {
|
||||||
{
|
|
||||||
Map<String, CountIngredient> map = SiegeWorkbenchRecipe.keyFromJson(GsonHelper.getAsJsonObject(json, "key"));
|
Map<String, CountIngredient> map = SiegeWorkbenchRecipe.keyFromJson(GsonHelper.getAsJsonObject(json, "key"));
|
||||||
String[] astring = SiegeWorkbenchRecipe.shrink(SiegeWorkbenchRecipe.patternFromJson(GsonHelper.getAsJsonArray(json, "pattern")));
|
String[] astring = SiegeWorkbenchRecipe.shrink(SiegeWorkbenchRecipe.patternFromJson(GsonHelper.getAsJsonArray(json, "pattern")));
|
||||||
|
|
||||||
@ -410,26 +404,5 @@ public class SiegeWorkbenchRecipe implements IShapedRecipe<CraftingContainer>
|
|||||||
|
|
||||||
buffer.writeItem(pRecipe.result);
|
buffer.writeItem(pRecipe.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public RecipeSerializer<?> setRegistryName(ResourceLocation name) {
|
|
||||||
// return INSTANCE;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Nullable
|
|
||||||
// @Override
|
|
||||||
// public ResourceLocation getRegistryName() {
|
|
||||||
// return ID;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public Class<RecipeSerializer<?>> getRegistryType() {
|
|
||||||
// return Serializer.castClass(RecipeSerializer.class);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @SuppressWarnings("unchecked") // Need this wrapper, because generics
|
|
||||||
// private static <G> Class<G> castClass(Class<?> cls) {
|
|
||||||
// return (Class<G>)cls;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
@ -8,17 +7,16 @@ import net.minecraftforge.network.NetworkDirection;
|
|||||||
import net.minecraftforge.network.NetworkRegistry;
|
import net.minecraftforge.network.NetworkRegistry;
|
||||||
import net.minecraftforge.network.simple.SimpleChannel;
|
import net.minecraftforge.network.simple.SimpleChannel;
|
||||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||||
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
|
|
||||||
public class PacketHandler
|
public class PacketHandler {
|
||||||
{
|
|
||||||
private static final String PROTOCOL_VERSION = "1";
|
private static final String PROTOCOL_VERSION = "1";
|
||||||
|
|
||||||
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(new ResourceLocation(SiegeMachines.ID, "main"), () -> "1", "1"::equals, "1"::equals);
|
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(new ResourceLocation(SiegeMachines.ID, "main"), () -> "1", "1"::equals, "1"::equals);
|
||||||
|
|
||||||
protected static int currentId = 0;
|
protected static int currentId = 0;
|
||||||
|
|
||||||
public static void init()
|
public static void init() {
|
||||||
{
|
|
||||||
INSTANCE.registerMessage(getNextId(), PacketMachine.class, PacketMachine::write, PacketMachine::read, PacketMachine.Handler::handle);
|
INSTANCE.registerMessage(getNextId(), PacketMachine.class, PacketMachine::write, PacketMachine::read, PacketMachine.Handler::handle);
|
||||||
INSTANCE.registerMessage(getNextId(), PacketMachineControl.class, PacketMachineControl::write, PacketMachineControl::read, PacketMachineControl.Handler::handle);
|
INSTANCE.registerMessage(getNextId(), PacketMachineControl.class, PacketMachineControl::write, PacketMachineControl::read, PacketMachineControl.Handler::handle);
|
||||||
INSTANCE.registerMessage(getNextId(), PacketMachineUse.class, PacketMachineUse::write, PacketMachineUse::read, PacketMachineUse.Handler::handle);
|
INSTANCE.registerMessage(getNextId(), PacketMachineUse.class, PacketMachineUse::write, PacketMachineUse::read, PacketMachineUse.Handler::handle);
|
||||||
@ -28,8 +26,7 @@ public class PacketHandler
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNextId()
|
public static int getNextId() {
|
||||||
{
|
|
||||||
int id = currentId;
|
int id = currentId;
|
||||||
currentId++;
|
currentId++;
|
||||||
return id;
|
return id;
|
||||||
@ -39,27 +36,21 @@ public class PacketHandler
|
|||||||
INSTANCE.sendToServer(packet);
|
INSTANCE.sendToServer(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendTo(Object packet, ServerPlayer player)
|
public static void sendTo(Object packet, ServerPlayer player) {
|
||||||
{
|
|
||||||
if (!(player instanceof net.minecraftforge.common.util.FakePlayer))
|
if (!(player instanceof net.minecraftforge.common.util.FakePlayer))
|
||||||
INSTANCE.sendTo(packet, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT);
|
INSTANCE.sendTo(packet, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacketToAllInArea(Object packet, BlockPos center, int rangesqr)
|
public static void sendPacketToAllInArea(Object packet, BlockPos center, int rangesqr) {
|
||||||
{
|
for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) {
|
||||||
for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers())
|
if (player.distanceToSqr(center.getX(), center.getY(), center.getZ()) < rangesqr) {
|
||||||
{
|
|
||||||
if (player.distanceToSqr(center.getX(), center.getY(), center.getZ()) < rangesqr)
|
|
||||||
{
|
|
||||||
sendTo(packet, player);
|
sendTo(packet, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacketToAll(Object packet)
|
public static void sendPacketToAll(Object packet) {
|
||||||
{
|
for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) {
|
||||||
for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers())
|
|
||||||
{
|
|
||||||
sendTo(packet, player);
|
sendTo(packet, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
@ -10,20 +9,19 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class PacketMachine
|
public class PacketMachine {
|
||||||
{
|
|
||||||
private final int entityid;
|
private final int entityid;
|
||||||
private final int delayticks;
|
private final int delayticks;
|
||||||
private final int useticks;
|
private final int useticks;
|
||||||
private final float turretyaw;
|
private final float turretyaw;
|
||||||
private final float turretpitch;
|
private final float turretpitch;
|
||||||
|
|
||||||
public PacketMachine(int entityid, int delayticks, int useticks, float turretpitch, float turretyaw)
|
public PacketMachine(int entityid, int delayticks, int useticks, float turretpitch, float turretyaw) {
|
||||||
{
|
|
||||||
this.entityid = entityid;
|
this.entityid = entityid;
|
||||||
this.delayticks = delayticks;
|
this.delayticks = delayticks;
|
||||||
this.useticks = useticks;
|
this.useticks = useticks;
|
||||||
@ -31,13 +29,11 @@ public class PacketMachine
|
|||||||
this.turretyaw = turretyaw;
|
this.turretyaw = turretyaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketMachine read(FriendlyByteBuf buf)
|
public static PacketMachine read(FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
return new PacketMachine(buf.readInt(), buf.readInt(), buf.readInt(), buf.readFloat(), buf.readFloat());
|
return new PacketMachine(buf.readInt(), buf.readInt(), buf.readInt(), buf.readFloat(), buf.readFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(PacketMachine message, FriendlyByteBuf buf)
|
public static void write(PacketMachine message, FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
buf.writeInt(message.entityid);
|
buf.writeInt(message.entityid);
|
||||||
buf.writeInt(message.delayticks);
|
buf.writeInt(message.delayticks);
|
||||||
buf.writeInt(message.useticks);
|
buf.writeInt(message.useticks);
|
||||||
@ -45,13 +41,10 @@ public class PacketMachine
|
|||||||
buf.writeFloat(message.turretyaw);
|
buf.writeFloat(message.turretyaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler
|
public static class Handler {
|
||||||
{
|
public static void handle(PacketMachine packet, Supplier<NetworkEvent.Context> ctx) {
|
||||||
public static void handle(PacketMachine packet, Supplier<NetworkEvent.Context> ctx)
|
|
||||||
{
|
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT)
|
if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) {
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachine.handleClientSide(packet));
|
context.enqueueWork(() -> PacketMachine.handleClientSide(packet));
|
||||||
}
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
@ -59,20 +52,16 @@ public class PacketMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void handleClientSide(PacketMachine packet)
|
public static void handleClientSide(PacketMachine packet) {
|
||||||
{
|
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
if(packet == null || player == null || player.level == null)
|
if (packet == null || player == null || player.level() == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = player.level.getEntity(packet.entityid);
|
Entity entity = player.level().getEntity(packet.entityid);
|
||||||
if (!(entity instanceof Machine))
|
if (!(entity instanceof Machine machine)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Machine machine = (Machine) entity;
|
|
||||||
|
|
||||||
machine.delayticks = packet.delayticks;
|
machine.delayticks = packet.delayticks;
|
||||||
machine.useticks = packet.useticks;
|
machine.useticks = packet.useticks;
|
||||||
|
@ -1,53 +1,46 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class PacketMachineControl
|
public class PacketMachineControl {
|
||||||
{
|
public PacketMachineControl() {
|
||||||
public PacketMachineControl() {}
|
}
|
||||||
|
|
||||||
public static PacketMachineControl read(FriendlyByteBuf buf)
|
public static PacketMachineControl read(FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
return new PacketMachineControl();
|
return new PacketMachineControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(PacketMachineControl message, FriendlyByteBuf buf) {}
|
public static void write(PacketMachineControl message, FriendlyByteBuf buf) {
|
||||||
|
}
|
||||||
|
|
||||||
public static class Handler
|
public static class Handler {
|
||||||
{
|
public static void handle(PacketMachineControl packet, Supplier<NetworkEvent.Context> ctx) {
|
||||||
public static void handle(PacketMachineControl packet, Supplier<NetworkEvent.Context> ctx)
|
|
||||||
{
|
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER)
|
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) {
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachineControl.handleServerSide(packet, context.getSender()));
|
context.enqueueWork(() -> PacketMachineControl.handleServerSide(packet, context.getSender()));
|
||||||
}
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleServerSide(PacketMachineControl packet, ServerPlayer player)
|
public static void handleServerSide(PacketMachineControl packet, ServerPlayer player) {
|
||||||
{
|
if (packet == null || player == null || !player.isPassenger()) {
|
||||||
if(packet == null || player == null || !player.isPassenger())
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = player.getVehicle();
|
Entity entity = player.getVehicle();
|
||||||
if (!(entity instanceof Machine))
|
if (!(entity instanceof Machine machine)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Machine machine = (Machine) entity;
|
|
||||||
|
|
||||||
machine.setTurretRotations(player.getXRot(), player.getYRot());
|
machine.setTurretRotations(player.getXRot(), player.getYRot());
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
@ -11,42 +10,36 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class PacketMachineInventorySlot
|
public class PacketMachineInventorySlot {
|
||||||
{
|
|
||||||
private final int entityid;
|
private final int entityid;
|
||||||
private final int slot;
|
private final int slot;
|
||||||
private ItemStack itemstack = ItemStack.EMPTY;
|
private ItemStack itemstack = ItemStack.EMPTY;
|
||||||
|
|
||||||
public PacketMachineInventorySlot(int entityid, int slot, ItemStack itemstack)
|
public PacketMachineInventorySlot(int entityid, int slot, ItemStack itemstack) {
|
||||||
{
|
|
||||||
this.entityid = entityid;
|
this.entityid = entityid;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.itemstack = itemstack.copy();
|
this.itemstack = itemstack.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketMachineInventorySlot read(FriendlyByteBuf buf)
|
public static PacketMachineInventorySlot read(FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
return new PacketMachineInventorySlot(buf.readInt(), buf.readInt(), buf.readItem());
|
return new PacketMachineInventorySlot(buf.readInt(), buf.readInt(), buf.readItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(PacketMachineInventorySlot message, FriendlyByteBuf buf)
|
public static void write(PacketMachineInventorySlot message, FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
buf.writeInt(message.entityid);
|
buf.writeInt(message.entityid);
|
||||||
buf.writeInt(message.slot);
|
buf.writeInt(message.slot);
|
||||||
buf.writeItemStack(message.itemstack, false);
|
buf.writeItemStack(message.itemstack, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler
|
public static class Handler {
|
||||||
{
|
public static void handle(PacketMachineInventorySlot packet, Supplier<NetworkEvent.Context> ctx) {
|
||||||
public static void handle(PacketMachineInventorySlot packet, Supplier<NetworkEvent.Context> ctx)
|
|
||||||
{
|
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT)
|
if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) {
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachineInventorySlot.handleClientSide(packet));
|
context.enqueueWork(() -> PacketMachineInventorySlot.handleClientSide(packet));
|
||||||
}
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
@ -54,17 +47,14 @@ public class PacketMachineInventorySlot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void handleClientSide(PacketMachineInventorySlot packet)
|
public static void handleClientSide(PacketMachineInventorySlot packet) {
|
||||||
{
|
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
if(packet == null || player == null || player.level == null)
|
if (packet == null || player == null || player.level() == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = player.level.getEntity(packet.entityid);
|
Entity entity = player.level().getEntity(packet.entityid);
|
||||||
if (!(entity instanceof Machine))
|
if (!(entity instanceof Machine)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Machine machine = (Machine) entity;
|
Machine machine = (Machine) entity;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
@ -10,40 +9,32 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class PacketMachineUse
|
public class PacketMachineUse {
|
||||||
{
|
|
||||||
private final int entityid;
|
private final int entityid;
|
||||||
|
|
||||||
public PacketMachineUse(int entityid)
|
public PacketMachineUse(int entityid) {
|
||||||
{
|
|
||||||
this.entityid = entityid;
|
this.entityid = entityid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketMachineUse read(FriendlyByteBuf buf)
|
public static PacketMachineUse read(FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
return new PacketMachineUse(buf.readInt());
|
return new PacketMachineUse(buf.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(PacketMachineUse message, FriendlyByteBuf buf)
|
public static void write(PacketMachineUse message, FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
buf.writeInt(message.entityid);
|
buf.writeInt(message.entityid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler
|
public static class Handler {
|
||||||
{
|
public static void handle(PacketMachineUse packet, Supplier<NetworkEvent.Context> ctx) {
|
||||||
public static void handle(PacketMachineUse packet, Supplier<NetworkEvent.Context> ctx)
|
|
||||||
{
|
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER)
|
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) {
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachineUse.handleEachSide(packet, context.getSender()));
|
context.enqueueWork(() -> PacketMachineUse.handleEachSide(packet, context.getSender()));
|
||||||
}
|
} else if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) {
|
||||||
else if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT)
|
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachineUse.handleClientSide(packet));
|
context.enqueueWork(() -> PacketMachineUse.handleClientSide(packet));
|
||||||
}
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
@ -51,24 +42,19 @@ public class PacketMachineUse
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void handleClientSide(PacketMachineUse packet)
|
public static void handleClientSide(PacketMachineUse packet) {
|
||||||
{
|
|
||||||
handleEachSide(packet, Minecraft.getInstance().player);
|
handleEachSide(packet, Minecraft.getInstance().player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleEachSide(PacketMachineUse packet, Player player)
|
public static void handleEachSide(PacketMachineUse packet, Player player) {
|
||||||
{
|
if (packet == null || player == null || player.level() == null) {
|
||||||
if(packet == null || player == null || player.level == null)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = player.level.getEntity(packet.entityid);
|
Entity entity = player.level().getEntity(packet.entityid);
|
||||||
if (!(entity instanceof Machine))
|
if (!(entity instanceof Machine machine)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Machine machine = (Machine) entity;
|
|
||||||
|
|
||||||
machine.use(player);
|
machine.use(player);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
@ -10,40 +9,32 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class PacketMachineUseRealise
|
public class PacketMachineUseRealise {
|
||||||
{
|
|
||||||
private final int entityid;
|
private final int entityid;
|
||||||
|
|
||||||
public PacketMachineUseRealise(int entityid)
|
public PacketMachineUseRealise(int entityid) {
|
||||||
{
|
|
||||||
this.entityid = entityid;
|
this.entityid = entityid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketMachineUseRealise read(FriendlyByteBuf buf)
|
public static PacketMachineUseRealise read(FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
return new PacketMachineUseRealise(buf.readInt());
|
return new PacketMachineUseRealise(buf.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(PacketMachineUseRealise message, FriendlyByteBuf buf)
|
public static void write(PacketMachineUseRealise message, FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
buf.writeInt(message.entityid);
|
buf.writeInt(message.entityid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Handler
|
public static class Handler {
|
||||||
{
|
public static void handle(PacketMachineUseRealise packet, Supplier<NetworkEvent.Context> ctx) {
|
||||||
public static void handle(PacketMachineUseRealise packet, Supplier<NetworkEvent.Context> ctx)
|
|
||||||
{
|
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER)
|
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) {
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachineUseRealise.handleEachSide(packet, context.getSender()));
|
context.enqueueWork(() -> PacketMachineUseRealise.handleEachSide(packet, context.getSender()));
|
||||||
}
|
} else if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT) {
|
||||||
else if (context.getDirection().getReceptionSide() == LogicalSide.CLIENT)
|
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketMachineUseRealise.handleClientSide(packet));
|
context.enqueueWork(() -> PacketMachineUseRealise.handleClientSide(packet));
|
||||||
}
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
@ -51,24 +42,19 @@ public class PacketMachineUseRealise
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void handleClientSide(PacketMachineUseRealise packet)
|
public static void handleClientSide(PacketMachineUseRealise packet) {
|
||||||
{
|
|
||||||
handleEachSide(packet, Minecraft.getInstance().player);
|
handleEachSide(packet, Minecraft.getInstance().player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleEachSide(PacketMachineUseRealise packet, Player player)
|
public static void handleEachSide(PacketMachineUseRealise packet, Player player) {
|
||||||
{
|
if (packet == null || player == null || player.level() == null) {
|
||||||
if(packet == null || player == null || player.level == null)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = player.level.getEntity(packet.entityid);
|
Entity entity = player.level().getEntity(packet.entityid);
|
||||||
if (!(entity instanceof Machine))
|
if (!(entity instanceof Machine machine)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Machine machine = (Machine) entity;
|
|
||||||
|
|
||||||
machine.useRealise();
|
machine.useRealise();
|
||||||
}
|
}
|
||||||
|
@ -1,53 +1,46 @@
|
|||||||
package ru.magistu.siegemachines.network;
|
package ru.magistu.siegemachines.network;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraftforge.fml.LogicalSide;
|
import net.minecraftforge.fml.LogicalSide;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
public class PacketOpenMachineInventory
|
public class PacketOpenMachineInventory {
|
||||||
{
|
public PacketOpenMachineInventory() {
|
||||||
public PacketOpenMachineInventory() {}
|
}
|
||||||
|
|
||||||
public static PacketOpenMachineInventory read(FriendlyByteBuf buf)
|
public static PacketOpenMachineInventory read(FriendlyByteBuf buf) {
|
||||||
{
|
|
||||||
return new PacketOpenMachineInventory();
|
return new PacketOpenMachineInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void write(PacketOpenMachineInventory message, FriendlyByteBuf buf) {}
|
public static void write(PacketOpenMachineInventory message, FriendlyByteBuf buf) {
|
||||||
|
}
|
||||||
|
|
||||||
public static class Handler
|
public static class Handler {
|
||||||
{
|
public static void handle(PacketOpenMachineInventory packet, Supplier<NetworkEvent.Context> ctx) {
|
||||||
public static void handle(PacketOpenMachineInventory packet, Supplier<NetworkEvent.Context> ctx)
|
|
||||||
{
|
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER)
|
if (context.getDirection().getReceptionSide() == LogicalSide.SERVER) {
|
||||||
{
|
|
||||||
context.enqueueWork(() -> PacketOpenMachineInventory.handleServerSide(packet, context.getSender()));
|
context.enqueueWork(() -> PacketOpenMachineInventory.handleServerSide(packet, context.getSender()));
|
||||||
}
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleServerSide(PacketOpenMachineInventory packet, ServerPlayer player)
|
public static void handleServerSide(PacketOpenMachineInventory packet, ServerPlayer player) {
|
||||||
{
|
if (packet == null || player == null || !player.isPassenger()) {
|
||||||
if(packet == null || player == null || !player.isPassenger())
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = player.getVehicle();
|
Entity entity = player.getVehicle();
|
||||||
if (!(entity instanceof Machine))
|
if (!(entity instanceof Machine machine)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Machine machine = (Machine) entity;
|
|
||||||
|
|
||||||
machine.openInventoryGui();
|
machine.openInventoryGui();
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,10 @@ public class SiegeWorkbenchRecipeCategory implements IRecipeCategory<SiegeWorkbe
|
|||||||
return Component.translatable("category." + SiegeMachines.ID + ".siege_workbench_crafting");
|
return Component.translatable("category." + SiegeMachines.ID + ".siege_workbench_crafting");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public IDrawable getBackground() {
|
// public IDrawable getBackground() {
|
||||||
return this.background;
|
// return this.background;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDrawable getIcon() {
|
public IDrawable getIcon() {
|
||||||
@ -53,13 +53,11 @@ public class SiegeWorkbenchRecipeCategory implements IRecipeCategory<SiegeWorkbe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(@Nonnull IRecipeLayoutBuilder builder, @Nonnull SiegeWorkbenchRecipe recipe, @Nonnull IFocusGroup focusGroup)
|
public void setRecipe(@Nonnull IRecipeLayoutBuilder builder, @Nonnull SiegeWorkbenchRecipe recipe, @Nonnull IFocusGroup focusGroup) {
|
||||||
{
|
|
||||||
builder.addSlot(RecipeIngredientRole.OUTPUT, 94, 18).addItemStack(recipe.getResultItem());
|
builder.addSlot(RecipeIngredientRole.OUTPUT, 94, 18).addItemStack(recipe.getResultItem());
|
||||||
List<CountIngredient> grid = recipe.getRecipeItems();
|
List<CountIngredient> grid = recipe.getRecipeItems();
|
||||||
|
|
||||||
for (int i = 0; i < recipe.getWidth(); ++i)
|
for (int i = 0; i < recipe.getWidth(); ++i) {
|
||||||
{
|
|
||||||
for (int j = 0; j < recipe.getHeight(); ++j)
|
for (int j = 0; j < recipe.getHeight(); ++j)
|
||||||
builder.addSlot(RecipeIngredientRole.INPUT, i * 18, j * 18).addItemStacks(grid.get(i + j * 3).getCountModifiedItemStacks());
|
builder.addSlot(RecipeIngredientRole.INPUT, i * 18, j * 18).addItemStacks(grid.get(i + j * 3).getCountModifiedItemStacks());
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,8 @@ package ru.magistu.siegemachines.proxy;
|
|||||||
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
||||||
|
|
||||||
public interface IProxy
|
public interface IProxy {
|
||||||
{
|
|
||||||
void setup(IEventBus paramIEventBus1, IEventBus paramIEventBus2);
|
void setup(IEventBus paramIEventBus1, IEventBus paramIEventBus2);
|
||||||
|
|
||||||
public void clientSetup(FMLClientSetupEvent event);
|
public void clientSetup(FMLClientSetupEvent event);
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package ru.magistu.siegemachines.server;
|
package ru.magistu.siegemachines.server;
|
||||||
|
|
||||||
import ru.magistu.siegemachines.proxy.IProxy;
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import ru.magistu.siegemachines.proxy.IProxy;
|
||||||
|
|
||||||
public class ServerProxy implements IProxy
|
public class ServerProxy implements IProxy {
|
||||||
{
|
public void setup(IEventBus modEventBus, IEventBus forgeEventBus) {
|
||||||
public void setup(IEventBus modEventBus, IEventBus forgeEventBus) {}
|
}
|
||||||
|
|
||||||
public void clientSetup(FMLClientSetupEvent event) {}
|
public void clientSetup(FMLClientSetupEvent event) {
|
||||||
|
}
|
||||||
public void onPreInit() {}
|
|
||||||
|
public void onPreInit() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@ package ru.magistu.siegemachines.util;
|
|||||||
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class CartesianGeometry
|
public class CartesianGeometry {
|
||||||
{
|
|
||||||
public static Vec3 applyRotations(Vec3 vec, double pitch, double yaw) {
|
public static Vec3 applyRotations(Vec3 vec, double pitch, double yaw) {
|
||||||
double x = vec.x * Math.cos(yaw) - vec.y * Math.sin(pitch) * Math.sin(yaw) - vec.z * Math.sin(yaw) * Math.cos(pitch);
|
double x = vec.x * Math.cos(yaw) - vec.y * Math.sin(pitch) * Math.sin(yaw) - vec.z * Math.sin(yaw) * Math.cos(pitch);
|
||||||
double y = vec.y * Math.cos(pitch) - vec.z * Math.sin(pitch);
|
double y = vec.y * Math.cos(pitch) - vec.z * Math.sin(pitch);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user