Release the tag update

This commit is contained in:
simeonvartik 2026-09-07 00:11:44 +02:00
commit cb6910b424
1300 changed files with 317229 additions and 0 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
gradlew text eol=lf

14
.gitignore vendored Normal file
View file

@ -0,0 +1,14 @@
# Gradle / build output
.gradle/
build/
out/
run/
# IDE
.idea/
*.iml
.vscode/
# OS
.DS_Store
Thumbs.db

47
CREDITS.md Normal file
View file

@ -0,0 +1,47 @@
# Credits
AUTISM Client includes original code written for this project, but it also uses, references, or derives ideas/code from other open-source Minecraft client projects.
Huge credit to the following developers and projects:
## OpSec by aurickk
Parts of AUTISM Client related to client privacy, mod detection protection, compatibility handling, and anti-fingerprinting behavior are inspired by or derived from OpSec.
Project: https://github.com/aurickk/OpSec
License: GPL-3.0
## Meteor Client
AUTISM Client uses ideas, structure, APIs, or source-code references from Meteor Client, especially around Fabric client architecture, modules, utilities, and client-side systems.
Project: https://github.com/MeteorDevelopment/meteor-client
License: GPL-3.0
## Wurst Client
AUTISM Client uses ideas, references, or code patterns from Wurst Client, one of the long-running open-source Minecraft utility clients.
Project: https://github.com/Wurst-Imperium/Wurst7
License: GPL-3.0
## ExploitPreventer by NikOverflow
AUTISM Client uses ideas, references, or derived logic from ExploitPreventer for protection against known client-side exploits.
Project: https://github.com/NikOverflow/ExploitPreventer
License: MIT
## Better Storage ESP by bestluaucoder
The Storage ESP "Ignore Structures" filters come from the Better Storage ESP addon: the idea of hiding containers that generated inside a structure, and the list of structures worth filtering.
Project: https://github.com/bestluaucoder/Autism-Better-Storage-esp-1-addon/tree/main
## License Notice
Because AUTISM Client uses and/or derives from GPL-licensed projects, AUTISM Client is released under the GNU General Public License v3.0.
Source code must stay available to users, and any redistributed modified versions must follow the same GPL-3.0 license terms.
If any credit is missing or inaccurate, contact the maintainers so it can be corrected.

674
LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

85
README.md Normal file
View file

@ -0,0 +1,85 @@
# AUTISM Client
AUTISM Client is the best Duping/Debugging client built for people who actually want control over what actions server recieves.
It is not trying to be a bloated all-in-one mess with 400 random buttons nobody uses. The point is simple: useful modules, a strong macro system, clean addon support, and tools that make testing, automation, and server interaction less painful.
This client is built around speed, control, and not pretending that users are too stupid to touch advanced features.
## What It Includes
AUTISM Client includes the normal client stuff you would expect, but the main focus is on systems that are actually useful.
Main features include:
* module system
* macro editor
* custom macro actions
* custom macro conditions
* addon support
* addon presets
* LAN sync tools
* custom payload sender
* NBT viewer
* packet and payload testing tools
* HUD elements
* commands
* event system
The client is made to be expandable. If the base client is not enough, addons can add their own modules, macro actions, conditions, presets, HUD elements, commands, events, and mixins.
---
# Credits
AUTISM Client includes original code written for this project, but it also uses, references, or derives ideas/code from other open-source Minecraft client projects.
Huge credit to the following developers and projects:
## OpSec by aurickk
Parts of AUTISM Client related to client privacy, mod detection protection, compatibility handling, and anti-fingerprinting behavior are inspired by or derived from OpSec.
Project: https://github.com/aurickk/OpSec
License: GPL-3.0
## Meteor Client
AUTISM Client uses ideas, structure, APIs, or source-code references from Meteor Client, especially around Fabric client architecture, modules, utilities, and client-side systems.
Project: https://github.com/MeteorDevelopment/meteor-client
License: GPL-3.0
## Wurst Client
AUTISM Client uses ideas, references, or code patterns from Wurst Client, one of the long-running open-source Minecraft utility clients.
Project: https://github.com/Wurst-Imperium/Wurst7
License: GPL-3.0
## ExploitPreventer by NikOverflow
AUTISM Client uses ideas, references, or derived logic from ExploitPreventer for protection against known client-side exploits.
Project: https://github.com/NikOverflow/ExploitPreventer
License: MIT
## Dupe Radar by ErneTalu
The Radar idea is credited to Dupe Radar by ErneTalu.
Project: https://github.com/ErneTalu/Dupe-Radar
## Better Storage ESP by bestluaucoder
The Storage ESP "Ignore Structures" filters come from the Better Storage ESP addon: the idea of hiding containers that generated inside a structure, and the list of structures worth filtering.
Project: https://github.com/bestluaucoder/Autism-Better-Storage-esp-1-addon/tree/main
## License Notice
Because AUTISM Client uses and/or derives from GPL-licensed projects, AUTISM Client is released under the GNU General Public License v3.0.
Source code must stay available to users, and any redistributed modified versions must follow the same GPL-3.0 license terms.
If any credit is missing or inaccurate, contact the maintainers so it can be corrected.

136
addon-templates/README.md Normal file
View file

@ -0,0 +1,136 @@
# AUTISM Client Addon Templates
These are the official addon templates for AUTISM Client.
Put these in the same repo as the client source. They are standalone Fabric mod projects, but they depend on the AUTISM Client API being published to your local Maven repo first.
This is not some magical separate SDK. Build the client API locally, then build your addon.
## Templates
- `minimal/` - This is the one you should probably start with.
It gives you the clean basic setup without throwing the entire client architecture at your face. It includes:
one module
one simple macro action
one simple wait condition
the beginner-friendly API setup
It is intentionally small. You can actually read it without needing to reverse engineer the entire client.
- `advanced/` - This is the full reference template.
Use this when you want to see how the bigger stuff is supposed to be wired. It includes:
modules
macro actions
macro conditions
presets
commands
HUD elements
events
a mixin
Addon presets are fully supported. They show up in the macro editor `Presets` picker under your addon's
own category, the same way addon modules/actions/conditions do.
Category names are intentionally simple: your addon name is the public category. If an API lets you pass a
custom category label, treat that as local organization only. The user-facing UI still groups your stuff under
the addon name so the menu does not turn into a junk drawer.
Use this when you want to see how everything works together, or when the minimal template stops being enough.
## Build Flow
From the main AUTISM Client folder, publish the API locally:
.\gradlew.bat publishToMavenLocal --no-daemon
Then build the template you want.
Minimal:
cd addon-templates\minimal
.\gradlew.bat build --no-daemon
Advanced:
cd addon-templates\advanced
.\gradlew.bat build --no-daemon
Your addon jar will be in:
build/libs/
That is the file you load as the addon.
## Toolkit
The toolkit renames addon projects for you so you don't hand-edit Gradle files into a cursed broken
state. It's one cross-platform program (`addon-toolkit.py`) with a launcher for each platform - they all
do the exact same thing, so pick whatever fits your OS.
Windows (PowerShell), same commands as before:
.\addon-templates\addon-toolkit.ps1
.\addon-templates\addon-toolkit.ps1 -Action Setup -Template minimal -OutputPath ..\MyAddon
.\addon-templates\addon-toolkit.ps1 -Action Scan -ProjectPath ..\MyAddon
.\addon-templates\addon-toolkit.ps1 -Action BuildAll
Linux / macOS / anywhere with Python 3:
python addon-templates/addon-toolkit.py
python addon-templates/addon-toolkit.py setup --template minimal --output ../MyAddon
python addon-templates/addon-toolkit.py scan --project ../MyAddon
python addon-templates/addon-toolkit.py build-all
(./addon-templates/addon-toolkit.sh ... is the same thing if you'd rather run a shell script.)
Through Gradle. Building needs only the JDK; the scaffold/scan tasks call the Python toolkit:
./gradlew buildAllTemplates # no Python needed
./gradlew newAddon -Pname="My Addon" -Ptemplate=minimal -Pout=../MyAddon # needs Python
./gradlew scanAddon -Pproject=../MyAddon # needs Python
./gradlew validateAddons # needs Python
Setup asks for:
addon name
output folder
version
author
If you leave the version blank, it bumps the current template version by one.
It also generates the annoying stuff automatically:
addon id
package name
Maven group
jar name
description
Fabric entrypoints
mixin references
This matters because half renaming a mod is one of the easiest ways to make Gradle look like it hates you personally.
If you want to set every value yourself, use:
.\addon-templates\addon-toolkit.ps1 -Action Setup -Template advanced -Advanced
Do that only if you actually need control over everything. Or edit the files directly.
## Public Repo Rule
Commit the source, Gradle wrapper files, and config files.
Do not commit:
.gradle/
build/
They are already ignored by the root .gitignore.
If it is generated trash from your machine, it probably does not belong in the repo.

View file

@ -0,0 +1,77 @@
param(
[ValidateSet("Menu", "Setup", "Scan", "Validate", "PublishApi", "Build", "BuildAll", "Clean")]
[string] $Action = "Menu",
[ValidateSet("minimal", "advanced")]
[string] $Template = "minimal",
[string] $ProjectPath,
[string] $OutputPath,
[string] $AddonId,
[string] $AddonName,
[string] $AddonVersion,
[string] $Package,
[string] $Author,
[string] $Description,
[string] $MavenGroup,
[string] $ArchiveName,
[switch] $Advanced,
[switch] $DebugStack,
[switch] $NoPublish,
[switch] $Yes,
[switch] $NonInteractive
)
# Forwards to addon-toolkit.py, keeping the old -Action/-Param interface.
$ErrorActionPreference = "Stop"
$toolkit = Join-Path $PSScriptRoot "addon-toolkit.py"
if (-not (Test-Path -LiteralPath $toolkit)) {
Write-Error "addon-toolkit.py not found next to this launcher."
exit 1
}
function Resolve-PythonCommand {
# Probe --version (not just existence) so we skip Windows' Store-alias stub that exits non-zero.
foreach ($candidate in @(@('py', '-3'), @('python'), @('python3'))) {
$exe = $candidate[0]
if (-not (Get-Command $exe -ErrorAction SilentlyContinue)) { continue }
$pre = if ($candidate.Count -gt 1) { $candidate[1..($candidate.Count - 1)] } else { @() }
try { & $exe @pre '--version' *> $null } catch { continue }
if ($LASTEXITCODE -eq 0) { return , $candidate }
}
return $null
}
$python = Resolve-PythonCommand
if (-not $python) {
Write-Error "Python 3 was not found on PATH. Install Python 3, or use the Gradle tasks (gradlew newAddon, scanAddon, ...)."
exit 1
}
$actionMap = @{
Menu = 'menu'; Setup = 'setup'; Scan = 'scan'; Validate = 'validate'
PublishApi = 'publish-api'; Build = 'build'; BuildAll = 'build-all'; Clean = 'clean'
}
$pyArgs = @($toolkit, $actionMap[$Action], '--template', $Template)
if ($ProjectPath) { $pyArgs += @('--project', $ProjectPath) }
if ($OutputPath) { $pyArgs += @('--output', $OutputPath) }
if ($AddonId) { $pyArgs += @('--addon-id', $AddonId) }
if ($AddonName) { $pyArgs += @('--name', $AddonName) }
if ($AddonVersion) { $pyArgs += @('--addon-version', $AddonVersion) }
if ($Package) { $pyArgs += @('--package', $Package) }
if ($Author) { $pyArgs += @('--author', $Author) }
if ($Description) { $pyArgs += @('--description', $Description) }
if ($MavenGroup) { $pyArgs += @('--maven-group', $MavenGroup) }
if ($ArchiveName) { $pyArgs += @('--archive-name', $ArchiveName) }
if ($Advanced) { $pyArgs += '--advanced' }
if ($NoPublish) { $pyArgs += '--no-publish' }
if ($Yes) { $pyArgs += '--yes' }
if ($NonInteractive) { $pyArgs += '--non-interactive' }
if ($DebugStack) { $pyArgs += '--debug-stack' }
$pyExe = $python[0]
$pyPre = if ($python.Count -gt 1) { $python[1..($python.Count - 1)] } else { @() }
& $pyExe @pyPre @pyArgs
exit $LASTEXITCODE

View file

@ -0,0 +1,759 @@
#!/usr/bin/env python3
"""AUTISM addon toolkit: scaffold, scan, validate and build addons. Runs anywhere with Python 3.
python addon-toolkit.py # menu
python addon-toolkit.py setup --template minimal --name "My Addon" --output ../MyAddon
python addon-toolkit.py scan --project ../MyAddon
python addon-toolkit.py build --project ../MyAddon
"""
from __future__ import annotations
import argparse
import json
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
SCRIPT_DIR = Path(__file__).resolve().parent
REPO_ROOT = SCRIPT_DIR.parent
TEMPLATES = ("minimal", "advanced")
TEXT_EXTS = {".java", ".json", ".kts", ".toml", ".properties", ".md", ".yml", ".yaml"}
class ToolkitError(Exception):
"""Expected failure, shown without a traceback."""
def info(msg: str) -> None: print(f"[AUTISM] {msg}")
def ok(msg: str) -> None: print(f"[OK] {msg}")
def warn(msg: str) -> None: print(f"[WARN] {msg}")
def bad(msg: str) -> None: print(f"[FAIL] {msg}")
def path_line(label: str, path) -> None:
print(f"{label}:")
print(str(path))
def failure_item(msg: str) -> None:
if re.match(r"^[A-Za-z]:[\\/]", msg) or msg.startswith("/") or re.match(r"^\.{1,2}[\\/]", msg):
path_line("Path", msg)
else:
bad(f" - {msg}")
def is_interactive(args) -> bool:
return not getattr(args, "non_interactive", False) and sys.stdin.isatty()
def read_text(path: Path) -> str:
return path.read_text(encoding="utf-8")
def write_text(path: Path, text: str) -> None:
path.write_text(text, encoding="utf-8", newline="")
def to_folder_name(name: str) -> str:
if not name or not name.strip():
return "MyAddon"
parts = re.findall(r"[A-Za-z0-9]+", name)
if not parts:
return "MyAddon"
folder = "".join(p.upper() if len(p) == 1 else p[0].upper() + p[1:] for p in parts)
return folder[:48]
def to_package_segment(value: str) -> str:
segment = re.sub(r"[^a-z0-9]+", "", value.lower())
if not segment:
segment = "myaddon"
if not segment[0].isalpha():
segment = "addon" + segment
return segment
def to_mod_id(name: str) -> str:
mod_id = re.sub(r"[^a-z0-9_-]+", "-", name.lower()).strip("-_")
if not mod_id:
return "my-autism-addon"
if not mod_id[0].isalpha():
mod_id = "addon-" + mod_id
if len(mod_id) > 64:
mod_id = mod_id[:64].strip("-_")
return mod_id
def default_author() -> str:
return os.environ.get("USERNAME") or os.environ.get("USER") or "You"
def test_mod_id(value: str) -> bool:
return bool(re.match(r"^[a-z][a-z0-9_-]{1,63}$", value or ""))
def test_java_package(value: str) -> bool:
return bool(re.match(r"^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)+$", value or ""))
def test_version(value: str) -> bool:
return bool(re.match(r"^[0-9A-Za-z][0-9A-Za-z._+-]*$", value or ""))
def step_version(version: str) -> str:
if not version or not version.strip():
return "1.0.0"
m = re.match(r"^(.*?)(\d+)(\D*)$", version)
if not m:
return version + ".1"
prefix, digits, suffix = m.group(1), m.group(2), m.group(3)
nxt = str(int(digits) + 1)
if len(digits) > 1 and len(nxt) < len(digits):
nxt = nxt.rjust(len(digits), "0")
return f"{prefix}{nxt}{suffix}"
def get_toml_version(path: Path, key: str) -> str:
m = re.search(r'(?m)^\s*' + re.escape(key) + r'\s*=\s*"([^"]+)"', read_text(path))
return m.group(1) if m else ""
def set_toml_version(path: Path, key: str, value: str) -> None:
text = read_text(path)
pattern = r'(?m)^(\s*' + re.escape(key) + r'\s*=\s*)"[^"]*"'
if re.search(pattern, text):
text = re.sub(pattern, lambda m: m.group(1) + f'"{value}"', text)
else:
text += f'\n{key} = "{value}"\n'
write_text(path, text)
def set_properties_value(path: Path, key: str, value: str) -> None:
text = read_text(path)
pattern = r"(?m)^" + re.escape(key) + r"=.*$"
if re.search(pattern, text):
text = re.sub(pattern, f"{key}={value}", text)
else:
text += f"\n{key}={value}\n"
write_text(path, text)
def set_root_project_name(path: Path, name: str) -> None:
text = read_text(path)
pattern = r'(?m)^(rootProject\.name\s*=\s*)"[^"]*"'
if re.search(pattern, text):
text = re.sub(pattern, lambda m: m.group(1) + f'"{name}"', text)
else:
text += f'\nrootProject.name = "{name}"\n'
write_text(path, text)
def get_json(path: Path):
return json.loads(read_text(path))
def save_json(path: Path, data) -> None:
write_text(path, json.dumps(data, indent=2, ensure_ascii=False) + "\n")
def is_under_build_or_gradle(path: Path, project: Path) -> bool:
try:
parts = path.relative_to(project).parts
except ValueError:
return False
return "build" in parts or ".gradle" in parts
def resolve_full_path(path: str) -> Path | None:
if not path or not path.strip():
return None
p = Path(path)
if p.is_absolute():
return p.resolve()
return (REPO_ROOT / p).resolve()
def is_shipped_template(path: Path) -> bool:
full = path.resolve()
return any(full == (REPO_ROOT / "addon-templates" / name).resolve() for name in TEMPLATES)
def get_first_java_package(project: Path) -> str:
entry = project / "src/main/resources/fabric.mod.json"
if entry.is_file():
data = get_json(entry)
classes = []
eps = data.get("entrypoints", {}) if isinstance(data, dict) else {}
for kind in ("client", "autism"):
if eps.get(kind):
classes += list(eps[kind]) if isinstance(eps[kind], list) else [eps[kind]]
for cls in classes:
m = re.match(r"^(.+)\.[^.]+$", str(cls))
if m:
return m.group(1)
java_root = project / "src/main/java"
if java_root.is_dir():
for java in sorted(java_root.rglob("*.java")):
m = re.search(r"(?m)^\s*package\s+([^;]+);", read_text(java))
if m:
return m.group(1).strip()
return "com.example.addon"
def class_simple_name(class_name: str, fallback: str) -> str:
m = re.search(r"\.([^.]+)$", class_name or "")
return m.group(1) if m else fallback
def replace_in_project_files(project: Path, old: str, new: str) -> None:
if not old or old == new:
return
for file in project.rglob("*"):
if not file.is_file() or file.suffix not in TEXT_EXTS:
continue
if is_under_build_or_gradle(file, project):
continue
text = read_text(file)
if old in text:
write_text(file, text.replace(old, new))
def move_java_package(project: Path, old_pkg: str, new_pkg: str) -> None:
if old_pkg == new_pkg:
return
src_root = project / "src/main/java"
old_path = src_root / old_pkg.replace(".", os.sep)
new_path = src_root / new_pkg.replace(".", os.sep)
if not old_path.is_dir():
return
if new_path.exists():
warn("Package path already exists. Not moving files.")
path_line("Path", new_path)
return
new_path.parent.mkdir(parents=True, exist_ok=True)
shutil.move(str(old_path), str(new_path))
cursor = old_path.parent
while src_root in cursor.parents and not any(cursor.iterdir()):
parent = cursor.parent
cursor.rmdir()
cursor = parent
def copy_addon_template(template_name: str, target: Path) -> None:
source = REPO_ROOT / "addon-templates" / template_name
if not source.is_dir():
path_line("Missing template", source)
raise ToolkitError("Template not found.")
if target.exists():
warn("Output already exists. Editing it in place.")
path_line("Path", target)
return
target.mkdir(parents=True, exist_ok=True)
for item in source.rglob("*"):
if is_under_build_or_gradle(item, source):
continue
rel = item.relative_to(source)
dest = target / rel
if item.is_dir():
dest.mkdir(parents=True, exist_ok=True)
else:
dest.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(item, dest)
def prompt(label: str, default: str, validator=None, interactive: bool = True) -> str:
if not interactive:
return default
while True:
suffix = f" [{default}]" if default else ""
try:
value = input(f"{label}{suffix}: ").strip()
except EOFError:
return default
if not value:
value = default
if validator is None or validator(value):
return value
warn("Bad value. Fix it.")
def prompt_version(current: str, interactive: bool) -> str:
base = current if current and current.strip() else "1.0.0"
nxt = step_version(base)
if not interactive:
return nxt
while True:
try:
value = input(f"Version current {base}, blank = {nxt}: ").strip()
except EOFError:
return nxt
if not value:
return nxt
if test_version(value):
return value
warn("Bad version. Fix it.")
def get_setup_project_path(args, name_for_output: str) -> Path:
if args.project and args.project.strip():
project = resolve_full_path(args.project)
if is_shipped_template(project):
raise ToolkitError("No. The shipped templates stay clean. Use --output to copy one, or pick a real addon folder.")
return project
output = args.output
if not output or not output.strip():
default_out = str((REPO_ROOT / ".." / to_folder_name(name_for_output)).resolve())
output = prompt("Output folder", default_out, lambda v: bool(v and v.strip()), is_interactive(args))
target = resolve_full_path(output)
if is_shipped_template(target):
raise ToolkitError("No. The shipped templates stay clean. Pick a different output folder.")
copy_addon_template(args.template, target)
return target
def configure_addon(args) -> Path:
interactive = is_interactive(args)
addon_name = args.addon_name
if not addon_name or not addon_name.strip():
default_name = "My Advanced Addon" if args.template == "advanced" else "My Addon"
addon_name = prompt("Addon name", default_name, lambda v: bool(v and v.strip()), interactive)
project = get_setup_project_path(args, addon_name)
if not project.is_dir():
path_line("Missing addon folder", project)
raise ToolkitError("Addon project not found.")
fabric_path = project / "src/main/resources/fabric.mod.json"
versions_path = project / "gradle/libs.versions.toml"
properties_path = project / "gradle.properties"
settings_path = project / "settings.gradle.kts"
for required in (fabric_path, versions_path, properties_path, settings_path):
if not required.is_file():
path_line("Missing file", required)
raise ToolkitError("Missing required addon file.")
fabric = get_json(fabric_path)
old_id = str(fabric.get("id", ""))
old_package = get_first_java_package(project)
old_version = get_toml_version(versions_path, "mod-version")
eps = fabric.get("entrypoints", {}) or {}
old_client = str((eps.get("client") or [f"{old_package}.Init"])[0])
old_addon = str((eps.get("autism") or [f"{old_package}.Addon"])[0])
original_mixin = str((fabric.get("mixins") or [""])[0])
client_simple = class_simple_name(old_client, "Init")
addon_simple = class_simple_name(old_addon, "Addon")
advanced = args.advanced
addon_id = args.addon_id
if not addon_id or not addon_id.strip():
suggested = to_mod_id(addon_name) if "template" in old_id else old_id
addon_id = prompt("Addon id", suggested, test_mod_id, interactive) if advanced else suggested
addon_version = args.addon_version
if not addon_version or not addon_version.strip():
addon_version = prompt_version(old_version or "1.0.0", interactive)
package = args.package
if not package or not package.strip():
suggested_pkg = f"com.{to_package_segment(addon_id)}.addon"
package = prompt("Java package", suggested_pkg, test_java_package, interactive) if advanced else suggested_pkg
maven_group = args.maven_group
if not maven_group or not maven_group.strip():
maven_group = prompt("Maven group", package, test_java_package, interactive) if advanced else package
archive_name = args.archive_name
if not archive_name or not archive_name.strip():
archive_name = prompt("Jar/archive base name", addon_id, test_mod_id, interactive) if advanced else addon_id
author = args.author
if not author or not author.strip():
author = prompt("Author", default_author(), lambda v: bool(v and v.strip()), interactive)
description = args.description
if not description or not description.strip():
suggested_desc = f"{addon_name} addon for AUTISM Client."
description = prompt("Description", suggested_desc, lambda v: bool(v and v.strip()), interactive) if advanced else suggested_desc
replace_in_project_files(project, old_package, package)
replace_in_project_files(project, old_id, addon_id)
move_java_package(project, old_package, package)
fabric = get_json(fabric_path)
fabric["id"] = addon_id
fabric["name"] = addon_name
fabric["version"] = "${version}"
fabric["description"] = description
fabric["authors"] = [author]
fabric.setdefault("entrypoints", {})
fabric["entrypoints"]["client"] = [f"{package}.{client_simple}"]
fabric["entrypoints"]["autism"] = [f"{package}.{addon_simple}"]
if fabric.get("mixins"):
old_mixin_name = original_mixin or str(fabric["mixins"][0])
new_mixin_name = f"{addon_id}.mixins.json"
resource_dir = project / "src/main/resources"
old_mixin = resource_dir / old_mixin_name
new_mixin = resource_dir / new_mixin_name
if old_mixin.is_file() and old_mixin != new_mixin:
shutil.move(str(old_mixin), str(new_mixin))
if new_mixin.is_file():
mixin_json = get_json(new_mixin)
mixin_json["package"] = f"{package}.mixin"
save_json(new_mixin, mixin_json)
fabric["mixins"] = [new_mixin_name]
save_json(fabric_path, fabric)
set_toml_version(versions_path, "mod-version", addon_version)
set_properties_value(properties_path, "maven_group", maven_group)
set_properties_value(properties_path, "archives_base_name", archive_name)
set_root_project_name(settings_path, addon_id)
ok("Addon rewritten.")
path_line("Addon folder", project)
print(f" id: {addon_id}")
print(f" name: {addon_name}")
print(f" version: {addon_version}")
print(f" package: {package}")
print()
print("Next:")
print(f" python addon-templates/addon-toolkit.py build --project \"{project}\"")
path_line("Jar folder", project / "build" / "libs")
return project
def test_addon_project(project: Path, allow_template_names: bool = False):
failures: list[str] = []
warnings: list[str] = []
if not project.is_dir():
failures.append("Project folder does not exist.")
failures.append(str(project))
return failures, warnings
required = [
"build.gradle.kts", "settings.gradle.kts", "gradle.properties",
"gradle/libs.versions.toml", "src/main/resources/fabric.mod.json",
]
for item in required:
if not (project / item).is_file():
failures.append(f"Missing {item}")
if not (project / "gradlew.bat").is_file() and not (project / "gradlew").is_file():
failures.append("Missing gradlew / gradlew.bat")
fabric_path = project / "src/main/resources/fabric.mod.json"
if fabric_path.is_file():
try:
fabric = get_json(fabric_path)
if not test_mod_id(str(fabric.get("id", ""))):
failures.append(f"fabric.mod.json id is invalid: {fabric.get('id')}")
if not str(fabric.get("name", "")).strip():
failures.append("fabric.mod.json name is empty.")
eps = fabric.get("entrypoints", {}) or {}
if not eps.get("autism"):
failures.append("Missing autism entrypoint in fabric.mod.json.")
else:
for entry in eps["autism"]:
cls = project / ("src/main/java/" + str(entry).replace(".", "/") + ".java")
if not cls.is_file():
failures.append(f"Autism entrypoint class file is missing: {entry}")
if not (fabric.get("depends", {}) or {}).get("autism"):
failures.append("fabric.mod.json must depend on autism.")
if not allow_template_names:
if re.search(r"template|example", str(fabric.get("id", ""))):
warnings.append("Addon id still looks like a template/example.")
if re.search(r"Template|Example", str(fabric.get("name", ""))):
warnings.append("Addon name still looks like a template/example.")
if "You" in (fabric.get("authors") or []):
warnings.append("Author is still 'You'.")
except json.JSONDecodeError as exc:
failures.append(f"fabric.mod.json is not valid JSON: {exc}")
versions_path = project / "gradle/libs.versions.toml"
if versions_path.is_file():
if not test_version(get_toml_version(versions_path, "mod-version")):
failures.append("Addon mod-version is missing or invalid.")
if not get_toml_version(versions_path, "autism").strip():
failures.append("AUTISM dependency version is missing from gradle/libs.versions.toml.")
if (project / ".gradle").exists():
warnings.append(".gradle cache exists locally. Ignored; do not upload it.")
if (project / "build").exists():
warnings.append("build output exists locally. Ignored; do not upload it.")
if (project / ".github").exists():
warnings.append(".github exists inside this addon project. Fine for a copied template, but it is not root repo CI unless you move it.")
leftovers = (
"autism-minimal-addon-template", "autism-advanced-addon-template",
"AUTISM Minimal Addon Template", "AUTISM Advanced Addon Template",
)
for file in project.rglob("*"):
if not file.is_file() or file.suffix not in TEXT_EXTS or is_under_build_or_gradle(file, project):
continue
text = read_text(file)
if re.search(r"[ÂÃâ]", text):
warnings.append(f"Mojibake-looking text in {file}")
if not allow_template_names:
for leftover in leftovers:
if leftover in text:
warnings.append(f"Template leftover '{leftover}' in {file}")
break
return failures, warnings
def get_addon_project_path(args) -> Path:
if args.project and args.project.strip():
return resolve_full_path(args.project)
if args.output and args.output.strip():
target = resolve_full_path(args.output)
copy_addon_template(args.template, target)
return target
return REPO_ROOT / "addon-templates" / args.template
def scan_addon(args) -> None:
project = get_addon_project_path(args)
failures, warnings = test_addon_project(project)
info("Scanned addon project.")
path_line("Addon folder", project)
for w in warnings:
warn(f"Heads up: {w}")
if failures:
bad("Scan found broken stuff:")
for f in failures:
failure_item(f)
raise ToolkitError("Scan failed.")
ok("Scan clean.")
def validate_addon_system(args) -> None:
failures: list[str] = []
warnings: list[str] = []
root_required = [
"src/main/java/autismclient/addons/AddonManager.java",
"src/main/java/autismclient/api/AutismAddon.java",
"src/main/java/autismclient/api/SimpleAddon.java",
"src/main/java/autismclient/api/AutismAddons.java",
"src/main/java/autismclient/api/ApiVersion.java",
"src/main/java/autismclient/api/module/SimpleModule.java",
"src/main/java/autismclient/api/macro/SimpleAction.java",
"src/main/java/autismclient/api/macro/SimpleCondition.java",
"src/main/java/autismclient/api/macro/MacroActionRegistry.java",
"src/main/java/autismclient/api/macro/MacroPresetRegistry.java",
"src/main/java/autismclient/api/hud/HudElements.java",
"src/main/java/autismclient/api/event/AddonEvents.java",
"src/main/java/autismclient/gui/screen/AutismAddonsScreen.java",
"src/main/java/autismclient/util/macro/MissingAddonAction.java",
"addon-templates/README.md",
"addon-templates/addon-toolkit.py",
"addon-templates/addon-toolkit.ps1",
"addon-templates/addon-toolkit.sh",
]
for f in root_required:
if not (REPO_ROOT / f).is_file():
failures.append(f"Missing {f}")
gitignore = REPO_ROOT / ".gitignore"
if gitignore.is_file():
ignore_text = read_text(gitignore)
for pattern in ("!/src/", "!/addon-templates/", "!/addon-templates/**",
"/addon-templates/**/build/", "/addon-templates/**/.gradle/", "/mc-src*/"):
if pattern not in ignore_text:
failures.append(f".gitignore is missing {pattern}")
else:
failures.append("Missing .gitignore")
main_version = get_toml_version(REPO_ROOT / "gradle/libs.versions.toml", "mod-version")
for template_name in TEMPLATES:
project = REPO_ROOT / "addon-templates" / template_name
t_failures, t_warnings = test_addon_project(project, allow_template_names=True)
failures += [f"{template_name} template: {x}" for x in t_failures]
warnings += [f"{template_name} template: {x}" for x in t_warnings]
target_version = get_toml_version(project / "gradle/libs.versions.toml", "autism")
if main_version and target_version and main_version != target_version:
failures.append(f"{template_name} template targets AUTISM {target_version}, main client is {main_version}.")
for w in warnings:
warn(f"Heads up: {w}")
if failures:
bad("Addon system is broken:")
for f in failures:
failure_item(f)
raise ToolkitError("Addon system validation failed.")
ok("Addon system clean.")
def run_gradle(project: Path, gradle_args: list[str]) -> None:
wrapper = project / ("gradlew.bat" if os.name == "nt" else "gradlew")
if not wrapper.is_file():
path_line("Missing Gradle wrapper", wrapper)
raise ToolkitError("Missing Gradle wrapper.")
cmd = [str(wrapper)] + gradle_args
if os.name != "nt" and not os.access(wrapper, os.X_OK):
cmd = ["sh", str(wrapper)] + gradle_args
result = subprocess.run(cmd, cwd=str(project))
if result.returncode != 0:
path_line("Gradle project", project)
raise ToolkitError(f"Gradle failed with exit code {result.returncode}.")
def publish_api(args) -> None:
info("Publishing client API to Maven Local.")
run_gradle(REPO_ROOT, ["publishToMavenLocal", "--no-daemon"])
ok("Client API published.")
def build_addon(args) -> None:
project = get_addon_project_path(args)
if not project.is_dir():
path_line("Addon folder", project)
raise ToolkitError("Wrong addon folder.")
if not (project / "gradlew.bat").is_file() and not (project / "gradlew").is_file():
path_line("Addon folder", project)
raise ToolkitError("No Gradle wrapper there. Wrong addon folder.")
if not args.no_publish:
publish_api(args)
info("Building addon.")
path_line("Addon folder", project)
run_gradle(project, ["build", "--no-daemon"])
ok("Addon built.")
path_line("Jar folder", project / "build" / "libs")
def build_all_templates(args) -> None:
if not args.no_publish:
publish_api(args)
for template_name in TEMPLATES:
project = REPO_ROOT / "addon-templates" / template_name
info(f"Building {template_name} template.")
run_gradle(project, ["build", "--no-daemon"])
ok(f"{template_name} template built.")
def clean_addon(args) -> None:
project = get_addon_project_path(args)
interactive = is_interactive(args)
for folder in (".gradle", "build"):
path = project / folder
if path.exists():
confirmed = args.yes or (interactive and input(f"Remove {path} ? Type YES: ").strip() == "YES")
if confirmed:
shutil.rmtree(path)
ok("Deleted local build junk.")
path_line("Path", path)
def menu(args) -> None:
last_path = ""
while True:
print()
print("AUTISM ADDON KIT")
print("1. New addon")
print("2. Build addon")
print("3. Scan addon")
print("4. Test shipped templates")
print("5. Publish client API")
print("6. Delete local build junk")
print("0. Leave")
try:
choice = input("> ").strip()
except EOFError:
return
try:
if choice == "1":
args.template = prompt("Template minimal/advanced", args.template, lambda v: v in TEMPLATES, True)
args.project = ""
args.output = ""
last_path = str(configure_addon(args))
elif choice == "2":
default_path = last_path or str((REPO_ROOT / ".." / to_folder_name("")).resolve())
args.project = prompt("Addon folder", default_path, lambda v: bool(v and v.strip()), True)
build_addon(args)
elif choice == "3":
default_path = last_path or str((REPO_ROOT / ".." / to_folder_name("")).resolve())
args.project = prompt("Addon folder", default_path, lambda v: bool(v and v.strip()), True)
scan_addon(args)
elif choice == "4":
validate_addon_system(args)
build_all_templates(args)
elif choice == "5":
publish_api(args)
elif choice == "6":
default_path = last_path or str((REPO_ROOT / ".." / to_folder_name("")).resolve())
args.project = prompt("Addon folder", default_path, lambda v: bool(v and v.strip()), True)
clean_addon(args)
elif choice == "0":
return
else:
warn("Bad choice.")
except ToolkitError as exc:
bad(str(exc))
try:
input("Press Enter. The error stays here until you do")
except EOFError:
return
def normalize_action(value: str) -> str:
v = value.strip().lower()
return {"publishapi": "publish-api", "buildall": "build-all"}.get(v, v)
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="AUTISM addon toolkit.")
parser.add_argument("action", nargs="?", default="menu", type=normalize_action,
choices=["menu", "setup", "scan", "validate", "publish-api", "build", "build-all", "clean"])
parser.add_argument("--template", type=str.lower, choices=list(TEMPLATES), default="minimal")
parser.add_argument("--project", "--project-path", dest="project")
parser.add_argument("--output", "--output-path", dest="output")
parser.add_argument("--addon-id", dest="addon_id")
parser.add_argument("--name", "--addon-name", dest="addon_name")
parser.add_argument("--addon-version", dest="addon_version")
parser.add_argument("--package")
parser.add_argument("--author")
parser.add_argument("--description")
parser.add_argument("--maven-group", dest="maven_group")
parser.add_argument("--archive-name", dest="archive_name")
parser.add_argument("--advanced", action="store_true")
parser.add_argument("--no-publish", action="store_true", dest="no_publish")
parser.add_argument("--yes", action="store_true")
parser.add_argument("--non-interactive", action="store_true", dest="non_interactive")
parser.add_argument("--debug-stack", action="store_true", dest="debug_stack")
return parser
ACTIONS = {
"menu": menu,
"setup": configure_addon,
"scan": scan_addon,
"validate": validate_addon_system,
"publish-api": publish_api,
"build": build_addon,
"build-all": build_all_templates,
"clean": clean_addon,
}
def main(argv: list[str]) -> int:
args = build_parser().parse_args(argv)
try:
ACTIONS[args.action](args)
return 0
except ToolkitError as exc:
bad(str(exc))
if args.debug_stack:
raise
return 1
except KeyboardInterrupt:
print()
return 130
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))

View file

@ -0,0 +1,20 @@
#!/usr/bin/env sh
# Forwards to addon-toolkit.py. Example: ./addon-toolkit.sh setup --template minimal --output ../MyAddon
set -e
DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
TOOLKIT="$DIR/addon-toolkit.py"
if [ ! -f "$TOOLKIT" ]; then
echo "addon-toolkit.py not found next to this launcher." >&2
exit 1
fi
# Probe --version (not just existence) so we skip Windows' Store-alias stub that exits 49.
for PY in python3 python py; do
if "$PY" --version >/dev/null 2>&1; then
exec "$PY" "$TOOLKIT" "$@"
fi
done
echo "Python 3 was not found on PATH. Install Python 3, or use the Gradle tasks (./gradlew newAddon, scanAddon, ...)." >&2
exit 1

View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{json,yml,yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false

View file

@ -0,0 +1,45 @@
name: Build
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 25
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
# NOTE: the build needs the AUTISM Client API artifact (com.autismclient:autism) to be resolvable.
# mavenLocal() is empty on a fresh CI runner, so make it available one of these ways:
# - publish AUTISM to a maven repo your build.gradle.kts lists (GitHub Packages, a maven server), or
# - commit the AUTISM jar into a `libs/` folder and add `flatDir { dirs("libs") }` to repositories.
- name: Build
run: ./gradlew build --stacktrace
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: addon-jar
path: build/libs/*.jar
- name: Release dev build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v2
with:
tag_name: dev
name: Dev Build
prerelease: true
files: build/libs/*.jar

6
addon-templates/advanced/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
.gradle/
build/
run/
*.log
.idea/
*.iml

View file

@ -0,0 +1,95 @@
# AUTISM Advanced Addon Template
A standalone reference addon for AUTISM Client. It registers one of each supported extension point, so
you can copy it when you need the full API surface.
Start small: keep `ExampleModule`, build once, then add macro actions, commands, HUD elements, events,
or mixins as needed.
## What It Demonstrates
| Extension point | File |
| --- | --- |
| Addon lifecycle | `ExampleAddon` |
| Module | `modules/ExampleModule` |
| Macro action | `macro/ExampleSayAction` |
| Macro condition | `macro/ExampleHeightCondition` + `macro/ExampleCondition` |
| Macro preset | `macro/ExamplePresets` |
| Command | `commands/ExampleCommand` |
| HUD element | `hud/ExampleHud` |
| Event hooks | `events/ExampleEvents` |
| Mixin | `mixin/ExampleMixin` + `autism-advanced-addon-template.mixins.json` |
Presets are first-class addon entries. `ExamplePresets` appears in the macro editor `Presets` picker
under this addon's category, and it can insert any normal stack of macro actions.
Your modules, macro actions, conditions and presets automatically group under a category named after
your addon from `fabric.mod.json`. Custom categories are scoped under your addon so they cannot collide
with built-ins or another addon.
## Build
1. In the AUTISM Client project, publish the API to your local Maven repo:
```sh
./gradlew publishToMavenLocal
```
2. Make sure the `autism` version in `gradle/libs.versions.toml` matches what you published.
3. Build this addon:
```sh
./gradlew build
```
The addon jar lands in `build/libs/`.
## Run
Drop both jars into your `mods/` folder:
- the AUTISM Client jar;
- this addon's jar from `build/libs/`.
## Make It Yours
Recommended (any OS, from the AUTISM Client repo root):
```sh
python addon-templates/addon-toolkit.py setup --template advanced --output ../MyAdvancedAddon
```
Windows PowerShell works the same: `.\addon-templates\addon-toolkit.ps1 -Action Setup -Template advanced -OutputPath ..\MyAdvancedAddon`. See `../README.md` for the Gradle (`./gradlew newAddon`) and `.sh` variants.
The toolkit asks for the addon name, output folder, version, and author. Blank version bumps the current
template version by one patch step. It derives the boring stuff and rewrites Gradle files, package paths,
`fabric.mod.json`, entrypoints, and the mixin config in one shot.
Manual path:
1. Rename the package `com.example.addon`.
2. Change `ExampleAddon.ID`.
3. Update `src/main/resources/fabric.mod.json`: `id`, `name`, `entrypoints`, `mixins`, and `autism:color`.
4. Rename `autism-advanced-addon-template.mixins.json` and update its `package`.
5. Keep `apiVersion()` and the `autism` dependency range honest for the client version you target.
## Project Structure
```text
addon-templates/advanced/
|-- gradle/
|-- src/main/java/com/example/addon/
| |-- ExampleAddon.java
| |-- ExampleInit.java
| |-- modules/ExampleModule.java
| |-- macro/ExampleSayAction.java
| |-- macro/ExampleHeightCondition.java
| |-- macro/ExampleCondition.java
| |-- macro/ExamplePresets.java
| |-- commands/ExampleCommand.java
| |-- hud/ExampleHud.java
| |-- events/ExampleEvents.java
| `-- mixin/ExampleMixin.java
|-- src/main/resources/
| |-- fabric.mod.json
| `-- autism-advanced-addon-template.mixins.json
|-- build.gradle.kts
`-- gradle.properties
```

View file

@ -0,0 +1,67 @@
plugins {
alias(libs.plugins.fabric.loom)
}
base {
archivesName = properties["archives_base_name"] as String
version = libs.versions.mod.version.get()
group = properties["maven_group"] as String
}
repositories {
// AUTISM Client is consumed from your local Maven repo. In the AUTISM project run:
// ./gradlew publishToMavenLocal
mavenLocal()
maven("https://maven.fabricmc.net/") { name = "Fabric" }
mavenCentral()
}
dependencies {
// Mirrors the AUTISM Client build: official Mojang mappings are implicit for the configured version, so there is no
// explicit `mappings(...)` line and dependencies use plain `implementation`.
minecraft(libs.minecraft)
implementation(libs.fabric.loader)
implementation(libs.fabric.api)
// The AUTISM Client API (published to mavenLocal from the AUTISM project).
implementation(libs.autism)
}
// Turns an exact Minecraft version (e.g. "26.2") into a compatible range ("~26.2") so the addon
// keeps loading across patch releases instead of pinning one exact build.
fun toMinecraftCompat(version: String): String {
val m = Regex("""^(\d+)\.(\d+)(?:\.(\d+))?$""").matchEntire(version)
?: return version
val (year, drop, _) = m.destructured
return "~$year.$drop"
}
tasks {
processResources {
val propertyMap = mapOf(
"version" to project.version,
"mc_version" to libs.versions.minecraft.get(),
"mc_compat" to toMinecraftCompat(libs.versions.minecraft.get()),
"fabric_api_version" to libs.versions.fabric.api.get(),
"autism_api_version" to libs.versions.autism.get()
)
inputs.properties(propertyMap)
filteringCharset = "UTF-8"
filesMatching("fabric.mod.json") {
expand(propertyMap)
}
}
java {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
toolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(25)
}
}

View file

@ -0,0 +1,7 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=false
maven_group=com.example.addon
archives_base_name=autism-advanced-addon-template

View file

@ -0,0 +1,23 @@
# In this repo these are auto-synced from the client: run `gradlew syncAddonTemplateVersions` (it also runs
# on publishToMavenLocal), which pins minecraft/fabric-loader/fabric-api/loom/autism to the client's
# gradle/libs.versions.toml. In a copied-out addon, set them to the AUTISM Client release you build against.
[versions]
mod-version = "1.0.0"
minecraft = "26.2"
fabric-loader = "0.19.3"
fabric-api = "0.152.2+26.2"
# The AUTISM Client release you compile against. The generated fabric.mod.json depends on `>=` this version, so a
# built addon keeps loading on newer hosts in the same major line (the API-version handshake gates real breaks).
autism = "5.0"
loom = "1.17.11"
[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" }
autism = { module = "com.autismclient:autism", version.ref = "autism" }
[plugins]
fabric-loom = { id = "net.fabricmc.fabric-loom", version.ref = "loom" }

Binary file not shown.

View file

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

248
addon-templates/advanced/gradlew vendored Executable file
View file

@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 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.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# 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/platforms/jvm/plugins-application/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##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || 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
# 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
if ! command -v java >/dev/null 2>&1
then
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
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=SC2039,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=SC2039,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" )
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 optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# 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" "$@"

93
addon-templates/advanced/gradlew.bat vendored Normal file
View file

@ -0,0 +1,93 @@
@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
@rem SPDX-License-Identifier: Apache-2.0
@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. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
: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

View file

@ -0,0 +1,9 @@
pluginManagement {
repositories {
maven("https://maven.fabricmc.net/") { name = "Fabric" }
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = "autism-advanced-addon-template"

View file

@ -0,0 +1,53 @@
package com.example.addon;
import autismclient.api.AutismAddon;
import autismclient.api.AutismAddons;
import autismclient.api.ApiVersion;
import autismclient.api.macro.MacroActionEntry;
import com.example.addon.commands.ExampleCommand;
import com.example.addon.events.ExampleEvents;
import com.example.addon.hud.ExampleHud;
import com.example.addon.macro.ExampleHeightCondition;
import com.example.addon.macro.ExamplePresets;
import com.example.addon.macro.ExampleSayAction;
import com.example.addon.modules.ExampleModule;
// Addon entrypoint (the "autism" entrypoint in fabric.mod.json). Start small:
// register only ExampleModule first, launch the client, then add macro/actions/HUD/events as needed.
// Modules, actions, conditions and presets all auto-group under a category named after this addon.
public final class ExampleAddon extends AutismAddon {
public static final String ID = "autism-advanced-addon-template";
@Override
public int apiVersion() {
return ApiVersion.CURRENT;
}
@Override
public void onInitialize() {
AutismAddons.modules().register(new ExampleModule());
// Action: appears in the "add action" picker.
AutismAddons.macroActions().register(MacroActionEntry.local("say", ExampleSayAction::new)
.picker("Say", "Send a chat message.")
.build());
// Condition: appears in the "add condition" picker (it waits).
AutismAddons.macroActions().register(MacroActionEntry.local("wait-height", ExampleHeightCondition::new)
.condition("Wait Height", "Wait until the player is at or above a Y level.")
.build());
AutismAddons.presets().register("Reach Height", "Wait for Y 80, then say.",
ExamplePresets::reachHeightThenSay);
AutismAddons.commands().register(new ExampleCommand());
AutismAddons.hud().register(new ExampleHud());
ExampleEvents.register();
}
@Override
public String getPackage() {
return "com.example.addon";
}
}

View file

@ -0,0 +1,9 @@
package com.example.addon;
import net.fabricmc.api.ClientModInitializer;
// Fabric's required client entrypoint. The addon's real work is in ExampleAddon.
public final class ExampleInit implements ClientModInitializer {
@Override
public void onInitializeClient() {}
}

View file

@ -0,0 +1,29 @@
package com.example.addon.commands;
import autismclient.commands.AutismCommandSource;
import autismclient.commands.Command;
import autismclient.util.AutismClientMessaging;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
// A Brigadier command. Users run it with the command prefix, e.g. .example or .example hi.
public final class ExampleCommand extends Command {
public ExampleCommand() {
super("example", "Example addon command.");
}
@Override
public void build(LiteralArgumentBuilder<AutismCommandSource> root) {
root.executes(ctx -> {
AutismClientMessaging.sendPrefixed("\u00a7dExample addon command works!");
return SUCCESS;
});
root.then(RequiredArgumentBuilder.<AutismCommandSource, String>argument("text", StringArgumentType.greedyString())
.executes(ctx -> {
AutismClientMessaging.sendPrefixed("\u00a7dYou said: \u00a7f" + StringArgumentType.getString(ctx, "text"));
return SUCCESS;
}));
}
}

View file

@ -0,0 +1,15 @@
package com.example.addon.events;
import autismclient.api.AutismAddons;
import autismclient.util.AutismClientMessaging;
// Event hooks. Register listeners once in onInitialize().
// Available: onTick, onPacketSend (return true to cancel), onPacketReceive, onGameJoin, onGameLeft.
public final class ExampleEvents {
private ExampleEvents() {}
public static void register() {
AutismAddons.events().onGameJoin(() ->
AutismClientMessaging.sendPrefixed("\u00a7a[Example] joined a world!"));
}
}

View file

@ -0,0 +1,43 @@
package com.example.addon.hud;
import com.example.addon.ExampleAddon;
import autismclient.api.hud.HudElementProvider;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphicsExtractor;
// A HUD element. Report your size via width()/height(); draw in render() with the GuiGraphicsExtractor
// (ctx.text / ctx.fill). The defaultX/Y/anchor/enabled are used until the user moves it in the HUD editor.
public final class ExampleHud implements HudElementProvider {
private static final int MIN_WIDTH = 94;
private static final int TEXT_PAD = 2;
@Override public String id() { return ExampleAddon.ID + ":clock"; }
@Override public String label() { return "Example Clock"; }
@Override public String description() { return "Shows the in-game tick."; }
@Override
public int width() {
Font font = Minecraft.getInstance().font;
String text = text();
int textWidth = font != null ? font.width(text) : text.length() * 6;
return Math.max(MIN_WIDTH, textWidth + TEXT_PAD * 2);
}
@Override public int height() { return 10; }
@Override
public void render(GuiGraphicsExtractor ctx, Font font, int x, int y, float alpha) {
ctx.text(font, text(), x + TEXT_PAD, y, 0xFFFFD7FF);
}
private static String text() {
long tick = Minecraft.getInstance().level != null ? Minecraft.getInstance().level.getGameTime() : 0L;
return "Addon tick: " + tick;
}
@Override public boolean defaultEnabled() { return false; }
@Override public String defaultAnchor() { return "TOP_LEFT"; }
@Override public int defaultX() { return 4; }
@Override public int defaultY() { return 120; }
}

View file

@ -0,0 +1,18 @@
package com.example.addon.macro;
import autismclient.api.macro.AddonCondition;
import net.minecraft.client.Minecraft;
// A reusable predicate: implement check(). A waiting step blocks on it via ctx.awaitCondition(...).
public final class ExampleCondition extends AddonCondition {
private final double minY;
public ExampleCondition(double minY) {
this.minY = minY;
}
@Override
public boolean check(Minecraft mc) {
return mc.player != null && mc.player.getY() >= minY;
}
}

View file

@ -0,0 +1,50 @@
package com.example.addon.macro;
import com.example.addon.ExampleAddon;
import autismclient.api.macro.ActionSchema;
import autismclient.api.macro.AddonContextAction;
import autismclient.api.macro.MacroExecutionContext;
import net.minecraft.nbt.CompoundTag;
// A macro condition: a step that waits. Extend AddonContextAction and block in run(), e.g. with
// ctx.awaitCondition(...). Register it with .condition(...) so it lands in the condition picker.
public final class ExampleHeightCondition extends AddonContextAction {
public static final String TYPE_ID = ExampleAddon.ID + ":wait-height";
public double minY = 64.0;
public ExampleHeightCondition() {
super(TYPE_ID);
}
@Override
public void run(MacroExecutionContext ctx) throws InterruptedException {
ctx.setStatus("Waiting until Y >= " + minY);
ctx.awaitCondition(new ExampleCondition(minY));
}
@Override
protected void save(CompoundTag tag) {
putDouble(tag, "minY", minY);
}
@Override
protected void load(CompoundTag tag) {
minY = getDouble(tag, "minY", minY);
}
@Override
protected ActionSchema schema() {
return ActionSchema.builder().decimal("minY", "Min Y").decRange(-64, 320).build();
}
@Override
public String getDisplayName() {
return "Wait until Y >= " + minY;
}
@Override
public String getIcon() {
return "Y";
}
}

View file

@ -0,0 +1,26 @@
package com.example.addon.macro;
import autismclient.util.macro.MacroAction;
import java.util.ArrayList;
import java.util.List;
// Presets insert a ready-made stack of steps. Return a fresh list each call; don't reuse instances.
public final class ExamplePresets {
private ExamplePresets() {}
// Wait until the player is high up, then announce it.
public static List<MacroAction> reachHeightThenSay() {
List<MacroAction> stack = new ArrayList<>();
ExampleHeightCondition waitForHeight = new ExampleHeightCondition();
waitForHeight.minY = 80.0;
stack.add(waitForHeight);
ExampleSayAction say = new ExampleSayAction();
say.message = "Reached Y 80!";
stack.add(say);
return stack;
}
}

View file

@ -0,0 +1,50 @@
package com.example.addon.macro;
import com.example.addon.ExampleAddon;
import autismclient.api.macro.ActionSchema;
import autismclient.api.macro.AddonAction;
import autismclient.util.AutismClientMessaging;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundTag;
// A macro action: runs once when the step is reached. Extend AddonAction and pass a namespaced id.
public final class ExampleSayAction extends AddonAction {
public static final String TYPE_ID = ExampleAddon.ID + ":say";
public String message = "Hello from an addon!";
public ExampleSayAction() {
super(TYPE_ID);
}
@Override
protected void run(Minecraft mc) {
AutismClientMessaging.sendPrefixed("\u00a7d[Example] " + message);
}
// Field keys here, in load(), and in the schema must match.
@Override
protected void save(CompoundTag tag) {
putString(tag, "message", message);
}
@Override
protected void load(CompoundTag tag) {
message = getString(tag, "message", message);
}
@Override
protected ActionSchema schema() {
return ActionSchema.builder().text("message", "Say").build();
}
@Override
public String getDisplayName() {
return "Say: " + message;
}
@Override
public String getIcon() {
return "S";
}
}

View file

@ -0,0 +1,19 @@
package com.example.addon.mixin;
import com.example.addon.ExampleAddon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.main.GameConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
// Example mixin. List your mixin classes in autism-advanced-addon-template.mixins.json (referenced from
// fabric.mod.json). An @Inject handler matches the target method's params, then CallbackInfo.
@Mixin(Minecraft.class)
public abstract class ExampleMixin {
@Inject(method = "<init>", at = @At("TAIL"))
private void onClientInit(GameConfig gameConfig, CallbackInfo ci) {
org.slf4j.LoggerFactory.getLogger(ExampleAddon.ID).info("Hello from ExampleMixin!");
}
}

View file

@ -0,0 +1,41 @@
package com.example.addon.modules;
import com.example.addon.ExampleAddon;
import autismclient.api.module.BoolSetting;
import autismclient.api.module.EnumSetting;
import autismclient.api.module.IntSetting;
import autismclient.modules.Module;
import autismclient.util.AutismClientMessaging;
import java.util.Locale;
// A toggleable module built on the typed setting API. Declare each setting as a final field with
// add(new XSetting(...)) and read it at runtime with field.get() — no string ids, no casting. An EnumSetting
// is backed by a real enum, so reads are compiler-checked (style.get() == Style.LOUD). Visibility is a plain
// predicate over other settings. With no category, the module auto-lands under a menu column named after your addon.
public final class ExampleModule extends Module {
public enum Style { FRIENDLY, LOUD }
private final BoolSetting greet = add(new BoolSetting("greet", "Greet on enable", true)
.group("General"));
private final IntSetting amount = add(new IntSetting("amount", "Amount", 3, 1, 10, 1)
.group("General"));
private final EnumSetting<Style> style = add(new EnumSetting<>("style", "Style", Style.FRIENDLY, Style.values())
.group("Display"));
private final BoolSetting shout = add(new BoolSetting("shout", "Shout in caps", false)
.group("Display")
.visibleWhen(() -> style.get() == Style.LOUD));
public ExampleModule() {
super(ExampleAddon.ID + ":example", "Example", "Demonstrates an AUTISM addon module.");
}
@Override
public void onEnable() {
if (greet.get()) {
String msg = "[Example] enabled - amount " + amount.get() + ", style " + style.get();
if (shout.get()) msg = msg.toUpperCase(Locale.ROOT);
AutismClientMessaging.sendPrefixed("§b" + msg);
}
}
}

View file

@ -0,0 +1,11 @@
{
"required": true,
"package": "com.example.addon.mixin",
"compatibilityLevel": "JAVA_25",
"client": [
"ExampleMixin"
],
"injectors": {
"defaultRequire": 1
}
}

View file

@ -0,0 +1,37 @@
{
"schemaVersion": 1,
"id": "autism-advanced-addon-template",
"version": "${version}",
"name": "AUTISM Advanced",
"description": "Reference addon for AUTISM Client: a module, macro action, preset, condition, command, HUD element, and event hook.",
"authors": [
"You"
],
"custom": {
"autism:color": "255,80,80",
"modmenu": {
"parent": {
"id": "autism"
}
}
},
"environment": "client",
"entrypoints": {
"client": [
"com.example.addon.ExampleInit"
],
"autism": [
"com.example.addon.ExampleAddon"
]
},
"mixins": [
"autism-advanced-addon-template.mixins.json"
],
"depends": {
"java": ">=25",
"minecraft": "${mc_compat}",
"fabricloader": ">=0.19.3",
"fabric-api": ">=${fabric_api_version}",
"autism": ">=${autism_api_version}"
}
}

View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{json,yml,yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false

6
addon-templates/minimal/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
.gradle/
build/
run/
*.log
.idea/
*.iml

View file

@ -0,0 +1,44 @@
# AUTISM Minimal Addon Template
Smallest useful AUTISM addon example:
- one module;
- one macro action;
- one macro condition.
This template uses the easy API (`SimpleAddon`, `SimpleModule`) and the one-call `registerSimpleAction` / `registerSimpleCondition` helpers.
Use `../advanced` when you need commands, HUD elements, events, raw custom macro serialization, or mixins.
## Build
1. From the AUTISM Client project, publish the API locally:
```powershell
.\gradlew.bat publishToMavenLocal --no-daemon
```
2. From this folder, build the addon:
```powershell
.\gradlew.bat build --no-daemon
```
The jar lands in `build/libs/`.
## Customize
Recommended (any OS, from the AUTISM Client repo root):
```sh
python addon-templates/addon-toolkit.py setup --template minimal --output ../MyAddon
```
Windows PowerShell works the same: `.\addon-templates\addon-toolkit.ps1 -Action Setup -Template minimal -OutputPath ..\MyAddon`. See `../README.md` for the Gradle (`./gradlew newAddon`) and `.sh` variants.
The toolkit asks for the addon name, output folder, version, and author. Blank version bumps the current
template version by one patch step. It derives the boring stuff and rewrites Gradle files, package paths,
`fabric.mod.json`, and entrypoints in one shot.
Manual path:
1. Rename package `com.example.minimal`.
2. Change `MinimalAddon.ID`.
3. Update `src/main/resources/fabric.mod.json`.
4. Change names/descriptions in `MinimalAddon`.

View file

@ -0,0 +1,67 @@
plugins {
alias(libs.plugins.fabric.loom)
}
base {
archivesName = properties["archives_base_name"] as String
version = libs.versions.mod.version.get()
group = properties["maven_group"] as String
}
repositories {
// AUTISM Client is consumed from your local Maven repo. In the AUTISM project run:
// ./gradlew publishToMavenLocal
mavenLocal()
maven("https://maven.fabricmc.net/") { name = "Fabric" }
mavenCentral()
}
dependencies {
// Mirrors the AUTISM Client build: official Mojang mappings are implicit for the configured version, so there is no
// explicit `mappings(...)` line and dependencies use plain `implementation`.
minecraft(libs.minecraft)
implementation(libs.fabric.loader)
implementation(libs.fabric.api)
// The AUTISM Client API (published to mavenLocal from the AUTISM project).
implementation(libs.autism)
}
// Turns an exact Minecraft version (e.g. "26.2") into a compatible range ("~26.2") so the addon
// keeps loading across patch releases instead of pinning one exact build.
fun toMinecraftCompat(version: String): String {
val m = Regex("""^(\d+)\.(\d+)(?:\.(\d+))?$""").matchEntire(version)
?: return version
val (year, drop, _) = m.destructured
return "~$year.$drop"
}
tasks {
processResources {
val propertyMap = mapOf(
"version" to project.version,
"mc_version" to libs.versions.minecraft.get(),
"mc_compat" to toMinecraftCompat(libs.versions.minecraft.get()),
"fabric_api_version" to libs.versions.fabric.api.get(),
"autism_api_version" to libs.versions.autism.get()
)
inputs.properties(propertyMap)
filteringCharset = "UTF-8"
filesMatching("fabric.mod.json") {
expand(propertyMap)
}
}
java {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
toolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(25)
}
}

View file

@ -0,0 +1,7 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=false
maven_group=com.example.addon
archives_base_name=autism-minimal-addon-template

View file

@ -0,0 +1,23 @@
# In this repo these are auto-synced from the client: run `gradlew syncAddonTemplateVersions` (it also runs
# on publishToMavenLocal), which pins minecraft/fabric-loader/fabric-api/loom/autism to the client's
# gradle/libs.versions.toml. In a copied-out addon, set them to the AUTISM Client release you build against.
[versions]
mod-version = "1.0.0"
minecraft = "26.2"
fabric-loader = "0.19.3"
fabric-api = "0.152.2+26.2"
# The AUTISM Client release you compile against. The generated fabric.mod.json depends on `>=` this version, so a
# built addon keeps loading on newer hosts in the same major line (the API-version handshake gates real breaks).
autism = "5.0"
loom = "1.17.11"
[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" }
autism = { module = "com.autismclient:autism", version.ref = "autism" }
[plugins]
fabric-loom = { id = "net.fabricmc.fabric-loom", version.ref = "loom" }

Binary file not shown.

View file

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

248
addon-templates/minimal/gradlew vendored Executable file
View file

@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 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.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# 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/platforms/jvm/plugins-application/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##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || 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
# 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
if ! command -v java >/dev/null 2>&1
then
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
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=SC2039,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=SC2039,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" )
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 optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# 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" "$@"

93
addon-templates/minimal/gradlew.bat vendored Normal file
View file

@ -0,0 +1,93 @@
@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
@rem SPDX-License-Identifier: Apache-2.0
@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. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
: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

View file

@ -0,0 +1,9 @@
pluginManagement {
repositories {
maven("https://maven.fabricmc.net/") { name = "Fabric" }
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = "autism-minimal-addon-template"

View file

@ -0,0 +1,33 @@
package com.example.minimal;
import autismclient.api.ApiVersion;
import autismclient.api.SimpleAddon;
import autismclient.api.module.SimpleModule;
import autismclient.util.AutismClientMessaging;
public final class MinimalAddon extends SimpleAddon {
public static final String ID = "autism-minimal-addon-template";
public MinimalAddon() {
super(ApiVersion.CURRENT, "com.example.minimal");
}
@Override
protected void initialize() {
SimpleModule module = new SimpleModule("hello-module", "HelloModule", "Tiny example addon module.")
.addBool("greet", "Greet On Enable", true)
.addText("message", "Message", "Hello from my addon")
.onEnabled(self -> {
if (self.getBool("greet")) {
AutismClientMessaging.sendPrefixed("\u00a7a" + self.getText("message"));
}
});
registerModule(module);
registerSimpleAction("say-hello", "Say Hello", "Send a short addon message.", "S", mc ->
AutismClientMessaging.sendPrefixed("\u00a7aHello from the minimal addon!"));
registerSimpleCondition("wait-player", "Wait Player", "Wait until the local player exists.",
"Waiting for player", "P", mc -> mc.player != null);
}
}

View file

@ -0,0 +1,8 @@
package com.example.minimal;
import net.fabricmc.api.ClientModInitializer;
public final class MinimalInit implements ClientModInitializer {
@Override
public void onInitializeClient() {}
}

View file

@ -0,0 +1,34 @@
{
"schemaVersion": 1,
"id": "autism-minimal-addon-template",
"version": "${version}",
"name": "AUTISM Minimal Addon Template",
"description": "Small AUTISM Client addon example: one module, one macro action, and one macro condition.",
"authors": [
"You"
],
"custom": {
"autism:color": "80,220,120",
"modmenu": {
"parent": {
"id": "autism"
}
}
},
"environment": "client",
"entrypoints": {
"client": [
"com.example.minimal.MinimalInit"
],
"autism": [
"com.example.minimal.MinimalAddon"
]
},
"depends": {
"java": ">=25",
"minecraft": "${mc_compat}",
"fabricloader": ">=0.19.3",
"fabric-api": ">=${fabric_api_version}",
"autism": ">=${autism_api_version}"
}
}

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
stroke-width: 40px;
}
</style>
</defs>
<g id="_x35_3">
<path class="st0" d="M474.1,289.8c-28.2-5.4-59.1-10.9-83.3-28.5-6.7-12.2,4-23.1,12.1-32.6,20.2-28.5,36.3-54.3,44.3-88.2,1.3-9.5-2.7-23.1-13.4-21.7-21.5,19-48.4,33.9-76.6,38-6.7,1.4-10.8-5.4-12.1-10.9-4-38-14.8-74.6-29.6-108.6-4-8.1-12.1-14.9-21.5-14.9-9.4,1.4-6.7,13.6-8.1,20.4-5.4,24.4-10.8,47.5-25.5,66.5-4,5.4-10.8,2.7-16.1,0-33.6-24.4-64.5-46.1-103.5-57-6.7-1.4-12.1,1.4-17.5,4.1-5.4,2.7-2.7,6.8-2.7,9.5,14.8,25.8,33.6,47.5,37.6,77.3,0,6.8-5.4,10.9-10.8,10.9-39,5.4-73.9,14.9-108.9,31.2-9.4,5.4-17.5,16.3-12.1,27.1,28.2,4.1,55.1,9.5,80.6,25.8,5.4,2.7,8.1,8.1,5.4,13.6-14.8,25.8-33.6,47.5-45.7,74.6-5.4,12.2-9.4,23.1-13.4,35.3-1.3,8.1,1.3,16.3,8.1,20.4,2.7,1.4,6.7,1.4,9.4-1.4,1.3-1.4,2.7-2.7,4-4.1,4-1.4,6.7-4.1,9.4-6.8,20.2-10.9,37.6-25.8,60.5-24.4,4,0,8.1,0,9.4,5.4,4,16.3,4,31.2,8.1,47.5,1.3,5.4,2.7,9.5,4,14.9,6.7,19,10.8,38,22.8,55.6,4,6.8,13.4,13.6,22.8,8.1,5.4-23.1,8.1-44.8,17.5-66.5,5.4-9.5,10.8-24.4,22.8-19,6.7,2.7,13.4,8.1,20.2,13.6,26.9,20.4,56.4,33.9,87.4,44.8,5.4,1.4,10.8,0,14.8-2.7,2.7-2.7,9.4-6.8,6.7-10.9-17.5-24.4-33.6-50.2-39-78.7,2.7-10.9,14.8-12.2,24.2-12.2,34.9-4.1,67.2-14.9,99.5-31.2,6.7-4.1,14.8-16.3,8.1-24.4Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
}
</style>
</defs>
<rect class="st0" x="6.7" y="7.9" width="484.2" height="44.1"/>
<rect class="st0" x="6.7" y="154.3" width="484.2" height="44.1"/>
<rect class="st0" x="6.7" y="300.7" width="484.2" height="44.1"/>
<rect class="st0" x="6.7" y="447.2" width="484.2" height="44.1"/>
<rect class="st0" x="7.1" y="7.5" width="44.1" height="484.2"/>
<rect class="st0" x="153.5" y="7.5" width="44.1" height="484.2"/>
<rect class="st0" x="300" y="7.5" width="44.1" height="484.2"/>
<rect class="st0" x="446.4" y="7.5" width="44.1" height="484.2"/>
</svg>

After

Width:  |  Height:  |  Size: 859 B

12
assets/icons/Filter.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
}
</style>
</defs>
<path class="st0" d="M384.7,70.7L318.8,4.8l-64.5,64.5L189.4,4.4l-65.4,65.4,65,65-47.9,47.9-65-65L10.7,183.1l65,65L11.1,312.6l65.8,65.8,64.5-64.5,48.2,48.2-64.5,64.5,65.8,65.8,64.5-64.5,65,65,65.4-65.4-65-65,47.9-47.9,65,65,65.4-65.4-65-65,64.5-64.5-65.8-65.8-64.5,64.5-48.2-48.2,64.5-64.5ZM302.9,248.8l-47.9,47.9-48.2-48.2,47.9-47.9,48.2,48.2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 670 B

26
assets/icons/Keybinds.svg Normal file
View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
stroke-width: 80px;
}
.st0, .st1 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
}
.st1 {
stroke-width: 30px;
}
</style>
</defs>
<path class="st1" d="M267.1,22.2C127.4,13.3,11.7,128.6,20.6,267.9c7.4,115.1,100.7,208.1,216.2,215.4,139.7,8.9,255.4-106.4,246.5-245.6-7.4-115.1-100.7-208.1-216.2-215.4ZM266.1,468.4c-130.7,8.3-238.9-99.5-230.5-229.7,6.9-107.7,94.2-194.6,202.2-201.5,130.7-8.3,238.9,99.5,230.5,229.7-6.9,107.7-94.2,194.6-202.2,201.5Z"/>
<path class="st0" d="M146.5,290.3v-75.1c0-5.3-5.8-8.7-10.5-6l-65.3,37.6c-4.6,2.7-4.6,9.4,0,12l65.3,37.6c4.6,2.7,10.5-.7,10.5-6Z"/>
<path class="st0" d="M357.4,215.2v75.1c0,5.3,5.8,8.7,10.5,6l65.3-37.6c4.6-2.7,4.6-9.4,0-12l-65.3-37.6c-4.6-2.7-10.5.7-10.5,6Z"/>
<path class="st0" d="M258,432.9l37.7-65c2.7-4.6-.7-10.4-6-10.4h-75.4c-5.4,0-8.7,5.8-6,10.4l37.7,65c2.7,4.6,9.4,4.6,12.1,0Z"/>
<path class="st0" d="M214.3,147.3h75.4c5.4,0,8.7-5.8,6-10.4l-37.7-65c-2.7-4.6-9.4-4.6-12.1,0l-37.7,65c-2.7,4.6.7,10.4,6,10.4Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

21
assets/icons/Lansync.svg Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
stroke-width: 20px;
}
</style>
</defs>
<path class="st0" d="M410.8,119.5V12H12.4v367.2h76.3v107.5h398.4V119.5h-76.3ZM471.9,193.2H103.8v-59.7h368.1v59.7ZM395.6,25.9v59l-368.1.7V25.9h368.1ZM27.5,365.2V99.6l368.1-.7v20.6H88.6v245.7H27.5ZM103.8,472.7V207.1h368.1v265.6H103.8Z"/>
<path class="st0" d="M139,176.8c10.2,1.4,18.9-6.5,17.3-15.9-1-5.9-6.2-10.6-12.5-11.5-10.2-1.4-18.9,6.5-17.3,15.9,1,5.9,6.2,10.6,12.5,11.5Z"/>
<path class="st0" d="M183.3,176.8c10.2,1.4,18.9-6.5,17.3-15.9-1-5.9-6.2-10.6-12.5-11.5-10.2-1.4-18.9,6.5-17.3,15.9,1,5.9,6.2,10.6,12.5,11.5Z"/>
<path class="st0" d="M229.5,176.8c10.2,1.4,18.9-6.5,17.3-15.9-1-5.9-6.2-10.6-12.5-11.5-10.2-1.4-18.9,6.5-17.3,15.9,1,5.9,6.2,10.6,12.5,11.5Z"/>
<path class="st0" d="M62.7,69.3c10.2,1.4,18.9-6.5,17.3-15.9-1-5.9-6.2-10.6-12.5-11.5-10.2-1.4-18.9,6.5-17.3,15.9,1,5.9,6.2,10.6,12.5,11.5Z"/>
<path class="st0" d="M107.1,69.3c10.2,1.4,18.9-6.5,17.3-15.9-1-5.9-6.2-10.6-12.5-11.5-10.2-1.4-18.9,6.5-17.3,15.9,1,5.9,6.2,10.6,12.5,11.5Z"/>
<path class="st0" d="M153.2,69.3c10.2,1.4,18.9-6.5,17.3-15.9-1-5.9-6.2-10.6-12.5-11.5-10.2-1.4-18.9,6.5-17.3,15.9,1,5.9,6.2,10.6,12.5,11.5Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

15
assets/icons/Macros.svg Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
stroke-width: 20px;
}
</style>
</defs>
<path class="st0" d="M385,288c-7,3.9-15.6,2.7-21.2-3l-34.9-35.5,35.5-36c5.6-5.7,14.3-6.9,21.2-3,25.5,14.3,58.3,10.4,79.9-11.5,27.1-27.5,26.2-72.7-2.6-99-25.9-23.6-66.3-22.9-91.4,1.6-22.5,22-26.6,55.8-12.3,82.1,3.8,7,2.7,15.8-2.9,21.5l-35.5,36-65.9-66.9v-.5h-.6v-12c0-8.1,5.3-15.1,12.9-17.3,28-8.2,48.5-34.4,48.5-65.5S283.4,8.8,244.6,10.9c-34.8,1.9-62.9,31.4-63.6,66.7-.6,31.7,20.1,58.5,48.5,66.9,7.6,2.2,12.9,9.3,12.9,17.3v12l-65.9,66.9-34.9-35.5c-5.6-5.7-6.8-14.4-2.9-21.5,14.3-26.3,10.2-60.1-12.3-82.1-25.1-24.5-65.6-25.2-91.4-1.6-28.9,26.4-29.7,71.5-2.6,99,21.6,22,54.4,25.8,79.9,11.5,7-3.9,15.6-2.7,21.2,3l34.9,35.5-35.5,36c-5.6,5.7-14.3,6.9-21.2,3-25.5-14.3-58.2-10.4-79.9,11.5-27.1,27.5-26.2,72.7,2.6,99,25.9,23.6,66.3,22.9,91.4-1.6,22.5-22,26.6-55.8,12.3-82.1-3.8-7-2.7-15.8,2.9-21.5l35.5-36,65.9,66.9v.5h.6v12c0,8.1-5.3,15.1-12.9,17.3-28,8.2-48.5,34.4-48.5,65.5s32.1,70.2,70.9,68.1c34.8-1.9,62.9-31.4,63.6-66.7.6-31.7-20.1-58.5-48.5-66.9-7.6-2.2-12.9-9.3-12.9-17.3v-12l65.9-66.9,34.9,35.5c5.6,5.7,6.8,14.4,2.9,21.5-14.3,26.3-10.2,60.1,12.3,82.1,25.1,24.5,65.6,25.2,91.4,1.6,28.9-26.4,29.7-71.5,2.6-99-21.6-22-54.4-25.8-79.9-11.5ZM242.4,307.6l-57.7-58.6,57.7-58.6v117.2ZM254.6,308.2v-117.2l57.7,58.6-57.7,58.6Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
stroke-width: 60px;
}
</style>
</defs>
<g id="_x37_3">
<polygon class="st0" points="318.4 85.3 314.2 186.7 413.9 179.2 340.3 248.8 415 315.1 315.2 312.2 321.2 413.3 253.6 339.5 187.3 416.3 191.5 314.9 91.8 322.4 165.4 252.8 90.7 186.5 190.5 189.4 184.5 88.3 252.1 162.1 318.4 85.3"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320">
<path d="M160,0C71.77,0,0,71.78,0,160s71.77,160,160,160,160-71.78,160-160S248.22,0,160,0ZM160,309.24c-82.29,0-149.24-66.95-149.24-149.24,0-30.47,9.22-58.8,24.95-82.44-.13,1.81-.32,3.6-.89,5.23-1.6,4.54-4.51,7.24-3.97,12.51,6.33,1.88,3.58-9.37,8.92-9.95,1.69,4.2.58,12.01.1,16.58-.66,6.29-1.89,7.85,1.87,13.25,2.98,4.28,3.96,7.14,9.72,7.82,5.28.62,7.47,3.01,9.67,8.1,4.07.87,6.54,1.54,7.06,6.05,1.76.98,5.09,4.16,6.95,4.65,2.7.71,7.21-3.14,9.76-.17,4.25,4.95-5.39,17.88-7.11,22.34-2.52,6.53-2.9,16.13,3.29,20.82,3.18,2.41,6.56,3.56,7.59,7.93.96,4.04.21,7.4,2,11.22,2.79,5.95,9.18,7.93,13.73,12.49,5.97,5.98,5.56,13.73,5.56,22.19s3.37,15.6,4.54,23.71c1.21,8.37,3.67,16.12,5.43,24.21,1.32,6.09,6.57,15.28,14.17,14.05.53-2.88-2.46-5.14-2.84-7.99-.34-2.6.39-5.3-.13-8.07-1.02-5.5-.97-8.73,2.67-13.51,1.29-1.69,3.06-3.08,4.39-4.78,2.58-3.28.6-2.31.49-5.9-.14-4.49,1.23-2.28,3.93-3.68,1.4-.73,2.96-2.92,4.04-4.04,2.36-2.46,6-5.4,7.83-8.31,2.05-3.28,1.8-7.85,3.9-11.23,2.42-3.88,5.84-3.89,9.21-6.42,4.38-3.28,2.57-6.74,3.37-11.24,1.33-7.52,4.74-15.82,9.49-21.81,5.97-7.54,8.54-13.96,1.27-21.2-3.59-3.58-5.46-2.63-10.22-3.87-3.63-.95-6.9-3.6-10.6-4.06-2.21-.27-3.52.53-5.55,0-1.88-.49-1.66-1.65-3.64-1.62-2.96.04-7.11,6.21-9.61,2.27-1.39-2.2,2.84-8.28,2.65-11.23-.24-3.62-1.58-9.52-5.13-11.5-1.34-.75-4.32-.86-5.97-1.49-1.93-.75-3.83-1.94-5.56-3.05-2.26-1.45-6.63-3.98-7.63-6.57-2.78-.11-4.66-1.64-7.48-1.6-2.53.03-4.21,1.2-6.95.9-2.4-.27-4.98-2.16-7.57-1.8-1.73.24-4.28,2.48-5.77,3.32-3.94,2.22-8.14,3.84-12.5,4.65-6.75,1.27-7.96-1.32-7.57-7.57l-1.01-2.02c2.51-6.97-2.01-7.46-6.99-9.15-.69-4.97,5.42-8.51,2.87-13.96-5.17-.27-10.8,14.27-15.17,7.98-2.88-4.15,1.5-15.77,4.04-19.29,2.56-3.55,11.86-9.95,16.24-10.5,3.41-.42,6.39,1.07,7.7,4.06,1.43,3.26-.44,6.33-.02,10.02,4.36-1.01,3.23-6.55,3.04-9.52-.32-4.96,2.28-4.59,4.82-8.17,2.3-3.26,2.66-6.98,5.54-10.13,2.24-2.46,4.87-5.04,7.33-7.3,2.8-2.58,5.96-2.35,8.84-4.25,4.37-2.89-1.41-8.26,5.03-7.86,2.29.14,1.15,1.57,4.19.88,1.29-.29,3.67-1.48,5.01-2.03,6.15-2.5,1.79-3.17-1.03-6.42-3.59-4.14,1.49-3.41,5.19-4.04,2.72-.46,2.14-1.34,4.53.25,2.1,1.41.87,3.28,3.92,3.18,5.82-.2,1.79-6.03.49-7.97-2.22-3.32-2.79-5.62-7.48-5.75.44-1.49.5-3.46-.15-4.89-3.95.52-4.63-2.35-7.62-3.48-5.03-1.9-4.22,2.22-6.28,5.03-2.12,2.9-6.17,2.4-7.73,5.93-1.62,3.68-.07,6.49-5.99,5.48.81-2.22.53-5.05.38-7.41-1.72-.22-3.29-.65-4.88-1.17,0-.84.16-1.55.41-2.19,8.61-3.97,17.66-7.11,27.05-9.39,2.02,1.21,4.14,2.17,6.88.08.94-.71,1.33-1.32,1.54-1.9,3.97-.72,7.97-1.38,12.05-1.78,0,0,.01.02.02.03.66,1.12,1.91,1.88,2.43,3.11.6,1.4-.81,3.15.96,4.1,2.22,1.19,7.85-4.81,10.93-7.96.1,0,.19-.01.29-.01,18.08,0,35.34,3.39,51.39,9.31.37.18.66.39,1.08.54.3.1.69.19,1.12.27,1.85.71,3.72,1.37,5.53,2.16.5.75.58,1.75-.3,3.26-2.72,4.67-5.73-1.45-7.1-2.92-1.9-2.04-7.52-4.3-7.34.38.26,6.96,15.95,5.84,12.59,13.49,1.88,1.11,5.59,2.95,4.98,5.69-.75,3.38-5.16,1.23-5.07,5.55.12,6.13,6.81,11.17,13.02,8.96,6.62-2.35,1.63-11.54,9.22-12.48,2.99-.37,4.75.5,7.43,2.62,2.18,1.73,3.59,5.65,6.59,5.34.31-1.87-1.09-3.2-1.33-4.92,2.33.58,7.01,3.49,8.35,5.51,2.02,3.07,1.81,7.48,6.75,3.53-.74-.61-1.11-1.96-1.51-2.45.07,0,.12.02.19.02,4.56,4.57,8.71,9.53,12.66,14.66-3.06.44-8.52-1.48-8.96,2.33-3.67-1.16-5.29-4.11-8.48-5.88-1.51-.84-4.3-.39-5.46-1.24-1.59-1.17-1.2-3.29-2.6-4.44-5.5-4.51-18.05,2.78-23.11,5.69-1.37.79-2.83.88-3.77,2.36-1.61,2.54.65,3.2.15,5.57-.72,3.39-5.14,4.95-6.48,7.67-3.21,6.52,3.31,15.86,2.43,23.1-.49,4.02-4.82,8.38-3.16,11.74.72,1.45,3.22,2.68,4.17,4.39.87,1.55,1.24,3.59,2.38,5.19,3.71,5.21,9.04,11.01,13.39,15.88,2.47,2.76,5.83,3.54,9.56,2.77,3.08-.63,7.74-1.66,10.59-3.03,3.81-1.82,4.31-4.39,8.31-2.66,3.18,1.38,5.99,5.44,9.7,2.08,3.07,2.99-.33,8.21-1.02,11.55-.88,4.28.82,7.99,3.44,11.63,3.15,4.36,3.89,5.13,3.25,10.96-.5,4.54-1.66,8.7-2.63,13.2-.93,4.3-3.68,7.57-3.53,12.13.14,4.21,1.96,7.59,1.4,12.11-.49,3.98-.73,8.71-1.77,12.61-1.07,3.99-3.88,7.52-5.07,11.6-1.13,3.88-.81,8.91,1.91,12.1,2.04,2.39,4.06,2.06,6.28.76-27.26,36.21-70.46,59.77-119.17,59.77Z" fill="#eb2329"/>
</svg>

After

Width:  |  Height:  |  Size: 4 KiB

BIN
assets/icons/Multi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
stroke-width: 30px;
}
</style>
</defs>
<path class="st0" d="M484.3,246.9c0-60.4-46-110-104.9-115.7l47.5-47.5-5.1-5.4c-.3-.3-.6-.6-.9-1-46.3-46.3-120.5-48.2-169.2-5.8V15.4c-.4,0-.7,0-1.1,0-60.4,0-110,46-115.7,104.9l-47.5-47.5-5.4,5.1c-.3.3-.6.6-.9.9l5.4,5.5-5.4-5.5h0c-23.4,23.4-36.3,54.6-36.3,87.7s10.8,58.9,30.5,81.5H19.1c0,.4,0,.7,0,1.1,0,60.4,46,110,104.9,115.7l-47.5,47.5,5.1,5.4c.3.3.6.6.9,1,24.2,24.2,55.9,36.3,87.7,36.3s58.2-10.2,81.5-30.5v56.1c.4,0,.7,0,1.1,0,60.4,0,110-46,115.7-104.9l47.5,47.5,5.4-5.1c.3-.3.6-.6,1-.9,46.3-46.3,48.2-120.5,5.8-169.2h56.1c0-.4,0-.7,0-1.1ZM256.4,88.2c21.2-21.2,49-31.8,76.8-31.8s51.5,9.1,72,27.2l-47.4,47.4c-56,4.9-100.6,49.5-105.5,105.5l-.3.3c0,0,0-.1-.1-.2V93.2c1.5-1.7,3-3.4,4.7-5ZM91.9,243.3c-20.5-20.5-31.8-47.8-31.8-76.8s9.6-52.1,27.3-72l47.4,47.4c4.9,56,49.5,100.6,105.5,105.5l.3.3c0,0-.1,0-.2.1H96.9c-1.7-1.5-3.4-3.1-5-4.7ZM247,407.8c-40.8,40.8-106.2,42.3-148.8,4.5l47.4-47.4c56-4.9,100.6-49.5,105.5-105.5l.3-.3c0,0,0,.1.1.2v143.6c-1.5,1.7-3.1,3.4-4.7,5ZM411.5,252.7c40.8,40.8,42.3,106.2,4.5,148.8l-47.4-47.4c-4.9-56-49.5-100.6-105.5-105.5l-.3-.3c0,0,.1,0,.2-.1h143.6c1.7,1.5,3.4,3.1,5,4.7Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
}
</style>
</defs>
<rect class="st0" x="11.3" y="14.8" width="55" height="479.3"/>
<rect class="st0" x="95.7" y="14.8" width="55" height="479.3"/>
<rect class="st0" x="264.6" y="14.8" width="55" height="479.3"/>
<rect class="st0" x="433.5" y="14.8" width="55" height="479.3"/>
<rect class="st0" x="180.2" y="136.5" width="55" height="357.6"/>
<rect class="st0" x="349.1" y="14.8" width="55" height="357.6"/>
</svg>

After

Width:  |  Height:  |  Size: 722 B

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
stroke: #ec2027;
stroke-miterlimit: 10;
stroke-width: 40px;
}
</style>
</defs>
<g id="_x33_1">
<path class="st0" d="M250.2,29.6c-125.9,0-228.3,99.6-228.3,221.9s102.4,221.9,228.3,221.9,228.3-99.6,228.3-221.9S376.1,29.6,250.2,29.6ZM250.2,41.1c116,0,210.9,89.1,216.2,200.5-23.3-22-110.3-96.8-216.2-96.8S57.3,219.6,34,241.7c5.3-111.5,100.3-200.5,216.2-200.5ZM459.8,251.6c-19.5,18.4-106.7,95.1-209.6,95.1S60.1,270,40.6,251.6c19.5-18.4,106.7-95.1,209.6-95.1s190.1,76.7,209.6,95.1ZM250.2,462c-116,0-210.9-89.1-216.2-200.5,23.3,22,110.3,96.8,216.2,96.8s192.9-74.7,216.2-96.8c-5.3,111.5-100.3,200.5-216.2,200.5Z"/>
<path class="st0" d="M214.8,251.6c0,19,15.9,34.4,35.4,34.4s35.4-15.4,35.4-34.4-15.9-34.4-35.4-34.4-35.4,15.4-35.4,34.4Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
<circle cx="250" cy="155" r="105" fill="#ec2027"/>
<path fill="#ec2027" d="M55 465c0-116 87-190 195-190s195 74 195 190H55Z"/>
</svg>

After

Width:  |  Height:  |  Size: 239 B

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
}
</style>
</defs>
<path class="st0" d="M1.2,225.8h223.5V2.3C106.7,14.1,12.9,107.9,1.2,225.8Z"/>
<path class="st0" d="M224.7,499.5v-223.5H1.2c11.8,118,105.6,211.8,223.5,223.5Z"/>
<path class="st0" d="M274.8,499.5c118-11.8,211.8-105.6,223.5-223.5h-223.5v223.5Z"/>
<path class="st0" d="M274.8,2.3v223.5h223.5C486.6,107.9,392.8,14.1,274.8,2.3Z"/>
</svg>

After

Width:  |  Height:  |  Size: 654 B

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 500 500">
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
<defs>
<style>
.st0 {
fill: #ec2027;
}
</style>
</defs>
<g id="_x30_9">
<path class="st0" d="M189.9,357.2c19.8-5.5,40.5-8.4,61.3-8.4s39.5,2.6,58.4,7.6c10.8-29.2,17.3-61.6,18.5-94.9h-156.8c1.2,33.8,7.6,66.4,18.5,95.7Z"/>
<path class="st0" d="M248.3,130.4c17.9,0,35.7-2.4,52.7-7.2-13.2-28.2-30.6-52.7-51.3-71.5-21,18.4-38.6,43.3-51.9,72.1,16.4,4.3,33.3,6.6,50.4,6.6Z"/>
<path class="st0" d="M217.8,51.5c-33.2,5.3-63.8,18.9-89.5,38.5,14.6,11.1,30.6,20.1,47.5,26.7,11.1-24.6,25.3-46.8,42-65.2Z"/>
<path class="st0" d="M351.5,238.2h98.9c-3-52.8-26.6-100.2-62.8-134.4-16.5,13.4-35.5,24.4-55.9,32.6,11.7,31.4,18.6,66.1,19.8,101.8Z"/>
<path class="st0" d="M167.5,137c-20.3-7.8-39.4-18.5-56.7-32-35.5,34.1-58.6,81-61.6,133.2h98.9c1.2-35.4,8-69.9,19.4-101.2Z"/>
<path class="st0" d="M369.7,88.8c-25.5-19.1-55.7-32.3-88.5-37.4,16.6,18.4,30.7,40.2,41.9,64.4,16.6-6.8,32.3-15.8,46.7-26.9Z"/>
<path class="st0" d="M309.7,143.9c-19.3,5.5-39.5,8.4-59.9,8.4s-40.7-2.7-60.2-8.1c-10.6,28.9-16.9,61-18.2,94h156.8c-1.2-33.3-7.7-65.3-18.5-94.3Z"/>
<path class="st0" d="M148.1,261.5H49.2c3.1,52.9,26.7,100.4,63.1,134.6,17.1-13.3,36-23.9,56.1-31.7-11.9-31.7-19-66.7-20.3-102.9Z"/>
<path class="st0" d="M249.8.7C112.2.7.6,112.3.6,249.8s111.5,249.1,249.1,249.1,249.1-111.5,249.1-249.1S387.4.7,249.8.7ZM402.2,414.3c-.3,1.6-1.1,3.2-2.4,4.5-2.6,1.7-4.6,2.9-6.8,3.6-38.5,32-87.9,51.4-141.8,51.7-.5,0-.9,0-1.4,0-54.9,0-105.2-19.8-144.2-52.6-.6-.4-1.3-1-1.8-1.6-47.9-41.1-78.2-102.1-78.2-170.1C25.5,126.1,126,25.6,249.8,25.6s224.2,100.5,224.2,224.2-27.7,123.5-71.9,164.4Z"/>
<path class="st0" d="M281.7,448.2c32.5-5.2,62.4-18.3,87.8-37.2-14.4-10.9-30-19.7-46.5-26.3-11,23.9-24.9,45.5-41.3,63.5Z"/>
<path class="st0" d="M331.7,363.5c20.3,7.6,39.5,18.2,56.8,31.4,35.6-34.1,58.8-81.1,61.8-133.4h-98.9c-1.2,35.7-8.1,70.5-19.7,102Z"/>
<path class="st0" d="M249.8,370.7c-17.5,0-34.7,2.3-51.4,6.8,13,27.7,30.3,51.8,51.4,70.4,20.6-18.1,37.9-42.3,51.1-70.4-16.6-4.4-33.7-6.7-51.1-6.7Z"/>
<path class="st0" d="M130,411c25.5,19,55.6,32.1,88.3,37.3-16.4-18.2-30.4-39.7-41.5-63.6-16.6,6.6-32.3,15.4-46.8,26.4Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

2253
build.gradle.kts Normal file

File diff suppressed because it is too large Load diff

9
gradle.properties Normal file
View file

@ -0,0 +1,9 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.configuration-cache=false
# Loom's manifest rewrite opens the output through JDK ZipFS. With Gradle 9/JDK 25, reusing the long-lived daemon
# can retain a closed ZipFileSystem and make a later forced :jar fail with ClosedFileSystemException. A fresh
# single-use process is deterministic and avoids producing a partially packaged release jar.
org.gradle.daemon=false
maven_group=com.autismclient
archives_base_name=AUTISM Client

19
gradle/libs.versions.toml Normal file
View file

@ -0,0 +1,19 @@
[versions]
mod-version = "5.0"
minecraft = "26.2"
fabric-loader = "0.19.3"
fabric-api = "0.152.2+26.2"
lithium = "mc26.2-0.25.0-fabric"
loom = "1.17.11"
[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" }
lithium = { module = "maven.modrinth:lithium", version.ref = "lithium" }
[plugins]
fabric-loom = { id = "net.fabricmc.fabric-loom", version.ref = "loom" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

248
gradlew vendored Executable file
View file

@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 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.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# 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/platforms/jvm/plugins-application/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##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || 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
# 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
if ! command -v java >/dev/null 2>&1
then
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
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=SC2039,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=SC2039,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" )
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 optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# 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" "$@"

93
gradlew.bat vendored Normal file
View file

@ -0,0 +1,93 @@
@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
@rem SPDX-License-Identifier: Apache-2.0
@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. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
: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

12
settings.gradle.kts Normal file
View file

@ -0,0 +1,12 @@
pluginManagement {
repositories {
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = "YungLightUI"

View file

@ -0,0 +1,20 @@
package autismclient;
import com.mojang.logging.LogUtils;
import net.fabricmc.loader.api.FabricLoader;
import org.slf4j.Logger;
public final class AutismClientAddon {
public static final Logger LOG = LogUtils.getLogger();
public static final String MOD_ID = "autism";
public static final boolean DEBUG = false;
public static final java.io.File FOLDER = FabricLoader.getInstance().getConfigDir().resolve("autism").toFile();
static {
FOLDER.mkdirs();
}
private AutismClientAddon() {}
}

View file

@ -0,0 +1,242 @@
package autismclient;
import autismclient.gui.vanillaui.components.UiText;
import autismclient.modules.PackAutoReconnectState;
import autismclient.modules.AutismModule;
import autismclient.render.AutismFemaleBodyRenderer;
import autismclient.security.AutismItemNbtSanity;
import autismclient.security.AutismProtector;
import autismclient.security.AutismProtectorPackStrip;
import autismclient.security.AutismProtectorServerPackFailureGuard;
import autismclient.security.AutismProtectorTracker;
import autismclient.security.AutismProtectorVanillaKeys;
import autismclient.util.AutismInstaBreakRenderer;
import autismclient.util.AutismFakeGamemode;
import autismclient.util.AutismJoinMacroController;
import autismclient.util.AutismLANSync;
import autismclient.util.AutismOverlayManager;
import autismclient.util.AutismSvgHudLogo;
import autismclient.util.AutismWindowBranding;
import autismclient.util.AutismSharedState;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
import net.fabricmc.fabric.api.client.networking.v1.ClientConfigurationConnectionEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.minecraft.server.packs.PackType;
public final class AutismClientMod implements ClientModInitializer {
private static void runSafe(String where, Runnable action) {
try {
action.run();
} catch (Throwable t) {
AutismClientAddon.LOG.warn("[Autism] client-event '{}' failed; isolated to protect the client", where, t);
}
}
private static final java.util.concurrent.ConcurrentHashMap<String, Long> LAST_TICK_ERROR_MS = new java.util.concurrent.ConcurrentHashMap<>();
private static void logTickError(String where, Throwable t) {
long now = System.currentTimeMillis();
Long last = LAST_TICK_ERROR_MS.get(where);
if (last != null && now - last < 5000L) return;
LAST_TICK_ERROR_MS.put(where, now);
AutismClientAddon.LOG.warn("[Autism] tick '{}' failed; isolated to protect the client", where, t);
}
@Override
@SuppressWarnings("deprecation")
public void onInitializeClient() {
AutismClientAddon.FOLDER.mkdirs();
runSafe("initialize", () -> AutismModule.get().initialize());
AutismProtectorTracker.bootstrap();
if (!AutismProtector.isOverlapExternalProtectorPresent()) {
AutismProtectorVanillaKeys.primeAsync();
}
if (AutismProtector.isFullExternalProtectorPresent()) {
AutismClientAddon.LOG.info(
"[AutismProtector] External protection mod detected; deferring all anti-fingerprint mixins to it.");
} else if (AutismProtector.isExploitPreventerPresent()) {
AutismClientAddon.LOG.info(
"[AutismProtector] ExploitPreventer detected; deferring overlapping protections while keeping brand/channel hiding active.");
} else {
AutismClientAddon.LOG.info(
"[AutismProtector] Built-in anti-fingerprint layer active.");
}
AutismInstaBreakRenderer.initialize();
autismclient.util.AutismFreecamHighlightRenderer.initialize();
autismclient.util.AutismSkeletonRenderer.initialize();
autismclient.util.AutismWorldHighlightRenderer.initialize();
autismclient.util.AutismScaffoldPlaceRenderer.initialize();
autismclient.util.AutismKillAuraRenderer.initialize();
autismclient.modules.HoleEspModule.initialize();
AutismFemaleBodyRenderer.initialize();
autismclient.commands.AutismCommands.init();
autismclient.addons.AddonManager.init();
ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener() {
@Override
public net.minecraft.resources.Identifier getFabricId() {
return net.minecraft.resources.Identifier.fromNamespaceAndPath("autismclient", "ui_assets");
}
@Override
public void onResourceManagerReload(net.minecraft.server.packs.resources.ResourceManager manager) {
UiText.onClientResourceReload();
AutismSvgHudLogo.clear();
}
});
ClientTickEvents.END_CLIENT_TICK.register(client -> {
try {
if (autismclient.util.AutismBlockNbtCapture.hasTickWork()) {
autismclient.util.AutismBlockNbtCapture.tick(client);
}
} catch (Throwable t) {
logTickError("blockNbtCapture", t);
}
try {
autismclient.modules.ScaffoldModule.endMovementTick();
} catch (Throwable t) {
logTickError("scaffoldEndClick", t);
}
try {
AutismWindowBranding.apply(client);
} catch (Throwable ignored) { }
try {
autismclient.security.AutismPackResponseScheduler.tick();
} catch (Throwable t) {
logTickError("packResponses", t);
}
try {
AutismModule.get().tick();
} catch (Throwable t) {
logTickError("module", t);
}
try {
autismclient.modules.ModuleOreSim.tickRetention();
} catch (Throwable t) {
logTickError("oreSimRetention", t);
}
try {
autismclient.util.multi.PacketTeleportController.tick(client);
} catch (Throwable t) {
logTickError("pacedTp", t);
}
try {
AutismJoinMacroController.onClientTick(client);
} catch (Throwable t) {
logTickError("joinMacro", t);
}
try {
autismclient.util.AutismLagWatchdog.onClientTick(client);
} catch (Throwable t) {
logTickError("lagWatchdog", t);
}
try {
if (!autismclient.util.AutismLiteVariant.enabled()) {
autismclient.util.multi.MultiTakeoverState.tick();
}
} catch (Throwable t) {
logTickError("multiTakeover", t);
}
try {
autismclient.util.AutismRemoteView.tick();
} catch (Throwable t) {
logTickError("remoteView", t);
}
try {
if (!autismclient.util.AutismLiteVariant.enabled()
&& autismclient.util.AutismDiscordLogin.hasSession() && autismclient.util.mm.MmPrefs.get().autoJoinPublic())
autismclient.util.mm.MatchmakingManager.get().autoJoinNudge();
} catch (Throwable t) {
logTickError("mmAutoJoin", t);
}
});
ClientTickEvents.END_LEVEL_TICK.register(level ->
runSafe("lan.levelTick", () -> AutismLANSync.getInstance().onLevelTick(level.getGameTime())));
ClientConfigurationConnectionEvents.INIT.register((listener, client) -> {
runSafe("cfg.hideMenuOverlays", () -> AutismModule.get().hideMenuOverlays());
runSafe("cfg.configStarted", () -> AutismModule.get().onConfigurationConnectionStarted());
runSafe("cfg.joinMacro", () -> AutismJoinMacroController.onConfigurationInit(listener));
});
ClientConfigurationConnectionEvents.DISCONNECT.register((listener, client) -> {
runSafe("cfg.remoteView", () -> autismclient.util.AutismRemoteView.stop(false));
runSafe("cfg.persist", autismclient.util.AutismConfig::enqueuePendingSaveNow);
runSafe("cfg.pacedTp", () -> autismclient.util.multi.PacketTeleportController.cancelAll("connection changed"));
runSafe("cfg.fakeGamemode", AutismFakeGamemode::clear);
runSafe("cfg.instaBreak", AutismInstaBreakRenderer::clear);
runSafe("cfg.packFailureGuard", AutismProtectorServerPackFailureGuard::clear);
runSafe("cfg.packResponses", autismclient.security.AutismPackResponseScheduler::clearAll);
runSafe("cfg.hideOverlays", () -> AutismOverlayManager.get().hideAllInteractiveOverlays());
runSafe("cfg.onGameLeft", () -> AutismModule.get().onGameLeft());
runSafe("cfg.joinMacro", AutismJoinMacroController::onConfigurationDisconnect);
});
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
runSafe("join.pacedTp", () -> autismclient.util.multi.PacketTeleportController.cancelAll("connection changed"));
runSafe("join.movementGrace", autismclient.modules.AutismJoinGrace::onJoin);
runSafe("join.hideMenuOverlays", () -> AutismModule.get().hideMenuOverlays());
runSafe("join.remember", () -> PackAutoReconnectState.remember(client.getCurrentServer()));
runSafe("join.onGameJoin", () -> AutismModule.get().onGameJoin());
runSafe("join.joinMacro", AutismJoinMacroController::onPlayJoin);
runSafe("join.surfaceFailures", autismclient.addons.AddonManager::surfaceFailuresOnJoin);
runSafe("join.lagWatchdog", autismclient.util.AutismLagWatchdog::reset);
runSafe("join.macroEditor", autismclient.util.AutismMacroEditorOverlay::onPlayJoin);
});
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> {
runSafe("leave.remoteView", () -> autismclient.util.AutismRemoteView.stop(false));
runSafe("leave.persist", autismclient.util.AutismConfig::enqueuePendingSaveNow);
runSafe("leave.stopMacro", () -> {
if (autismclient.util.AutismConfig.getGlobal().stopMacroOnLeave) autismclient.util.macro.MacroExecutor.stop();
});
runSafe("leave.pacedTp", () -> autismclient.util.multi.PacketTeleportController.cancelAll("disconnected"));
runSafe("leave.movementGrace", autismclient.modules.AutismJoinGrace::clear);
runSafe("leave.fakeGamemode", AutismFakeGamemode::clear);
runSafe("leave.instaBreak", AutismInstaBreakRenderer::clear);
runSafe("leave.packStrip", AutismProtectorPackStrip::clearAll);
runSafe("leave.packResponses", autismclient.security.AutismPackResponseScheduler::clearAll);
runSafe("leave.packFailureGuard", AutismProtectorServerPackFailureGuard::clear);
runSafe("leave.macroEditor", autismclient.util.AutismMacroEditorOverlay::onPlayDisconnect);
runSafe("leave.lanSync", () -> AutismLANSync.getInstance().onGameDisconnected());
runSafe("leave.hideOverlays", () -> AutismOverlayManager.get().hideAllInteractiveOverlays());
runSafe("leave.joinMacro", AutismJoinMacroController::onGameLeft);
runSafe("leave.onGameLeft", () -> AutismModule.get().onGameLeft());
runSafe("leave.lagWatchdog", autismclient.util.AutismLagWatchdog::reset);
});
ItemTooltipCallback.EVENT.register((stack, tooltipContext, tooltipType, lines) -> {
AutismItemNbtSanity.scrubUnsafeTooltipLines(lines);
AutismItemNbtSanity.trimTooltipLines(lines);
AutismModule.get().appendTooltip(stack, lines);
});
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> {
if (!autismclient.util.AutismLiteVariant.enabled()) {
autismclient.util.mm.MatchmakingManager.get().shutdownLeave();
}
autismclient.util.AutismConfig.flushPendingSaves(2000L);
});
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (!autismclient.util.AutismLiteVariant.enabled()) {
autismclient.util.mm.MatchmakingManager.get().shutdownLeave();
}
autismclient.util.AutismConfig.flushPendingSaves(2000L);
}, "mm-shutdown-leave"));
}
}

View file

@ -0,0 +1,530 @@
package autismclient.addons;
import autismclient.AutismClientAddon;
import autismclient.api.ApiVersion;
import autismclient.api.AutismAddon;
import autismclient.util.AutismConfig;
import autismclient.util.AutismNotifications;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.entrypoint.EntrypointContainer;
import net.fabricmc.loader.api.metadata.CustomValue;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.fabricmc.loader.api.metadata.Person;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
public final class AddonManager {
private static final int MAX_UI_ADDON_NAME_LENGTH = 22;
private static final List<AutismAddon> LOADED = new ArrayList<>();
private static final Map<String, AddonReport> REPORTS = new LinkedHashMap<>();
private record LoadingContext(String addonId, String addonName) {}
private static volatile LoadingContext currentContext = null;
private static boolean failuresSurfaced = false;
private AddonManager() {}
public static void init() {
LOADED.clear();
REPORTS.clear();
failuresSurfaced = false;
AutismConfig config = AutismConfig.getGlobal();
List<LoadedAddon> accepted = new ArrayList<>();
for (EntrypointContainer<AutismAddon> container : FabricLoader.getInstance()
.getEntrypointContainers("autism", AutismAddon.class)) {
ModContainer mod;
try {
mod = container.getProvider();
} catch (Throwable t) {
AutismClientAddon.LOG.error("[Addons] Failed to inspect an addon entrypoint", t);
continue;
}
String modId = mod.getMetadata().getId();
AddonReport report = ensureReport(mod.getMetadata());
if (isDisabledOnRestart(modId)) {
report.markDisabled("Disabled in AUTISM config. Enable it and restart to load.");
continue;
}
AutismAddon addon;
try {
addon = container.getEntrypoint();
} catch (Throwable t) {
report.markFailed("construct", "Failed to construct entrypoint: " + shortError(t));
AutismClientAddon.LOG.error("[Addons] Failed to construct addon '{}'", modId, t);
continue;
}
try {
int declared = addon.apiVersion();
report.setApiVersion(declared);
if (declared <= 0) {
report.markFailed("apiVersion", "Invalid API version " + declared + ".");
AutismClientAddon.LOG.warn("[Addons] Addon '{}' declared invalid API v{}; skipping it.", modId, declared);
continue;
}
if (declared > ApiVersion.CURRENT) {
report.markNeedsNewerApi("Needs API v" + declared + ", host provides v" + ApiVersion.CURRENT + ".");
AutismClientAddon.LOG.warn("[Addons] Addon '{}' needs API v{} but this client provides v{}; skipping it.",
modId, declared, ApiVersion.CURRENT);
continue;
}
if (declared < ApiVersion.CURRENT) {
AutismClientAddon.LOG.info("[Addons] Addon '{}' built against API v{} (current v{}); loading.",
modId, declared, ApiVersion.CURRENT);
}
applyMetadata(addon, mod.getMetadata());
report.copyRuntimeMetadata(addon);
accepted.add(new LoadedAddon(modId, addon));
} catch (AbstractMethodError e) {
report.markMissingApiVersion("Missing apiVersion() override.");
AutismClientAddon.LOG.error("[Addons] Addon '{}' does not declare apiVersion(); skipping it.", modId, e);
} catch (Throwable t) {
report.markFailed("prepare", "Failed to prepare: " + shortError(t));
AutismClientAddon.LOG.error("[Addons] Error preparing addon '{}'", modId, t);
}
}
List<LoadedAddon> categoryReady = new ArrayList<>();
for (LoadedAddon la : accepted) {
if (runPhase(la, "onRegisterCategories", la.addon::onRegisterCategories)) {
categoryReady.add(la);
} else {
invokeUnload(la);
rollbackRegistrations(la.modId);
}
}
for (LoadedAddon la : categoryReady) {
if (runPhase(la, "onInitialize", la.addon::onInitialize)) {
LOADED.add(la.addon);
AddonReport report = REPORTS.get(la.modId);
if (report != null) report.markLoaded();
} else {
invokeUnload(la);
rollbackRegistrations(la.modId);
}
}
if (!LOADED.isEmpty()) {
AutismClientAddon.LOG.info("[Addons] Loaded {} addon(s).", LOADED.size());
}
if (config.disabledAddonIds != null) {
for (String id : config.disabledAddonIds) {
if (id == null || id.isBlank() || REPORTS.containsKey(id)) continue;
AddonReport report = new AddonReport(id.trim(), id.trim(), "", "", 0xFFAA66FF);
report.markDisabled("Disabled in AUTISM config, but no matching addon entrypoint was discovered.");
REPORTS.put(report.modId(), report);
}
}
}
private static boolean runPhase(LoadedAddon la, String phase, Runnable body) {
String name = la.addon.name == null || la.addon.name.isBlank() ? la.modId : la.addon.name;
currentContext = new LoadingContext(la.modId, name);
AddonReport report = REPORTS.get(la.modId);
if (report != null) report.setPhase(phase);
try {
body.run();
return true;
} catch (Throwable t) {
if (report != null) report.markFailed(phase, "Threw during " + phase + ": " + shortError(t));
AutismClientAddon.LOG.error("[Addons] Addon '{}' threw during {}", la.modId, phase, t);
return false;
} finally {
currentContext = null;
}
}
private static void invokeUnload(LoadedAddon la) {
if (la == null || la.addon == null) return;
try {
la.addon.onUnload();
} catch (Throwable t) {
AutismClientAddon.LOG.warn("[Addons] Addon '{}' threw during onUnload", la.modId, t);
}
}
private static void rollbackRegistrations(String addonId) {
if (addonId == null || addonId.isBlank()) return;
AddonReport report = REPORTS.get(addonId);
rollbackStep(addonId, report, "macro actions", () -> autismclient.api.macro.MacroActionRegistry.unregisterAddon(addonId));
rollbackStep(addonId, report, "custom menu adapters", () -> autismclient.api.custommenu.CustomMenuAdapterRegistry.unregisterAddon(addonId));
rollbackStep(addonId, report, "presets", () -> autismclient.api.macro.MacroPresetRegistry.unregisterAddon(addonId));
rollbackStep(addonId, report, "events", () -> autismclient.api.event.AddonEvents.unregisterAddon(addonId));
rollbackStep(addonId, report, "hud", () -> autismclient.api.hud.HudElements.unregisterAddon(addonId));
rollbackStep(addonId, report, "modules", () -> autismclient.modules.ModuleRegistry.unregisterAddonModules(addonId));
rollbackStep(addonId, report, "commands", () -> autismclient.commands.AutismCommands.unregisterAddonCommands(addonId));
if (report != null) report.addRollback("Rolled back partial registrations after load failure.");
}
private static void rollbackStep(String addonId, AddonReport report, String kind, Runnable body) {
try {
body.run();
} catch (Throwable t) {
String detail = "Failed to rollback " + kind + ": " + shortError(t);
if (report != null) report.addRollback(detail);
AutismClientAddon.LOG.warn("[Addons] Addon '{}' rollback failed for {}", addonId, kind, t);
}
}
private static AddonReport ensureReport(ModMetadata meta) {
String modId = meta.getId();
AddonReport existing = REPORTS.get(modId);
if (existing != null) return existing;
AddonReport report = new AddonReport(
modId,
meta.getName() == null || meta.getName().isBlank() ? modId : meta.getName(),
meta.getVersion().getFriendlyString(),
meta.getAuthors().stream().map(Person::getName).collect(Collectors.joining(", ")),
metadataColor(meta, 0xFFAA66FF)
);
REPORTS.put(modId, report);
return report;
}
private static void applyMetadata(AutismAddon addon, ModMetadata meta) {
addon.name = meta.getName();
addon.authors = meta.getAuthors().stream().map(Person::getName).collect(Collectors.joining(", "));
addon.color = metadataColor(meta, addon.color);
}
private static int metadataColor(ModMetadata meta, int fallback) {
CustomValue color = meta.containsCustomValue("autism:color") ? meta.getCustomValue("autism:color") : null;
if (color != null && color.getType() == CustomValue.CvType.STRING) {
return parseColor(color.getAsString(), fallback);
}
return fallback;
}
private static int parseColor(String raw, int fallback) {
try {
String[] parts = raw.split(",");
if (parts.length != 3) return fallback;
int r = clamp(Integer.parseInt(parts[0].trim()));
int g = clamp(Integer.parseInt(parts[1].trim()));
int b = clamp(Integer.parseInt(parts[2].trim()));
return 0xFF000000 | (r << 16) | (g << 8) | b;
} catch (Exception e) {
return fallback;
}
}
private static int clamp(int v) { return Math.max(0, Math.min(255, v)); }
private static String currentId() {
LoadingContext ctx = currentContext;
return ctx == null ? null : ctx.addonId();
}
private static String currentName() {
LoadingContext ctx = currentContext;
return ctx == null ? null : ctx.addonName();
}
public static String currentAddonId() {
return currentId();
}
public static boolean isLifecycleActive() {
String id = currentId();
return id != null && !id.isBlank();
}
public static String currentAddonName() {
return currentName();
}
public static String normalizedAddonName(String name, String fallback) {
String value = name == null ? "" : name.replaceAll("\\s+", " ").trim();
if (value.isBlank()) value = fallback == null ? "" : fallback.replaceAll("\\s+", " ").trim();
return value.isBlank() ? "Addon" : value;
}
public static String compactAddonName(String name, String fallback) {
String value = normalizedAddonName(name, fallback);
if (value.length() <= MAX_UI_ADDON_NAME_LENGTH) return value;
return value.substring(0, Math.max(1, MAX_UI_ADDON_NAME_LENGTH - 3)).trim() + "...";
}
public static String scopedId(String rawId) {
String raw = rawId == null ? "" : rawId.trim();
if (raw.contains(":")) return raw;
String owner = currentId();
if (owner == null || owner.isBlank()) return raw;
return owner + ":" + raw;
}
public static String scopedCategoryLabel(String customLabel) {
LoadingContext ctx = currentContext;
String id = ctx == null ? null : ctx.addonId();
String name = ctx == null ? null : ctx.addonName();
if (name == null || name.isBlank()) name = id;
return compactAddonName(name, id);
}
public static List<AutismAddon> loaded() {
return Collections.unmodifiableList(LOADED);
}
public static List<AddonReport> reports() {
return Collections.unmodifiableList(new ArrayList<>(REPORTS.values()));
}
public static AddonReport report(String addonId) {
return addonId == null ? null : REPORTS.get(addonId);
}
public static File modsFolder() {
return FabricLoader.getInstance().getGameDir().resolve("mods").toFile();
}
public static boolean isDisabledOnRestart(String addonId) {
if (addonId == null || addonId.isBlank()) return false;
AutismConfig config = AutismConfig.getGlobal();
if (config.disabledAddonIds == null) return false;
String needle = addonId.trim().toLowerCase(Locale.ROOT);
for (String id : config.disabledAddonIds) {
if (id != null && needle.equals(id.trim().toLowerCase(Locale.ROOT))) return true;
}
return false;
}
public static void setDisabledOnRestart(String addonId, boolean disabled) {
if (addonId == null || addonId.isBlank()) return;
AutismConfig config = AutismConfig.getGlobal();
if (config.disabledAddonIds == null) config.disabledAddonIds = new ArrayList<>();
String normalized = addonId.trim();
boolean currently = isDisabledOnRestart(normalized);
if (disabled && !currently) {
config.disabledAddonIds.add(normalized);
} else if (!disabled && currently) {
config.disabledAddonIds.removeIf(id -> id != null && normalized.equalsIgnoreCase(id.trim()));
}
config.save();
}
public static void recordAcceptedRegistration(String kind, String id) {
AddonReport report = REPORTS.get(currentId());
if (report != null) report.recordAccepted(kind, id);
}
public static void recordRejectedRegistration(String addonId, String kind, String id, String reason) {
AddonReport report = REPORTS.get(addonId == null || addonId.isBlank() ? currentId() : addonId);
if (report != null) report.recordRejected(kind, id, reason);
}
public static void recordRuntimeError(String addonId, String detail) {
AddonReport report = REPORTS.get(addonId);
if (report != null) report.recordRuntimeError(detail);
}
public static void surfaceFailuresOnJoin() {
if (failuresSurfaced) return;
int issues = issueCount();
if (issues <= 0) return;
failuresSurfaced = true;
AutismNotifications.warning(issues + " addon issue(s). Open Addons for details.");
}
private static int issueCount() {
int count = 0;
for (AddonReport report : REPORTS.values()) {
if (report.status().isIssue()) count++;
}
return count;
}
private static String shortError(Throwable t) {
if (t == null) return "Unknown error";
String msg = t.getMessage();
return msg == null || msg.isBlank() ? t.getClass().getSimpleName() : t.getClass().getSimpleName() + ": " + msg;
}
private record LoadedAddon(String modId, AutismAddon addon) {}
public enum AddonLoadStatus {
LOADED("Loaded", false),
DISABLED("Disabled on restart", false),
FAILED("Failed", true),
NEEDS_NEWER_API("Needs newer API", true),
MISSING_API_VERSION("Missing apiVersion", true);
private final String label;
private final boolean issue;
AddonLoadStatus(String label, boolean issue) {
this.label = label;
this.issue = issue;
}
public String label() { return label; }
public boolean isIssue() { return issue; }
}
public static final class AddonReport {
private final String modId;
private String name;
private String version;
private String authors;
private int color;
private int apiVersion = -1;
private int hostApiVersion = ApiVersion.CURRENT;
private AddonLoadStatus status = AddonLoadStatus.FAILED;
private String phase = "discovered";
private String failureReason = "";
private final Map<String, Integer> accepted = new LinkedHashMap<>();
private final Map<String, Integer> rejected = new LinkedHashMap<>();
private final List<String> rejectionDetails = new ArrayList<>();
private final List<String> rollbackDetails = new ArrayList<>();
private int runtimeErrors;
private String lastRuntimeError = "";
private AddonReport(String modId, String name, String version, String authors, int color) {
this.modId = modId == null ? "" : modId;
this.name = name == null || name.isBlank() ? this.modId : name;
this.version = version == null ? "" : version;
this.authors = authors == null ? "" : authors;
this.color = color;
}
private void copyRuntimeMetadata(AutismAddon addon) {
if (addon == null) return;
if (addon.name != null && !addon.name.isBlank()) this.name = addon.name;
if (addon.authors != null && !addon.authors.isBlank()) this.authors = addon.authors;
this.color = addon.color;
}
private void setApiVersion(int apiVersion) {
this.apiVersion = apiVersion;
}
private void setPhase(String phase) {
this.phase = phase == null || phase.isBlank() ? this.phase : phase;
}
private void markLoaded() {
this.status = AddonLoadStatus.LOADED;
this.phase = "loaded";
this.failureReason = "";
}
private void markDisabled(String reason) {
this.status = AddonLoadStatus.DISABLED;
this.phase = "disabled";
this.failureReason = reason == null ? "" : reason;
}
private void markFailed(String phase, String reason) {
this.status = AddonLoadStatus.FAILED;
this.phase = phase == null || phase.isBlank() ? "failed" : phase;
this.failureReason = reason == null ? "" : reason;
}
private void markNeedsNewerApi(String reason) {
this.status = AddonLoadStatus.NEEDS_NEWER_API;
this.phase = "apiVersion";
this.failureReason = reason == null ? "" : reason;
}
private void markMissingApiVersion(String reason) {
this.status = AddonLoadStatus.MISSING_API_VERSION;
this.phase = "apiVersion";
this.failureReason = reason == null ? "" : reason;
}
private void recordAccepted(String kind, String id) {
String key = kind == null || kind.isBlank() ? "item" : kind;
accepted.merge(key, 1, Integer::sum);
}
private void recordRejected(String kind, String id, String reason) {
String key = kind == null || kind.isBlank() ? "item" : kind;
rejected.merge(key, 1, Integer::sum);
String detail = key + (id == null || id.isBlank() ? "" : " " + id) + ": "
+ (reason == null || reason.isBlank() ? "rejected" : reason);
rejectionDetails.add(detail);
}
private void addRollback(String detail) {
if (detail != null && !detail.isBlank()) rollbackDetails.add(detail);
}
private void recordRuntimeError(String detail) {
runtimeErrors++;
lastRuntimeError = detail == null || detail.isBlank() ? "Runtime error" : detail;
}
public String modId() { return modId; }
public String name() { return name; }
public String version() { return version; }
public String authors() { return authors; }
public int color() { return color; }
public int apiVersion() { return apiVersion; }
public int hostApiVersion() { return hostApiVersion; }
public AddonLoadStatus status() { return status; }
public String phase() { return phase; }
public String failureReason() { return failureReason; }
public int runtimeErrors() { return runtimeErrors; }
public String lastRuntimeError() { return lastRuntimeError; }
public Map<String, Integer> accepted() { return Collections.unmodifiableMap(accepted); }
public Map<String, Integer> rejected() { return Collections.unmodifiableMap(rejected); }
public List<String> rejectionDetails() { return Collections.unmodifiableList(rejectionDetails); }
public List<String> rollbackDetails() { return Collections.unmodifiableList(rollbackDetails); }
public int acceptedTotal() {
int total = 0;
for (int value : accepted.values()) total += value;
return total;
}
public int rejectedTotal() {
int total = 0;
for (int value : rejected.values()) total += value;
return total;
}
public String summaryCounts() {
if (accepted.isEmpty()) return "No registered extensions";
List<String> parts = new ArrayList<>();
for (Map.Entry<String, Integer> entry : accepted.entrySet()) {
parts.add(entry.getValue() + " " + entry.getKey());
}
return String.join(", ", parts);
}
public String copyReport() {
StringBuilder sb = new StringBuilder();
sb.append("Addon: ").append(name).append('\n');
sb.append("ID: ").append(modId).append('\n');
if (!version.isBlank()) sb.append("Version: ").append(version).append('\n');
if (!authors.isBlank()) sb.append("Authors: ").append(authors).append('\n');
sb.append("Status: ").append(status.label()).append('\n');
sb.append("Phase: ").append(phase).append('\n');
sb.append("API: addon v").append(apiVersion < 0 ? "unknown" : Integer.toString(apiVersion))
.append(", host v").append(hostApiVersion).append('\n');
sb.append("Disabled on restart: ").append(isDisabledOnRestart(modId)).append('\n');
if (!failureReason.isBlank()) sb.append("Reason: ").append(failureReason).append('\n');
sb.append("Accepted: ").append(accepted).append('\n');
if (!rejected.isEmpty()) sb.append("Rejected: ").append(rejected).append('\n');
for (String detail : rejectionDetails) sb.append("- ").append(detail).append('\n');
for (String detail : rollbackDetails) sb.append("- ").append(detail).append('\n');
if (runtimeErrors > 0) {
sb.append("Runtime errors: ").append(runtimeErrors).append('\n');
sb.append("Last runtime error: ").append(lastRuntimeError).append('\n');
}
return sb.toString();
}
}
}

View file

@ -0,0 +1,16 @@
package autismclient.api;
public record AddonRegistrationResult(boolean accepted, String kind, String id, String reason) {
public static AddonRegistrationResult accepted(String kind, String id) {
return new AddonRegistrationResult(true, clean(kind), clean(id), "Accepted");
}
public static AddonRegistrationResult rejected(String kind, String id, String reason) {
return new AddonRegistrationResult(false, clean(kind), clean(id), clean(reason));
}
private static String clean(String value) {
return value == null || value.isBlank() ? "" : value.trim();
}
}

View file

@ -0,0 +1,8 @@
package autismclient.api;
public final class ApiVersion {
public static final int CURRENT = 3;
private ApiVersion() {}
}

View file

@ -0,0 +1,20 @@
package autismclient.api;
public abstract class AutismAddon {
public String name = "";
public String authors = "";
public int color = 0xFFFFFFFF;
public abstract int apiVersion();
public void onRegisterCategories() {}
public abstract void onInitialize();
public void onUnload() {}
public abstract String getPackage();
}

View file

@ -0,0 +1,162 @@
package autismclient.api;
import autismclient.addons.AddonManager;
import autismclient.api.event.AddonEvents;
import autismclient.api.custommenu.CustomMenuAdapter;
import autismclient.api.custommenu.CustomMenuAdapterRegistry;
import autismclient.api.hud.HudElementProvider;
import autismclient.api.hud.HudElements;
import autismclient.api.macro.MacroActionEntry;
import autismclient.api.macro.MacroActionRegistry;
import autismclient.api.macro.MacroPresetRegistry;
import autismclient.commands.Command;
import autismclient.modules.Module;
import autismclient.modules.ModuleCategory;
import autismclient.modules.ModuleRegistry;
import autismclient.util.macro.MacroAction;
import net.minecraft.client.Minecraft;
import net.minecraft.network.protocol.Packet;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
public final class AutismAddons {
private AutismAddons() {}
public static Modules modules() { return Modules.INSTANCE; }
public static Commands commands() { return Commands.INSTANCE; }
public static MacroActions macroActions() { return MacroActions.INSTANCE; }
public static Presets presets() { return Presets.INSTANCE; }
public static Hud hud() { return Hud.INSTANCE; }
public static Events events() { return Events.INSTANCE; }
public static CustomMenus customMenus() { return CustomMenus.INSTANCE; }
public static List<AutismAddon> list() { return AddonManager.loaded(); }
public static String id(String localId) { return AddonManager.scopedId(localId); }
public static int apiVersion() { return ApiVersion.CURRENT; }
public static final class Modules {
static final Modules INSTANCE = new Modules();
private Modules() {}
public boolean register(Module module) {
return ModuleRegistry.registerAddonModule(module, AddonManager.currentAddonId());
}
public AddonRegistrationResult registerDetailed(Module module) {
return ModuleRegistry.registerAddonModuleDetailed(module, AddonManager.currentAddonId());
}
public ModuleCategory autoCategory() {
return ModuleCategory.registerAddon(AddonManager.currentAddonId(),
AddonManager.scopedCategoryLabel(null));
}
public ModuleCategory registerCategory(String label) {
return ModuleCategory.registerAddon(AddonManager.currentAddonId(),
AddonManager.scopedCategoryLabel(label));
}
}
public static final class Commands {
static final Commands INSTANCE = new Commands();
private Commands() {}
public void register(Command command) {
autismclient.commands.AutismCommands.registerAddonCommand(command, AddonManager.currentAddonId());
}
public AddonRegistrationResult registerDetailed(Command command) {
return autismclient.commands.AutismCommands.registerAddonCommandDetailed(command, AddonManager.currentAddonId());
}
}
public static final class MacroActions {
static final MacroActions INSTANCE = new MacroActions();
private MacroActions() {}
public boolean register(MacroActionEntry entry) {
return MacroActionRegistry.register(entry);
}
public AddonRegistrationResult registerDetailed(MacroActionEntry entry) {
return MacroActionRegistry.registerDetailed(entry);
}
public void registerCategory(String id, String label, int color) {
MacroActionRegistry.registerScopedCategory(id, label, color);
}
}
public static final class CustomMenus {
static final CustomMenus INSTANCE = new CustomMenus();
private CustomMenus() {}
public boolean register(CustomMenuAdapter adapter) {
return CustomMenuAdapterRegistry.register(adapter);
}
}
public static final class Presets {
static final Presets INSTANCE = new Presets();
private Presets() {}
public void registerCategory(String id, String label) {
MacroPresetRegistry.registerScopedCategory(id, label);
}
public void register(String label, String tip, Supplier<List<MacroAction>> builder) {
MacroPresetRegistry.register(MacroPresetRegistry.ensureScopedCategory(null), label, tip, builder);
}
public AddonRegistrationResult registerDetailed(String label, String tip, Supplier<List<MacroAction>> builder) {
return MacroPresetRegistry.registerDetailed(MacroPresetRegistry.ensureScopedCategory(null), label, tip, builder);
}
public void register(String categoryId, String label, String tip, Supplier<List<MacroAction>> builder) {
MacroPresetRegistry.register(MacroPresetRegistry.ensureScopedCategory(categoryId), label, tip, builder);
}
public AddonRegistrationResult registerDetailed(String categoryId, String label, String tip, Supplier<List<MacroAction>> builder) {
return MacroPresetRegistry.registerDetailed(MacroPresetRegistry.ensureScopedCategory(categoryId), label, tip, builder);
}
}
public static final class Hud {
static final Hud INSTANCE = new Hud();
private Hud() {}
public boolean register(HudElementProvider provider) {
return HudElements.register(provider);
}
public AddonRegistrationResult registerDetailed(HudElementProvider provider) {
return HudElements.registerDetailed(provider);
}
}
public static final class Events {
static final Events INSTANCE = new Events();
private Events() {}
public void onTick(Consumer<Minecraft> listener) { AddonEvents.onTick(listener); }
public void onPacketSend(Predicate<Packet<?>> listener) { AddonEvents.onPacketSend(listener); }
public void onPacketReceive(Consumer<Packet<?>> listener) { AddonEvents.onPacketReceive(listener); }
public void onGameJoin(Runnable listener) { AddonEvents.onGameJoin(listener); }
public void onGameLeft(Runnable listener) { AddonEvents.onGameLeft(listener); }
}
}

View file

@ -0,0 +1,94 @@
package autismclient.api;
import autismclient.api.macro.MacroActionEntry;
import autismclient.api.macro.MacroPresetRegistry;
import autismclient.api.macro.SimpleAction;
import autismclient.api.macro.SimpleCondition;
import autismclient.modules.Module;
import autismclient.util.macro.MacroAction;
import net.minecraft.client.Minecraft;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
public abstract class SimpleAddon extends AutismAddon {
private final int apiVersion;
private final String rootPackage;
protected SimpleAddon(int apiVersion, String rootPackage) {
this.apiVersion = apiVersion;
this.rootPackage = rootPackage == null ? "" : rootPackage;
}
@Override
public final int apiVersion() {
return apiVersion;
}
@Override
public final String getPackage() {
return rootPackage;
}
@Override
public final void onInitialize() {
initialize();
}
protected abstract void initialize();
protected final String id(String localId) {
return AutismAddons.id(localId);
}
protected final AddonRegistrationResult registerModule(Module module) {
return AutismAddons.modules().registerDetailed(module);
}
protected final AddonRegistrationResult registerAction(MacroActionEntry entry) {
return AutismAddons.macroActions().registerDetailed(entry);
}
protected final AddonRegistrationResult registerPreset(String label, String tip, Supplier<List<MacroAction>> builder) {
return AutismAddons.presets().registerDetailed(label, tip, builder);
}
protected final AddonRegistrationResult registerSimpleAction(
String localId, String label, String tip, String icon, Consumer<Minecraft> runner) {
return registerAction(simpleAction(localId, label, tip, icon, runner));
}
protected final AddonRegistrationResult registerSimpleCondition(
String localId, String label, String tip, String status, String icon, Predicate<Minecraft> predicate) {
return registerAction(simpleCondition(localId, label, tip, status, icon, predicate));
}
protected final MacroActionEntry simpleAction(
String localId,
String label,
String tip,
String icon,
Consumer<Minecraft> runner
) {
String typeId = id(localId);
return MacroActionEntry.builder(typeId, () -> new SimpleAction(typeId, label, icon, runner))
.picker(label, tip)
.build();
}
protected final MacroActionEntry simpleCondition(
String localId,
String label,
String tip,
String status,
String icon,
Predicate<Minecraft> predicate
) {
String typeId = id(localId);
return MacroActionEntry.builder(typeId, () -> new SimpleCondition(typeId, label, status, icon, predicate))
.condition(label, tip)
.build();
}
}

View file

@ -0,0 +1,15 @@
package autismclient.api.custommenu;
import net.minecraft.network.protocol.Packet;
public interface CustomMenuAdapter {
String id();
default boolean acceptsInbound(Packet<?> packet) {
return true;
}
CustomMenuEvent inspectInbound(Packet<?> packet, String phase);
CustomMenuSubmitResult submit(CustomMenuSnapshot snapshot, CustomMenuSubmission submission);
}

View file

@ -0,0 +1,91 @@
package autismclient.api.custommenu;
import autismclient.AutismClientAddon;
import autismclient.addons.AddonManager;
import autismclient.util.custommenu.VanillaDialogAdapter;
import net.minecraft.network.protocol.Packet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public final class CustomMenuAdapterRegistry {
private record Registered(CustomMenuAdapter adapter, String owner) {}
private record RegistrySnapshot(Registered[] ordered, Map<String, Registered> byId, List<String> ids) {}
private static final Map<String, Registered> ADAPTERS = new LinkedHashMap<>();
private static volatile RegistrySnapshot SNAPSHOT;
static {
ADAPTERS.put(VanillaDialogAdapter.ID, new Registered(new VanillaDialogAdapter(), "autismclient"));
publishSnapshot();
}
private CustomMenuAdapterRegistry() {}
public static synchronized boolean register(CustomMenuAdapter adapter) {
if (adapter == null || adapter.id() == null || adapter.id().isBlank()) return false;
String id = adapter.id().trim().toLowerCase(java.util.Locale.ROOT);
if (ADAPTERS.containsKey(id)) return false;
ADAPTERS.put(id, new Registered(adapter, AddonManager.currentAddonId()));
publishSnapshot();
return true;
}
public static synchronized void unregisterAddon(String addonId) {
if (addonId == null || addonId.isBlank()) return;
if (ADAPTERS.entrySet().removeIf(entry -> addonId.equals(entry.getValue().owner()))) {
publishSnapshot();
}
}
public static boolean acceptsInbound(Packet<?> packet) {
if (packet == null) return false;
for (Registered registered : SNAPSHOT.ordered()) {
try {
if (registered.adapter().acceptsInbound(packet)) return true;
} catch (Throwable error) {
return true;
}
}
return false;
}
public static CustomMenuEvent inspect(Packet<?> packet, String phase) {
if (packet == null) return CustomMenuEvent.NONE;
for (Registered registered : SNAPSHOT.ordered()) {
try {
if (!registered.adapter().acceptsInbound(packet)) continue;
CustomMenuEvent event = registered.adapter().inspectInbound(packet, phase);
if (event != null && event.type() != CustomMenuEvent.Type.NONE) return event;
} catch (Throwable error) {
AutismClientAddon.LOG.warn("[CustomMenus] Adapter '{}' failed while reading a packet", registered.adapter().id(), error);
}
}
return CustomMenuEvent.NONE;
}
public static CustomMenuSubmitResult submit(CustomMenuSnapshot snapshot, CustomMenuSubmission submission) {
if (snapshot == null) return CustomMenuSubmitResult.failure("No custom menu is open");
Registered registered = SNAPSHOT.byId().get(snapshot.adapterId().toLowerCase(java.util.Locale.ROOT));
if (registered == null) return CustomMenuSubmitResult.failure("Custom menu adapter is unavailable");
try {
CustomMenuSubmitResult result = registered.adapter().submit(snapshot, submission);
return result == null ? CustomMenuSubmitResult.failure("Custom menu adapter returned no result") : result;
} catch (Throwable error) {
AutismClientAddon.LOG.warn("[CustomMenus] Adapter '{}' failed while submitting a form ({})",
registered.adapter().id(), error.getClass().getSimpleName());
return CustomMenuSubmitResult.failure("Custom menu adapter failed");
}
}
public static List<String> ids() {
return SNAPSHOT.ids();
}
private static void publishSnapshot() {
Registered[] ordered = ADAPTERS.values().toArray(Registered[]::new);
SNAPSHOT = new RegistrySnapshot(ordered, Map.copyOf(ADAPTERS), List.copyOf(ADAPTERS.keySet()));
}
}

View file

@ -0,0 +1,20 @@
package autismclient.api.custommenu;
public record CustomMenuButton(int index, String label, String actionId, Kind kind, String labelColor) {
public enum Kind { CUSTOM, COMMAND, DIALOG, URL, CLIPBOARD, OTHER, EMPTY }
public CustomMenuButton(int index, String label, String actionId, Kind kind) {
this(index, label, actionId, kind, "");
}
public CustomMenuButton {
label = label == null ? "" : label;
actionId = actionId == null ? "" : actionId;
kind = kind == null ? Kind.OTHER : kind;
labelColor = labelColor == null ? "" : labelColor;
}
public boolean serverRelevant() {
return kind == Kind.CUSTOM || kind == Kind.COMMAND || kind == Kind.DIALOG;
}
}

View file

@ -0,0 +1,12 @@
package autismclient.api.custommenu;
public record CustomMenuEvent(Type type, CustomMenuSnapshot snapshot) {
public enum Type { NONE, OPEN, CLEAR }
public static final CustomMenuEvent NONE = new CustomMenuEvent(Type.NONE, null);
public static final CustomMenuEvent CLEAR = new CustomMenuEvent(Type.CLEAR, null);
public static CustomMenuEvent open(CustomMenuSnapshot snapshot) {
return new CustomMenuEvent(Type.OPEN, snapshot);
}
}

View file

@ -0,0 +1,26 @@
package autismclient.api.custommenu;
import java.util.List;
public record CustomMenuInput(
int index,
String key,
String label,
Kind kind,
String initialValue,
int maxLength,
double min,
double max,
double step,
List<String> options
) {
public enum Kind { TEXT, BOOLEAN, NUMBER, OPTION }
public CustomMenuInput {
key = key == null ? "" : key;
label = label == null ? "" : label;
kind = kind == null ? Kind.TEXT : kind;
initialValue = initialValue == null ? "" : initialValue;
options = options == null ? List.of() : List.copyOf(options);
}
}

View file

@ -0,0 +1,25 @@
package autismclient.api.custommenu;
import java.util.List;
public record CustomMenuSnapshot(
String adapterId,
String phase,
long generation,
String title,
List<CustomMenuInput> inputs,
List<CustomMenuButton> buttons,
Object adapterState
) {
public CustomMenuSnapshot {
adapterId = adapterId == null ? "" : adapterId;
phase = phase == null ? "" : phase;
title = title == null ? "" : title;
inputs = inputs == null ? List.of() : List.copyOf(inputs);
buttons = buttons == null ? List.of() : List.copyOf(buttons);
}
public CustomMenuSnapshot withConnectionState(String newPhase, long newGeneration) {
return new CustomMenuSnapshot(adapterId, newPhase, newGeneration, title, inputs, buttons, adapterState);
}
}

View file

@ -0,0 +1,9 @@
package autismclient.api.custommenu;
import java.util.Map;
public record CustomMenuSubmission(Map<String, String> values, CustomMenuButton button) {
public CustomMenuSubmission {
values = values == null ? Map.of() : Map.copyOf(values);
}
}

View file

@ -0,0 +1,30 @@
package autismclient.api.custommenu;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.chat.ClickEvent;
import java.util.List;
public record CustomMenuSubmitResult(
boolean success,
String error,
List<Packet<?>> packets,
CustomMenuSnapshot replacement,
ClickEvent clientAction
) {
public CustomMenuSubmitResult {
error = error == null ? "" : error;
packets = packets == null ? List.of() : List.copyOf(packets);
}
public static CustomMenuSubmitResult failure(String error) {
return new CustomMenuSubmitResult(false, error, List.of(), null, null);
}
public static CustomMenuSubmitResult packets(List<Packet<?>> packets) {
return new CustomMenuSubmitResult(true, "", packets, null, null);
}
public static CustomMenuSubmitResult replacement(CustomMenuSnapshot replacement, ClickEvent clientAction) {
return new CustomMenuSubmitResult(true, "", List.of(), replacement, clientAction);
}
}

View file

@ -0,0 +1,153 @@
package autismclient.api.event;
import autismclient.AutismClientAddon;
import autismclient.addons.AddonManager;
import autismclient.modules.PackHideState;
import net.minecraft.client.Minecraft;
import net.minecraft.network.protocol.Packet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import java.util.function.Predicate;
public final class AddonEvents {
private static final List<OwnedConsumer<Minecraft>> TICK = new CopyOnWriteArrayList<>();
private static final List<OwnedPredicate<Packet<?>>> PACKET_SEND = new CopyOnWriteArrayList<>();
private static final List<OwnedConsumer<Packet<?>>> PACKET_RECEIVE = new CopyOnWriteArrayList<>();
private static final List<OwnedRunnable> GAME_JOIN = new CopyOnWriteArrayList<>();
private static final List<OwnedRunnable> GAME_LEFT = new CopyOnWriteArrayList<>();
private static final long ERROR_LOG_INTERVAL_MS = 5_000L;
private static final Map<String, Long> LAST_ERROR_LOG_MS = new ConcurrentHashMap<>();
private AddonEvents() {}
public static void onTick(Consumer<Minecraft> listener) {
String owner = ownerOrReject("tick");
if (owner != null && listener != null) {
TICK.add(new OwnedConsumer<>(owner, listener));
AddonManager.recordAcceptedRegistration("event", "tick");
}
}
public static void onPacketSend(Predicate<Packet<?>> listener) {
String owner = ownerOrReject("packetSend");
if (owner != null && listener != null) {
PACKET_SEND.add(new OwnedPredicate<>(owner, listener));
AddonManager.recordAcceptedRegistration("event", "packetSend");
}
}
public static void onPacketReceive(Consumer<Packet<?>> listener) {
String owner = ownerOrReject("packetReceive");
if (owner != null && listener != null) {
PACKET_RECEIVE.add(new OwnedConsumer<>(owner, listener));
AddonManager.recordAcceptedRegistration("event", "packetReceive");
}
}
public static void onGameJoin(Runnable listener) {
String owner = ownerOrReject("gameJoin");
if (owner != null && listener != null) {
GAME_JOIN.add(new OwnedRunnable(owner, listener));
AddonManager.recordAcceptedRegistration("event", "gameJoin");
}
}
public static void onGameLeft(Runnable listener) {
String owner = ownerOrReject("gameLeft");
if (owner != null && listener != null) {
GAME_LEFT.add(new OwnedRunnable(owner, listener));
AddonManager.recordAcceptedRegistration("event", "gameLeft");
}
}
private static String ownerOrReject(String event) {
String owner = AddonManager.currentAddonId();
if (owner == null || owner.isBlank()) {
AutismClientAddon.LOG.warn("[Addons] Rejecting {} listener outside an addon lifecycle", event);
AddonManager.recordRejectedRegistration(owner, "event", event, "registration outside an addon lifecycle - register from onInitialize() or onRegisterCategories()");
return null;
}
return owner;
}
public static void unregisterAddon(String addonId) {
if (addonId == null || addonId.isBlank()) return;
TICK.removeIf(listener -> addonId.equals(listener.owner()));
PACKET_SEND.removeIf(listener -> addonId.equals(listener.owner()));
PACKET_RECEIVE.removeIf(listener -> addonId.equals(listener.owner()));
GAME_JOIN.removeIf(listener -> addonId.equals(listener.owner()));
GAME_LEFT.removeIf(listener -> addonId.equals(listener.owner()));
LAST_ERROR_LOG_MS.keySet().removeIf(key -> key.startsWith(addonId + ":"));
}
public static void fireTick(Minecraft mc) {
if (PackHideState.isHardLocked()) return;
if (TICK.isEmpty()) return;
for (OwnedConsumer<Minecraft> l : TICK) {
try { l.listener().accept(mc); } catch (Throwable t) { logThrottled(l.owner(), "tick", t); }
}
}
public static boolean hasTickListeners() {
if (PackHideState.isHardLocked()) return false;
return !TICK.isEmpty();
}
public static boolean hasPacketListeners() {
if (PackHideState.isHardLocked()) return false;
return !PACKET_SEND.isEmpty() || !PACKET_RECEIVE.isEmpty();
}
public static boolean firePacketSend(Packet<?> packet) {
if (PackHideState.isHardLocked()) return false;
if (PACKET_SEND.isEmpty()) return false;
boolean cancel = false;
for (OwnedPredicate<Packet<?>> l : PACKET_SEND) {
try { cancel |= l.listener().test(packet); } catch (Throwable t) { logThrottled(l.owner(), "packetSend", t); }
}
return cancel;
}
public static void firePacketReceive(Packet<?> packet) {
if (PackHideState.isHardLocked()) return;
if (PACKET_RECEIVE.isEmpty()) return;
for (OwnedConsumer<Packet<?>> l : PACKET_RECEIVE) {
try { l.listener().accept(packet); } catch (Throwable t) { logThrottled(l.owner(), "packetReceive", t); }
}
}
public static void fireGameJoin() {
if (PackHideState.isHardLocked()) return;
if (GAME_JOIN.isEmpty()) return;
for (OwnedRunnable l : GAME_JOIN) {
try { l.listener().run(); } catch (Throwable t) { logThrottled(l.owner(), "gameJoin", t); }
}
}
public static void fireGameLeft() {
if (PackHideState.isHardLocked()) return;
if (GAME_LEFT.isEmpty()) return;
for (OwnedRunnable l : GAME_LEFT) {
try { l.listener().run(); } catch (Throwable t) { logThrottled(l.owner(), "gameLeft", t); }
}
}
private static void logThrottled(String owner, String event, Throwable t) {
long now = System.currentTimeMillis();
String key = owner + ":" + event + ":" + t.getClass().getName();
Long last = LAST_ERROR_LOG_MS.get(key);
if (last != null && now - last < ERROR_LOG_INTERVAL_MS) return;
LAST_ERROR_LOG_MS.put(key, now);
AddonManager.recordRuntimeError(owner, event + " listener threw " + t.getClass().getSimpleName());
AutismClientAddon.LOG.warn("[Addons] Addon '{}' {} event listener threw", owner, event, t);
}
private record OwnedConsumer<T>(String owner, Consumer<T> listener) {}
private record OwnedPredicate<T>(String owner, Predicate<T> listener) {}
private record OwnedRunnable(String owner, Runnable listener) {}
}

View file

@ -0,0 +1,27 @@
package autismclient.api.hud;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphicsExtractor;
public interface HudElementProvider {
String id();
String label();
default String description() { return ""; }
int width();
int height();
void render(GuiGraphicsExtractor ctx, Font font, int x, int y, float alpha);
default boolean defaultEnabled() { return false; }
default String defaultAnchor() { return "TOP_LEFT"; }
default int defaultX() { return 0; }
default int defaultY() { return 0; }
}

View file

@ -0,0 +1,104 @@
package autismclient.api.hud;
import autismclient.AutismClientAddon;
import autismclient.api.AddonRegistrationResult;
import autismclient.addons.AddonManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public final class HudElements {
private static final Map<String, HudElementProvider> PROVIDERS = new LinkedHashMap<>();
private static final Map<String, String> OWNERS = new LinkedHashMap<>();
private static int revision;
private HudElements() {}
public static int revision() {
return revision;
}
public static boolean register(HudElementProvider provider) {
return registerDetailed(provider).accepted();
}
public static AddonRegistrationResult registerDetailed(HudElementProvider provider) {
if (provider == null) return AddonRegistrationResult.rejected("hud", "", "provider was null");
String ownerAddonId = AddonManager.currentAddonId();
if (ownerAddonId == null || ownerAddonId.isBlank()) {
return reject(ownerAddonId, "", "registration outside an addon lifecycle - register from onInitialize() or onRegisterCategories()");
}
String id = provider.id();
if (id == null || !id.contains(":")) {
return reject(ownerAddonId, id, "non-namespaced id - scope it with AutismAddons.id(...) so it becomes addonId:localId");
}
if (!id.startsWith(ownerAddonId + ":")) {
return reject(ownerAddonId, id, "foreign namespace - the id must start with your addon id; scope it with AutismAddons.id(...)");
}
if (PROVIDERS.containsKey(id)) {
return reject(ownerAddonId, id, "duplicate id");
}
AddonRegistrationResult sizeCheck = validateSize(ownerAddonId, id, provider);
if (!sizeCheck.accepted()) return sizeCheck;
PROVIDERS.put(id, provider);
OWNERS.put(id, ownerAddonId);
revision++;
AddonManager.recordAcceptedRegistration("hud", id);
return AddonRegistrationResult.accepted("hud", id);
}
private static AddonRegistrationResult validateSize(String ownerAddonId, String id, HudElementProvider provider) {
int width;
int height;
try {
width = provider.width();
height = provider.height();
} catch (Throwable t) {
AutismClientAddon.LOG.warn("[Hud] Rejecting HUD element '{}': sizing threw", id, t);
AddonManager.recordRejectedRegistration(ownerAddonId, "hud", id, "sizing threw " + t.getClass().getSimpleName());
return AddonRegistrationResult.rejected("hud", id, "sizing threw " + t.getClass().getSimpleName());
}
if (width <= 0) return reject(ownerAddonId, id, "width must be positive");
if (height <= 0) return reject(ownerAddonId, id, "height must be positive");
return AddonRegistrationResult.accepted("hud", id);
}
private static AddonRegistrationResult reject(String ownerAddonId, String id, String reason) {
AutismClientAddon.LOG.warn("[Hud] Rejecting HUD element '{}': {}", id, reason);
AddonManager.recordRejectedRegistration(ownerAddonId, "hud", id, reason);
return AddonRegistrationResult.rejected("hud", id, reason);
}
public static void unregisterAddon(String addonId) {
if (addonId == null || addonId.isBlank()) return;
List<String> remove = new ArrayList<>();
for (Map.Entry<String, String> owner : OWNERS.entrySet()) {
if (addonId.equals(owner.getValue())) remove.add(owner.getKey());
}
if (remove.isEmpty()) return;
for (String id : remove) {
PROVIDERS.remove(id);
OWNERS.remove(id);
}
revision++;
}
public static HudElementProvider get(String id) {
return id == null ? null : PROVIDERS.get(id);
}
public static boolean isAddon(String id) {
return id != null && PROVIDERS.containsKey(id);
}
public static List<String> ids() {
return Collections.unmodifiableList(new ArrayList<>(PROVIDERS.keySet()));
}
public static boolean isEmpty() {
return PROVIDERS.isEmpty();
}
}

View file

@ -0,0 +1,83 @@
package autismclient.api.macro;
import autismclient.gui.macro.editor.ActionFieldSchema;
public final class ActionSchema {
private final ActionFieldSchema internal;
private ActionSchema(ActionFieldSchema internal) {
this.internal = internal;
}
public ActionFieldSchema internal() {
return internal;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private final ActionFieldSchema.Builder delegate = ActionFieldSchema.builder();
private Builder() {}
public Builder toggle(String key, String label) { delegate.toggle(key, label); return this; }
public Builder number(String key, String label) { delegate.number(key, label); return this; }
public Builder decimal(String key, String label) { delegate.decimal(key, label); return this; }
public Builder text(String key, String label) { delegate.text(key, label); return this; }
public Builder macroSelect(String key, String label) { delegate.macroSelect(key, label); return this; }
public Builder enumField(String key, String label, String... options) { delegate.enumField(key, label, options); return this; }
public Builder stringList(String key, String label) { delegate.stringList(key, label); return this; }
public Builder slot(String key, String label) { delegate.slot(key, label); return this; }
public Builder targetSummary(String key, String label) { delegate.targetSummary(key, label); return this; }
public Builder capturePacketClick(String key, String label) { delegate.capturePacketClick(key, label); return this; }
public Builder blockPos(String key, String label) { delegate.blockPos(key, label); return this; }
public Builder range(int min, int max) { delegate.range(min, max); return this; }
public Builder decRange(double min, double max) { delegate.decRange(min, max); return this; }
public Builder showWhen(String key) { delegate.showWhen(key); return this; }
public Builder hideWhen(String key) { delegate.hideWhen(key); return this; }
public Builder showWhenEnum(String key, String value) { delegate.showWhenEnum(key, value); return this; }
public Builder hideWhenEnum(String key, String value) { delegate.hideWhenEnum(key, value); return this; }
public Builder addLabel(String label) { delegate.addLabel(label); return this; }
public Builder xyzKeys(String... keys) { delegate.xyzKeys(keys); return this; }
public Builder xyzDouble(boolean value) { delegate.xyzDouble(value); return this; }
public Builder captureBlock() { delegate.captureBlock(); return this; }
public Builder captureEntity() { delegate.captureEntity(); return this; }
public Builder captureCatalog() { delegate.captureCatalog(); return this; }
public Builder captureItemSlot() { delegate.captureItemSlot(); return this; }
public Builder capturePacketName() { delegate.capturePacketName(); return this; }
public Builder exclusiveWith(String... keys) { delegate.exclusiveWith(keys); return this; }
public Builder dynamic() { delegate.dynamic(); return this; }
public ActionSchema build() {
return new ActionSchema(delegate.build());
}
}
}

View file

@ -0,0 +1,61 @@
package autismclient.api.macro;
import autismclient.util.macro.MacroAction;
import net.minecraft.nbt.CompoundTag;
public abstract class AddonAction implements MacroAction {
private final String typeId;
protected AddonAction(String typeId) {
this.typeId = typeId;
}
protected abstract void run(net.minecraft.client.Minecraft mc);
protected void save(CompoundTag tag) {}
protected void load(CompoundTag tag) {}
protected ActionSchema schema() {
return null;
}
@Override
public final void execute(net.minecraft.client.Minecraft mc) {
run(mc);
}
@Override
public final String getTypeId() {
return typeId;
}
@Override
public final CompoundTag toTag() {
CompoundTag tag = new CompoundTag();
tag.putString("type", typeId);
save(tag);
return tag;
}
@Override
public final void fromTag(CompoundTag tag) {
load(tag);
}
protected static void putString(CompoundTag tag, String key, String value) { tag.putString(key, value == null ? "" : value); }
protected static void putInt(CompoundTag tag, String key, int value) { tag.putInt(key, value); }
protected static void putDouble(CompoundTag tag, String key, double value) { tag.putDouble(key, value); }
protected static void putBool(CompoundTag tag, String key, boolean value) { tag.putBoolean(key, value); }
protected static String getString(CompoundTag tag, String key, String def) { return tag.getStringOr(key, def); }
protected static int getInt(CompoundTag tag, String key, int def) { return tag.getIntOr(key, def); }
protected static double getDouble(CompoundTag tag, String key, double def) { return tag.getDoubleOr(key, def); }
protected static boolean getBool(CompoundTag tag, String key, boolean def) { return tag.getBooleanOr(key, def); }
public static ActionSchema schemaOf(MacroAction action) {
return action instanceof AddonAction a ? a.schema()
: action instanceof AddonContextAction c ? c.schemaInternal()
: null;
}
}

View file

@ -0,0 +1,10 @@
package autismclient.api.macro;
import net.minecraft.client.Minecraft;
public abstract class AddonCondition {
public abstract boolean check(Minecraft mc);
public void onComplete() {}
}

View file

@ -0,0 +1,51 @@
package autismclient.api.macro;
import net.minecraft.nbt.CompoundTag;
public abstract class AddonContextAction implements ContextMacroAction {
private final String typeId;
protected AddonContextAction(String typeId) {
this.typeId = typeId;
}
protected void save(CompoundTag tag) {}
protected void load(CompoundTag tag) {}
protected ActionSchema schema() {
return null;
}
ActionSchema schemaInternal() {
return schema();
}
@Override
public final String getTypeId() {
return typeId;
}
@Override
public final CompoundTag toTag() {
CompoundTag tag = new CompoundTag();
tag.putString("type", typeId);
save(tag);
return tag;
}
@Override
public final void fromTag(CompoundTag tag) {
load(tag);
}
protected static void putString(CompoundTag tag, String key, String value) { tag.putString(key, value == null ? "" : value); }
protected static void putInt(CompoundTag tag, String key, int value) { tag.putInt(key, value); }
protected static void putDouble(CompoundTag tag, String key, double value) { tag.putDouble(key, value); }
protected static void putBool(CompoundTag tag, String key, boolean value) { tag.putBoolean(key, value); }
protected static String getString(CompoundTag tag, String key, String def) { return tag.getStringOr(key, def); }
protected static int getInt(CompoundTag tag, String key, int def) { return tag.getIntOr(key, def); }
protected static double getDouble(CompoundTag tag, String key, double def) { return tag.getDoubleOr(key, def); }
protected static boolean getBool(CompoundTag tag, String key, boolean def) { return tag.getBooleanOr(key, def); }
}

View file

@ -0,0 +1,14 @@
package autismclient.api.macro;
import autismclient.util.macro.MacroAction;
import net.minecraft.client.Minecraft;
public interface ContextMacroAction extends MacroAction {
void run(MacroExecutionContext ctx) throws InterruptedException;
@Override
default void execute(Minecraft mc) {
}
}

View file

@ -0,0 +1,103 @@
package autismclient.api.macro;
import autismclient.addons.AddonManager;
import autismclient.gui.macro.editor.ActionFieldSchema;
import autismclient.util.macro.MacroAction;
import java.util.function.Supplier;
public final class MacroActionEntry {
public enum Kind { ACTION, CONDITION }
private final String typeId;
private final Supplier<MacroAction> factory;
private final ActionFieldSchema schema;
private String pickerCategory;
private final String pickerLabel;
private final String pickerTip;
private final Kind kind;
private MacroActionEntry(Builder b) {
this.typeId = b.typeId;
this.factory = b.factory;
this.schema = b.schema;
this.pickerCategory = b.pickerCategory;
this.pickerLabel = b.pickerLabel;
this.pickerTip = b.pickerTip;
this.kind = b.kind;
}
public String typeId() { return typeId; }
public Supplier<MacroAction> factory() { return factory; }
public ActionFieldSchema schema() { return schema; }
public boolean hasPicker() { return pickerCategory != null && pickerLabel != null; }
boolean wantsPicker() { return pickerLabel != null; }
public String pickerCategory() { return pickerCategory; }
public String pickerLabel() { return pickerLabel; }
public String pickerTip() { return pickerTip == null ? "" : pickerTip; }
public Kind kind() { return kind; }
public boolean isCondition() { return kind == Kind.CONDITION; }
void setPickerCategory(String categoryId) {
this.pickerCategory = categoryId;
}
public static Builder builder(String typeId, Supplier<MacroAction> factory) {
return new Builder(typeId, factory);
}
public static Builder local(String localId, Supplier<MacroAction> factory) {
return new Builder(AddonManager.scopedId(localId), factory);
}
public static final class Builder {
private final String typeId;
private final Supplier<MacroAction> factory;
private ActionFieldSchema schema;
private String pickerCategory;
private String pickerLabel;
private String pickerTip;
private Kind kind = Kind.ACTION;
private Builder(String typeId, Supplier<MacroAction> factory) {
this.typeId = typeId;
this.factory = factory;
}
public Builder schema(ActionSchema schema) {
this.schema = schema == null ? null : schema.internal();
return this;
}
public Builder picker(String label, String tip) {
return picker(null, label, tip);
}
public Builder picker(String categoryId, String label, String tip) {
this.pickerCategory = categoryId;
this.pickerLabel = label;
this.pickerTip = tip;
this.kind = Kind.ACTION;
return this;
}
public Builder condition(String label, String tip) {
return condition(null, label, tip);
}
public Builder condition(String categoryId, String label, String tip) {
this.pickerCategory = categoryId;
this.pickerLabel = label;
this.pickerTip = tip;
this.kind = Kind.CONDITION;
return this;
}
public MacroActionEntry build() {
return new MacroActionEntry(this);
}
}
}

View file

@ -0,0 +1,230 @@
package autismclient.api.macro;
import autismclient.AutismClientAddon;
import autismclient.api.AddonRegistrationResult;
import autismclient.addons.AddonManager;
import autismclient.gui.macro.editor.ActionFieldSchema;
import autismclient.util.macro.MacroAction;
import autismclient.util.macro.MacroActionType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.Supplier;
public final class MacroActionRegistry {
private static final Map<String, MacroActionEntry> ENTRIES = new LinkedHashMap<>();
private static final Map<String, ActionCategory> CATEGORIES = new LinkedHashMap<>();
private static final Map<String, String> ENTRY_OWNERS = new LinkedHashMap<>();
private static final Map<String, String> CATEGORY_OWNERS = new LinkedHashMap<>();
private static final Map<String, ActionFieldSchema> RESOLVED_SCHEMAS = new LinkedHashMap<>();
public record ActionCategory(String id, String label, int color) {}
public static final int ADDON_AUTO_CATEGORY_COLOR = 0xFFAA66FF;
private static final String ADDON_CAT_PREFIX = "addon:";
private MacroActionRegistry() {}
public static String scopeCategoryId(String rawId) {
if (AddonManager.isLifecycleActive()) {
String addonId = AddonManager.currentAddonId();
return ADDON_CAT_PREFIX + (addonId == null || addonId.isBlank() ? "shared" : addonId);
}
if (rawId != null && rawId.startsWith(ADDON_CAT_PREFIX)) return rawId;
String addonId = AddonManager.currentAddonId();
String base = addonId == null || addonId.isBlank() ? "shared" : addonId;
return rawId == null || rawId.isBlank()
? ADDON_CAT_PREFIX + base
: ADDON_CAT_PREFIX + base + "/" + rawId;
}
public static String ensureScopedCategory(String rawId) {
String scopedId = scopeCategoryId(rawId);
if (!CATEGORIES.containsKey(scopedId)) {
registerCategoryInternal(scopedId, AddonManager.scopedCategoryLabel(null), ADDON_AUTO_CATEGORY_COLOR,
AddonManager.currentAddonId());
}
return scopedId;
}
public static void registerScopedCategory(String rawId, String label, int color) {
String visible = AddonManager.isLifecycleActive() ? AddonManager.scopedCategoryLabel(null) : label;
registerCategoryInternal(scopeCategoryId(rawId), visible, color,
AddonManager.currentAddonId());
}
public static void registerCategory(String id, String label, int color) {
registerCategoryInternal(id, label, color, null);
}
private static void registerCategoryInternal(String id, String label, int color, String ownerAddonId) {
if (id == null || id.isBlank()) return;
CATEGORIES.put(id, new ActionCategory(id, label == null || label.isBlank() ? id : label, color));
if (ownerAddonId != null && !ownerAddonId.isBlank()) CATEGORY_OWNERS.put(id, ownerAddonId);
}
public static ActionCategory category(String id) {
return id == null ? null : CATEGORIES.get(id);
}
public static boolean register(MacroActionEntry entry) {
return registerDetailed(entry).accepted();
}
public static AddonRegistrationResult registerDetailed(MacroActionEntry entry) {
if (entry == null) return AddonRegistrationResult.rejected("macro action", "", "entry was null");
String ownerAddonId = AddonManager.currentAddonId();
if (ownerAddonId == null || ownerAddonId.isBlank()) {
return reject(ownerAddonId, "macro action", "", "registration outside an addon lifecycle - register from onInitialize() or onRegisterCategories()");
}
String typeId = entry.typeId();
if (typeId == null || !typeId.contains(":")) {
return reject(ownerAddonId, "macro action", typeId, "non-namespaced type id - scope it with AutismAddons.id(...) so it becomes addonId:localId");
}
if (!typeId.startsWith(ownerAddonId + ":")) {
return reject(ownerAddonId, "macro action", typeId, "foreign namespace - the id must start with your addon id; scope it with AutismAddons.id(...)");
}
if (entry.factory() == null) {
return reject(ownerAddonId, "macro action", typeId, "missing factory");
}
if (isBuiltinName(typeId)) {
return reject(ownerAddonId, "macro action", typeId, "collides with a built-in type");
}
if (ENTRIES.containsKey(typeId)) {
return reject(ownerAddonId, "macro action", typeId, "duplicate type id");
}
if (entry.wantsPicker()) {
entry.setPickerCategory(ensureScopedCategory(entry.pickerCategory()));
}
ActionFieldSchema effectiveSchema = entry.schema();
MacroAction probe;
try {
probe = entry.factory().get();
} catch (Throwable t) {
AutismClientAddon.LOG.warn("[MacroActions] Rejecting action '{}' because its factory threw during validation", typeId, t);
return reject(ownerAddonId, "macro action", typeId, "factory threw: " + errorName(t));
}
if (probe == null) {
return reject(ownerAddonId, "macro action", typeId, "factory returned null");
}
if (effectiveSchema == null) {
ActionSchema declared = AddonAction.schemaOf(probe);
if (declared != null) effectiveSchema = declared.internal();
}
String validationError = validateProbe(typeId, entry, probe, effectiveSchema);
if (validationError != null) return reject(ownerAddonId, "macro action", typeId, validationError);
ENTRIES.put(typeId, entry);
ENTRY_OWNERS.put(typeId, ownerAddonId);
if (effectiveSchema != null) RESOLVED_SCHEMAS.put(typeId, effectiveSchema);
AddonManager.recordAcceptedRegistration("macro action", typeId);
return AddonRegistrationResult.accepted("macro action", typeId);
}
private static AddonRegistrationResult reject(String ownerAddonId, String kind, String id, String reason) {
AutismClientAddon.LOG.warn("[MacroActions] Rejecting {} '{}': {}", kind, id, reason);
AddonManager.recordRejectedRegistration(ownerAddonId, kind, id, reason);
return AddonRegistrationResult.rejected(kind, id, reason);
}
private static String validateProbe(String typeId, MacroActionEntry entry, MacroAction probe, ActionFieldSchema schema) {
String writtenType;
net.minecraft.nbt.CompoundTag tag;
try {
tag = probe.toTag();
writtenType = tag.getStringOr("type", "");
} catch (Throwable t) {
AutismClientAddon.LOG.warn("[MacroActions] Rejecting '{}' because toTag() threw", typeId, t);
return "toTag() threw: " + errorName(t);
}
if (!typeId.equals(writtenType)) {
return "writes type=\"" + writtenType + "\" instead of \"" + typeId + "\"";
}
if (schema != null) {
for (autismclient.gui.macro.editor.FieldDef field : schema.fields()) {
String key = field.key();
if (field.type() == autismclient.gui.macro.editor.FieldType.BLOCK_POS) {
for (String axisKey : field.xyzKeys()) {
if (axisKey != null && !axisKey.isEmpty() && !tag.contains(axisKey)) {
return "schema field '" + axisKey + "' is not written by toTag()/save()";
}
}
} else if (key != null && !key.isEmpty() && !tag.contains(key)) {
return "schema field '" + key + "' is not written by toTag()/save()";
}
}
}
if (entry.isCondition() && !(probe instanceof ContextMacroAction)) {
return "conditions must implement ContextMacroAction";
}
return null;
}
public static void unregisterAddon(String addonId) {
if (addonId == null || addonId.isBlank()) return;
List<String> removeTypes = new ArrayList<>();
for (Map.Entry<String, String> owner : ENTRY_OWNERS.entrySet()) {
if (addonId.equals(owner.getValue())) removeTypes.add(owner.getKey());
}
for (String typeId : removeTypes) {
ENTRIES.remove(typeId);
RESOLVED_SCHEMAS.remove(typeId);
ENTRY_OWNERS.remove(typeId);
}
List<String> removeCategories = new ArrayList<>();
for (Map.Entry<String, String> owner : CATEGORY_OWNERS.entrySet()) {
if (addonId.equals(owner.getValue())) removeCategories.add(owner.getKey());
}
for (String categoryId : removeCategories) {
CATEGORIES.remove(categoryId);
CATEGORY_OWNERS.remove(categoryId);
}
}
public static Supplier<MacroAction> factory(String typeId) {
MacroActionEntry e = typeId == null ? null : ENTRIES.get(typeId);
return e == null ? null : e.factory();
}
public static ActionFieldSchema schema(String typeId) {
return typeId == null ? null : RESOLVED_SCHEMAS.get(typeId);
}
public static boolean isCondition(String typeId) {
MacroActionEntry e = typeId == null ? null : ENTRIES.get(typeId);
return e != null && e.isCondition();
}
public static String ownerOf(String typeId) {
return typeId == null ? null : ENTRY_OWNERS.get(typeId);
}
public static List<MacroActionEntry> entries() {
return Collections.unmodifiableList(new ArrayList<>(ENTRIES.values()));
}
private static boolean isBuiltinName(String typeId) {
try {
MacroActionType.valueOf(typeId.toUpperCase(Locale.ROOT));
return true;
} catch (IllegalArgumentException e) {
return false;
}
}
private static String errorName(Throwable t) {
if (t == null) return "unknown";
String message = t.getMessage();
return message == null || message.isBlank() ? t.getClass().getSimpleName() : t.getClass().getSimpleName() + ": " + message;
}
}

View file

@ -0,0 +1,78 @@
package autismclient.api.macro;
import net.minecraft.client.Minecraft;
import net.minecraft.network.protocol.Packet;
import java.util.concurrent.CompletableFuture;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import autismclient.util.macro.MacroTemplate;
import autismclient.util.macro.MacroValue;
public interface MacroExecutionContext {
Minecraft mc();
void runOnClientThread(Runnable r);
<T> T callOnClientThread(Supplier<T> s);
void waitTicks(int ticks);
void awaitCondition(CompletableFuture<Void> future);
void awaitCondition(AddonCondition condition);
boolean isActive();
void setStatus(String status);
void sendPacket(Packet<?> packet);
Optional<MacroValue> variable(String name);
void setVariable(String name, MacroValue value);
default void setVariable(String name, Object value) {
setVariable(name, MacroValue.text(value));
}
void removeVariable(String name);
Map<String, MacroValue> variables();
MacroTemplate.Resolution resolveTemplate(String template);
default void captureResult(String name, MacroValue value) {
setVariable(name, value);
}
default void captureResults(Map<String, MacroValue> values) {
if (values != null) values.forEach(this::setVariable);
}
default Optional<Integer> resolveInt(String template) {
MacroTemplate.Resolution resolved = resolveTemplate(template);
if (!resolved.success()) return Optional.empty();
try { return Optional.of(Integer.parseInt(resolved.value().trim())); }
catch (NumberFormatException ignored) { return Optional.empty(); }
}
default Optional<Double> resolveDouble(String template) {
MacroTemplate.Resolution resolved = resolveTemplate(template);
if (!resolved.success()) return Optional.empty();
try { return Optional.of(Double.parseDouble(resolved.value().trim())); }
catch (NumberFormatException ignored) { return Optional.empty(); }
}
default <E extends Enum<E>> Optional<E> resolveEnum(String template, Class<E> type) {
if (type == null) return Optional.empty();
MacroTemplate.Resolution resolved = resolveTemplate(template);
if (!resolved.success()) return Optional.empty();
for (E value : type.getEnumConstants()) {
if (value.name().equalsIgnoreCase(resolved.value().trim())) return Optional.of(value);
}
return Optional.empty();
}
}

View file

@ -0,0 +1,115 @@
package autismclient.api.macro;
import autismclient.AutismClientAddon;
import autismclient.api.AddonRegistrationResult;
import autismclient.addons.AddonManager;
import autismclient.util.macro.MacroAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
public final class MacroPresetRegistry {
public record PresetEntry(String categoryId, String label, String tip, Supplier<List<MacroAction>> builder) {}
private static final List<PresetEntry> ENTRIES = new ArrayList<>();
private static final Map<PresetEntry, String> ENTRY_OWNERS = new IdentityHashMap<>();
private static final Map<String, String> CATEGORY_LABELS = new LinkedHashMap<>();
private static final Map<String, String> CATEGORY_OWNERS = new LinkedHashMap<>();
private MacroPresetRegistry() {}
public static void registerCategory(String id, String label) {
registerCategory(id, label, AddonManager.currentAddonId());
}
public static String ensureScopedCategory(String rawId) {
String scopedId = MacroActionRegistry.scopeCategoryId(rawId);
if (!CATEGORY_LABELS.containsKey(scopedId)) {
registerCategory(scopedId, AddonManager.scopedCategoryLabel(null), AddonManager.currentAddonId());
}
return scopedId;
}
public static void registerScopedCategory(String rawId, String label) {
String visible = AddonManager.isLifecycleActive() ? AddonManager.scopedCategoryLabel(null) : label;
registerCategory(MacroActionRegistry.scopeCategoryId(rawId), visible,
AddonManager.currentAddonId());
}
private static void registerCategory(String id, String label, String ownerAddonId) {
if (id == null || id.isBlank()) return;
CATEGORY_LABELS.put(id, label == null || label.isBlank() ? id : label);
if (ownerAddonId != null && !ownerAddonId.isBlank()) CATEGORY_OWNERS.put(id, ownerAddonId);
}
public static void register(String categoryId, String label, String tip, Supplier<List<MacroAction>> builder) {
registerDetailed(categoryId, label, tip, builder);
}
public static AddonRegistrationResult registerDetailed(String categoryId, String label, String tip, Supplier<List<MacroAction>> builder) {
String ownerAddonId = AddonManager.currentAddonId();
if (ownerAddonId == null || ownerAddonId.isBlank()) {
return reject(ownerAddonId, label, "registration outside an addon lifecycle - register from onInitialize() or onRegisterCategories()");
}
if (categoryId == null || categoryId.isBlank()) return reject(ownerAddonId, label, "missing category");
if (label == null || label.isBlank()) return reject(ownerAddonId, label, "missing label");
if (builder == null) return reject(ownerAddonId, label, "missing builder");
AddonRegistrationResult validation = validateBuilder(ownerAddonId, label, builder);
if (!validation.accepted()) return validation;
PresetEntry entry = new PresetEntry(categoryId, label, tip == null ? "" : tip, builder);
ENTRIES.add(entry);
ENTRY_OWNERS.put(entry, ownerAddonId);
AddonManager.recordAcceptedRegistration("preset", label);
return AddonRegistrationResult.accepted("preset", label);
}
private static AddonRegistrationResult validateBuilder(String ownerAddonId, String label, Supplier<List<MacroAction>> builder) {
List<MacroAction> actions;
try {
actions = builder.get();
} catch (Throwable t) {
AutismClientAddon.LOG.warn("[MacroPresets] Rejecting preset '{}': builder threw", label, t);
AddonManager.recordRejectedRegistration(ownerAddonId, "preset", label, "builder threw " + t.getClass().getSimpleName());
return AddonRegistrationResult.rejected("preset", label, "builder threw " + t.getClass().getSimpleName());
}
if (actions == null) return reject(ownerAddonId, label, "builder returned null");
for (int i = 0; i < actions.size(); i++) {
if (actions.get(i) == null) {
return reject(ownerAddonId, label, "builder returned null action at index " + i);
}
}
return AddonRegistrationResult.accepted("preset", label);
}
private static AddonRegistrationResult reject(String ownerAddonId, String label, String reason) {
AutismClientAddon.LOG.warn("[MacroPresets] Rejecting preset '{}': {}", label, reason);
AddonManager.recordRejectedRegistration(ownerAddonId, "preset", label, reason);
return AddonRegistrationResult.rejected("preset", label, reason);
}
public static void unregisterAddon(String addonId) {
if (addonId == null || addonId.isBlank()) return;
List<PresetEntry> remove = new ArrayList<>();
for (PresetEntry entry : ENTRIES) {
if (addonId.equals(ENTRY_OWNERS.get(entry))) remove.add(entry);
}
ENTRIES.removeAll(remove);
for (PresetEntry entry : remove) ENTRY_OWNERS.remove(entry);
CATEGORY_LABELS.entrySet().removeIf(entry -> addonId.equals(CATEGORY_OWNERS.get(entry.getKey())));
CATEGORY_OWNERS.entrySet().removeIf(entry -> addonId.equals(entry.getValue()));
}
public static List<PresetEntry> entries() {
return Collections.unmodifiableList(ENTRIES);
}
public static String categoryLabel(String id) {
return CATEGORY_LABELS.get(id);
}
}

Some files were not shown because too many files have changed in this diff Show more