Initial Ascend Ailments implementation
@@ -0,0 +1,5 @@
|
||||
# Disable autocrlf on generated files, they always generate with LF
|
||||
# Add any extra files or paths here to make git stop saying they
|
||||
# are changed when only line endings change.
|
||||
src/generated/**/.cache/cache text eol=lf
|
||||
src/generated/**/*.json text eol=lf
|
||||
@@ -0,0 +1,44 @@
|
||||
# Gradle and compiled output
|
||||
/.gradle/
|
||||
/build/
|
||||
/bin/
|
||||
/out/
|
||||
*.class
|
||||
|
||||
# IDE metadata
|
||||
/.idea/
|
||||
/.settings/
|
||||
/.metadata/
|
||||
/.classpath
|
||||
/.project
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
*.launch
|
||||
|
||||
# Generated IDE projects and Minecraft run directories
|
||||
/eclipse/
|
||||
/run/
|
||||
/run-data/
|
||||
|
||||
# Logs, crash reports, and JVM diagnostics
|
||||
/logs/
|
||||
/crash-reports/
|
||||
*.log
|
||||
*.log.gz
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# Local-only files and bundled development dependencies
|
||||
/libs/
|
||||
local.properties
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Operating-system files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Files from the Forge MDK
|
||||
forge*changelog.txt
|
||||
@@ -0,0 +1,65 @@
|
||||
Minecraft Forge: Credits/Thank You
|
||||
|
||||
Forge is a set of tools and modifications to the Minecraft base game code to assist
|
||||
mod developers in creating new and exciting content. It has been in development for
|
||||
several years now, but I would like to take this time thank a few people who have
|
||||
helped it along it's way.
|
||||
|
||||
First, the people who originally created the Forge projects way back in Minecraft
|
||||
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
|
||||
of me taking over the project, who knows what Minecraft modding would be today.
|
||||
|
||||
Secondly, someone who has worked with me, and developed some of the core features
|
||||
that allow modding to be as functional, and as simple as it is, cpw. For developing
|
||||
FML, which stabelized the client and server modding ecosystem. As well as the base
|
||||
loading system that allows us to modify Minecraft's code as elegently as possible.
|
||||
|
||||
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
|
||||
sane as well as guiding the community into creating better additions to Forge.
|
||||
|
||||
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
|
||||
I am a part}. For creating some of the core tools needed to make Minecraft modding
|
||||
both possible, and as stable as can be.
|
||||
On that note, here is some specific information of the MCP data we use:
|
||||
* Minecraft Coder Pack (MCP) *
|
||||
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
|
||||
download components of MCP and distribute MCP data files. This permission is not
|
||||
transitive and others wishing to redistribute the Minecraft Forge source independently
|
||||
should seek permission of MCP or remove the MCP data files and request their users
|
||||
to download MCP separately.
|
||||
|
||||
And lastly, the countless community members who have spent time submitting bug reports,
|
||||
pull requests, and just helping out the community in general. Thank you.
|
||||
|
||||
--LexManos
|
||||
|
||||
=========================================================================
|
||||
|
||||
This is Forge Mod Loader.
|
||||
|
||||
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
|
||||
|
||||
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
|
||||
and minecraft clients.
|
||||
|
||||
The code is authored by cpw.
|
||||
|
||||
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
|
||||
http://www.minecraftforum.net/topic/75440-
|
||||
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
|
||||
|
||||
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
|
||||
http://www.minecraftforge.net/
|
||||
|
||||
Additionally, it contains an implementation of topological sort based on that
|
||||
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
|
||||
|
||||
It also contains code from the Maven project for performing versioned dependency
|
||||
resolution. http://maven.apache.org/
|
||||
|
||||
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
|
||||
with credit to it's authors.
|
||||
|
||||
Forge Mod Loader downloads components from the Minecraft Coder Pack
|
||||
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
|
||||
|
||||
@@ -0,0 +1,523 @@
|
||||
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.
|
||||
|
||||
This software includes the Monocraft font from https://github.com/IdreesInc/Monocraft/ for use in the early loading
|
||||
display.
|
||||
=========================================================================
|
||||
|
||||
|
||||
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
|
||||
@@ -0,0 +1,102 @@
|
||||
# Ascend: Ailments
|
||||
|
||||
Forge 1.20.1 library mod providing Soul Rot, Bleed, Fracture, Fear, Charm, Taunt, Overcharm, and Winded.
|
||||
The mod ID is `ascend_ailments`; Ascend is optional.
|
||||
|
||||
## Public API
|
||||
|
||||
Normal callers should use `net.fretux.ailments.api.AilmentApi`, for example:
|
||||
|
||||
```java
|
||||
AilmentApi.applyBleed(target, source);
|
||||
AilmentApi.applySoulRot(target, source, true);
|
||||
AilmentApi.applyFear(target, source, 100);
|
||||
AilmentApi.applyCharm(target, source, 100);
|
||||
AilmentApi.applyTaunt(target, source, 100, 0);
|
||||
AilmentApi.applyOvercharm(target, source, 200);
|
||||
AilmentApi.applyWinded(target, source, 60);
|
||||
AilmentApi.applyFracture(target, source, 160);
|
||||
```
|
||||
|
||||
Skill nodes, modded weapons, and other data-driven callers can use the uniform application API:
|
||||
|
||||
```java
|
||||
boolean applied = AilmentApi.applyEffect(target, source, AilmentType.FEAR, 100, 0);
|
||||
|
||||
int appliedCount = AilmentApi.applyEffects(target, source,
|
||||
AilmentApplication.stack(AilmentType.BLEED),
|
||||
AilmentApplication.timed(AilmentType.WINDED, 60));
|
||||
```
|
||||
|
||||
`applyEffects` attempts every descriptor in order and returns how many were accepted. Use `stack` for configured
|
||||
Bleed/Soul Rot stacking and `timed` for an explicit duration and amplifier. `AilmentApi.getEffect(type)` exposes the
|
||||
registered `MobEffect` when an integration needs to inspect an active effect without depending on registry internals.
|
||||
|
||||
Fracture stacks up to three times. Each stack removes 2 armor and 1 armor toughness; reapplication adds a stack and
|
||||
refreshes its duration. Arcane scales that refreshed duration but never changes the fixed attribute penalties.
|
||||
|
||||
These methods reject invalid targets, enforce PvP and immunity rules, scale duration once at application,
|
||||
and persist source/potency data. Query methods expose stacks, loaded sources, Bleed immunity, and mental-control
|
||||
resistance/immunity. Source queries return `null` when the UUID cannot currently be resolved.
|
||||
|
||||
Soul Rot's optional stack-duration mode follows the explicit balance table: amplifier 0 through 4 receives
|
||||
160/180/200/220/240 base ticks (or the configured base plus 20 ticks per amplifier). This resolves the prose
|
||||
formula/table mismatch in favor of the listed gameplay results.
|
||||
|
||||
At two or more Bleed stacks, every successful Bleed damage tick builds the victim's Hemorrhage meter. Fill uses the
|
||||
Bleed source's application-time Arcane potency snapshot. At the configured threshold, the meter resets to zero and
|
||||
deals Bleed damage equal to 20% of the victim's maximum health by default. Integrations and HUD implementations can
|
||||
read `AilmentApi.getHemorrhageProgress(target)` or the normalized `getHemorrhageFraction(target)`. Minimum stacks,
|
||||
threshold, fill per tick, burst health fraction, and the synchronized player-victim HUD meter are configurable in the
|
||||
`bleed` section.
|
||||
|
||||
## Damage ordering
|
||||
|
||||
The single `LivingHurtEvent` pipeline applies modifiers in this order:
|
||||
|
||||
1. Soul Rot victim vulnerability
|
||||
2. Charm victim/attacker rules
|
||||
3. Taunt victim/attacker rules
|
||||
4. Overcharm's pre-hit Charm snapshot and direct-player-melee bonus
|
||||
|
||||
Each applicable multiplier is applied once. The Overcharm snapshot happens before Charm is refreshed, so its first
|
||||
hit has no pre-existing-Charm bonus.
|
||||
|
||||
## Optional Ascend integration
|
||||
|
||||
`compat.AscendCompat` checks for mod ID `ascend` and reflection-isolates its player-stats capability. Missing classes,
|
||||
missing capabilities, non-player sources, and absent/unloaded source data all fall back to 1.0x. DOT potency is
|
||||
snapshotted on application so source unloading does not alter an active effect.
|
||||
|
||||
## Datapack extension
|
||||
|
||||
Entity type tags:
|
||||
|
||||
- `ascend_ailments:bleed_immune`
|
||||
- `ascend_ailments:mental_control_resistant`
|
||||
- `ascend_ailments:mental_control_immune`
|
||||
|
||||
Players remain Bleed-compatible and non-player undead are automatically rejected independently of tags.
|
||||
|
||||
Item tags:
|
||||
|
||||
- `ascend_ailments:bleed_on_hit`
|
||||
- `ascend_ailments:soul_rot_on_hit`
|
||||
- `ascend_ailments:fracture_on_hit`
|
||||
- `ascend_ailments:fear_on_hit`
|
||||
- `ascend_ailments:charm_on_hit`
|
||||
- `ascend_ailments:taunt_on_hit`
|
||||
- `ascend_ailments:overcharm_on_hit`
|
||||
- `ascend_ailments:winded_on_hit`
|
||||
|
||||
Direct melee hits with items in these tags apply their corresponding ailment. Soul Rot, Bleed, and Fracture use
|
||||
their configured stack/duration behavior; the other tags use `taggedWeaponEffectDurationTicks`. Bleed also applies to non-vanilla item
|
||||
registry paths containing a configured katana-family keyword. Automatic application, proc chance, matching keywords,
|
||||
and the PvP proc cooldown are configurable under `integration` in `ascend-ailments-common.toml`. PvP cooldowns are
|
||||
tracked per attacking player and ailment; their configured minimum is 60 ticks (3 seconds).
|
||||
|
||||
## Admin commands
|
||||
|
||||
`/ascendailments apply ...` supports all seven effects and `/ascendailments clear <target>` removes the library's
|
||||
effects and metadata. Permission level 2 is required. Durations are ticks; amplifier arguments use vanilla's
|
||||
zero-based convention.
|
||||
@@ -0,0 +1,218 @@
|
||||
plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
group = mod_group_id
|
||||
|
||||
base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
minecraft {
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// Channel: Version:
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
||||
//
|
||||
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
// In most cases, it is not necessary to enable.
|
||||
// enableEclipsePrepareRuns = true
|
||||
// enableIdeaPrepareRuns = true
|
||||
|
||||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||
// It is REQUIRED to be set to true for this template to function.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
copyIdeResources = true
|
||||
|
||||
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
|
||||
// The folder name can be set on a run configuration using the "folderName" property.
|
||||
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
|
||||
// generateRunFolders = true
|
||||
|
||||
// This property enables access transformers for use in development.
|
||||
// They will be applied to the Minecraft artifact.
|
||||
// The access transformer file can be anywhere in the project.
|
||||
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
||||
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
||||
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client {
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
args '--nogui'
|
||||
}
|
||||
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// By default, the server will crash when no gametests are provided.
|
||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||
gameTestServer {
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
data {
|
||||
// example of overriding the workingDirectory set in configureEach above
|
||||
workingDirectory project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
repositories {
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
||||
if (project.hasProperty('withAscend')) {
|
||||
flatDir { dir '../Ascend/build/libs' }
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Specify the version of Minecraft to use.
|
||||
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
|
||||
// The "userdev" classifier will be requested and setup by ForgeGradle.
|
||||
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
|
||||
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
testImplementation platform('org.junit:junit-bom:5.10.2')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
|
||||
// Opt-in integration run: .\gradlew.bat runData -PwithAscend
|
||||
if (project.hasProperty('withAscend')) {
|
||||
runtimeOnly fg.deobf('local:ascend:3.0.8')
|
||||
}
|
||||
|
||||
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
|
||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
|
||||
|
||||
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||
// The group id is ignored when searching -- in this case, it is "blank"
|
||||
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
|
||||
|
||||
// For more info:
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
tasks.named('test', Test).configure {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
loader_version_range: loader_version_range,
|
||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors: mod_authors, mod_description: mod_description,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
tasks.named('jar', Jar).configure {
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1', // We are version 1 of ourselves
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
// This is the preferred method to reobfuscate your jar file
|
||||
finalizedBy 'reobfJar'
|
||||
}
|
||||
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
|
||||
// tasks.named('publish').configure {
|
||||
// dependsOn 'reobfJar'
|
||||
// }
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
publishing {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/mcmodsrepo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
|
||||
## Environment Properties
|
||||
|
||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||
minecraft_version=1.20.1
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.20.1,1.21)
|
||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||
forge_version=47.4.23
|
||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||
forge_version_range=[47,)
|
||||
# The loader version range can only use the major version of Forge/FML as bounds
|
||||
loader_version_range=[47,)
|
||||
# The mapping channel to use for mappings.
|
||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||
#
|
||||
# | Channel | Version | |
|
||||
# |-----------|----------------------|--------------------------------------------------------------------------------|
|
||||
# | official | MCVersion | Official field/method names from Mojang mapping files |
|
||||
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
|
||||
#
|
||||
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
#
|
||||
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
|
||||
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
|
||||
mapping_channel=official
|
||||
# The mapping version to query from the mapping channel.
|
||||
# This must match the format required by the mapping channel.
|
||||
mapping_version=1.20.1
|
||||
|
||||
|
||||
## Mod Properties
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=ascend_ailments
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=Ascend: Ailments
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.0.0
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
mod_group_id=net.fretux.ailments
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=Fretux
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=A reusable, standalone library of source-aware combat ailments with optional Ascend Arcane scaling.
|
||||
@@ -0,0 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,245 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,13 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package net.fretux.ailments;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.fretux.ailments.command.AilmentCommands;
|
||||
import net.fretux.ailments.compat.AscendCompat;
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.registry.ModEffects;
|
||||
import net.fretux.ailments.network.AilmentNetwork;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@Mod(AscendAilments.MOD_ID)
|
||||
public final class AscendAilments {
|
||||
public static final String MOD_ID = "ascend_ailments";
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public AscendAilments(FMLJavaModLoadingContext context) {
|
||||
IEventBus modBus = context.getModEventBus();
|
||||
ModEffects.register(modBus);
|
||||
AilmentNetwork.register();
|
||||
modBus.addListener(this::commonSetup);
|
||||
context.registerConfig(ModConfig.Type.COMMON, AilmentsConfig.SPEC,
|
||||
"ascend-ailments-common.toml");
|
||||
MinecraftForge.EVENT_BUS.addListener(this::registerCommands);
|
||||
}
|
||||
|
||||
private void commonSetup(FMLCommonSetupEvent event) {
|
||||
event.enqueueWork(() -> {
|
||||
if (AscendCompat.isAscendLoaded())
|
||||
LOGGER.info("Ascend Arcane integration API available: {}", AscendCompat.validateIntegration());
|
||||
});
|
||||
}
|
||||
|
||||
private void registerCommands(RegisterCommandsEvent event) {
|
||||
AilmentCommands.register(event.getDispatcher());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.registry.ModEffects;
|
||||
import net.fretux.ailments.util.EffectSourceUtil;
|
||||
import net.fretux.ailments.util.MentalControlUtil;
|
||||
import net.fretux.ailments.util.ModEntityTypeTags;
|
||||
import net.fretux.ailments.util.HemorrhageTracker;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MobType;
|
||||
import net.minecraft.world.entity.monster.EnderMan;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
/** Stable, source-aware entry point for applying and querying Ascend: Ailments effects. */
|
||||
public final class AilmentApi {
|
||||
/**
|
||||
* Applies one explicit ailment through the same validation, immunity, scaling, and source tracking used by
|
||||
* the effect-specific methods. This is the primary entry point for skill engines and item integrations.
|
||||
*/
|
||||
public static boolean applyEffect(LivingEntity target, @Nullable LivingEntity source, AilmentType type,
|
||||
int requestedTicks, int amplifier) {
|
||||
Objects.requireNonNull(type, "type");
|
||||
if (requestedTicks < 1 || amplifier < 0) return false;
|
||||
return switch (type) {
|
||||
case SOUL_ROT -> applySoulRot(target, source, requestedTicks, amplifier);
|
||||
case BLEED -> applyBleed(target, source, requestedTicks, amplifier);
|
||||
case FRACTURE -> applyFracture(target, source, requestedTicks, amplifier);
|
||||
case FEAR -> applyFear(target, source, requestedTicks);
|
||||
case CHARM -> applyCharm(target, source, requestedTicks);
|
||||
case TAUNT -> applyTaunt(target, source, requestedTicks, amplifier);
|
||||
case OVERCHARM -> applyOvercharm(target, source, requestedTicks);
|
||||
case WINDED -> applyWinded(target, source, requestedTicks);
|
||||
};
|
||||
}
|
||||
|
||||
/** Applies one explicit amplifier-zero ailment. */
|
||||
public static boolean applyEffect(LivingEntity target, @Nullable LivingEntity source, AilmentType type,
|
||||
int requestedTicks) {
|
||||
return applyEffect(target, source, type, requestedTicks, 0);
|
||||
}
|
||||
|
||||
/** Applies one reusable application descriptor. */
|
||||
public static boolean applyEffect(LivingEntity target, @Nullable LivingEntity source,
|
||||
AilmentApplication application) {
|
||||
Objects.requireNonNull(application, "application");
|
||||
if (application.isStacking()) {
|
||||
return switch (application.type()) {
|
||||
case BLEED -> applyBleed(target, source);
|
||||
case SOUL_ROT -> applySoulRot(target, source);
|
||||
case FRACTURE -> applyFracture(target, source);
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
return applyEffect(target, source, application.type(), application.durationTicks(), application.amplifier());
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies one or more descriptors in order and returns the number accepted by their ailment rules.
|
||||
* A rejected effect does not prevent later effects from being attempted.
|
||||
*/
|
||||
public static int applyEffects(LivingEntity target, @Nullable LivingEntity source,
|
||||
AilmentApplication... applications) {
|
||||
Objects.requireNonNull(applications, "applications");
|
||||
int applied = 0;
|
||||
for (AilmentApplication application : applications) {
|
||||
if (applyEffect(target, source, application)) applied++;
|
||||
}
|
||||
return applied;
|
||||
}
|
||||
|
||||
/** Iterable overload for data-driven integrations. */
|
||||
public static int applyEffects(LivingEntity target, @Nullable LivingEntity source,
|
||||
Iterable<AilmentApplication> applications) {
|
||||
Objects.requireNonNull(applications, "applications");
|
||||
int applied = 0;
|
||||
for (AilmentApplication application : applications) {
|
||||
if (applyEffect(target, source, application)) applied++;
|
||||
}
|
||||
return applied;
|
||||
}
|
||||
|
||||
/** Returns the registered MobEffect represented by a stable public ailment identifier. */
|
||||
public static MobEffect getEffect(AilmentType type) {
|
||||
Objects.requireNonNull(type, "type");
|
||||
return switch (type) {
|
||||
case SOUL_ROT -> ModEffects.SOUL_ROT.get();
|
||||
case BLEED -> ModEffects.BLEED.get();
|
||||
case FRACTURE -> ModEffects.FRACTURE.get();
|
||||
case FEAR -> ModEffects.FEAR.get();
|
||||
case CHARM -> ModEffects.CHARM.get();
|
||||
case TAUNT -> ModEffects.TAUNT.get();
|
||||
case OVERCHARM -> ModEffects.OVERCHARM.get();
|
||||
case WINDED -> ModEffects.WINDED.get();
|
||||
};
|
||||
}
|
||||
|
||||
/** Applies one Soul Rot stack. Extra stacks use 180/200/220/240 tick base durations. */
|
||||
public static boolean applySoulRot(LivingEntity target, @Nullable LivingEntity source) {
|
||||
return applySoulRot(target, source, true);
|
||||
}
|
||||
|
||||
/** Applies one Soul Rot stack; disabling extension always refreshes the configured base duration. */
|
||||
public static boolean applySoulRot(LivingEntity target, @Nullable LivingEntity source,
|
||||
boolean extendWithStacks) {
|
||||
if (!serverValid(target) || !pvpProcReady(target, source, AilmentType.SOUL_ROT)) return false;
|
||||
MobEffect effect = ModEffects.SOUL_ROT.get();
|
||||
MobEffectInstance current = target.getEffect(effect);
|
||||
int currentStacks = current == null ? 0 : current.getAmplifier() + 1;
|
||||
int maxStacks = AilmentsConfig.value(AilmentsConfig.SOUL_ROT_MAX_STACKS);
|
||||
int stacks = Math.min(currentStacks + 1, maxStacks);
|
||||
int amplifier = stacks - 1;
|
||||
int base = AilmentsConfig.value(AilmentsConfig.SOUL_ROT_DURATION);
|
||||
if (extendWithStacks) base = safeAdd(base, amplifier * 20);
|
||||
int duration = AilmentScaling.scaleDuration(base, source);
|
||||
target.removeEffect(effect);
|
||||
boolean applied = target.addEffect(instance(effect, duration, amplifier, true));
|
||||
if (applied) {
|
||||
EffectSourceUtil.setSource(target, EffectSourceUtil.SOUL_ROT, source);
|
||||
EffectSourceUtil.setPotency(target, EffectSourceUtil.SOUL_ROT,
|
||||
AilmentScaling.getPotencyMultiplier(source, AilmentType.SOUL_ROT));
|
||||
}
|
||||
return finishApplication(applied, target, source, AilmentType.SOUL_ROT);
|
||||
}
|
||||
|
||||
/** Applies an explicit, capped Soul Rot amplifier and source-scaled requested duration. */
|
||||
public static boolean applySoulRot(LivingEntity target, @Nullable LivingEntity source,
|
||||
int requestedTicks, int amplifier) {
|
||||
if (!serverValid(target) || !pvpProcReady(target, source, AilmentType.SOUL_ROT)) return false;
|
||||
int capped = Math.min(Math.max(0, amplifier),
|
||||
AilmentsConfig.value(AilmentsConfig.SOUL_ROT_MAX_STACKS) - 1);
|
||||
return finishApplication(applyDot(target, source, ModEffects.SOUL_ROT.get(), EffectSourceUtil.SOUL_ROT,
|
||||
requestedTicks, capped, AilmentType.SOUL_ROT), target, source, AilmentType.SOUL_ROT);
|
||||
}
|
||||
|
||||
/** Applies or adds one Bleed stack, returning false for immune targets. */
|
||||
public static boolean applyBleed(LivingEntity target, @Nullable LivingEntity source) {
|
||||
if (!serverValid(target) || !canBleed(target) || !pvpProcReady(target, source, AilmentType.BLEED)) return false;
|
||||
MobEffect effect = ModEffects.BLEED.get();
|
||||
MobEffectInstance current = target.getEffect(effect);
|
||||
int amplifier = current == null ? 0 : Math.min(current.getAmplifier() + 1,
|
||||
AilmentsConfig.value(AilmentsConfig.BLEED_MAX_AMPLIFIER));
|
||||
int base = amplifier <= 0 ? AilmentsConfig.value(AilmentsConfig.BLEED_DURATION_0)
|
||||
: amplifier == 1 ? AilmentsConfig.value(AilmentsConfig.BLEED_DURATION_1)
|
||||
: AilmentsConfig.value(AilmentsConfig.BLEED_DURATION_2);
|
||||
int duration = AilmentScaling.scaleDuration(base, source);
|
||||
target.removeEffect(effect);
|
||||
boolean applied = target.addEffect(instance(effect, duration, amplifier, true));
|
||||
if (applied) {
|
||||
EffectSourceUtil.setSource(target, EffectSourceUtil.BLEED, source);
|
||||
EffectSourceUtil.setPotency(target, EffectSourceUtil.BLEED,
|
||||
AilmentScaling.getPotencyMultiplier(source, AilmentType.BLEED));
|
||||
}
|
||||
return finishApplication(applied, target, source, AilmentType.BLEED);
|
||||
}
|
||||
|
||||
/** Applies an explicit, capped Bleed amplifier and source-scaled requested duration. */
|
||||
public static boolean applyBleed(LivingEntity target, @Nullable LivingEntity source,
|
||||
int requestedTicks, int amplifier) {
|
||||
if (!serverValid(target) || !canBleed(target) || !pvpProcReady(target, source, AilmentType.BLEED)) return false;
|
||||
int capped = Math.min(Math.max(0, amplifier),
|
||||
AilmentsConfig.value(AilmentsConfig.BLEED_MAX_AMPLIFIER));
|
||||
return finishApplication(applyDot(target, source, ModEffects.BLEED.get(), EffectSourceUtil.BLEED,
|
||||
requestedTicks, capped, AilmentType.BLEED), target, source, AilmentType.BLEED);
|
||||
}
|
||||
|
||||
/** Applies one Fracture stack and refreshes its configured, source-scaled duration. */
|
||||
public static boolean applyFracture(LivingEntity target, @Nullable LivingEntity source) {
|
||||
return applyFracture(target, source, AilmentsConfig.value(AilmentsConfig.FRACTURE_DURATION), 0);
|
||||
}
|
||||
|
||||
/** Applies one Fracture stack and refreshes the source-scaled requested duration. */
|
||||
public static boolean applyFracture(LivingEntity target, @Nullable LivingEntity source, int requestedTicks) {
|
||||
return applyFracture(target, source, requestedTicks, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies or increases Fracture, capped at three stacks. The requested amplifier acts as a minimum, while an
|
||||
* existing Fracture always gains one stack. Arcane scales only duration; attribute penalties remain fixed.
|
||||
*/
|
||||
public static boolean applyFracture(LivingEntity target, @Nullable LivingEntity source,
|
||||
int requestedTicks, int amplifier) {
|
||||
if (!serverValid(target) || requestedTicks < 1 || amplifier < 0
|
||||
|| !pvpProcReady(target, source, AilmentType.FRACTURE)) return false;
|
||||
MobEffect effect = ModEffects.FRACTURE.get();
|
||||
MobEffectInstance current = target.getEffect(effect);
|
||||
int stackedAmplifier = current == null ? 0 : Math.min(2, current.getAmplifier() + 1);
|
||||
int appliedAmplifier = Math.min(2, Math.max(stackedAmplifier, amplifier));
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
target.removeEffect(effect);
|
||||
boolean applied = target.addEffect(instance(effect, duration, appliedAmplifier, true));
|
||||
if (applied) EffectSourceUtil.setSource(target, EffectSourceUtil.FRACTURE, source);
|
||||
return finishApplication(applied, target, source, AilmentType.FRACTURE);
|
||||
}
|
||||
|
||||
public static boolean applyFear(LivingEntity target, @Nullable LivingEntity source, int requestedTicks) {
|
||||
if (!hostileControlValid(target, source) || MentalControlUtil.isMentalControlImmune(target)
|
||||
|| target.getMaxHealth() > AilmentsConfig.value(AilmentsConfig.FEAR_IMMUNITY_HEALTH)
|
||||
|| !pvpProcReady(target, source, AilmentType.FEAR)) return false;
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
if (target.getMaxHealth() > AilmentsConfig.value(AilmentsConfig.FEAR_REDUCED_HEALTH)) duration /= 2;
|
||||
if (MentalControlUtil.isMentalControlResistant(target))
|
||||
duration = MentalControlUtil.resistantDuration(duration, 3);
|
||||
if (target instanceof EnderMan) duration = Math.max(1, duration / 2);
|
||||
return finishApplication(applySourced(target, source, ModEffects.FEAR.get(), EffectSourceUtil.FEAR,
|
||||
Math.max(1, duration), 0), target, source, AilmentType.FEAR);
|
||||
}
|
||||
|
||||
public static boolean applyCharm(LivingEntity target, @Nullable LivingEntity source, int requestedTicks) {
|
||||
if (!hostileControlValid(target, source) || MentalControlUtil.isMentalControlImmune(target)
|
||||
|| !pvpProcReady(target, source, AilmentType.CHARM)) return false;
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
if (MentalControlUtil.isMentalControlResistant(target))
|
||||
duration = MentalControlUtil.resistantDuration(duration, 2);
|
||||
return finishApplication(applySourced(target, source, ModEffects.CHARM.get(), EffectSourceUtil.CHARM,
|
||||
duration, 0), target, source, AilmentType.CHARM);
|
||||
}
|
||||
|
||||
public static boolean applyTaunt(LivingEntity target, @Nullable LivingEntity source, int requestedTicks, int amplifier) {
|
||||
if (!hostileControlValid(target, source) || MentalControlUtil.isMentalControlImmune(target)
|
||||
|| !pvpProcReady(target, source, AilmentType.TAUNT)) return false;
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
if (MentalControlUtil.isMentalControlResistant(target))
|
||||
duration = MentalControlUtil.resistantDuration(duration, 2);
|
||||
return finishApplication(applySourced(target, source, ModEffects.TAUNT.get(), EffectSourceUtil.TAUNT,
|
||||
duration, Math.max(0, amplifier)), target, source, AilmentType.TAUNT);
|
||||
}
|
||||
|
||||
public static boolean applyOvercharm(LivingEntity target, @Nullable LivingEntity source, int requestedTicks) {
|
||||
if (!serverValid(target) || !pvpProcReady(target, source, AilmentType.OVERCHARM)) return false;
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
boolean result = target.addEffect(instance(ModEffects.OVERCHARM.get(), duration, 0, true));
|
||||
if (result) {
|
||||
// Ascend itself scales beneficial effects received by players. Restore the source-scaled duration so
|
||||
// this API remains the single authority and cannot be scaled twice when both mods are installed.
|
||||
MobEffectInstance active = target.getEffect(ModEffects.OVERCHARM.get());
|
||||
if (active != null) active.mapDuration(ignored -> duration);
|
||||
EffectSourceUtil.setSource(target, EffectSourceUtil.OVERCHARM, source);
|
||||
}
|
||||
return finishApplication(result, target, source, AilmentType.OVERCHARM);
|
||||
}
|
||||
|
||||
public static boolean applyWinded(LivingEntity target, @Nullable LivingEntity source, int requestedTicks) {
|
||||
if (!serverValid(target) || !pvpProcReady(target, source, AilmentType.WINDED)) return false;
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
return finishApplication(target.addEffect(instance(ModEffects.WINDED.get(), duration, 0, true)),
|
||||
target, source, AilmentType.WINDED);
|
||||
}
|
||||
|
||||
public static boolean canBleed(LivingEntity target) {
|
||||
if (target instanceof Player) return true;
|
||||
return target.getMobType() != MobType.UNDEAD && !target.getType().is(ModEntityTypeTags.BLEED_IMMUNE);
|
||||
}
|
||||
public static boolean isMentalControlResistant(LivingEntity target) {
|
||||
return MentalControlUtil.isMentalControlResistant(target);
|
||||
}
|
||||
public static boolean isMentalControlImmune(LivingEntity target) {
|
||||
return MentalControlUtil.isMentalControlImmune(target);
|
||||
}
|
||||
public static int getBleedStacks(LivingEntity target) { return stacks(target, ModEffects.BLEED.get()); }
|
||||
public static int getSoulRotStacks(LivingEntity target) { return stacks(target, ModEffects.SOUL_ROT.get()); }
|
||||
public static int getFractureStacks(LivingEntity target) { return stacks(target, ModEffects.FRACTURE.get()); }
|
||||
/** Returns raw Hemorrhage progress in the configured threshold's units. */
|
||||
public static double getHemorrhageProgress(LivingEntity target) {
|
||||
return HemorrhageTracker.getProgress(target);
|
||||
}
|
||||
/** Returns normalized Hemorrhage bar progress from 0.0 through 1.0. */
|
||||
public static double getHemorrhageFraction(LivingEntity target) {
|
||||
return HemorrhageTracker.getFraction(target);
|
||||
}
|
||||
public static void clearHemorrhage(LivingEntity target) { HemorrhageTracker.clear(target); }
|
||||
@Nullable public static LivingEntity getCharmSource(LivingEntity target) {
|
||||
return EffectSourceUtil.getSource(target, EffectSourceUtil.CHARM);
|
||||
}
|
||||
@Nullable public static LivingEntity getFearSource(LivingEntity target) {
|
||||
return EffectSourceUtil.getSource(target, EffectSourceUtil.FEAR);
|
||||
}
|
||||
@Nullable public static LivingEntity getTauntSource(LivingEntity target) {
|
||||
return EffectSourceUtil.getSource(target, EffectSourceUtil.TAUNT);
|
||||
}
|
||||
@Nullable public static LivingEntity getBleedSource(LivingEntity target) {
|
||||
return EffectSourceUtil.getSource(target, EffectSourceUtil.BLEED);
|
||||
}
|
||||
@Nullable public static LivingEntity getSoulRotSource(LivingEntity target) {
|
||||
return EffectSourceUtil.getSource(target, EffectSourceUtil.SOUL_ROT);
|
||||
}
|
||||
@Nullable public static LivingEntity getFractureSource(LivingEntity target) {
|
||||
return EffectSourceUtil.getSource(target, EffectSourceUtil.FRACTURE);
|
||||
}
|
||||
|
||||
/** Removes all registered ailments and all associated source/potency metadata. */
|
||||
public static void clearAll(LivingEntity target) {
|
||||
target.removeEffect(ModEffects.SOUL_ROT.get()); target.removeEffect(ModEffects.BLEED.get());
|
||||
target.removeEffect(ModEffects.FEAR.get()); target.removeEffect(ModEffects.CHARM.get());
|
||||
target.removeEffect(ModEffects.TAUNT.get()); target.removeEffect(ModEffects.OVERCHARM.get());
|
||||
target.removeEffect(ModEffects.WINDED.get());
|
||||
target.removeEffect(ModEffects.FRACTURE.get());
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.SOUL_ROT);
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.BLEED);
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.FEAR);
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.CHARM);
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.TAUNT);
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.OVERCHARM);
|
||||
EffectSourceUtil.clear(target, EffectSourceUtil.FRACTURE);
|
||||
HemorrhageTracker.clear(target);
|
||||
}
|
||||
|
||||
private static boolean applySourced(LivingEntity target, @Nullable LivingEntity source, MobEffect effect,
|
||||
String key, int duration, int amplifier) {
|
||||
boolean applied = target.addEffect(instance(effect, Math.max(1, duration), amplifier, true));
|
||||
if (applied) EffectSourceUtil.setSource(target, key, source);
|
||||
return applied;
|
||||
}
|
||||
private static boolean applyDot(LivingEntity target, @Nullable LivingEntity source, MobEffect effect,
|
||||
String key, int requestedTicks, int amplifier, AilmentType type) {
|
||||
int duration = AilmentScaling.scaleDuration(requestedTicks, source);
|
||||
target.removeEffect(effect);
|
||||
boolean applied = target.addEffect(instance(effect, duration, amplifier, true));
|
||||
if (applied) {
|
||||
EffectSourceUtil.setSource(target, key, source);
|
||||
EffectSourceUtil.setPotency(target, key, AilmentScaling.getPotencyMultiplier(source, type));
|
||||
}
|
||||
return applied;
|
||||
}
|
||||
private static MobEffectInstance instance(MobEffect effect, int duration, int amplifier, boolean icon) {
|
||||
return new MobEffectInstance(effect, duration, amplifier, false, false, icon);
|
||||
}
|
||||
private static boolean serverValid(LivingEntity target) {
|
||||
return target != null && !target.level().isClientSide && target.isAlive()
|
||||
&& (!(target instanceof Player player) || !player.isSpectator());
|
||||
}
|
||||
private static boolean hostileControlValid(LivingEntity target, @Nullable LivingEntity source) {
|
||||
if (!serverValid(target) || source == null || !source.isAlive()
|
||||
|| source.level().isClientSide || source.isSpectator()) return false;
|
||||
return !(source instanceof Player sourcePlayer && target instanceof Player targetPlayer)
|
||||
|| sourcePlayer.canHarmPlayer(targetPlayer);
|
||||
}
|
||||
private static int stacks(LivingEntity target, MobEffect effect) {
|
||||
MobEffectInstance active = target.getEffect(effect);
|
||||
return active == null ? 0 : active.getAmplifier() + 1;
|
||||
}
|
||||
private static int safeAdd(int a, int b) {
|
||||
return (int) Math.min(Integer.MAX_VALUE, (long) a + b);
|
||||
}
|
||||
private static boolean pvpProcReady(LivingEntity target, @Nullable LivingEntity source, AilmentType type) {
|
||||
if (!(source instanceof Player) || !(target instanceof Player) || source == target) return true;
|
||||
String key = pvpCooldownKey(type);
|
||||
long now = source.level().getGameTime();
|
||||
return !source.getPersistentData().contains(key)
|
||||
|| now - source.getPersistentData().getLong(key)
|
||||
>= AilmentsConfig.value(AilmentsConfig.PVP_PROC_COOLDOWN_TICKS);
|
||||
}
|
||||
private static boolean finishApplication(boolean applied, LivingEntity target,
|
||||
@Nullable LivingEntity source, AilmentType type) {
|
||||
if (applied && source instanceof Player && target instanceof Player && source != target) {
|
||||
source.getPersistentData().putLong(pvpCooldownKey(type), source.level().getGameTime());
|
||||
}
|
||||
return applied;
|
||||
}
|
||||
private static String pvpCooldownKey(AilmentType type) {
|
||||
return "ascend_ailments.pvp_proc." + type.name().toLowerCase(java.util.Locale.ROOT);
|
||||
}
|
||||
private AilmentApi() {}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Immutable description of one ailment application.
|
||||
*
|
||||
* <p>Use {@link #timed(AilmentType, int, int)} when the caller controls the duration and
|
||||
* amplifier. Use {@link #stack(AilmentType)} for the library's configured Bleed, Soul Rot, or Fracture
|
||||
* stacking behavior.</p>
|
||||
*/
|
||||
public final class AilmentApplication {
|
||||
private final AilmentType type;
|
||||
private final int durationTicks;
|
||||
private final int amplifier;
|
||||
private final boolean stacking;
|
||||
|
||||
private AilmentApplication(AilmentType type, int durationTicks, int amplifier, boolean stacking) {
|
||||
this.type = Objects.requireNonNull(type, "type");
|
||||
this.durationTicks = durationTicks;
|
||||
this.amplifier = amplifier;
|
||||
this.stacking = stacking;
|
||||
}
|
||||
|
||||
/** Creates an explicit, source-scaled application. Duration is measured in ticks. */
|
||||
public static AilmentApplication timed(AilmentType type, int durationTicks, int amplifier) {
|
||||
if (durationTicks < 1) throw new IllegalArgumentException("durationTicks must be positive");
|
||||
if (amplifier < 0) throw new IllegalArgumentException("amplifier must not be negative");
|
||||
return new AilmentApplication(type, durationTicks, amplifier, false);
|
||||
}
|
||||
|
||||
/** Creates an explicit amplifier-zero, source-scaled application. */
|
||||
public static AilmentApplication timed(AilmentType type, int durationTicks) {
|
||||
return timed(type, durationTicks, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds one stack using the configured duration and cap.
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code type} does not support stacking
|
||||
*/
|
||||
public static AilmentApplication stack(AilmentType type) {
|
||||
Objects.requireNonNull(type, "type");
|
||||
if (type != AilmentType.BLEED && type != AilmentType.SOUL_ROT && type != AilmentType.FRACTURE) {
|
||||
throw new IllegalArgumentException("Only BLEED, SOUL_ROT, and FRACTURE support stack applications");
|
||||
}
|
||||
return new AilmentApplication(type, 0, 0, true);
|
||||
}
|
||||
|
||||
public AilmentType type() { return type; }
|
||||
public int durationTicks() { return durationTicks; }
|
||||
public int amplifier() { return amplifier; }
|
||||
public boolean isStacking() { return stacking; }
|
||||
|
||||
@Override public boolean equals(Object other) {
|
||||
if (this == other) return true;
|
||||
if (!(other instanceof AilmentApplication that)) return false;
|
||||
return durationTicks == that.durationTicks && amplifier == that.amplifier
|
||||
&& stacking == that.stacking && type == that.type;
|
||||
}
|
||||
|
||||
@Override public int hashCode() {
|
||||
return Objects.hash(type, durationTicks, amplifier, stacking);
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return stacking ? "AilmentApplication[" + type + ", stack]"
|
||||
: "AilmentApplication[" + type + ", " + durationTicks + " ticks, amplifier=" + amplifier + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
import net.fretux.ailments.compat.AscendCompat;
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** Central, application-time Arcane scaling. The normalized curve is concave and reaches 1 at 100 Arcane. */
|
||||
public final class AilmentScaling {
|
||||
public static double getDurationMultiplier(@Nullable LivingEntity source) {
|
||||
return getDurationMultiplierForArcane(AscendCompat.getArcane(source));
|
||||
}
|
||||
|
||||
public static double getPotencyMultiplier(@Nullable LivingEntity source, AilmentType type) {
|
||||
return getPotencyMultiplierForArcane(AscendCompat.getArcane(source), type);
|
||||
}
|
||||
|
||||
static double getPotencyMultiplierForArcane(int arcane, AilmentType type) {
|
||||
double maximumBonus = switch (type) {
|
||||
case SOUL_ROT -> AilmentsConfig.value(AilmentsConfig.SOUL_ROT_ARCANE_POTENCY);
|
||||
case BLEED -> AilmentsConfig.value(AilmentsConfig.BLEED_ARCANE_POTENCY);
|
||||
default -> 0.0;
|
||||
};
|
||||
return 1.0 + normalizedArcane(arcane) * maximumBonus;
|
||||
}
|
||||
|
||||
public static int scaleDuration(int requestedTicks, @Nullable LivingEntity source) {
|
||||
if (requestedTicks <= 0) return 1;
|
||||
return Math.max(1, (int) Math.min(Integer.MAX_VALUE,
|
||||
Math.round(requestedTicks * getDurationMultiplier(source))));
|
||||
}
|
||||
|
||||
public static double getDurationMultiplierForArcane(int arcane) {
|
||||
return 1.0 + normalizedArcane(arcane) * AilmentsConfig.value(AilmentsConfig.ARCANE_DURATION_BONUS);
|
||||
}
|
||||
|
||||
static double normalizedArcane(int arcane) {
|
||||
return arcane <= 0 ? 0.0 : Math.pow(Math.min(100, arcane) / 100.0, 0.8);
|
||||
}
|
||||
private AilmentScaling() {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
/** Public identifiers for ailment-specific scaling and integrations. */
|
||||
public enum AilmentType {
|
||||
SOUL_ROT, BLEED, FRACTURE, FEAR, CHARM, TAUNT, OVERCHARM, WINDED
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.fretux.ailments.client;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public final class ClientHemorrhageState {
|
||||
private static float progress;
|
||||
|
||||
public static float getProgress() { return progress; }
|
||||
public static void setProgress(float value) {
|
||||
progress = Math.max(0.0F, Math.min(1.0F, value));
|
||||
}
|
||||
|
||||
private ClientHemorrhageState() {}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.fretux.ailments.client;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterGuiOverlaysEvent;
|
||||
import net.minecraftforge.client.gui.overlay.IGuiOverlay;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = AscendAilments.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public final class HemorrhageOverlay {
|
||||
private static final int BAR_WIDTH = 96;
|
||||
private static final int BAR_HEIGHT = 5;
|
||||
private static final int BORDER = 1;
|
||||
|
||||
private static final IGuiOverlay OVERLAY = (gui, graphics, partialTick, screenWidth, screenHeight) -> {
|
||||
float progress = ClientHemorrhageState.getProgress();
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
if (progress <= 0.0F || minecraft.options.hideGui || minecraft.player == null
|
||||
|| !minecraft.player.isAlive()) return;
|
||||
|
||||
// Souls-like status buildup placement: centered below the crosshair, clear of boss bars and the hotbar.
|
||||
int x = (screenWidth - BAR_WIDTH) / 2;
|
||||
int y = Math.min(screenHeight - 52, screenHeight / 2 + 54);
|
||||
int filled = Math.round((BAR_WIDTH - BORDER * 2) * progress);
|
||||
|
||||
graphics.fill(x, y, x + BAR_WIDTH, y + BAR_HEIGHT, 0xB8000000);
|
||||
graphics.fill(x + BORDER, y + BORDER, x + BAR_WIDTH - BORDER,
|
||||
y + BAR_HEIGHT - BORDER, 0xA02A0A0A);
|
||||
if (filled > 0) graphics.fill(x + BORDER, y + BORDER, x + BORDER + filled,
|
||||
y + BAR_HEIGHT - BORDER, 0xFFE04444);
|
||||
|
||||
Font font = minecraft.font;
|
||||
Component label = Component.translatable("gui.ascend_ailments.hemorrhage");
|
||||
int labelX = (screenWidth - font.width(label)) / 2;
|
||||
graphics.drawString(font, label, labelX, y - 10, 0xFFD8A0A0, true);
|
||||
};
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerOverlay(RegisterGuiOverlaysEvent event) {
|
||||
event.registerAboveAll("hemorrhage", OVERLAY);
|
||||
}
|
||||
|
||||
private HemorrhageOverlay() {}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package net.fretux.ailments.command;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.fretux.ailments.api.AilmentApi;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
public final class AilmentCommands {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
dispatcher.register(Commands.literal("ascendailments").requires(source -> source.hasPermission(2))
|
||||
.then(Commands.literal("clear").then(Commands.argument("target", EntityArgument.entity())
|
||||
.executes(ctx -> withTarget(ctx, target -> { AilmentApi.clearAll(target); return true; }))))
|
||||
.then(Commands.literal("apply").then(Commands.argument("target", EntityArgument.entity())
|
||||
.then(Commands.literal("bleed")
|
||||
.executes(ctx -> withTarget(ctx, target -> AilmentApi.applyBleed(target, null)))
|
||||
.then(explicitDot(false)))
|
||||
.then(Commands.literal("soul_rot")
|
||||
.executes(ctx -> withTarget(ctx, target -> AilmentApi.applySoulRot(target, null)))
|
||||
.then(explicitDot(true)))
|
||||
.then(control("fracture", AilmentApi::applyFracture, true))
|
||||
.then(control("fear", (target, source, duration, amplifier) ->
|
||||
AilmentApi.applyFear(target, source, duration), false))
|
||||
.then(control("charm", (target, source, duration, amplifier) ->
|
||||
AilmentApi.applyCharm(target, source, duration), false))
|
||||
.then(control("taunt", AilmentApi::applyTaunt, true))
|
||||
.then(Commands.literal("overcharm")
|
||||
.then(Commands.argument("duration", IntegerArgumentType.integer(1))
|
||||
.executes(ctx -> withTarget(ctx, target -> AilmentApi.applyOvercharm(target,
|
||||
null, IntegerArgumentType.getInteger(ctx, "duration"))))))
|
||||
.then(Commands.literal("winded")
|
||||
.then(Commands.argument("duration", IntegerArgumentType.integer(1))
|
||||
.executes(ctx -> withTarget(ctx, target -> AilmentApi.applyWinded(target,
|
||||
null, IntegerArgumentType.getInteger(ctx, "duration")))))))));
|
||||
}
|
||||
|
||||
private static com.mojang.brigadier.builder.ArgumentBuilder<CommandSourceStack, ?> explicitDot(boolean soulRot) {
|
||||
return Commands.argument("duration", IntegerArgumentType.integer(1))
|
||||
.executes(ctx -> withTarget(ctx, target -> soulRot
|
||||
? AilmentApi.applySoulRot(target, null, IntegerArgumentType.getInteger(ctx, "duration"), 0)
|
||||
: AilmentApi.applyBleed(target, null, IntegerArgumentType.getInteger(ctx, "duration"), 0)))
|
||||
.then(Commands.argument("amplifier", IntegerArgumentType.integer(0, soulRot ? 4 : 2))
|
||||
.executes(ctx -> withTarget(ctx, target -> soulRot
|
||||
? AilmentApi.applySoulRot(target, null,
|
||||
IntegerArgumentType.getInteger(ctx, "duration"),
|
||||
IntegerArgumentType.getInteger(ctx, "amplifier"))
|
||||
: AilmentApi.applyBleed(target, null,
|
||||
IntegerArgumentType.getInteger(ctx, "duration"),
|
||||
IntegerArgumentType.getInteger(ctx, "amplifier")))));
|
||||
}
|
||||
|
||||
private static com.mojang.brigadier.builder.ArgumentBuilder<CommandSourceStack, ?> control(
|
||||
String name, ControlApplication application, boolean amplifier) {
|
||||
var duration = Commands.argument("duration", IntegerArgumentType.integer(1))
|
||||
.executes(ctx -> applyControl(ctx, application, 0));
|
||||
if (amplifier) duration.then(Commands.argument("amplifier", IntegerArgumentType.integer(0, 255))
|
||||
.executes(ctx -> applyControl(ctx, application,
|
||||
IntegerArgumentType.getInteger(ctx, "amplifier"))));
|
||||
return Commands.literal(name).then(Commands.argument("source", EntityArgument.entity()).then(duration));
|
||||
}
|
||||
|
||||
private static int applyControl(CommandContext<CommandSourceStack> ctx, ControlApplication application,
|
||||
int amplifier) throws com.mojang.brigadier.exceptions.CommandSyntaxException {
|
||||
Entity targetEntity = EntityArgument.getEntity(ctx, "target");
|
||||
Entity sourceEntity = EntityArgument.getEntity(ctx, "source");
|
||||
if (!(targetEntity instanceof LivingEntity target) || !(sourceEntity instanceof LivingEntity source)) {
|
||||
ctx.getSource().sendFailure(Component.literal("Target and source must be living entities"));
|
||||
return 0;
|
||||
}
|
||||
boolean applied = application.apply(target, source, IntegerArgumentType.getInteger(ctx, "duration"), amplifier);
|
||||
return result(ctx, applied);
|
||||
}
|
||||
|
||||
private static int withTarget(CommandContext<CommandSourceStack> ctx, TargetApplication application)
|
||||
throws com.mojang.brigadier.exceptions.CommandSyntaxException {
|
||||
Entity entity = EntityArgument.getEntity(ctx, "target");
|
||||
if (!(entity instanceof LivingEntity target)) {
|
||||
ctx.getSource().sendFailure(Component.literal("Target must be a living entity"));
|
||||
return 0;
|
||||
}
|
||||
return result(ctx, application.apply(target));
|
||||
}
|
||||
|
||||
private static int result(CommandContext<CommandSourceStack> ctx, boolean applied) {
|
||||
if (!applied) { ctx.getSource().sendFailure(Component.literal("Ailment was rejected")); return 0; }
|
||||
ctx.getSource().sendSuccess(() -> Component.literal("Ailment operation succeeded"), true);
|
||||
return 1;
|
||||
}
|
||||
@FunctionalInterface private interface TargetApplication { boolean apply(LivingEntity target); }
|
||||
@FunctionalInterface private interface ControlApplication {
|
||||
boolean apply(LivingEntity target, LivingEntity source, int duration, int amplifier);
|
||||
}
|
||||
private AilmentCommands() {}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package net.fretux.ailments.compat;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Optional;
|
||||
|
||||
/** Reflection boundary: no Ascend type appears in a loadable signature or constant-pool class reference. */
|
||||
public final class AscendCompat {
|
||||
private static final String PROVIDER = "net.fretux.ascend.player.PlayerStatsProvider";
|
||||
private static boolean resolved;
|
||||
private static Capability<?> statsCapability;
|
||||
private static Method getAttributeLevel;
|
||||
|
||||
public static boolean isAscendLoaded() { return ModList.get().isLoaded("ascend"); }
|
||||
|
||||
/** Resolves the optional public API without requiring an entity; useful for lifecycle diagnostics. */
|
||||
public static boolean validateIntegration() {
|
||||
if (!isAscendLoaded()) return false;
|
||||
try {
|
||||
resolve();
|
||||
return statsCapability != null && getAttributeLevel != null;
|
||||
} catch (ReflectiveOperationException | LinkageError ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getArcane(LivingEntity source) {
|
||||
if (!(source instanceof Player player) || !isAscendLoaded()) return 0;
|
||||
try {
|
||||
resolve();
|
||||
if (statsCapability == null || getAttributeLevel == null) return 0;
|
||||
LazyOptional<?> lazy = player.getCapability(statsCapability);
|
||||
Optional<?> stats = lazy.resolve();
|
||||
if (stats.isEmpty()) return 0;
|
||||
return Math.max(0, ((Number) getAttributeLevel.invoke(stats.get(), "arcane")).intValue());
|
||||
} catch (ReflectiveOperationException | LinkageError ignored) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static synchronized void resolve() throws ReflectiveOperationException {
|
||||
if (resolved) return;
|
||||
resolved = true;
|
||||
Class<?> provider = Class.forName(PROVIDER, false, AscendCompat.class.getClassLoader());
|
||||
Field capabilityField = provider.getField("PLAYER_STATS");
|
||||
statsCapability = (Capability<?>) capabilityField.get(null);
|
||||
Class<?> statsClass = Class.forName("net.fretux.ascend.player.PlayerStats", false,
|
||||
AscendCompat.class.getClassLoader());
|
||||
getAttributeLevel = statsClass.getMethod("getAttributeLevel", String.class);
|
||||
}
|
||||
private AscendCompat() {}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package net.fretux.ailments.config;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class AilmentsConfig {
|
||||
private static final ForgeConfigSpec.Builder B = new ForgeConfigSpec.Builder();
|
||||
|
||||
public static final ForgeConfigSpec.DoubleValue ARCANE_DURATION_BONUS;
|
||||
public static final ForgeConfigSpec.DoubleValue SOUL_ROT_ARCANE_POTENCY;
|
||||
public static final ForgeConfigSpec.DoubleValue BLEED_ARCANE_POTENCY;
|
||||
public static final ForgeConfigSpec.IntValue SOUL_ROT_DURATION, SOUL_ROT_MAX_STACKS;
|
||||
public static final ForgeConfigSpec.DoubleValue SOUL_ROT_EXHAUSTION_BASE, SOUL_ROT_EXHAUSTION_PER_AMP,
|
||||
SOUL_ROT_DAMAGE_TAKEN, SOUL_ROT_HEALING;
|
||||
public static final ForgeConfigSpec.IntValue BLEED_DURATION_0, BLEED_DURATION_1, BLEED_DURATION_2,
|
||||
BLEED_INTERVAL_0, BLEED_INTERVAL_1, BLEED_INTERVAL_2, BLEED_MAX_AMPLIFIER;
|
||||
public static final ForgeConfigSpec.DoubleValue BLEED_DAMAGE_0, BLEED_DAMAGE_1, BLEED_DAMAGE_2;
|
||||
public static final ForgeConfigSpec.IntValue HEMORRHAGE_MINIMUM_STACKS;
|
||||
public static final ForgeConfigSpec.DoubleValue HEMORRHAGE_THRESHOLD, HEMORRHAGE_FILL_PER_TICK,
|
||||
HEMORRHAGE_MAX_HEALTH_DAMAGE;
|
||||
public static final ForgeConfigSpec.BooleanValue HEMORRHAGE_SHOW_PLAYER_BAR;
|
||||
public static final ForgeConfigSpec.DoubleValue FEAR_IMMUNITY_HEALTH, FEAR_REDUCED_HEALTH,
|
||||
FEAR_FLEE_SPEED, FEAR_FLEE_DISTANCE, FEAR_PLAYER_PUSH;
|
||||
public static final ForgeConfigSpec.IntValue FRACTURE_DURATION;
|
||||
public static final ForgeConfigSpec.DoubleValue CHARM_VICTIM_BONUS, CHARM_SOURCE_PENALTY, CHARM_OTHER_BONUS;
|
||||
public static final ForgeConfigSpec.DoubleValue TAUNT_VICTIM_MULTIPLIER, TAUNT_SOURCE_MULTIPLIER;
|
||||
public static final ForgeConfigSpec.IntValue OVERCHARM_CHARM_DURATION;
|
||||
public static final ForgeConfigSpec.DoubleValue OVERCHARM_DAMAGE_BONUS, WINDED_MOVEMENT_REDUCTION,
|
||||
WINDED_ATTACK_REDUCTION;
|
||||
public static final ForgeConfigSpec.IntValue PVP_PROC_COOLDOWN_TICKS;
|
||||
public static final ForgeConfigSpec.BooleanValue AUTOMATIC_WEAPON_BLEED;
|
||||
public static final ForgeConfigSpec.DoubleValue AUTOMATIC_WEAPON_BLEED_CHANCE;
|
||||
public static final ForgeConfigSpec.IntValue TAGGED_WEAPON_EFFECT_DURATION;
|
||||
public static final ForgeConfigSpec.ConfigValue<List<? extends String>> AUTOMATIC_WEAPON_BLEED_KEYWORDS;
|
||||
|
||||
static {
|
||||
B.push("arcane");
|
||||
ARCANE_DURATION_BONUS = d("durationBonusAt100", 0.30, 0, 5);
|
||||
SOUL_ROT_ARCANE_POTENCY = d("soulRotExhaustionBonusAt100", 0.20, 0, 5);
|
||||
BLEED_ARCANE_POTENCY = d("bleedDamageBonusAt100", 0.20, 0, 5);
|
||||
B.pop().push("soulRot");
|
||||
SOUL_ROT_DURATION = i("baseDurationTicks", 160, 1, Integer.MAX_VALUE);
|
||||
SOUL_ROT_MAX_STACKS = i("maximumStacks", 5, 1, 5);
|
||||
SOUL_ROT_EXHAUSTION_BASE = d("exhaustionBase", 1.2, 0, 1000);
|
||||
SOUL_ROT_EXHAUSTION_PER_AMP = d("exhaustionPerAmplifier", 0.4, 0, 1000);
|
||||
SOUL_ROT_DAMAGE_TAKEN = d("damageTakenMultiplier", 1.10, 0, 100);
|
||||
SOUL_ROT_HEALING = d("healingMultiplier", 0.25, 0, 100);
|
||||
B.pop().push("bleed");
|
||||
BLEED_DURATION_0 = i("durationStack1", 100, 1, Integer.MAX_VALUE);
|
||||
BLEED_DURATION_1 = i("durationStack2", 120, 1, Integer.MAX_VALUE);
|
||||
BLEED_DURATION_2 = i("durationStack3", 140, 1, Integer.MAX_VALUE);
|
||||
BLEED_INTERVAL_0 = i("intervalStack1", 30, 1, 1200);
|
||||
BLEED_INTERVAL_1 = i("intervalStack2", 25, 1, 1200);
|
||||
BLEED_INTERVAL_2 = i("intervalStack3", 20, 1, 1200);
|
||||
BLEED_DAMAGE_0 = d("damageStack1", 1, 0, 1000);
|
||||
BLEED_DAMAGE_1 = d("damageStack2", 1, 0, 1000);
|
||||
BLEED_DAMAGE_2 = d("damageStack3", 2, 0, 1000);
|
||||
BLEED_MAX_AMPLIFIER = i("maximumAmplifier", 2, 0, 2);
|
||||
HEMORRHAGE_MINIMUM_STACKS = B.comment(
|
||||
"Bleed stacks required before damaging Bleed ticks build Hemorrhage.")
|
||||
.defineInRange("hemorrhageMinimumStacks", 2, 2, 3);
|
||||
HEMORRHAGE_THRESHOLD = B.comment("Progress required to trigger Hemorrhage.")
|
||||
.defineInRange("hemorrhageThreshold", 100.0, 1.0, 1000000.0);
|
||||
HEMORRHAGE_FILL_PER_TICK = B.comment(
|
||||
"Base progress added by each successful Bleed damage tick; snapshotted Arcane potency multiplies it.")
|
||||
.defineInRange("hemorrhageFillPerBleedTick", 10.0, 0.0, 1000000.0);
|
||||
HEMORRHAGE_MAX_HEALTH_DAMAGE = B.comment(
|
||||
"Fraction of the victim's maximum health dealt as Bleed damage when Hemorrhage fills.")
|
||||
.defineInRange("hemorrhageMaxHealthDamage", 0.20, 0.0, 100.0);
|
||||
HEMORRHAGE_SHOW_PLAYER_BAR = B.comment(
|
||||
"Show player victims their current Hemorrhage progress as a compact HUD meter.")
|
||||
.define("showHemorrhagePlayerBar", true);
|
||||
B.pop().push("fracture");
|
||||
FRACTURE_DURATION = B.comment("Base duration refreshed whenever Fracture is reapplied.")
|
||||
.defineInRange("baseDurationTicks", 160, 1, Integer.MAX_VALUE);
|
||||
B.pop().push("fear");
|
||||
FEAR_IMMUNITY_HEALTH = d("immunityHealthThreshold", 150, 1, 1000000);
|
||||
FEAR_REDUCED_HEALTH = d("reducedDurationHealthThreshold", 50, 0, 1000000);
|
||||
FEAR_FLEE_SPEED = d("fleeSpeed", 1.25, 0, 100);
|
||||
FEAR_FLEE_DISTANCE = d("fleeDistance", 6, 0, 1000);
|
||||
FEAR_PLAYER_PUSH = d("playerPushStrength", 0.18, 0, 10);
|
||||
B.pop().push("charm");
|
||||
CHARM_VICTIM_BONUS = d("charmedVictimMultiplier", 1.10, 0, 100);
|
||||
CHARM_SOURCE_PENALTY = d("attackerVsSourceMultiplier", 0.85, 0, 100);
|
||||
CHARM_OTHER_BONUS = d("attackerVsOthersMultiplier", 1.15, 0, 100);
|
||||
B.pop().push("taunt");
|
||||
TAUNT_VICTIM_MULTIPLIER = d("victimDamageMultiplier", 1.20, 0, 100);
|
||||
TAUNT_SOURCE_MULTIPLIER = d("attackerVsSourceMultiplier", 1.20, 0, 100);
|
||||
B.pop().push("overcharm");
|
||||
OVERCHARM_CHARM_DURATION = i("charmDurationTicks", 100, 1, Integer.MAX_VALUE);
|
||||
OVERCHARM_DAMAGE_BONUS = d("preCharmedMeleeMultiplier", 1.10, 0, 100);
|
||||
B.pop().push("winded");
|
||||
WINDED_MOVEMENT_REDUCTION = d("movementReduction", 0.25, 0, 1);
|
||||
WINDED_ATTACK_REDUCTION = d("attackSpeedReduction", 0.25, 0, 1);
|
||||
B.pop().push("integration");
|
||||
PVP_PROC_COOLDOWN_TICKS = B.comment(
|
||||
"Minimum ticks between successful procs of the same ailment by one player against other players.",
|
||||
"This cannot be configured below 60 ticks (3 seconds).")
|
||||
.defineInRange("pvpProcCooldownTicks", 60, 60, Integer.MAX_VALUE);
|
||||
AUTOMATIC_WEAPON_BLEED = B.comment(
|
||||
"Automatically add one Bleed stack on direct melee hits with matching modded weapons.")
|
||||
.define("automaticWeaponBleed", true);
|
||||
AUTOMATIC_WEAPON_BLEED_CHANCE = B.comment(
|
||||
"Chance per eligible melee hit to apply automatic weapon Bleed.")
|
||||
.defineInRange("automaticWeaponBleedChance", 1.0, 0.0, 1.0);
|
||||
TAGGED_WEAPON_EFFECT_DURATION = B.comment(
|
||||
"Base duration used by fear, charm, taunt, overcharm, and winded on-hit item tags.",
|
||||
"Soul Rot, Bleed, and Fracture continue to use their ailment-specific configured durations.")
|
||||
.defineInRange("taggedWeaponEffectDurationTicks", 100, 1, Integer.MAX_VALUE);
|
||||
AUTOMATIC_WEAPON_BLEED_KEYWORDS = B.comment(
|
||||
"Case-insensitive registry-path fragments used to identify modded katana-like weapons.",
|
||||
"Items in #ascend_ailments:bleed_on_hit are eligible independently of this list.")
|
||||
.defineListAllowEmpty("automaticWeaponBleedKeywords",
|
||||
List.of("katana", "wakizashi", "nodachi", "odachi", "uchigatana", "tachi"),
|
||||
value -> value instanceof String keyword && !keyword.isBlank());
|
||||
B.pop();
|
||||
}
|
||||
|
||||
public static final ForgeConfigSpec SPEC = B.build();
|
||||
private static ForgeConfigSpec.DoubleValue d(String key, double value, double min, double max) {
|
||||
return B.defineInRange(key, value, min, max);
|
||||
}
|
||||
private static ForgeConfigSpec.IntValue i(String key, int value, int min, int max) {
|
||||
return B.defineInRange(key, value, min, max);
|
||||
}
|
||||
public static double value(ForgeConfigSpec.DoubleValue value) {
|
||||
return SPEC.isLoaded() ? value.get() : value.getDefault();
|
||||
}
|
||||
public static int value(ForgeConfigSpec.IntValue value) {
|
||||
return SPEC.isLoaded() ? value.get() : value.getDefault();
|
||||
}
|
||||
public static boolean value(ForgeConfigSpec.BooleanValue value) {
|
||||
return SPEC.isLoaded() ? value.get() : value.getDefault();
|
||||
}
|
||||
public static List<? extends String> weaponBleedKeywords() {
|
||||
return SPEC.isLoaded() ? AUTOMATIC_WEAPON_BLEED_KEYWORDS.get()
|
||||
: AUTOMATIC_WEAPON_BLEED_KEYWORDS.getDefault();
|
||||
}
|
||||
private AilmentsConfig() {}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.fretux.ailments.damage;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.damagesource.DamageType;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public final class ModDamageSources {
|
||||
public static final ResourceKey<DamageType> BLEED = ResourceKey.create(Registries.DAMAGE_TYPE,
|
||||
ResourceLocation.fromNamespaceAndPath(AscendAilments.MOD_ID, "bleed"));
|
||||
|
||||
public static DamageSource bleed(Level level) {
|
||||
return new DamageSource(level.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE)
|
||||
.getHolderOrThrow(BLEED));
|
||||
}
|
||||
private ModDamageSources() {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.fretux.ailments.effect;
|
||||
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.damage.ModDamageSources;
|
||||
import net.fretux.ailments.util.EffectSourceUtil;
|
||||
import net.fretux.ailments.util.HemorrhageTracker;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
public final class BleedEffect extends MobEffect {
|
||||
public BleedEffect() { super(MobEffectCategory.HARMFUL, 0xAA0000); }
|
||||
|
||||
@Override public boolean isDurationEffectTick(int duration, int amplifier) {
|
||||
int interval = amplifier <= 0 ? AilmentsConfig.value(AilmentsConfig.BLEED_INTERVAL_0)
|
||||
: amplifier == 1 ? AilmentsConfig.value(AilmentsConfig.BLEED_INTERVAL_1)
|
||||
: AilmentsConfig.value(AilmentsConfig.BLEED_INTERVAL_2);
|
||||
return duration % interval == 0;
|
||||
}
|
||||
|
||||
@Override public void applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if (entity.level().isClientSide) return;
|
||||
double base = amplifier <= 0 ? AilmentsConfig.value(AilmentsConfig.BLEED_DAMAGE_0)
|
||||
: amplifier == 1 ? AilmentsConfig.value(AilmentsConfig.BLEED_DAMAGE_1)
|
||||
: AilmentsConfig.value(AilmentsConfig.BLEED_DAMAGE_2);
|
||||
float potency = EffectSourceUtil.getPotency(entity, EffectSourceUtil.BLEED);
|
||||
boolean damaged = entity.hurt(ModDamageSources.bleed(entity.level()), (float) (base * potency));
|
||||
if (damaged) HemorrhageTracker.recordBleedDamage(entity, amplifier, potency);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.fretux.ailments.effect;
|
||||
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
|
||||
/** Three-stack armor-breaking ailment. Arcane scaling is handled only when its duration is applied. */
|
||||
public final class FractureEffect extends MobEffect {
|
||||
public static final String ARMOR_UUID = "9d353786-61e3-43d8-b980-1471e9b84e58";
|
||||
public static final String TOUGHNESS_UUID = "6610760d-38d6-42de-b3ab-621d84896d42";
|
||||
|
||||
public FractureEffect() {
|
||||
super(MobEffectCategory.HARMFUL, 0x8B8178);
|
||||
addAttributeModifier(Attributes.ARMOR, ARMOR_UUID, -2.0, AttributeModifier.Operation.ADDITION);
|
||||
addAttributeModifier(Attributes.ARMOR_TOUGHNESS, TOUGHNESS_UUID, -1.0,
|
||||
AttributeModifier.Operation.ADDITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAttributeModifierValue(int amplifier, AttributeModifier modifier) {
|
||||
int stacks = Math.min(3, Math.max(0, amplifier) + 1);
|
||||
if (modifier.getId().toString().equals(ARMOR_UUID)) return -2.0 * stacks;
|
||||
if (modifier.getId().toString().equals(TOUGHNESS_UUID)) return -1.0 * stacks;
|
||||
return super.getAttributeModifierValue(amplifier, modifier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.fretux.ailments.effect;
|
||||
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.util.EffectSourceUtil;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class SoulRotEffect extends MobEffect {
|
||||
public SoulRotEffect() { super(MobEffectCategory.HARMFUL, 0x8E0E0E); }
|
||||
|
||||
@Override public boolean isDurationEffectTick(int duration, int amplifier) { return duration % 20 == 0; }
|
||||
|
||||
@Override public void applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if (entity.level().isClientSide || !(entity instanceof Player player)) return;
|
||||
float base = (float) (AilmentsConfig.value(AilmentsConfig.SOUL_ROT_EXHAUSTION_BASE)
|
||||
+ AilmentsConfig.value(AilmentsConfig.SOUL_ROT_EXHAUSTION_PER_AMP) * amplifier);
|
||||
player.causeFoodExhaustion(base * EffectSourceUtil.getPotency(entity, EffectSourceUtil.SOUL_ROT));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.fretux.ailments.effect;
|
||||
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
|
||||
public final class WindedEffect extends MobEffect {
|
||||
public static final String MOVEMENT_UUID = "f0eeefea-3f57-4ebb-b8d6-d4ae352efb50";
|
||||
public static final String ATTACK_SPEED_UUID = "3b6a4969-0cd5-4e9c-9b64-a8cd0a0f8d0f";
|
||||
|
||||
public WindedEffect() {
|
||||
super(MobEffectCategory.HARMFUL, 0x567051);
|
||||
addAttributeModifier(Attributes.MOVEMENT_SPEED, MOVEMENT_UUID, -0.25,
|
||||
AttributeModifier.Operation.MULTIPLY_TOTAL);
|
||||
addAttributeModifier(Attributes.ATTACK_SPEED, ATTACK_SPEED_UUID, -0.25,
|
||||
AttributeModifier.Operation.MULTIPLY_TOTAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAttributeModifierValue(int amplifier, AttributeModifier modifier) {
|
||||
if (modifier.getId().toString().equals(MOVEMENT_UUID))
|
||||
return -AilmentsConfig.value(AilmentsConfig.WINDED_MOVEMENT_REDUCTION);
|
||||
if (modifier.getId().toString().equals(ATTACK_SPEED_UUID))
|
||||
return -AilmentsConfig.value(AilmentsConfig.WINDED_ATTACK_REDUCTION);
|
||||
return super.getAttributeModifierValue(amplifier, modifier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package net.fretux.ailments.event;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.fretux.ailments.api.AilmentApi;
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.registry.ModEffects;
|
||||
import net.fretux.ailments.util.ControlEffectHelper;
|
||||
import net.fretux.ailments.util.EffectSourceUtil;
|
||||
import net.fretux.ailments.util.MentalControlUtil;
|
||||
import net.fretux.ailments.util.ModItemTags;
|
||||
import net.fretux.ailments.util.HemorrhageTracker;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingChangeTargetEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHealEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/** One deterministic damage pipeline: Soul Rot, Charm, Taunt, then Overcharm. */
|
||||
@Mod.EventBusSubscriber(modid = AscendAilments.MOD_ID)
|
||||
public final class AilmentEvents {
|
||||
@SubscribeEvent
|
||||
public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
|
||||
HemorrhageTracker.syncDisplay(event.getEntity());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event) {
|
||||
HemorrhageTracker.hideDisplay(event.getEntity());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onDeath(LivingDeathEvent event) {
|
||||
HemorrhageTracker.clear(event.getEntity());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLivingTick(LivingEvent.LivingTickEvent event) {
|
||||
ControlEffectHelper.handleLivingTick(event.getEntity());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onHeal(LivingHealEvent event) {
|
||||
if (!event.isCanceled() && event.getEntity().hasEffect(ModEffects.SOUL_ROT.get()))
|
||||
event.setAmount((float) (event.getAmount() * AilmentsConfig.value(AilmentsConfig.SOUL_ROT_HEALING)));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onAttack(LivingAttackEvent event) {
|
||||
Entity attacker = event.getSource().getEntity();
|
||||
if (attacker instanceof LivingEntity living && !(living instanceof Player)
|
||||
&& living.hasEffect(ModEffects.CHARM.get())
|
||||
&& ControlEffectHelper.isOwnCharmSource(living, event.getEntity())) event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onChangeTarget(LivingChangeTargetEvent event) {
|
||||
if (!(event.getEntity() instanceof Mob mob)) return;
|
||||
LivingEntity taunter = mob.hasEffect(ModEffects.TAUNT.get())
|
||||
&& !MentalControlUtil.isMentalControlResistant(mob)
|
||||
? ControlEffectHelper.validTauntSource(mob) : null;
|
||||
if (taunter != null) {
|
||||
if (event.getNewTarget() != taunter) event.setNewTarget(taunter);
|
||||
return;
|
||||
}
|
||||
if (mob.hasEffect(ModEffects.CHARM.get()) && event.getNewTarget() != null
|
||||
&& ControlEffectHelper.isOwnCharmSource(mob, event.getNewTarget())) event.setNewTarget(null);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onHurt(LivingHurtEvent event) {
|
||||
if (event.isCanceled()) return;
|
||||
LivingEntity victim = event.getEntity();
|
||||
DamageSource damageSource = event.getSource();
|
||||
Entity causing = damageSource.getEntity();
|
||||
LivingEntity attacker = causing instanceof LivingEntity living ? living : null;
|
||||
float amount = event.getAmount();
|
||||
|
||||
// 1. Victim vulnerability.
|
||||
if (victim.hasEffect(ModEffects.SOUL_ROT.get()))
|
||||
amount *= (float) AilmentsConfig.value(AilmentsConfig.SOUL_ROT_DAMAGE_TAKEN);
|
||||
|
||||
// 2. Charm victim and attacker rules.
|
||||
if (attacker != null && !(victim instanceof Player) && victim.hasEffect(ModEffects.CHARM.get())
|
||||
&& ControlEffectHelper.isOwnCharmSource(victim, attacker))
|
||||
amount *= (float) AilmentsConfig.value(AilmentsConfig.CHARM_VICTIM_BONUS);
|
||||
if (attacker != null && attacker.hasEffect(ModEffects.CHARM.get())) {
|
||||
amount *= (float) (ControlEffectHelper.isOwnCharmSource(attacker, victim)
|
||||
? AilmentsConfig.value(AilmentsConfig.CHARM_SOURCE_PENALTY)
|
||||
: AilmentsConfig.value(AilmentsConfig.CHARM_OTHER_BONUS));
|
||||
}
|
||||
|
||||
// 3. Taunt rules; each logically distinct rule is applied once.
|
||||
if (victim.hasEffect(ModEffects.TAUNT.get()))
|
||||
amount *= (float) AilmentsConfig.value(AilmentsConfig.TAUNT_VICTIM_MULTIPLIER);
|
||||
if (attacker != null && attacker.hasEffect(ModEffects.TAUNT.get())) {
|
||||
LivingEntity taunter = EffectSourceUtil.getSource(attacker, EffectSourceUtil.TAUNT);
|
||||
if (taunter != null && taunter.getUUID().equals(victim.getUUID()))
|
||||
amount *= (float) AilmentsConfig.value(AilmentsConfig.TAUNT_SOURCE_MULTIPLIER);
|
||||
}
|
||||
|
||||
// 4. Snapshot pre-hit Charm before Overcharm refreshes it.
|
||||
if (attacker != null && attacker != victim && attacker.hasEffect(ModEffects.OVERCHARM.get())) {
|
||||
boolean alreadyCharmedByAttacker = victim.hasEffect(ModEffects.CHARM.get())
|
||||
&& ControlEffectHelper.isOwnCharmSource(victim, attacker);
|
||||
boolean directPlayerMelee = attacker instanceof Player && damageSource.getDirectEntity() == attacker;
|
||||
if (alreadyCharmedByAttacker && directPlayerMelee)
|
||||
amount *= (float) AilmentsConfig.value(AilmentsConfig.OVERCHARM_DAMAGE_BONUS);
|
||||
AilmentApi.applyCharm(victim, attacker,
|
||||
AilmentsConfig.value(AilmentsConfig.OVERCHARM_CHARM_DURATION));
|
||||
}
|
||||
|
||||
if (attacker != null && attacker != victim && amount > 0
|
||||
&& damageSource.getDirectEntity() == attacker)
|
||||
applyTaggedWeaponAilments(attacker.getMainHandItem(), victim, attacker);
|
||||
event.setAmount(amount);
|
||||
}
|
||||
|
||||
private static void applyTaggedWeaponAilments(ItemStack stack, LivingEntity victim, LivingEntity attacker) {
|
||||
if (stack.isEmpty()) return;
|
||||
if (isAutomaticBleedWeapon(stack) && attacker.getRandom().nextDouble()
|
||||
< AilmentsConfig.value(AilmentsConfig.AUTOMATIC_WEAPON_BLEED_CHANCE))
|
||||
AilmentApi.applyBleed(victim, attacker);
|
||||
if (stack.is(ModItemTags.SOUL_ROT_ON_HIT)) AilmentApi.applySoulRot(victim, attacker);
|
||||
if (stack.is(ModItemTags.FRACTURE_ON_HIT)) AilmentApi.applyFracture(victim, attacker);
|
||||
|
||||
int duration = AilmentsConfig.value(AilmentsConfig.TAGGED_WEAPON_EFFECT_DURATION);
|
||||
if (stack.is(ModItemTags.FEAR_ON_HIT)) AilmentApi.applyFear(victim, attacker, duration);
|
||||
if (stack.is(ModItemTags.CHARM_ON_HIT)) AilmentApi.applyCharm(victim, attacker, duration);
|
||||
if (stack.is(ModItemTags.TAUNT_ON_HIT)) AilmentApi.applyTaunt(victim, attacker, duration, 0);
|
||||
if (stack.is(ModItemTags.OVERCHARM_ON_HIT)) AilmentApi.applyOvercharm(victim, attacker, duration);
|
||||
if (stack.is(ModItemTags.WINDED_ON_HIT)) AilmentApi.applyWinded(victim, attacker, duration);
|
||||
}
|
||||
|
||||
private static boolean isAutomaticBleedWeapon(ItemStack stack) {
|
||||
if (!AilmentsConfig.value(AilmentsConfig.AUTOMATIC_WEAPON_BLEED) || stack.isEmpty()) return false;
|
||||
if (stack.is(ModItemTags.BLEED_ON_HIT)) return true;
|
||||
ResourceLocation id = ForgeRegistries.ITEMS.getKey(stack.getItem());
|
||||
if (id == null || id.getNamespace().equals("minecraft")) return false;
|
||||
String path = id.getPath().toLowerCase(Locale.ROOT);
|
||||
return AilmentsConfig.weaponBleedKeywords().stream()
|
||||
.map(keyword -> keyword.toLowerCase(Locale.ROOT))
|
||||
.anyMatch(path::contains);
|
||||
}
|
||||
private AilmentEvents() {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.fretux.ailments.network;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.network.NetworkDirection;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import net.minecraftforge.network.simple.SimpleChannel;
|
||||
|
||||
public final class AilmentNetwork {
|
||||
private static final String PROTOCOL = "1";
|
||||
private static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel(
|
||||
ResourceLocation.fromNamespaceAndPath(AscendAilments.MOD_ID, "main"),
|
||||
() -> PROTOCOL, PROTOCOL::equals, PROTOCOL::equals);
|
||||
|
||||
public static void register() {
|
||||
CHANNEL.messageBuilder(ClientboundHemorrhagePacket.class, 0, NetworkDirection.PLAY_TO_CLIENT)
|
||||
.encoder(ClientboundHemorrhagePacket::encode)
|
||||
.decoder(ClientboundHemorrhagePacket::decode)
|
||||
.consumerMainThread(ClientboundHemorrhagePacket::handle)
|
||||
.add();
|
||||
}
|
||||
|
||||
public static void sendHemorrhageProgress(ServerPlayer player, float fraction) {
|
||||
CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), new ClientboundHemorrhagePacket(fraction));
|
||||
}
|
||||
|
||||
private AilmentNetwork() {}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.fretux.ailments.network;
|
||||
|
||||
import net.fretux.ailments.client.ClientHemorrhageState;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public record ClientboundHemorrhagePacket(float fraction) {
|
||||
public ClientboundHemorrhagePacket {
|
||||
fraction = Math.max(0.0F, Math.min(1.0F, fraction));
|
||||
}
|
||||
|
||||
public static void encode(ClientboundHemorrhagePacket packet, FriendlyByteBuf buffer) {
|
||||
buffer.writeFloat(packet.fraction);
|
||||
}
|
||||
|
||||
public static ClientboundHemorrhagePacket decode(FriendlyByteBuf buffer) {
|
||||
return new ClientboundHemorrhagePacket(buffer.readFloat());
|
||||
}
|
||||
|
||||
public static void handle(ClientboundHemorrhagePacket packet,
|
||||
Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
NetworkEvent.Context context = contextSupplier.get();
|
||||
context.enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
||||
() -> () -> ClientHemorrhageState.setProgress(packet.fraction)));
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package net.fretux.ailments.registry;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.fretux.ailments.effect.BleedEffect;
|
||||
import net.fretux.ailments.effect.FractureEffect;
|
||||
import net.fretux.ailments.effect.SoulRotEffect;
|
||||
import net.fretux.ailments.effect.WindedEffect;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
public final class ModEffects {
|
||||
public static final DeferredRegister<MobEffect> EFFECTS =
|
||||
DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, AscendAilments.MOD_ID);
|
||||
|
||||
public static final RegistryObject<MobEffect> SOUL_ROT = EFFECTS.register("soul_rot", SoulRotEffect::new);
|
||||
public static final RegistryObject<MobEffect> BLEED = EFFECTS.register("bleed", BleedEffect::new);
|
||||
public static final RegistryObject<MobEffect> FRACTURE = EFFECTS.register("fracture", FractureEffect::new);
|
||||
public static final RegistryObject<MobEffect> FEAR = EFFECTS.register("fear",
|
||||
() -> new SimpleAilmentEffect(MobEffectCategory.HARMFUL, 0xAA0000));
|
||||
public static final RegistryObject<MobEffect> CHARM = EFFECTS.register("charm",
|
||||
() -> new SimpleAilmentEffect(MobEffectCategory.HARMFUL, 0xCC7AB6));
|
||||
public static final RegistryObject<MobEffect> TAUNT = EFFECTS.register("taunt",
|
||||
() -> new SimpleAilmentEffect(MobEffectCategory.HARMFUL, 0xCC7AB6));
|
||||
public static final RegistryObject<MobEffect> OVERCHARM = EFFECTS.register("overcharm",
|
||||
() -> new SimpleAilmentEffect(MobEffectCategory.BENEFICIAL, 0xFFD966));
|
||||
public static final RegistryObject<MobEffect> WINDED = EFFECTS.register("winded", WindedEffect::new);
|
||||
|
||||
public static void register(IEventBus bus) { EFFECTS.register(bus); }
|
||||
private ModEffects() {}
|
||||
|
||||
private static final class SimpleAilmentEffect extends MobEffect {
|
||||
private SimpleAilmentEffect(MobEffectCategory category, int color) { super(category, color); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package net.fretux.ailments.util;
|
||||
|
||||
import net.fretux.ailments.api.AilmentApi;
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.registry.ModEffects;
|
||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.food.FoodData;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public final class ControlEffectHelper {
|
||||
private static final String FEAR_DISTANCE = "ascend_ailments.fear.last_distance_sqr";
|
||||
private static final String SOUL_FOOD = "ascend_ailments.soul_rot.last_food";
|
||||
private static final String SOUL_SATURATION = "ascend_ailments.soul_rot.last_saturation";
|
||||
|
||||
public static void handleLivingTick(LivingEntity entity) {
|
||||
if (entity.level().isClientSide) return;
|
||||
handleSoulRotFood(entity);
|
||||
cleanDotData(entity);
|
||||
if (entity.hasEffect(ModEffects.FEAR.get())) tickFear(entity);
|
||||
else {
|
||||
EffectSourceUtil.clear(entity, EffectSourceUtil.FEAR);
|
||||
entity.getPersistentData().remove(FEAR_DISTANCE);
|
||||
}
|
||||
if (entity.hasEffect(ModEffects.TAUNT.get())) tickTaunt(entity);
|
||||
else EffectSourceUtil.clear(entity, EffectSourceUtil.TAUNT);
|
||||
if (entity.hasEffect(ModEffects.CHARM.get())) validateCharm(entity);
|
||||
else EffectSourceUtil.clear(entity, EffectSourceUtil.CHARM);
|
||||
if (!entity.hasEffect(ModEffects.OVERCHARM.get()))
|
||||
EffectSourceUtil.clear(entity, EffectSourceUtil.OVERCHARM);
|
||||
}
|
||||
|
||||
private static void tickFear(LivingEntity entity) {
|
||||
LivingEntity source = validControlSource(entity, EffectSourceUtil.FEAR);
|
||||
if (source == null) {
|
||||
entity.removeEffect(ModEffects.FEAR.get());
|
||||
EffectSourceUtil.clear(entity, EffectSourceUtil.FEAR);
|
||||
entity.getPersistentData().remove(FEAR_DISTANCE);
|
||||
return;
|
||||
}
|
||||
if (MentalControlUtil.isMentalControlResistant(entity)) {
|
||||
MobEffectInstance winded = entity.getEffect(ModEffects.WINDED.get());
|
||||
if (winded == null || winded.getDuration() < 10)
|
||||
entity.addEffect(new MobEffectInstance(ModEffects.WINDED.get(), 25, 0, false, false, false));
|
||||
return;
|
||||
}
|
||||
if (entity instanceof Mob mob) flee(mob, source);
|
||||
else if (entity instanceof Player player) restrictFearedPlayer(player, source);
|
||||
}
|
||||
|
||||
private static void flee(Mob mob, LivingEntity source) {
|
||||
mob.setTarget(null);
|
||||
if (mob.distanceToSqr(source) > 400.0) return;
|
||||
Vec3 away = mob.position().subtract(source.position());
|
||||
Vec3 horizontal = new Vec3(away.x, 0, away.z);
|
||||
if (horizontal.lengthSqr() < 1.0E-8) horizontal = new Vec3(1, 0, 0);
|
||||
Vec3 destination = mob.position().add(horizontal.normalize()
|
||||
.scale(AilmentsConfig.value(AilmentsConfig.FEAR_FLEE_DISTANCE)));
|
||||
mob.getNavigation().moveTo(destination.x, destination.y, destination.z,
|
||||
AilmentsConfig.value(AilmentsConfig.FEAR_FLEE_SPEED));
|
||||
}
|
||||
|
||||
private static void restrictFearedPlayer(Player player, LivingEntity source) {
|
||||
double distance = player.distanceToSqr(source);
|
||||
CompoundTag data = player.getPersistentData();
|
||||
if (distance <= 144.0) {
|
||||
Vec3 toward = source.position().subtract(player.position());
|
||||
Vec3 horizontal = new Vec3(toward.x, 0, toward.z);
|
||||
if (horizontal.lengthSqr() >= 1.0E-8) {
|
||||
Vec3 direction = horizontal.normalize();
|
||||
Vec3 velocity = player.getDeltaMovement();
|
||||
double towardSpeed = velocity.x * direction.x + velocity.z * direction.z;
|
||||
if (towardSpeed > 0)
|
||||
player.setDeltaMovement(velocity.x - direction.x * towardSpeed, velocity.y,
|
||||
velocity.z - direction.z * towardSpeed);
|
||||
if (data.contains(FEAR_DISTANCE) && distance < data.getDouble(FEAR_DISTANCE)) {
|
||||
double push = AilmentsConfig.value(AilmentsConfig.FEAR_PLAYER_PUSH);
|
||||
player.push(-direction.x * push, 0, -direction.z * push);
|
||||
player.hurtMarked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
data.putDouble(FEAR_DISTANCE, distance);
|
||||
if (distance <= 36.0) {
|
||||
player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 20, 3, false, false, false));
|
||||
player.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 20, 0, false, false, false));
|
||||
}
|
||||
}
|
||||
|
||||
private static void tickTaunt(LivingEntity entity) {
|
||||
LivingEntity source = validControlSource(entity, EffectSourceUtil.TAUNT);
|
||||
if (source == null) {
|
||||
entity.removeEffect(ModEffects.TAUNT.get());
|
||||
EffectSourceUtil.clear(entity, EffectSourceUtil.TAUNT);
|
||||
return;
|
||||
}
|
||||
if (MentalControlUtil.isMentalControlResistant(entity)) return;
|
||||
if (entity instanceof Mob mob && mob.getTarget() != source) mob.setTarget(source);
|
||||
else if (entity instanceof Player player)
|
||||
player.lookAt(EntityAnchorArgument.Anchor.EYES, source.getEyePosition());
|
||||
}
|
||||
|
||||
private static void validateCharm(LivingEntity entity) {
|
||||
if (validControlSource(entity, EffectSourceUtil.CHARM) == null) {
|
||||
entity.removeEffect(ModEffects.CHARM.get());
|
||||
EffectSourceUtil.clear(entity, EffectSourceUtil.CHARM);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isOwnCharmSource(LivingEntity charmed, LivingEntity possibleSource) {
|
||||
LivingEntity source = EffectSourceUtil.getSource(charmed, EffectSourceUtil.CHARM);
|
||||
return source != null && source.getUUID().equals(possibleSource.getUUID());
|
||||
}
|
||||
|
||||
public static LivingEntity validTauntSource(LivingEntity entity) {
|
||||
return validControlSource(entity, EffectSourceUtil.TAUNT);
|
||||
}
|
||||
|
||||
private static LivingEntity validControlSource(LivingEntity target, String key) {
|
||||
LivingEntity source = EffectSourceUtil.getSource(target, key);
|
||||
return source != null && source.isAlive() && source.level() == target.level() ? source : null;
|
||||
}
|
||||
|
||||
private static void handleSoulRotFood(LivingEntity entity) {
|
||||
if (!(entity instanceof Player player)) return;
|
||||
CompoundTag data = player.getPersistentData();
|
||||
if (!player.hasEffect(ModEffects.SOUL_ROT.get())) {
|
||||
data.remove(SOUL_FOOD); data.remove(SOUL_SATURATION); return;
|
||||
}
|
||||
FoodData food = player.getFoodData();
|
||||
if (data.contains(SOUL_FOOD)) food.setFoodLevel(Math.min(food.getFoodLevel(), data.getInt(SOUL_FOOD)));
|
||||
if (data.contains(SOUL_SATURATION))
|
||||
food.setSaturation(Math.min(food.getSaturationLevel(), data.getFloat(SOUL_SATURATION)));
|
||||
data.putInt(SOUL_FOOD, food.getFoodLevel());
|
||||
data.putFloat(SOUL_SATURATION, food.getSaturationLevel());
|
||||
}
|
||||
|
||||
private static void cleanDotData(LivingEntity entity) {
|
||||
if (!entity.hasEffect(ModEffects.SOUL_ROT.get())) EffectSourceUtil.clear(entity, EffectSourceUtil.SOUL_ROT);
|
||||
if (!entity.hasEffect(ModEffects.BLEED.get())) EffectSourceUtil.clear(entity, EffectSourceUtil.BLEED);
|
||||
if (!entity.hasEffect(ModEffects.FRACTURE.get())) EffectSourceUtil.clear(entity, EffectSourceUtil.FRACTURE);
|
||||
}
|
||||
private ControlEffectHelper() {}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package net.fretux.ailments.util;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class EffectSourceUtil {
|
||||
public static final String SOUL_ROT = "ascend_ailments.soul_rot";
|
||||
public static final String BLEED = "ascend_ailments.bleed";
|
||||
public static final String FRACTURE = "ascend_ailments.fracture";
|
||||
public static final String FEAR = "ascend_ailments.fear";
|
||||
public static final String CHARM = "ascend_ailments.charm";
|
||||
public static final String TAUNT = "ascend_ailments.taunt";
|
||||
public static final String OVERCHARM = "ascend_ailments.overcharm";
|
||||
|
||||
public static void setSource(LivingEntity target, String ailment, @Nullable LivingEntity source) {
|
||||
CompoundTag data = target.getPersistentData();
|
||||
if (source == null) data.remove(sourceKey(ailment));
|
||||
else data.putUUID(sourceKey(ailment), source.getUUID());
|
||||
}
|
||||
|
||||
@Nullable public static UUID getSourceUuid(LivingEntity target, String ailment) {
|
||||
CompoundTag data = target.getPersistentData();
|
||||
String key = sourceKey(ailment);
|
||||
return data.hasUUID(key) ? data.getUUID(key) : null;
|
||||
}
|
||||
|
||||
@Nullable public static LivingEntity getSource(LivingEntity target, String ailment) {
|
||||
UUID id = getSourceUuid(target, ailment);
|
||||
if (id == null || !(target.level() instanceof ServerLevel level)) return null;
|
||||
MinecraftServer server = level.getServer();
|
||||
for (ServerLevel candidate : server.getAllLevels()) {
|
||||
Entity entity = candidate.getEntity(id);
|
||||
if (entity instanceof LivingEntity living) return living;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void setPotency(LivingEntity target, String ailment, double potency) {
|
||||
target.getPersistentData().putFloat(potencyKey(ailment), (float) Math.max(0, potency));
|
||||
}
|
||||
|
||||
public static float getPotency(LivingEntity target, String ailment) {
|
||||
CompoundTag data = target.getPersistentData();
|
||||
String key = potencyKey(ailment);
|
||||
return data.contains(key) ? Math.max(0, data.getFloat(key)) : 1.0F;
|
||||
}
|
||||
|
||||
public static void clear(LivingEntity target, String ailment) {
|
||||
target.getPersistentData().remove(sourceKey(ailment));
|
||||
target.getPersistentData().remove(potencyKey(ailment));
|
||||
}
|
||||
|
||||
private static String sourceKey(String ailment) { return ailment + ".source"; }
|
||||
private static String potencyKey(String ailment) { return ailment + ".potency"; }
|
||||
private EffectSourceUtil() {}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package net.fretux.ailments.util;
|
||||
|
||||
import net.fretux.ailments.config.AilmentsConfig;
|
||||
import net.fretux.ailments.damage.ModDamageSources;
|
||||
import net.fretux.ailments.network.AilmentNetwork;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
/** Server-authoritative Hemorrhage progress produced by stacked Bleed damage. */
|
||||
public final class HemorrhageTracker {
|
||||
private static final String PROGRESS = "ascend_ailments.hemorrhage.progress";
|
||||
|
||||
/**
|
||||
* Records one successful Bleed damage tick and triggers the max-health burst when full.
|
||||
* Arcane potency is snapshotted when Bleed is applied, so an unloaded source cannot change an active meter.
|
||||
*/
|
||||
public static boolean recordBleedDamage(LivingEntity target, int amplifier, double arcanePotency) {
|
||||
if (target.level().isClientSide
|
||||
|| amplifier + 1 < AilmentsConfig.value(AilmentsConfig.HEMORRHAGE_MINIMUM_STACKS)) return false;
|
||||
double threshold = AilmentsConfig.value(AilmentsConfig.HEMORRHAGE_THRESHOLD);
|
||||
double added = AilmentsConfig.value(AilmentsConfig.HEMORRHAGE_FILL_PER_TICK)
|
||||
* Math.max(0.0, arcanePotency);
|
||||
if (added <= 0) return false;
|
||||
|
||||
double progress = Math.min(threshold, getProgress(target) + added);
|
||||
if (progress < threshold) {
|
||||
target.getPersistentData().putDouble(PROGRESS, progress);
|
||||
syncDisplay(target);
|
||||
return false;
|
||||
}
|
||||
|
||||
clear(target);
|
||||
if (target.isAlive()) {
|
||||
float damage = (float) (target.getMaxHealth()
|
||||
* AilmentsConfig.value(AilmentsConfig.HEMORRHAGE_MAX_HEALTH_DAMAGE));
|
||||
if (damage > 0) target.hurt(ModDamageSources.bleed(target.level()), damage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static double getProgress(LivingEntity target) {
|
||||
CompoundTag data = target.getPersistentData();
|
||||
return data.contains(PROGRESS) ? Math.max(0.0, data.getDouble(PROGRESS)) : 0.0;
|
||||
}
|
||||
|
||||
public static double getFraction(LivingEntity target) {
|
||||
double threshold = AilmentsConfig.value(AilmentsConfig.HEMORRHAGE_THRESHOLD);
|
||||
return threshold <= 0 ? 0.0 : Math.min(1.0, getProgress(target) / threshold);
|
||||
}
|
||||
|
||||
public static void clear(LivingEntity target) {
|
||||
target.getPersistentData().remove(PROGRESS);
|
||||
hideDisplay(target);
|
||||
}
|
||||
|
||||
/** Synchronizes the compact client HUD after login or a meter update. */
|
||||
public static void syncDisplay(LivingEntity target) {
|
||||
if (!(target instanceof ServerPlayer player)) return;
|
||||
double fraction = getFraction(player);
|
||||
AilmentNetwork.sendHemorrhageProgress(player,
|
||||
AilmentsConfig.value(AilmentsConfig.HEMORRHAGE_SHOW_PLAYER_BAR) ? (float) fraction : 0.0F);
|
||||
}
|
||||
|
||||
/** Hides the client HUD while retaining persistent meter progress. */
|
||||
public static void hideDisplay(LivingEntity target) {
|
||||
if (target instanceof ServerPlayer player) AilmentNetwork.sendHemorrhageProgress(player, 0.0F);
|
||||
}
|
||||
|
||||
private HemorrhageTracker() {}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.fretux.ailments.util;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
public final class MentalControlUtil {
|
||||
public static boolean isMentalControlResistant(LivingEntity target) {
|
||||
return target.getType().is(ModEntityTypeTags.MENTAL_CONTROL_RESISTANT);
|
||||
}
|
||||
public static boolean isMentalControlImmune(LivingEntity target) {
|
||||
return target.getType().is(ModEntityTypeTags.MENTAL_CONTROL_IMMUNE);
|
||||
}
|
||||
public static int resistantDuration(int duration, int divisor) {
|
||||
return Math.max(20, duration / divisor);
|
||||
}
|
||||
private MentalControlUtil() {}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.fretux.ailments.util;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
|
||||
public final class ModEntityTypeTags {
|
||||
public static final TagKey<EntityType<?>> BLEED_IMMUNE = tag("bleed_immune");
|
||||
public static final TagKey<EntityType<?>> MENTAL_CONTROL_RESISTANT = tag("mental_control_resistant");
|
||||
public static final TagKey<EntityType<?>> MENTAL_CONTROL_IMMUNE = tag("mental_control_immune");
|
||||
private static TagKey<EntityType<?>> tag(String path) {
|
||||
return TagKey.create(Registries.ENTITY_TYPE,
|
||||
ResourceLocation.fromNamespaceAndPath(AscendAilments.MOD_ID, path));
|
||||
}
|
||||
private ModEntityTypeTags() {}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.fretux.ailments.util;
|
||||
|
||||
import net.fretux.ailments.AscendAilments;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
/** Public item tags consumed by Ascend: Ailments integrations. */
|
||||
public final class ModItemTags {
|
||||
/** Items in this tag apply one Bleed stack on direct melee hits. */
|
||||
public static final TagKey<Item> BLEED_ON_HIT = tag("bleed_on_hit");
|
||||
/** Items in these tags apply the corresponding ailment on direct melee hits. */
|
||||
public static final TagKey<Item> SOUL_ROT_ON_HIT = tag("soul_rot_on_hit");
|
||||
public static final TagKey<Item> FRACTURE_ON_HIT = tag("fracture_on_hit");
|
||||
public static final TagKey<Item> FEAR_ON_HIT = tag("fear_on_hit");
|
||||
public static final TagKey<Item> CHARM_ON_HIT = tag("charm_on_hit");
|
||||
public static final TagKey<Item> TAUNT_ON_HIT = tag("taunt_on_hit");
|
||||
public static final TagKey<Item> OVERCHARM_ON_HIT = tag("overcharm_on_hit");
|
||||
public static final TagKey<Item> WINDED_ON_HIT = tag("winded_on_hit");
|
||||
|
||||
private static TagKey<Item> tag(String path) {
|
||||
return TagKey.create(Registries.ITEM,
|
||||
ResourceLocation.fromNamespaceAndPath(AscendAilments.MOD_ID, path));
|
||||
}
|
||||
|
||||
private ModItemTags() {}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
# This is an example mods.toml file. It contains the data relating to the loading mods.
|
||||
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
|
||||
# The overall format is standard TOML format, v0.5.0.
|
||||
# Note that there are a couple of TOML lists in this file.
|
||||
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="${mod_license}"
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||
# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN),
|
||||
# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers.
|
||||
#clientSideOnly=true #optional - defaults to false if absent
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId="${mod_id}" #mandatory
|
||||
# The version number of the mod
|
||||
version="${mod_version}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="${mod_name}" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
logoFile="ascend_ailments.png"
|
||||
# A text field displayed in the mod UI
|
||||
#credits="" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors="${mod_authors}" #optional
|
||||
# Display Test controls the display for your mod in the server connection screen
|
||||
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||
#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional)
|
||||
|
||||
# Access Transformers
|
||||
# Optional, if not specified Forge will attempt to find the default META-INF/accesstransformer.cfg and silently continue if not found. May default to an empty list in a future MC.
|
||||
# If you specify AT path strings in this list, Forge will attempt to load each of them and throw errors for any that aren't found.
|
||||
# Specifying an empty list when your mod has no ATs is recommended to opt-out of the default for slightly better loading performance.
|
||||
#accessTransformers = []
|
||||
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description='''${mod_description}'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies.${mod_id}]] #optional
|
||||
# the modid of the dependency
|
||||
modId="forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="${forge_version_range}" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
||||
# BEFORE - This mod is loaded BEFORE the dependency
|
||||
# AFTER - This mod is loaded AFTER the dependency
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||
side="BOTH"
|
||||
# Here's another dependency
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="ascend"
|
||||
mandatory=false
|
||||
versionRange="[0,)"
|
||||
ordering="AFTER"
|
||||
side="BOTH"
|
||||
|
||||
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
|
||||
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
||||
# stop your mod loading on the server for example.
|
||||
#[features.${mod_id}]
|
||||
#openGLVersion="[3.2,)"
|
||||
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"effect.ascend_ailments.soul_rot": "Soul Rot",
|
||||
"effect.ascend_ailments.bleed": "Bleed",
|
||||
"effect.ascend_ailments.fracture": "Fracture",
|
||||
"effect.ascend_ailments.fear": "Fear",
|
||||
"effect.ascend_ailments.charm": "Charm",
|
||||
"effect.ascend_ailments.taunt": "Taunt",
|
||||
"effect.ascend_ailments.overcharm": "Overcharm",
|
||||
"effect.ascend_ailments.winded": "Winded",
|
||||
"gui.ascend_ailments.hemorrhage": "Hemorrhage",
|
||||
"death.attack.bleed": "%1$s bled out",
|
||||
"death.attack.bleed.player": "%1$s bled out while fighting %2$s"
|
||||
}
|
||||
|
After Width: | Height: | Size: 333 B |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 602 B |
|
After Width: | Height: | Size: 844 B |
|
After Width: | Height: | Size: 421 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 440 B |
|
After Width: | Height: | Size: 447 B |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"exhaustion": 0.0,
|
||||
"message_id": "bleed",
|
||||
"scaling": "never"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:iron_golem",
|
||||
"minecraft:snow_golem"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:ender_dragon",
|
||||
"minecraft:wither",
|
||||
"minecraft:warden"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:elder_guardian",
|
||||
"minecraft:ravager"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": {
|
||||
"text": "${mod_id} resources"
|
||||
},
|
||||
"pack_format": 15
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class AilmentApplicationTest {
|
||||
@Test void timedApplicationRetainsPublicParameters() {
|
||||
AilmentApplication application = AilmentApplication.timed(AilmentType.TAUNT, 100, 2);
|
||||
assertEquals(AilmentType.TAUNT, application.type());
|
||||
assertEquals(100, application.durationTicks());
|
||||
assertEquals(2, application.amplifier());
|
||||
assertFalse(application.isStacking());
|
||||
}
|
||||
|
||||
@Test void stackingIsOnlyAvailableForStackableAilments() {
|
||||
assertTrue(AilmentApplication.stack(AilmentType.BLEED).isStacking());
|
||||
assertTrue(AilmentApplication.stack(AilmentType.SOUL_ROT).isStacking());
|
||||
assertTrue(AilmentApplication.stack(AilmentType.FRACTURE).isStacking());
|
||||
assertThrows(IllegalArgumentException.class, () -> AilmentApplication.stack(AilmentType.FEAR));
|
||||
}
|
||||
|
||||
@Test void timedApplicationRejectsInvalidValues() {
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> AilmentApplication.timed(AilmentType.CHARM, 0, 0));
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> AilmentApplication.timed(AilmentType.CHARM, 20, -1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
import net.fretux.ailments.compat.AscendCompat;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class AilmentScalingTest {
|
||||
@Test void durationCurveMatchesBalanceTargets() {
|
||||
assertEquals(1.00, AilmentScaling.getDurationMultiplierForArcane(0), 0.001);
|
||||
assertEquals(1.08, AilmentScaling.getDurationMultiplierForArcane(20), 0.01);
|
||||
assertEquals(1.15, AilmentScaling.getDurationMultiplierForArcane(40), 0.01);
|
||||
assertEquals(1.21, AilmentScaling.getDurationMultiplierForArcane(60), 0.011);
|
||||
assertEquals(1.26, AilmentScaling.getDurationMultiplierForArcane(80), 0.011);
|
||||
assertEquals(1.30, AilmentScaling.getDurationMultiplierForArcane(100), 0.001);
|
||||
assertEquals(1.30, AilmentScaling.getDurationMultiplierForArcane(500), 0.001);
|
||||
}
|
||||
|
||||
@Test void absentAscendAndNullSourceAreSafeDefaults() {
|
||||
assertDoesNotThrow(() -> AscendCompat.getArcane(null));
|
||||
assertEquals(0, AscendCompat.getArcane(null));
|
||||
assertEquals(1.0, AilmentScaling.getDurationMultiplier(null), 0.0);
|
||||
assertEquals(160, AilmentScaling.scaleDuration(160, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.fretux.ailments.api;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class HemorrhageScalingTest {
|
||||
@Test void bleedPotencyAndHemorrhageRateIncreaseWithArcane() {
|
||||
double zeroArcane = AilmentScaling.getPotencyMultiplierForArcane(0, AilmentType.BLEED);
|
||||
double highArcane = AilmentScaling.getPotencyMultiplierForArcane(100, AilmentType.BLEED);
|
||||
assertTrue(highArcane > zeroArcane);
|
||||
}
|
||||
}
|
||||