diff --git a/plugins.json b/plugins.json
index e5572fe0..679a5c34 100644
--- a/plugins.json
+++ b/plugins.json
@@ -1708,5 +1708,23 @@
"repository": "https://github.com/MopicMP/gltf-to-minecraft",
"bug_tracker": "https://github.com/MopicMP/gltf-to-minecraft/issues",
"creation_date": "2026-08-01"
+ },
+ "armor_trim_editor": {
+ "title": "Armor Trim Editor",
+ "author": "BbIJABNPOBATEJb",
+ "icon": "checkroom",
+ "description": "Paint Minecraft: Java Edition armor trims on an exact armor model with poses, skins and a live material preview, draw how they look on armor icons, then export them straight into a resource pack and a datapack.",
+ "tags": ["Minecraft: Java Edition", "Paint", "Exporter"],
+ "version": "1.1.0",
+ "min_version": "5.0.0",
+ "variant": "desktop",
+ "creation_date": "2026-09-27",
+ "has_changelog": true,
+ "contributes": {
+ "formats": ["armor_trim"]
+ },
+ "website": "https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor",
+ "repository": "https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor",
+ "bug_tracker": "https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor/issues"
}
}
diff --git a/plugins/armor_trim_editor/LICENSE.MD b/plugins/armor_trim_editor/LICENSE.MD
new file mode 100644
index 00000000..f288702d
--- /dev/null
+++ b/plugins/armor_trim_editor/LICENSE.MD
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ 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 .
+
+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:
+
+ Copyright (C)
+ 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
+.
+
+ 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
+.
diff --git a/plugins/armor_trim_editor/about.md b/plugins/armor_trim_editor/about.md
new file mode 100644
index 00000000..772e78fc
--- /dev/null
+++ b/plugins/armor_trim_editor/about.md
@@ -0,0 +1,23 @@
+
+
+Paint Minecraft: Java Edition armor trims on the exact armor model the game uses, preview every trim material while you paint, and export the result straight into a resource pack.
+
+## How to use
+
+1. **File → New → Armor Trim**. Start empty or from a vanilla pattern, or open existing trims with **Trim → Open trim from resource pack** (Ctrl or Shift opens several at once).
+2. Paint on the model or on the `humanoid` / `humanoid_leggings` textures. The eight gray shades in the **Trim: palette & export** panel are recolored by the trim material; any other color stays as painted.
+3. Use the **Trim: preview** panel to show or hide armor pieces and layers, switch the reference armor and trim material, pose the player (including poses with the body parts pulled apart) and change the skin. Right-click a piece to show only that piece.
+4. Click **Icon** to generate the smithing template icon from a vanilla template.
+5. In vanilla every trim looks the same on armor items in the inventory. In the **Icons** tab you draw how this trim looks on each armor shape (helmet, chestplate, leggings, boots, netherite helmet and boots, turtle shell), previewed on every armor type and material. **Generators** create the icons from the trim on the player, the vanilla overlay or simple shapes. They are exported in the format of the [Visual Armor Trims](https://modrinth.com/resourcepack/visual-armor-trims) resource pack, into VAT itself if your pack contains it (Minecraft 1.21.5+).
+6. Click **Export** and save the trim into a resource pack zip (with `pack.mcmeta` and `pack.png`, e.g. in `.minecraft/resourcepacks`) or into a pack folder, then press `F3 + T` in game. Exporting another trim into the same archive adds it next to the others. After the first export, **Quick export** (`Ctrl + Alt + E`) repeats it.
+7. Click **Datapack** to add the trim pattern to a datapack zip, e.g. right in `saves//datapacks` (Minecraft 1.21.2 – 26.2). **Trim → How to use a trim in game** shows the `/give` command and Bukkit/Paper code for it.
+
+## Notes
+
+* Desktop only: the plugin reads your Minecraft client jar (found automatically, or set in **Trim → Settings**) for default skins, armor textures, vanilla trims and template icons, and writes files into your resource pack. Nothing from the game is bundled.
+* The helmet has two trim layers: the left half of the top row (1.0) and the right half (outer layer, 1.5).
+* The left arm and leg reuse the right side of the texture, mirrored.
+* Trims render as cutout: alpha below 10% is dropped, everything else is opaque. **Check** finds and fixes such pixels.
+* **Trim → How trims work** explains the texture layout in detail.
+
+Source code, screenshots and issue tracker: [github.com/BbIJABNPOBATEJb/Armor-Trim-Editor](https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor)
diff --git a/plugins/armor_trim_editor/armor_trim_editor.js b/plugins/armor_trim_editor/armor_trim_editor.js
new file mode 100644
index 00000000..67a23158
--- /dev/null
+++ b/plugins/armor_trim_editor/armor_trim_editor.js
@@ -0,0 +1,5327 @@
+/**
+ * Armor Trim Editor — Blockbench plugin
+ * Paint Minecraft armor trims on an accurate player/armor model, preview materials and poses,
+ * generate template icons and export everything straight into a resource pack.
+ */
+(function () {
+'use strict';
+
+const PLUGIN_ID = 'armor_trim_editor';
+const PLUGIN_VERSION = '1.1.0';
+const FORMAT_ID = 'armor_trim';
+
+const TL_PREFIX = 'armor_trim_editor.';
+function t(key, variables) {
+ return tl(TL_PREFIX + key, variables);
+}
+(function registerTranslations() {
+ let translations = getTranslations();
+ for (let lang in translations) {
+ let strings = {};
+ for (let key in translations[lang]) strings[TL_PREFIX + key] = translations[lang][key];
+ Language.addTranslations(lang, strings);
+ }
+})();
+
+const deletables = [];
+const track = (item) => { if (item) deletables.push(item); return item; };
+
+// ============================================================================
+// Game data (verified against the 1.21.11 / 26.1 client)
+// ============================================================================
+
+// Bone pivots in Blockbench space (Java model space: x -> -x, y -> 24 - y).
+const BONES = [
+ {id: 'head', origin: [0, 24, 0]},
+ {id: 'body', origin: [0, 24, 0]},
+ {id: 'right_arm', origin: [5, 22, 0]},
+ {id: 'left_arm', origin: [-5, 22, 0]},
+ {id: 'right_leg', origin: [1.9, 12, 0]},
+ {id: 'left_leg', origin: [-1.9, 12, 0]},
+];
+const BOXES = {
+ head: {from: [-4, 24, -4], to: [4, 32, 4]},
+ body: {from: [-4, 12, -2], to: [4, 24, 2]},
+ right_arm: {from: [4, 12, -2], to: [8, 24, 2]},
+ left_arm: {from: [-8, 12, -2], to: [-4, 24, 2]},
+ right_arm_slim: {from: [4, 12, -2], to: [7, 24, 2]},
+ left_arm_slim: {from: [-7, 12, -2], to: [-4, 24, 2]},
+ right_leg: {from: [-0.1, 0, -2], to: [3.9, 12, 2]},
+ left_leg: {from: [-3.9, 0, -2], to: [0.1, 12, 2]},
+};
+
+// Armor model: HumanoidModel.createArmorMeshSet(inner 0.5, outer 1.0); legs get an extra -0.1,
+// the helmet keeps the "hat" child (+0.5). Left limbs use the mirrored right-side UV.
+const PIECES = {
+ helmet: {layer: 'humanoid', parts: [
+ {key: 'helmet', bone: 'head', box: 'head', inflate: 1.0, uv: [0, 0]},
+ {key: 'helmet_outer', bone: 'head', box: 'head', inflate: 1.5, uv: [32, 0]},
+ ]},
+ chestplate: {layer: 'humanoid', parts: [
+ {key: 'chest_body', bone: 'body', box: 'body', inflate: 1.0, uv: [16, 16]},
+ {key: 'chest_right_arm', bone: 'right_arm', box: 'right_arm', inflate: 1.0, uv: [40, 16]},
+ {key: 'chest_left_arm', bone: 'left_arm', box: 'left_arm', inflate: 1.0, uv: [40, 16], mirror: true},
+ ]},
+ leggings: {layer: 'humanoid_leggings', parts: [
+ {key: 'legs_waist', bone: 'body', box: 'body', inflate: 0.5, uv: [16, 16]},
+ {key: 'legs_right', bone: 'right_leg', box: 'right_leg', inflate: 0.4, uv: [0, 16]},
+ {key: 'legs_left', bone: 'left_leg', box: 'left_leg', inflate: 0.4, uv: [0, 16], mirror: true},
+ ]},
+ boots: {layer: 'humanoid', parts: [
+ {key: 'boots_right', bone: 'right_leg', box: 'right_leg', inflate: 0.9, uv: [0, 16]},
+ {key: 'boots_left', bone: 'left_leg', box: 'left_leg', inflate: 0.9, uv: [0, 16], mirror: true},
+ ]},
+};
+const PIECE_ORDER = ['helmet', 'chestplate', 'leggings', 'boots'];
+const PART_TO_PIECE = {};
+const PARTS = {};
+for (let piece of PIECE_ORDER) {
+ for (let part of PIECES[piece].parts) {
+ PART_TO_PIECE[part.key] = piece;
+ PARTS[part.key] = part;
+ }
+}
+// The reference armor sits a hair inside the trim so both never z-fight.
+const ARMOR_BASE_SHRINK = 0.02;
+
+const SKIN_PARTS = [
+ {key: 'head', bone: 'head', box: 'head', uv: [0, 0]},
+ {key: 'hat', bone: 'head', box: 'head', uv: [32, 0], inflate: 0.5, outer: true},
+ {key: 'body', bone: 'body', box: 'body', uv: [16, 16]},
+ {key: 'jacket', bone: 'body', box: 'body', uv: [16, 32], inflate: 0.25, outer: true},
+ {key: 'right_arm', bone: 'right_arm', box: 'right_arm', uv: [40, 16], arm: true},
+ {key: 'right_sleeve', bone: 'right_arm', box: 'right_arm', uv: [40, 32], inflate: 0.25, outer: true, arm: true},
+ {key: 'left_arm', bone: 'left_arm', box: 'left_arm', uv: [32, 48], arm: true},
+ {key: 'left_sleeve', bone: 'left_arm', box: 'left_arm', uv: [48, 48], inflate: 0.25, outer: true, arm: true},
+ {key: 'right_leg', bone: 'right_leg', box: 'right_leg', uv: [0, 16]},
+ {key: 'right_pants', bone: 'right_leg', box: 'right_leg', uv: [0, 32], inflate: 0.25, outer: true},
+ {key: 'left_leg', bone: 'left_leg', box: 'left_leg', uv: [16, 48]},
+ {key: 'left_pants', bone: 'left_leg', box: 'left_leg', uv: [0, 48], inflate: 0.25, outer: true},
+];
+
+// Pixel areas that the game actually samples: [u, v, width, height, depth] of each box unwrap.
+const USED_BOXES = {
+ trim_humanoid: [[0, 0, 8, 8, 8], [32, 0, 8, 8, 8], [16, 16, 8, 12, 4], [40, 16, 4, 12, 4], [0, 16, 4, 12, 4]],
+ trim_leggings: [[16, 16, 8, 12, 4], [0, 16, 4, 12, 4]],
+};
+const PIECE_BOXES = {
+ helmet: {trim_humanoid: [[0, 0, 8, 8, 8], [32, 0, 8, 8, 8]]},
+ chestplate: {trim_humanoid: [[16, 16, 8, 12, 4], [40, 16, 4, 12, 4]]},
+ leggings: {trim_leggings: [[16, 16, 8, 12, 4], [0, 16, 4, 12, 4]]},
+ boots: {trim_humanoid: [[0, 16, 4, 12, 4]]},
+};
+
+const PALETTE_KEY = ['#e0e0e0', '#c0c0c0', '#a0a0a0', '#808080', '#606060', '#404040', '#202020', '#000000'];
+const PALETTES = {
+ amethyst: ['c98ff3', '9a5cc6', '6c49aa', '523687', '422776', '361c6a', '240c53', '17063b'],
+ copper: ['e3826c', 'b4684d', '9a472c', '793c28', '6d3420', '5f2b18', '4c2010', '3d180b'],
+ copper_darker: ['7b4135', '6b3628', '592a19', '4c2416', '401e11', '36190f', '29140c', '1b0e08'],
+ diamond: ['cbfff5', '6eecd2', '2cbaa8', '1d969a', '0c788d', '076578', '04515f', '013c47'],
+ diamond_darker: ['15b3a1', '0a9ca1', '048185', '027472', '065d5b', '095148', '034642', '04403e'],
+ emerald: ['82f6ad', '0ec754', '11a036', '107b24', '0e7222', '09631b', '035013', '023d0e'],
+ gold: ['fffd90', 'ecd93f', 'deb12d', 'b16712', 'a0450a', '803503', '712d00', '572300'],
+ gold_darker: ['c29c2a', 'ba8327', 'a35f14', '89470c', '803503', '712d00', '572300', '3e1b03'],
+ iron: ['c5d2d4', 'bfc9c8', '9daaaa', '7b8989', '717d7d', '657070', '576363', '465151'],
+ iron_darker: ['a2b0b3', '8a9291', '6f7676', '576363', '3d4949', '313b3b', '2b3434', '1d2828'],
+ lapis: ['416e97', '1c4d9c', '21497b', '123365', '112e63', '0c285a', '091e45', '051636'],
+ netherite: ['5a575a', '443a3b', '312e31', '2f2727', '231e1e', '1a1616', '100c0c', '090707'],
+ netherite_darker: ['2e2829', '282425', '281d1d', '241a1a', '1f1717', '1d1313', '140f0f', '0b0909'],
+ quartz: ['f2efed', 'f6eadf', 'e3dbc4', 'b6ad96', '908e80', '656156', '45433c', '2a2822'],
+ redstone: ['e62008', 'bd2008', '971607', '781101', '650b01', '520d06', '360803', '1d0502'],
+ resin: ['ffc354', 'f69f3b', 'f0852a', 'ec7214', 'db5f10', 'c7490a', 'a53b11', '802a1a'],
+};
+const VANILLA_PERMUTATIONS = ['quartz', 'iron', 'gold', 'diamond', 'netherite', 'redstone', 'copper', 'emerald', 'lapis', 'amethyst',
+ 'iron_darker', 'gold_darker', 'diamond_darker', 'netherite_darker', 'copper_darker', 'resin'];
+
+const TRIM_MATERIALS = [
+ {id: 'quartz', color: '#E3D4C4', name: t('quartz')},
+ {id: 'iron', color: '#ECECEC', name: t('iron'), armor: 'iron'},
+ {id: 'netherite', color: '#625859', name: t('netherite'), armor: 'netherite'},
+ {id: 'redstone', color: '#971607', name: t('redstone')},
+ {id: 'copper', color: '#B4684D', name: t('copper'), armor: 'copper'},
+ {id: 'gold', color: '#DEB12D', name: t('gold'), armor: 'gold'},
+ {id: 'emerald', color: '#11A036', name: t('emerald')},
+ {id: 'diamond', color: '#6EECD2', name: t('diamond'), armor: 'diamond'},
+ {id: 'lapis', color: '#416E97', name: t('lapis')},
+ {id: 'amethyst', color: '#9A5CC6', name: t('amethyst')},
+ {id: 'resin', color: '#FC7812', name: t('resin')},
+];
+
+const ARMOR_MATERIALS = [
+ {id: 'none', name: t('no_armor'), color: '#000000'},
+ {id: 'leather', name: t('leather'), color: '#a06540'},
+ {id: 'chainmail', name: t('chainmail'), color: '#8b8b8b'},
+ {id: 'iron', name: t('iron_2'), color: '#c6c6c6'},
+ {id: 'copper', name: t('copper_2'), color: '#b4684d'},
+ {id: 'gold', name: t('gold_2'), color: '#e7c24a'},
+ {id: 'diamond', name: t('diamond_2'), color: '#4aedd9'},
+ {id: 'netherite', name: t('netherite_2'), color: '#4a4042'},
+ {id: 'turtle_scute', name: t('turtle_shell'), color: '#47bf4a', helmet_only: true},
+];
+
+const VANILLA_PATTERNS = ['bolt', 'coast', 'dune', 'eye', 'flow', 'host', 'raiser', 'rib', 'sentry', 'shaper', 'silence',
+ 'snout', 'spire', 'tide', 'vex', 'ward', 'wayfinder', 'wild'];
+
+const DEFAULT_SKINS = ['steve', 'alex', 'ari', 'efe', 'kai', 'makena', 'noor', 'sunny', 'zuri'];
+const DEFAULT_SLIM = {alex: true};
+
+const DEFAULT_ICON_ID = 'minecraft:item/{id}_armor_trim_smithing_template';
+
+const PART_NAMES = {
+ helmet: t('helmet'),
+ helmet_outer: t('helmet_outer_layer'),
+ chest_body: t('chestplate_body'),
+ chest_right_arm: t('chestplate_right_arm'),
+ chest_left_arm: t('chestplate_left_arm'),
+ legs_waist: t('leggings_waist'),
+ legs_right: t('leggings_right_leg'),
+ legs_left: t('leggings_left_leg'),
+ boots_right: t('boots_right'),
+ boots_left: t('boots_left'),
+};
+const SKIN_NAMES = {
+ head: t('head'), hat: t('hat_layer'),
+ body: t('body'), jacket: t('jacket'),
+ right_arm: t('right_arm'), right_sleeve: t('right_sleeve'),
+ left_arm: t('left_arm'), left_sleeve: t('left_sleeve'),
+ right_leg: t('right_leg'), right_pants: t('right_pants'),
+ left_leg: t('left_leg'), left_pants: t('left_pants'),
+};
+const PIECE_NAMES = {
+ helmet: t('helmet_2'), chestplate: t('chestplate'),
+ leggings: t('leggings'), boots: t('boots'),
+};
+
+// ============================================================================
+// Small utilities
+// ============================================================================
+
+const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
+const rad = (d) => d * Math.PI / 180;
+const deg = (r) => r * 180 / Math.PI;
+
+function hexToRgb(hex) {
+ hex = String(hex).replace('#', '');
+ if (hex.length == 3) hex = hex.split('').map(c => c + c).join('');
+ let n = parseInt(hex.substring(0, 6), 16);
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
+}
+function rgbToHex(r, g, b) {
+ return '#' + [r, g, b].map(v => clamp(Math.round(v), 0, 255).toString(16).padStart(2, '0')).join('');
+}
+function rgbToHsl(r, g, b) {
+ r /= 255; g /= 255; b /= 255;
+ let max = Math.max(r, g, b), min = Math.min(r, g, b);
+ let h = 0, s = 0, l = (max + min) / 2;
+ if (max != min) {
+ let d = max - min;
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ if (max == r) h = (g - b) / d + (g < b ? 6 : 0);
+ else if (max == g) h = (b - r) / d + 2;
+ else h = (r - g) / d + 4;
+ h /= 6;
+ }
+ return [h, s, l];
+}
+function hslToRgb(h, s, l) {
+ h = ((h % 1) + 1) % 1; s = clamp(s, 0, 1); l = clamp(l, 0, 1);
+ if (s == 0) return [l * 255, l * 255, l * 255];
+ const hue2rgb = (p, q, t) => {
+ if (t < 0) t += 1; if (t > 1) t -= 1;
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
+ if (t < 1 / 2) return q;
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
+ return p;
+ };
+ let q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ let p = 2 * l - q;
+ return [hue2rgb(p, q, h + 1 / 3) * 255, hue2rgb(p, q, h) * 255, hue2rgb(p, q, h - 1 / 3) * 255];
+}
+function luminance(r, g, b) {
+ return (0.299 * r + 0.587 * g + 0.114 * b) / 255;
+}
+
+function makeCanvas(w, h) {
+ let canvas = document.createElement('canvas');
+ canvas.width = w; canvas.height = h;
+ let ctx = canvas.getContext('2d', {willReadFrequently: true});
+ ctx.imageSmoothingEnabled = false;
+ return {canvas, ctx};
+}
+function loadImage(src) {
+ return new Promise((resolve, reject) => {
+ let img = new Image();
+ img.onload = () => resolve(img);
+ img.onerror = () => reject(new Error('Could not load image'));
+ img.src = src;
+ });
+}
+async function dataURLToCanvas(url) {
+ let img = await loadImage(url);
+ let {canvas, ctx} = makeCanvas(img.naturalWidth, img.naturalHeight);
+ ctx.drawImage(img, 0, 0);
+ return canvas;
+}
+function blankDataURL(w, h) {
+ return makeCanvas(w, h).canvas.toDataURL('image/png');
+}
+function bufferToDataURL(buffer) {
+ return 'data:image/png;base64,' + Buffer.from(buffer).toString('base64');
+}
+function dataURLToBuffer(url) {
+ return Buffer.from(url.substring(url.indexOf(',') + 1), 'base64');
+}
+function deepDefaults(target, defaults) {
+ if (!target || typeof target != 'object') target = {};
+ for (let key in defaults) {
+ let dv = defaults[key];
+ if (dv && typeof dv == 'object' && !Array.isArray(dv)) {
+ target[key] = deepDefaults(target[key], dv);
+ } else if (target[key] === undefined) {
+ target[key] = dv;
+ }
+ }
+ return target;
+}
+function parseResourceId(id, fallback_ns = 'minecraft') {
+ id = String(id || '').trim();
+ let i = id.indexOf(':');
+ if (i == -1) return {ns: fallback_ns, path: id};
+ return {ns: id.substring(0, i) || fallback_ns, path: id.substring(i + 1)};
+}
+function normalizeId(id) {
+ let p = parseResourceId(id);
+ return p.ns + ':' + p.path;
+}
+function isValidPath(path) {
+ return /^[a-z0-9_.\-\/]+$/.test(path) && !path.startsWith('/') && !path.includes('//');
+}
+function isValidNamespace(ns) {
+ return /^[a-z0-9_.\-]+$/.test(ns);
+}
+function sanitizeId(text) {
+ return String(text || '').toLowerCase().trim().replace(/[\s]+/g, '_').replace(/[^a-z0-9_.\-]/g, '');
+}
+function boxRects(u, v, w, h, d) {
+ return [[u + d, v, w, d], [u + d + w, v, w, d], [u, v + d, 2 * (d + w), h]];
+}
+function escapeHTML(text) {
+ return String(text).replace(/[&<>"']/g, c => ({'&': '&', '<': '<', '>': '>', '"': '"', "'": '''}[c]));
+}
+function notify(text, time = 2200) {
+ Blockbench.showQuickMessage(text, time);
+}
+function showError(title, err) {
+ console.error('[Trim Editor]', err);
+ Blockbench.showMessageBox({title, icon: 'error', message: escapeHTML(err && err.message ? err.message : String(err))});
+}
+
+// ============================================================================
+// File system (desktop) and global preferences
+// ============================================================================
+
+const PathModule = (typeof isApp != 'undefined' && isApp) ? require('path') : null;
+let fs_module = null;
+function getFS() {
+ if (fs_module) return fs_module;
+ if (!isApp) throw new Error(t('file_access_requires_the_desktop_app'));
+ fs_module = require('fs', {message: t('needed_to_read_the_minecraft_jar_skins')});
+ if (!fs_module) throw new Error(t('file_access_was_denied'));
+ return fs_module;
+}
+function pathExists(path) {
+ try { return !!path && getFS().existsSync(path); } catch (e) { return false; }
+}
+function isDirectory(path) {
+ try { return getFS().statSync(path).isDirectory(); } catch (e) { return false; }
+}
+function readDir(path) {
+ try { return getFS().readdirSync(path); } catch (e) { return []; }
+}
+function ensureDir(dir) {
+ let fs = getFS();
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, {recursive: true});
+}
+function revealInFolder(path) {
+ let shell = require('shell', {message: t('to_reveal_the_exported_trim_in_the_file')});
+ if (shell) shell.showItemInFolder(path);
+}
+
+const Prefs = {
+ key: 'armor_trim_editor_prefs',
+ get() {
+ try { return JSON.parse(localStorage.getItem(this.key)) || {}; } catch (e) { return {}; }
+ },
+ set(patch) {
+ let data = Object.assign(this.get(), patch);
+ try { localStorage.setItem(this.key, JSON.stringify(data)); } catch (e) {}
+ return data;
+ }
+};
+
+// ============================================================================
+// Vanilla assets from the Minecraft client jar
+// ============================================================================
+
+const Assets = {
+ path: '',
+ zip: null,
+ opening: null,
+ cache: new Map(),
+
+ candidates() {
+ let found = [];
+ if (!isApp) return found;
+ let P = PathModule;
+ let home = SystemInfo.home_directory;
+ let platform = SystemInfo.platform;
+ let appdata = SystemInfo.appdata_directory || P.join(home, 'AppData', 'Roaming');
+ let seen = new Set();
+ let add = (path, version, source) => {
+ if (seen.has(path) || !/^\d+(\.\d+)+$/.test(version)) return;
+ seen.add(path);
+ if (pathExists(path)) found.push({path, version, source});
+ };
+ let addVersionsDir = (dir, source) => {
+ for (let v of readDir(dir)) add(P.join(dir, v, v + '.jar'), v, source);
+ };
+ let addLibraries = (root) => {
+ let libs = P.join(root, 'libraries', 'com', 'mojang', 'minecraft');
+ for (let v of readDir(libs)) add(P.join(libs, v, `minecraft-${v}-client.jar`), v, P.basename(root));
+ };
+
+ // Jars downloaded by other Blockbench plugins
+ let bb_cache = P.join(SystemInfo.user_data_directory || P.join(appdata, 'Blockbench'), 'minecraft_assets_cache');
+ for (let file of readDir(bb_cache)) {
+ let m = file.match(/^(\d+\.\d+(?:\.\d+)?)\.jar$/);
+ if (m) add(P.join(bb_cache, file), m[1], 'Blockbench');
+ }
+
+ // Official launcher
+ let minecraft_dir = platform == 'win32' ? P.join(appdata, '.minecraft')
+ : platform == 'darwin' ? P.join(home, 'Library', 'Application Support', 'minecraft')
+ : P.join(home, '.minecraft');
+ addVersionsDir(P.join(minecraft_dir, 'versions'), 'Minecraft Launcher');
+
+ // MultiMC-style launchers keep client jars in a libraries folder
+ let roots = [];
+ if (platform == 'win32') {
+ let local = P.join(home, 'AppData', 'Local');
+ roots.push(P.join(appdata, 'PrismLauncher'), P.join(appdata, 'PolyMC'), P.join(local, 'Programs', 'PrismLauncher'));
+ // Portable installs: look one level into the usual places
+ let bases = ['C:/Program Files', 'C:/Program Files (x86)', 'C:/Games', home,
+ P.join(home, 'Desktop'), P.join(home, 'Documents'), P.join(home, 'Downloads')];
+ for (let base of bases) {
+ for (let entry of readDir(base)) {
+ if (!/multimc|mmc|prism|polymc/i.test(entry)) continue;
+ let dir = P.join(base, entry);
+ roots.push(dir, P.join(dir, 'MultiMC'), P.join(dir, 'PrismLauncher'));
+ }
+ }
+ } else if (platform == 'darwin') {
+ let support = P.join(home, 'Library', 'Application Support');
+ roots.push(P.join(support, 'PrismLauncher'), P.join(support, 'PolyMC'), P.join(support, 'MultiMC'));
+ } else {
+ let share = P.join(home, '.local', 'share');
+ roots.push(P.join(share, 'PrismLauncher'), P.join(share, 'PolyMC'), P.join(share, 'multimc'),
+ P.join(home, '.var', 'app', 'org.prismlauncher.PrismLauncher', 'data', 'PrismLauncher'));
+ }
+ for (let root of roots) addLibraries(root);
+
+ let cmp = (a, b) => {
+ let pa = a.split('.').map(Number), pb = b.split('.').map(Number);
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
+ if ((pa[i] || 0) != (pb[i] || 0)) return (pb[i] || 0) - (pa[i] || 0);
+ }
+ return 0;
+ };
+ found.sort((a, b) => cmp(a.version, b.version));
+ return found;
+ },
+ resolvePath() {
+ let saved = Prefs.get().jar_path;
+ if (saved && pathExists(saved)) return saved;
+ let list = this.candidates();
+ return list[0] ? list[0].path : '';
+ },
+ setPath(path) {
+ Prefs.set({jar_path: path});
+ this.zip = null;
+ this.path = '';
+ this.cache.clear();
+ },
+ async open() {
+ if (this.zip) return this.zip;
+ if (this.opening) return this.opening;
+ this.opening = (async () => {
+ let path = this.resolvePath();
+ if (!path) {
+ throw new Error(t('minecraft_client_jar_not_found_set_it_in'));
+ }
+ let buffer = getFS().readFileSync(path);
+ this.zip = await JSZip.loadAsync(buffer);
+ this.path = path;
+ return this.zip;
+ })();
+ try {
+ return await this.opening;
+ } finally {
+ this.opening = null;
+ }
+ },
+ async image(paths) {
+ if (!Array.isArray(paths)) paths = [paths];
+ for (let path of paths) {
+ if (this.cache.has(path)) return this.cache.get(path);
+ }
+ let zip = await this.open();
+ for (let path of paths) {
+ let file = zip.file(path);
+ if (!file) continue;
+ let url = 'data:image/png;base64,' + await file.async('base64');
+ this.cache.set(path, url);
+ return url;
+ }
+ return null;
+ },
+ async text(path) {
+ let file = (await this.open()).file(path);
+ return file ? file.async('string') : null;
+ },
+ skin(id, slim) {
+ let variant = slim ? 'slim' : 'wide';
+ return this.image([
+ `assets/minecraft/textures/entity/player/${variant}/${id}.png`,
+ `assets/minecraft/textures/entity/player/${slim ? 'wide' : 'slim'}/${id}.png`,
+ ]);
+ },
+ armor(material, layer) {
+ let legacy = {humanoid: '_layer_1', humanoid_leggings: '_layer_2'}[layer];
+ let legacy_name = material == 'turtle_scute' ? 'turtle' : material;
+ return this.image([
+ `assets/minecraft/textures/entity/equipment/${layer}/${material}.png`,
+ `assets/minecraft/textures/models/armor/${legacy_name}${legacy}.png`,
+ ]);
+ },
+ trim(pattern, layer) {
+ return this.image([`assets/minecraft/textures/trims/entity/${layer}/${pattern}.png`, `assets/minecraft/textures/trims/models/armor/${pattern}${layer == 'humanoid' ? '' : '_leggings'}.png`]);
+ },
+ template(pattern) {
+ let name = pattern == 'netherite_upgrade' ? 'netherite_upgrade_smithing_template' : pattern + '_armor_trim_smithing_template';
+ return this.image(`assets/minecraft/textures/item/${name}.png`);
+ },
+};
+
+// ============================================================================
+// Project data
+// ============================================================================
+
+const DATA_VERSION = 4;
+function defaultData() {
+ let prefs = Prefs.get();
+ return {
+ version: DATA_VERSION,
+ trim_id: 'new_trim',
+ resolution: 1,
+ view: {
+ pieces: {helmet: true, chestplate: true, leggings: true, boots: true},
+ helmet_inner: true,
+ helmet_outer: true,
+ layers: {trim: true, armor: true, skin: true, skin_outer: true, icon: true, armor_icons: true},
+ },
+ armor: {material: 'diamond', leather_color: '#a06540'},
+ preview: {material: 'none', highlight: false},
+ skin: {source: 'default', id: 'steve', slim: false, name: ''},
+ pose: {id: 'default', speed: 1, paused: false, head_yaw: 0, head_pitch: 0},
+ mc_version: prefs.mc_version || DEFAULT_MC_VERSION,
+ export: {
+ pack_type: prefs.pack_type || 'zip',
+ pack_path: prefs.pack_path || '',
+ zip_dir: prefs.zip_dir || '',
+ zip_name: prefs.zip_name || 'armor_trims',
+ namespace: prefs.namespace || 'minecraft',
+ register_atlas: true,
+ sync_permutations: true,
+ icon: true,
+ icon_texture: prefs.icon_texture || DEFAULT_ICON_ID,
+ icon_model: prefs.icon_model || DEFAULT_ICON_ID,
+ icon_parent: prefs.icon_parent || 'minecraft:item/generated',
+ armor_icons: true,
+ icon_colors: 'palette',
+ backup: true,
+ },
+ icon_gen: {base: 'sentry', body: '#6a3fb0', accent: '#4bc9c9', glyph: 'recolor', contrast: 1},
+ datapack: {dir: prefs.datapack_dir || '', name: prefs.datapack_name || 'armor_trims', decal: false, names: ''},
+ };
+}
+function isTrimProject(project = Project) {
+ return !!(project && project.format && project.format.id == FORMAT_ID);
+}
+function D() {
+ if (!isTrimProject()) return null;
+ let data = Project.armor_trim_editor;
+ if (!data || !data.view || !(data.version >= DATA_VERSION)) {
+ data = data || {};
+ // Projects from before zip export wrote into a resource pack folder
+ if (data.export && data.export.pack_path && !data.export.pack_type) data.export.pack_type = 'folder';
+ if (data.datapack && data.datapack.version && !data.mc_version) data.mc_version = data.datapack.version;
+ // Fill settings added in newer versions without touching existing ones
+ Project.armor_trim_editor = deepDefaults(data, defaultData());
+ Project.armor_trim_editor.version = DATA_VERSION;
+ }
+ return Project.armor_trim_editor;
+}
+function findTexture(role) {
+ return Texture.all.find(t => t.trim_role == role);
+}
+function findBone(id) {
+ return Group.all.find(g => g.name == id && !(g.parent instanceof Group));
+}
+function roleCubes(prefix) {
+ return Cube.all.filter(c => c.trim_role && c.trim_role.startsWith(prefix));
+}
+function trimTextures() {
+ return Texture.all.filter(t => t.trim_role == 'trim_humanoid' || t.trim_role == 'trim_leggings');
+}
+
+// ============================================================================
+// Model construction
+// ============================================================================
+
+function createTexture(role, name, data_url, uv_w, uv_h) {
+ let texture = new Texture({name, trim_role: role, uv_width: uv_w, uv_height: uv_h, internal: true});
+ texture.fromDataURL(data_url).add(false);
+ return texture;
+}
+function setTextureImage(texture, data_url) {
+ return new Promise((resolve) => {
+ let done = false;
+ let finish = () => {
+ if (done) return;
+ done = true;
+ texture.saved = true;
+ resolve(texture);
+ };
+ texture.img.addEventListener('load', () => setTimeout(finish, 20), {once: true});
+ texture.internal = true;
+ texture.updateSource(data_url);
+ setTimeout(finish, 1500);
+ });
+}
+function makeBoxCube(name, role, box, options, texture, group) {
+ let cube = new Cube({
+ name,
+ trim_role: role,
+ from: box.from.slice(),
+ to: box.to.slice(),
+ inflate: options.inflate || 0,
+ box_uv: true,
+ uv_offset: options.uv.slice(),
+ mirror_uv: !!options.mirror,
+ locked: !!options.locked,
+ color: options.color || 0,
+ });
+ cube.addTo(group).init();
+ for (let face in cube.faces) {
+ cube.faces[face].texture = texture ? texture.uuid : null;
+ }
+ return cube;
+}
+
+async function buildTrimProject(opts) {
+ let data = D();
+ Object.assign(data, {trim_id: opts.trim_id, resolution: opts.resolution || 1});
+ if (opts.export) Object.assign(data.export, opts.export);
+ if (opts.armor) data.armor.material = opts.armor;
+ if (opts.skin) Object.assign(data.skin, opts.skin);
+
+ let res = data.resolution;
+ Project.name = opts.trim_id;
+ Project.texture_width = 64;
+ Project.texture_height = 32;
+ Project.box_uv = true;
+
+ let tex_h = createTexture('trim_humanoid', 'humanoid', opts.humanoid || blankDataURL(64 * res, 32 * res), 64, 32);
+ let tex_l = createTexture('trim_leggings', 'humanoid_leggings', opts.leggings || blankDataURL(64 * res, 32 * res), 64, 32);
+ let tex_icon = createTexture('icon', 'icon', opts.icon || blankDataURL(16 * res, 16 * res), 16, 16);
+ let tex_armor_h = createTexture('armor_humanoid', t('armor_preview'), blankDataURL(64, 32), 64, 32);
+ let tex_armor_l = createTexture('armor_leggings', t('armor_leggings_preview'), blankDataURL(64, 32), 64, 32);
+ let tex_skin = createTexture('skin', t('skin_preview'), opts.skin_data || blankDataURL(64, 64), 64, 64);
+
+ let groups = {};
+ for (let bone of BONES) {
+ let group = new Group({name: bone.id, origin: bone.origin.slice()});
+ group.init();
+ group.addTo();
+ group.isOpen = false;
+ groups[bone.id] = group;
+ }
+
+ let trim_name = t('trim'), armor_name = t('armor'), skin_name = t('skin');
+ for (let piece of PIECE_ORDER) {
+ let def = PIECES[piece];
+ let texture = def.layer == 'humanoid' ? tex_h : tex_l;
+ for (let part of def.parts) {
+ makeBoxCube(`${trim_name}: ${PART_NAMES[part.key]}`, 'trim/' + part.key, BOXES[part.box],
+ {inflate: part.inflate, uv: part.uv, mirror: part.mirror, color: 1}, texture, groups[part.bone]);
+ }
+ }
+ for (let piece of PIECE_ORDER) {
+ let def = PIECES[piece];
+ let texture = def.layer == 'humanoid' ? tex_armor_h : tex_armor_l;
+ for (let part of def.parts) {
+ makeBoxCube(`${armor_name}: ${PART_NAMES[part.key]}`, 'armor/' + part.key, BOXES[part.box],
+ {inflate: part.inflate - ARMOR_BASE_SHRINK, uv: part.uv, mirror: part.mirror, locked: true, color: 5}, texture, groups[part.bone]);
+ }
+ }
+ for (let part of SKIN_PARTS) {
+ let box = BOXES[part.box + (part.arm && data.skin.slim ? '_slim' : '')];
+ makeBoxCube(`${skin_name}: ${SKIN_NAMES[part.key]}`, 'skin/' + part.key, box,
+ {inflate: part.inflate || 0, uv: part.uv, locked: true, color: 0}, tex_skin, groups[part.bone]);
+ }
+
+ // Item icon, shown as a flat card next to the player
+ let icon_cube = new Cube({
+ name: t('item_icon'),
+ trim_role: 'icon',
+ from: [-42, 10, 0], to: [-26, 26, 0],
+ box_uv: false,
+ color: 2,
+ });
+ icon_cube.addTo().init();
+ for (let face in icon_cube.faces) {
+ icon_cube.faces[face].texture = null;
+ }
+ icon_cube.faces.north.texture = tex_icon.uuid;
+ icon_cube.faces.north.uv = [0, 0, 16, 16];
+ icon_cube.faces.south.texture = tex_icon.uuid;
+ icon_cube.faces.south.uv = [16, 0, 0, 16];
+
+ ensureArmorIcons(opts.armor_icons || {});
+ Canvas.updateAll();
+ tex_h.select();
+
+ await Promise.all([refreshSkin(false), refreshArmor(false)]);
+ if (opts.icons_source && !opts.armor_icons) {
+ await Promise.all(trimTextures().map(textureReady));
+ await applyIconGenerator({source: opts.icons_source, mode: 'replace'}, ICON_SLOTS.map(slot => slot.id), false);
+ }
+ applyVisibility();
+ updatePreviewUniforms();
+ Project.saved = true;
+}
+
+function startNewTrim(opts) {
+ if (!newProject(Formats[FORMAT_ID])) return Promise.resolve();
+ Project.armor_trim_editor = deepDefaults({}, defaultData());
+ return buildTrimProject(opts).then(() => {
+ Modes.options.paint.select();
+ refreshPanels();
+ }).catch(err => showError(t('could_not_create_trim'), err));
+}
+
+// ============================================================================
+// Skin & reference armor
+// ============================================================================
+
+function fallbackSkin() {
+ // Plain mannequin used when no Minecraft jar is available
+ let {canvas, ctx} = makeCanvas(64, 64);
+ let paint = (box, top, side) => {
+ let [u, v, w, h, d] = box;
+ ctx.fillStyle = top;
+ ctx.fillRect(u + d, v, w * 2, d);
+ ctx.fillStyle = side;
+ ctx.fillRect(u, v + d, 2 * (d + w), h);
+ };
+ paint([0, 0, 8, 8, 8], '#b98f6c', '#c9a07c');
+ paint([16, 16, 8, 12, 4], '#56708f', '#607d9e');
+ paint([40, 16, 4, 12, 4], '#b98f6c', '#c9a07c');
+ paint([32, 48, 4, 12, 4], '#b98f6c', '#c9a07c');
+ paint([0, 16, 4, 12, 4], '#3c465e', '#46516b');
+ paint([16, 48, 4, 12, 4], '#3c465e', '#46516b');
+ ctx.fillStyle = '#2b2b33';
+ ctx.fillRect(9, 12, 2, 1);
+ ctx.fillRect(13, 12, 2, 1);
+ return canvas.toDataURL('image/png');
+}
+async function getSkinDataURL(skin) {
+ if (skin.source == 'default') {
+ let url = null;
+ try {
+ url = await Assets.skin(skin.id, skin.slim);
+ } catch (err) {
+ console.warn('[Trim Editor] skin:', err);
+ }
+ return url || fallbackSkin();
+ }
+ return null;
+}
+async function normalizeSkin(data_url) {
+ let canvas = await dataURLToCanvas(data_url);
+ let w = canvas.width, h = canvas.height;
+ if (w == h * 2) {
+ // Legacy 64x32 skin: rebuild the 64x64 layout the same way the game does
+ let s = w / 64;
+ let {canvas: out, ctx} = makeCanvas(w, w);
+ ctx.drawImage(canvas, 0, 0);
+ let copyFlipped = (sx, sy, sw, sh, dx, dy) => {
+ ctx.save();
+ ctx.translate((dx + sw) * s, dy * s);
+ ctx.scale(-1, 1);
+ ctx.drawImage(canvas, sx * s, sy * s, sw * s, sh * s, 0, 0, sw * s, sh * s);
+ ctx.restore();
+ };
+ copyFlipped(4, 16, 4, 4, 20, 48); copyFlipped(8, 16, 4, 4, 24, 48);
+ copyFlipped(0, 20, 4, 12, 24, 52); copyFlipped(4, 20, 4, 12, 20, 52);
+ copyFlipped(8, 20, 4, 12, 16, 52); copyFlipped(12, 20, 4, 12, 28, 52);
+ copyFlipped(44, 16, 4, 4, 36, 48); copyFlipped(48, 16, 4, 4, 40, 48);
+ copyFlipped(40, 20, 4, 12, 40, 52); copyFlipped(44, 20, 4, 12, 36, 52);
+ copyFlipped(48, 20, 4, 12, 32, 52); copyFlipped(52, 20, 4, 12, 44, 52);
+ return out.toDataURL('image/png');
+ }
+ return canvas.toDataURL('image/png');
+}
+async function detectSlim(data_url) {
+ let canvas = await dataURLToCanvas(data_url);
+ if (canvas.width != canvas.height) return false;
+ let s = canvas.width / 64;
+ let pixels = canvas.getContext('2d').getImageData(54 * s, 20 * s, 2 * s, 12 * s).data;
+ for (let i = 3; i < pixels.length; i += 4) {
+ if (pixels[i] != 0) return false;
+ }
+ return true;
+}
+async function refreshSkin(update = true) {
+ let data = D();
+ let texture = findTexture('skin');
+ if (!data || !texture) return;
+ try {
+ let url = await getSkinDataURL(data.skin);
+ if (url) await setTextureImage(texture, url);
+ } catch (err) {
+ console.warn('[Trim Editor] skin:', err);
+ if (update) notify(err.message || String(err), 3500);
+ }
+ applySkinModel();
+ if (update) refreshPanels();
+}
+async function setCustomSkin(data_url, slim, source, name) {
+ let data = D();
+ let texture = findTexture('skin');
+ if (!data || !texture) return;
+ data_url = await normalizeSkin(data_url);
+ if (slim === undefined) slim = await detectSlim(data_url);
+ Object.assign(data.skin, {source, slim, name: name || ''});
+ await setTextureImage(texture, data_url);
+ applySkinModel();
+ refreshPanels();
+}
+async function blobToDataURL(blob) {
+ return new Promise((resolve, reject) => {
+ let reader = new FileReader();
+ reader.onload = () => resolve(reader.result);
+ reader.onerror = reject;
+ reader.readAsDataURL(blob);
+ });
+}
+async function loadPlayerSkin(name) {
+ let url = null, slim;
+ try {
+ let profile = await (await fetch('https://api.mojang.com/users/profiles/minecraft/' + encodeURIComponent(name))).json();
+ if (profile && profile.id) {
+ let session = await (await fetch('https://sessionserver.mojang.com/session/minecraft/profile/' + profile.id)).json();
+ let prop = (session.properties || []).find(p => p.name == 'textures');
+ let textures = JSON.parse(atob(prop.value)).textures;
+ if (textures.SKIN) {
+ let skin_response = await fetch(textures.SKIN.url.replace(/^http:/, 'https:'));
+ url = await blobToDataURL(await skin_response.blob());
+ slim = !!(textures.SKIN.metadata && textures.SKIN.metadata.model == 'slim');
+ name = profile.name || name;
+ }
+ }
+ } catch (err) {
+ console.warn('[Trim Editor] Mojang API:', err);
+ }
+ if (!url) {
+ let response = await fetch('https://mc-heads.net/skin/' + encodeURIComponent(name), {cache: 'no-cache'});
+ if (!response.ok) throw new Error(t('player_not_found') + ' (HTTP ' + response.status + ')');
+ url = await blobToDataURL(await response.blob());
+ }
+ await setCustomSkin(url, slim, 'player', name);
+}
+function applySkinModel() {
+ let data = D();
+ if (!data) return;
+ let changed = [];
+ for (let part of SKIN_PARTS) {
+ if (!part.arm) continue;
+ let cube = Cube.all.find(c => c.trim_role == 'skin/' + part.key);
+ if (!cube) continue;
+ let box = BOXES[part.box + (data.skin.slim ? '_slim' : '')];
+ if (!cube.from.equals(box.from) || !cube.to.equals(box.to)) {
+ cube.from.replace(box.from);
+ cube.to.replace(box.to);
+ changed.push(cube);
+ }
+ }
+ if (changed.length) {
+ Canvas.updateView({elements: changed, element_aspects: {geometry: true, uv: true, faces: true}});
+ }
+}
+
+function tintCanvas(source, color) {
+ let [tr_, tg, tb] = hexToRgb(color);
+ let {canvas, ctx} = makeCanvas(source.width, source.height);
+ ctx.drawImage(source, 0, 0);
+ let image = ctx.getImageData(0, 0, canvas.width, canvas.height);
+ let px = image.data;
+ for (let i = 0; i < px.length; i += 4) {
+ px[i] = px[i] * tr_ / 255;
+ px[i + 1] = px[i + 1] * tg / 255;
+ px[i + 2] = px[i + 2] * tb / 255;
+ }
+ ctx.putImageData(image, 0, 0);
+ return canvas;
+}
+function fallbackArmor(color, layer) {
+ let {canvas, ctx} = makeCanvas(64, 32);
+ let [r, g, b] = hexToRgb(color);
+ let boxes = layer == 'humanoid' ? [[0, 0, 8, 8, 8], [16, 16, 8, 12, 4], [40, 16, 4, 12, 4], [0, 16, 4, 12, 4]] : USED_BOXES.trim_leggings;
+ for (let box of boxes) {
+ for (let [x, y, w, h] of boxRects(...box)) {
+ ctx.fillStyle = rgbToHex(r * 0.75, g * 0.75, b * 0.75);
+ ctx.fillRect(x, y, w, h);
+ ctx.fillStyle = rgbToHex(r, g, b);
+ ctx.fillRect(x + 1, y + 1, Math.max(0, w - 2), Math.max(0, h - 2));
+ }
+ }
+ return canvas.toDataURL('image/png');
+}
+async function armorDataURL(material, layer, leather_color) {
+ let def = ARMOR_MATERIALS.find(m => m.id == material);
+ if (!def || material == 'none') return blankDataURL(64, 32);
+ if (def.helmet_only && layer == 'humanoid_leggings') return blankDataURL(64, 32);
+ let url = null;
+ try {
+ url = await Assets.armor(material, layer);
+ if (url && material == 'leather') {
+ let base = tintCanvas(await dataURLToCanvas(url), leather_color || '#a06540');
+ let overlay_url = await Assets.image([
+ `assets/minecraft/textures/entity/equipment/${layer}/leather_overlay.png`,
+ `assets/minecraft/textures/models/armor/leather${layer == 'humanoid' ? '_layer_1' : '_layer_2'}_overlay.png`,
+ ]);
+ if (overlay_url) base.getContext('2d').drawImage(await dataURLToCanvas(overlay_url), 0, 0);
+ url = base.toDataURL('image/png');
+ }
+ } catch (err) {
+ console.warn('[Trim Editor] armor:', err);
+ }
+ return url || fallbackArmor(def.color, layer);
+}
+async function refreshArmor(update = true) {
+ let data = D();
+ if (!data) return;
+ let mat = data.armor.material;
+ let tex_h = findTexture('armor_humanoid'), tex_l = findTexture('armor_leggings');
+ if (tex_h) await setTextureImage(tex_h, await armorDataURL(mat, 'humanoid', data.armor.leather_color));
+ if (tex_l) await setTextureImage(tex_l, await armorDataURL(mat, 'humanoid_leggings', data.armor.leather_color));
+ await refreshArmorIcons();
+ applyVisibility();
+ updatePreviewUniforms();
+ if (update) refreshPanels();
+}
+
+// ============================================================================
+// Visibility
+// ============================================================================
+
+function applyVisibility() {
+ let data = D();
+ if (!data) return;
+ let view = data.view;
+ let armor_def = ARMOR_MATERIALS.find(m => m.id == data.armor.material) || ARMOR_MATERIALS[0];
+ let focus = isIconFocus();
+ let changed = [];
+ for (let cube of Cube.all) {
+ let role = cube.trim_role;
+ if (!role) continue;
+ let [kind, key] = role.split('/');
+ let visible = true;
+ if (kind == 'trim' || kind == 'armor') {
+ let piece = PART_TO_PIECE[key];
+ visible = !!(view.pieces[piece] && view.layers[kind]);
+ if (key == 'helmet') visible = visible && view.helmet_inner;
+ if (key == 'helmet_outer') visible = visible && view.helmet_outer;
+ if (kind == 'armor') {
+ if (armor_def.id == 'none') visible = false;
+ if (armor_def.helmet_only && piece != 'helmet') visible = false;
+ }
+ } else if (kind == 'skin') {
+ let part = SKIN_PARTS.find(p => p.key == key);
+ visible = !!(view.layers.skin && (!part || !part.outer || view.layers.skin_outer));
+ } else if (kind == 'icon') {
+ visible = !!view.layers.icon;
+ } else if (kind == 'aicon' || kind == 'aiconbase') {
+ visible = focus || !!view.layers.armor_icons;
+ }
+ // While painting armor icons only the icons are shown
+ if (focus && kind != 'aicon' && kind != 'aiconbase') visible = false;
+ if (cube.visibility != visible) {
+ cube.visibility = visible;
+ changed.push(cube);
+ }
+ }
+ if (changed.length) {
+ Canvas.updateView({elements: changed, element_aspects: {visibility: true}});
+ }
+}
+
+// ============================================================================
+// Material preview: palette swap inside the texture shader
+// ============================================================================
+
+const SHADER_UNIFORMS = 'uniform int TRIM_MODE;\nuniform vec3 TRIM_KEYS[8];\nuniform vec3 TRIM_VALS[8];\nuniform int TRIM_DECAL;\nuniform sampler2D TRIM_ARMOR_MAP;\n';
+const SHADER_CODE = `
+ if (TRIM_DECAL == 1 && texture2D(TRIM_ARMOR_MAP, vUv).a < 0.1) discard;
+ if (TRIM_MODE > 0 && color.a > 0.0) {
+ int trim_hit = -1;
+ for (int ti = 0; ti < 8; ti++) {
+ vec3 td = abs(color.rgb - TRIM_KEYS[ti]);
+ if (trim_hit < 0 && td.r < 0.003 && td.g < 0.003 && td.b < 0.003) trim_hit = ti;
+ }
+ if (TRIM_MODE == 1 || TRIM_MODE == 3) {
+ for (int ti = 0; ti < 8; ti++) {
+ if (ti == trim_hit) color.rgb = TRIM_VALS[ti];
+ }
+ }
+ if (TRIM_MODE >= 2) {
+ if (trim_hit >= 0) {
+ color.rgb = mix(color.rgb, vec3(1.0, 0.15, 0.85), 0.45);
+ } else {
+ color.rgb = mix(color.rgb, vec3(0.1, 0.9, 1.0), 0.45);
+ }
+ }
+ }
+`;
+const COLOR_LINE = /vec4\s+color\s*=\s*texture2D\(\s*map\s*,\s*vUv\s*\)\s*;/;
+
+function patchMaterial(texture) {
+ let material = texture.getOwnMaterial ? texture.getOwnMaterial() : texture.material;
+ if (!material || !material.uniforms) return false;
+ if (material.uniforms.TRIM_MODE) return true;
+ if (!COLOR_LINE.test(material.fragmentShader)) return false;
+ material.userData.trim_original_shader = material.fragmentShader;
+ material.uniforms.TRIM_MODE = {value: 0};
+ material.uniforms.TRIM_KEYS = {value: PALETTE_KEY.map(hex => new THREE.Vector3(...hexToRgb(hex).map(v => v / 255)))};
+ material.uniforms.TRIM_VALS = {value: PALETTE_KEY.map(hex => new THREE.Vector3(...hexToRgb(hex).map(v => v / 255)))};
+ material.uniforms.TRIM_DECAL = {value: 0};
+ material.uniforms.TRIM_ARMOR_MAP = {value: null};
+ material.fragmentShader = material.fragmentShader
+ .replace(/void\s+main\s*\(\s*(void)?\s*\)\s*\{/, (m) => SHADER_UNIFORMS + m)
+ .replace(COLOR_LINE, (m) => m + SHADER_CODE);
+ material.needsUpdate = true;
+ return true;
+}
+function unpatchMaterial(texture) {
+ let material = texture.getOwnMaterial ? texture.getOwnMaterial() : texture.material;
+ if (!material || !material.uniforms || !material.uniforms.TRIM_MODE) return;
+ material.fragmentShader = material.userData.trim_original_shader;
+ delete material.uniforms.TRIM_MODE;
+ delete material.uniforms.TRIM_KEYS;
+ delete material.uniforms.TRIM_VALS;
+ delete material.uniforms.TRIM_DECAL;
+ delete material.uniforms.TRIM_ARMOR_MAP;
+ material.needsUpdate = true;
+}
+function armorMapFor(trim_texture) {
+ // Trim and reference armor share the UV layout, so the armor texel at the same UV tells whether armor is there
+ let armor = findTexture(trim_texture.trim_role == 'trim_leggings' ? 'armor_leggings' : 'armor_humanoid');
+ let material = armor && armor.getOwnMaterial && armor.getOwnMaterial();
+ return material ? material.map : null;
+}
+function effectivePaletteId(material_id, armor_id) {
+ let def = TRIM_MATERIALS.find(m => m.id == material_id);
+ if (def && def.armor && def.armor == armor_id && PALETTES[material_id + '_darker']) return material_id + '_darker';
+ return material_id;
+}
+function updatePreviewUniforms() {
+ let data = D();
+ if (!data) return;
+ let palette_id = data.preview.material != 'none' ? effectivePaletteId(data.preview.material, data.armor.material) : null;
+ let palette = palette_id && PALETTES[palette_id];
+ let mode = (palette ? 1 : 0) + (data.preview.highlight ? 2 : 0);
+ // Without reference armor there is nothing to clip against, so the decal preview stays off
+ let decal = !!data.datapack.decal && data.armor.material != 'none';
+ for (let texture of trimTextures()) {
+ if (!patchMaterial(texture)) continue;
+ let uniforms = texture.getOwnMaterial().uniforms;
+ uniforms.TRIM_MODE.value = mode;
+ uniforms.TRIM_DECAL.value = decal ? 1 : 0;
+ uniforms.TRIM_ARMOR_MAP.value = armorMapFor(texture);
+ if (palette) {
+ palette.forEach((hex, i) => uniforms.TRIM_VALS.value[i].set(...hexToRgb(hex).map(v => v / 255)));
+ }
+ }
+ updateIconUniforms(data);
+}
+
+// ============================================================================
+// Poses (port of HumanoidModel.setupAnim)
+// ============================================================================
+
+const PI = Math.PI;
+const POSES = [
+ {id: 'default', icon: 'accessibility', name: t('standing')},
+ {id: 'idle', icon: 'self_improvement', name: t('idle'), animated: true},
+ {id: 'walk', icon: 'directions_walk', name: t('walking'), animated: true},
+ {id: 'run', icon: 'directions_run', name: t('sprinting'), animated: true},
+ {id: 'sneak', icon: 'airline_seat_legroom_reduced', name: t('sneaking'), animated: true},
+ {id: 'sneak_walk', icon: 'hiking', name: t('sneak_walk'), animated: true},
+ {id: 'sit', icon: 'event_seat', name: t('riding')},
+ {id: 'attack', icon: 'sports_martial_arts', name: t('attack'), animated: true},
+ {id: 'bow', icon: 'gps_fixed', name: t('bow')},
+ {id: 'crossbow', icon: 'center_focus_strong', name: t('crossbow')},
+ {id: 'shield', icon: 'shield', name: t('shield')},
+ {id: 'trident', icon: 'north', name: t('trident')},
+ {id: 'spyglass', icon: 'search', name: t('spyglass')},
+ {id: 'zombie', icon: 'front_hand', name: t('arms_forward')},
+ {id: 'tpose', icon: 'open_with', name: t('t_pose')},
+ {id: 'spread', icon: 'open_in_full', name: t('pose_spread')},
+ {id: 'tpose_spread', icon: 'zoom_out_map', name: t('pose_tpose_spread')},
+ {id: 'wave', icon: 'waving_hand', name: t('waving'), animated: true},
+ {id: 'swim', icon: 'pool', name: t('swimming'), animated: true},
+ {id: 'elytra', icon: 'flight', name: t('elytra')},
+];
+
+function mcDefaultParts() {
+ let part = (x, y, z) => ({x, y, z, xRot: 0, yRot: 0, zRot: 0, x0: x, y0: y, z0: z});
+ return {
+ head: part(0, 0, 0), body: part(0, 0, 0),
+ right_arm: part(-5, 2, 0), left_arm: part(5, 2, 0),
+ right_leg: part(-1.9, 12, 0), left_leg: part(1.9, 12, 0),
+ };
+}
+function bob(part, age, dir) {
+ part.zRot += dir * (Math.cos(age * 0.09) * 0.05 + 0.05);
+ part.xRot += dir * Math.sin(age * 0.067) * 0.05;
+}
+function quadraticArm(x) {
+ return -65 * x + x * x;
+}
+function lerp(t, a, b) {
+ return a + (b - a) * t;
+}
+
+// Returns MC-space part transforms plus an optional root transform (Blockbench space).
+function computePose(pose_id, ticks, head_yaw, head_pitch) {
+ let p = mcDefaultParts();
+ let head = p.head, body = p.body, ra = p.right_arm, la = p.left_arm, rl = p.right_leg, ll = p.left_leg;
+ let root = {rot: [0, 0, 0], pos: [0, 0, 0]};
+ let s = {walk_pos: 0, walk_speed: 0, crouch: false, riding: false, bob: true, swim: 0, fall_flying: false, attack: 0};
+
+ switch (pose_id) {
+ case 'default': s.bob = false; break;
+ case 'spread': s.bob = false; s.spread = true; break;
+ case 'tpose_spread': s.bob = false; s.spread = true; break;
+ case 'walk': s.walk_pos = ticks * 0.86; s.walk_speed = 0.86; break;
+ case 'run': s.walk_pos = ticks * 1.0; s.walk_speed = 1.0; break;
+ case 'sneak': s.crouch = true; break;
+ case 'sneak_walk': s.crouch = true; s.walk_pos = ticks * 0.3; s.walk_speed = 0.3; break;
+ case 'sit': s.riding = true; break;
+ case 'attack': s.attack = (ticks % 10) / 6; if (s.attack >= 1) s.attack = 0; break;
+ case 'swim': s.swim = 1; s.walk_pos = ticks * 0.9; s.walk_speed = 0.9; break;
+ case 'elytra': s.fall_flying = true; s.walk_pos = ticks * 0.3; s.walk_speed = 0.1; break;
+ }
+ let age = ticks;
+
+ head.xRot = rad(head_pitch);
+ head.yRot = rad(-head_yaw);
+ if (s.fall_flying) head.xRot = -PI / 4;
+ else if (s.swim > 0) head.xRot = lerp(s.swim, head.xRot, -PI / 4);
+
+ ra.xRot = Math.cos(s.walk_pos * 0.6662 + PI) * 2 * s.walk_speed * 0.5;
+ la.xRot = Math.cos(s.walk_pos * 0.6662) * 2 * s.walk_speed * 0.5;
+ rl.xRot = Math.cos(s.walk_pos * 0.6662) * 1.4 * s.walk_speed;
+ ll.xRot = Math.cos(s.walk_pos * 0.6662 + PI) * 1.4 * s.walk_speed;
+ rl.yRot = 0.005; ll.yRot = -0.005; rl.zRot = 0.005; ll.zRot = -0.005;
+
+ if (s.riding) {
+ ra.xRot += -PI / 5; la.xRot += -PI / 5;
+ rl.xRot = -1.4137167; rl.yRot = PI / 10; rl.zRot = 0.07853982;
+ ll.xRot = -1.4137167; ll.yRot = -PI / 10; ll.zRot = -0.07853982;
+ }
+
+ switch (pose_id) {
+ case 'bow':
+ ra.yRot = -0.1 + head.yRot; la.yRot = 0.1 + head.yRot + 0.4;
+ ra.xRot = -PI / 2 + head.xRot; la.xRot = -PI / 2 + head.xRot;
+ break;
+ case 'crossbow':
+ ra.yRot = -0.3 + head.yRot; la.yRot = 0.6 + head.yRot;
+ ra.xRot = -PI / 2 + head.xRot + 0.1; la.xRot = -1.5 + head.xRot;
+ break;
+ case 'shield':
+ la.xRot = la.xRot * 0.5 - 0.9424779; la.yRot = PI / 6;
+ ra.xRot = ra.xRot * 0.5 - PI / 10;
+ break;
+ case 'trident':
+ ra.xRot = ra.xRot * 0.5 - PI; ra.yRot = 0;
+ break;
+ case 'spyglass':
+ ra.xRot = clamp(head.xRot - 1.9198622, -2.4, 3.3); ra.yRot = head.yRot - PI / 12;
+ s.bob = false;
+ break;
+ case 'zombie':
+ ra.xRot = -PI / 2; la.xRot = -PI / 2;
+ break;
+ case 'tpose':
+ case 'tpose_spread':
+ ra.zRot = PI / 2; la.zRot = -PI / 2; s.bob = false;
+ break;
+ case 'wave':
+ ra.xRot = -0.2; ra.zRot = 2.6 + Math.sin(ticks * 0.35) * 0.35;
+ break;
+ }
+
+ if (s.attack > 0) {
+ let f = s.attack;
+ body.yRot = Math.sin(Math.sqrt(f) * PI * 2) * 0.2;
+ ra.z = Math.sin(body.yRot) * 5; ra.x = -Math.cos(body.yRot) * 5;
+ la.z = -Math.sin(body.yRot) * 5; la.x = Math.cos(body.yRot) * 5;
+ ra.yRot += body.yRot; la.yRot += body.yRot; la.xRot += body.yRot;
+ let g = 1 - f; g *= g; g *= g; g = 1 - g;
+ let h = Math.sin(g * PI);
+ let k = Math.sin(f * PI) * -(head.xRot - 0.7) * 0.75;
+ ra.xRot -= h * 1.2 + k;
+ ra.yRot += body.yRot * 2;
+ ra.zRot += Math.sin(f * PI) * -0.4;
+ }
+
+ if (s.crouch) {
+ body.xRot = 0.5;
+ ra.xRot += 0.4; la.xRot += 0.4;
+ rl.z += 4; ll.z += 4;
+ head.y += 4.2; body.y += 3.2; la.y += 3.2; ra.y += 3.2;
+ }
+
+ if (s.spread) {
+ // Pull the parts apart so the armor of each one is seen on its own (like an exploded view)
+ head.y -= 4.5;
+ ra.x -= 4; la.x += 4;
+ rl.x -= 2; ll.x += 2;
+ rl.y += 4; ll.y += 4;
+ }
+
+ if (s.bob) {
+ bob(ra, age, 1);
+ bob(la, age, -1);
+ }
+
+ if (s.swim > 0) {
+ let l = s.walk_pos % 26;
+ let n = s.swim, m = s.swim;
+ if (l < 14) {
+ la.xRot = lerp(n, la.xRot, 0); ra.xRot = lerp(m, ra.xRot, 0);
+ la.yRot = lerp(n, la.yRot, PI); ra.yRot = lerp(m, ra.yRot, PI);
+ la.zRot = lerp(n, la.zRot, PI + 1.8707964 * quadraticArm(l) / quadraticArm(14));
+ ra.zRot = lerp(m, ra.zRot, PI - 1.8707964 * quadraticArm(l) / quadraticArm(14));
+ } else if (l < 22) {
+ let o = (l - 14) / 8;
+ la.xRot = lerp(n, la.xRot, PI / 2 * o); ra.xRot = lerp(m, ra.xRot, PI / 2 * o);
+ la.yRot = lerp(n, la.yRot, PI); ra.yRot = lerp(m, ra.yRot, PI);
+ la.zRot = lerp(n, la.zRot, 5.012389 - 1.8707964 * o);
+ ra.zRot = lerp(m, ra.zRot, 1.2707963 + 1.8707964 * o);
+ } else {
+ let o = (l - 22) / 4;
+ la.xRot = lerp(n, la.xRot, PI / 2 - PI / 2 * o); ra.xRot = lerp(m, ra.xRot, PI / 2 - PI / 2 * o);
+ la.yRot = lerp(n, la.yRot, PI); ra.yRot = lerp(m, ra.yRot, PI);
+ la.zRot = lerp(n, la.zRot, PI); ra.zRot = lerp(m, ra.zRot, PI);
+ }
+ ll.xRot = lerp(s.swim, ll.xRot, 0.3 * Math.cos(s.walk_pos * 0.33333334 + PI));
+ rl.xRot = lerp(s.swim, rl.xRot, 0.3 * Math.cos(s.walk_pos * 0.33333334));
+ root = {rot: [-90, 0, 0], pos: [0, 5, 16]};
+ }
+ if (s.fall_flying) {
+ root = {rot: [-80, 0, 0], pos: [0, 6, 16]};
+ ra.zRot += 0.15; la.zRot -= 0.15;
+ rl.zRot += 0.05; ll.zRot -= 0.05;
+ }
+
+ // Convert Java model space to Blockbench (x and y flipped)
+ let bones = {};
+ for (let id in p) {
+ let part = p[id];
+ bones[id] = {
+ rot: [-deg(part.xRot), -deg(part.yRot), deg(part.zRot)],
+ pos: [-(part.x - part.x0), -(part.y - part.y0), part.z - part.z0],
+ };
+ }
+ return {bones, root};
+}
+
+const PoseRuntime = {
+ ticks: 0,
+ last_time: 0,
+ active: false,
+ mouse_down: false,
+
+ frame() {
+ let data = D();
+ if (!data || !Project || !Project.model_3d) {
+ this.active = false;
+ return;
+ }
+ let now = performance.now();
+ let dt = this.last_time ? Math.min(0.1, (now - this.last_time) / 1000) : 0;
+ this.last_time = now;
+ let pose = data.pose;
+ let def = POSES.find(p => p.id == pose.id) || POSES[0];
+ let static_pose = pose.id == 'default' && !pose.head_yaw && !pose.head_pitch;
+ if (static_pose) {
+ if (this.active) this.reset();
+ return;
+ }
+ let frozen = pose.paused || (this.mouse_down && Modes.paint);
+ if (def.animated && !frozen) this.ticks += dt * 20 * (pose.speed || 1);
+ this.apply(computePose(pose.id, this.ticks, pose.head_yaw || 0, pose.head_pitch || 0));
+ },
+ apply(result) {
+ // The root transform (swimming, elytra) is baked into every bone so the icon card stays put
+ let root = new THREE.Matrix4().compose(
+ new THREE.Vector3(...result.root.pos),
+ new THREE.Quaternion().setFromEuler(new THREE.Euler(rad(result.root.rot[0]), rad(result.root.rot[1]), rad(result.root.rot[2]), 'ZYX')),
+ new THREE.Vector3(1, 1, 1)
+ );
+ let local = new THREE.Matrix4();
+ for (let bone of BONES) {
+ let group = findBone(bone.id);
+ if (!group || !group.mesh) continue;
+ let pose = result.bones[bone.id];
+ let mesh = group.mesh;
+ local.compose(
+ new THREE.Vector3(group.origin[0] + pose.pos[0], group.origin[1] + pose.pos[1], group.origin[2] + pose.pos[2]),
+ new THREE.Quaternion().setFromEuler(new THREE.Euler(
+ rad(group.rotation[0] + pose.rot[0]), rad(group.rotation[1] + pose.rot[1]), rad(group.rotation[2] + pose.rot[2]), 'ZYX')),
+ mesh.scale
+ );
+ local.premultiply(root);
+ local.decompose(mesh.position, mesh.quaternion, new THREE.Vector3());
+ }
+ this.active = true;
+ },
+ reset() {
+ this.active = false;
+ if (!Project || !Project.model_3d) return;
+ Canvas.updateAllBones();
+ },
+};
+
+// ============================================================================
+// Icon generator
+// ============================================================================
+
+const GLYPH_COLORS = ['4bc9c9', '209ab8', '60e8e8', '83f8f8'];
+function isGlyphPixel(r, g, b) {
+ let hex = rgbToHex(r, g, b).substring(1);
+ if (GLYPH_COLORS.includes(hex)) return true;
+ let [h, s] = rgbToHsl(r, g, b);
+ return h > 0.46 && h < 0.56 && s > 0.45;
+}
+const FALLBACK_TABLET = [
+ '................',
+ '.......###......',
+ '.....##ooo#.....',
+ '....#oooooo#....',
+ '...#oooooooo#...',
+ '..#oo+ooooooo#..',
+ '..#o+oooooooo#..',
+ '.#ooooooooooo#..',
+ '.#oooooooooooo#.',
+ '.#ooooooooooo--.',
+ '..#oooooooo---..',
+ '..#oooooo----...',
+ '...#ooo----.....',
+ '....#----.......',
+ '.....--.........',
+ '................',
+];
+function fallbackTemplateCanvas() {
+ let {canvas, ctx} = makeCanvas(16, 16);
+ let colors = {'#': '#2a2a33', 'o': '#6e6d75', '+': '#9a99a2', '-': '#1c1c22'};
+ FALLBACK_TABLET.forEach((row, y) => row.split('').forEach((ch, x) => {
+ if (!colors[ch]) return;
+ ctx.fillStyle = colors[ch];
+ ctx.fillRect(x, y, 1, 1);
+ }));
+ return canvas;
+}
+function recolorIcon(source, opts) {
+ let w = source.width, h = source.height;
+ let {canvas, ctx} = makeCanvas(w, h);
+ ctx.drawImage(source, 0, 0);
+ let image = ctx.getImageData(0, 0, w, h);
+ let px = image.data;
+ let glyph = new Uint8Array(w * h);
+ let sums = {body: [0, 0], glyph: [0, 0]};
+ for (let i = 0; i < w * h; i++) {
+ if (px[i * 4 + 3] == 0) continue;
+ let is_glyph = isGlyphPixel(px[i * 4], px[i * 4 + 1], px[i * 4 + 2]);
+ glyph[i] = is_glyph ? 1 : 0;
+ let l = luminance(px[i * 4], px[i * 4 + 1], px[i * 4 + 2]);
+ let bucket = is_glyph ? sums.glyph : sums.body;
+ bucket[0] += l; bucket[1]++;
+ }
+ let body_mean = sums.body[1] ? sums.body[0] / sums.body[1] : 0.4;
+ let glyph_mean = sums.glyph[1] ? sums.glyph[0] / sums.glyph[1] : 0.6;
+ let body_hsl = rgbToHsl(...hexToRgb(opts.body));
+ let accent_hsl = rgbToHsl(...hexToRgb(opts.accent));
+ let contrast = opts.contrast || 1;
+ let out = new Uint8ClampedArray(px);
+ for (let i = 0; i < w * h; i++) {
+ if (px[i * 4 + 3] == 0) continue;
+ let l = luminance(px[i * 4], px[i * 4 + 1], px[i * 4 + 2]);
+ let rgb;
+ if (glyph[i] && opts.glyph == 'keep') continue;
+ if (glyph[i] && opts.glyph == 'recolor') {
+ rgb = hslToRgb(accent_hsl[0], accent_hsl[1], accent_hsl[2] + (l - glyph_mean) * contrast);
+ } else if (glyph[i] && opts.glyph == 'remove') {
+ let acc = [0, 0, 0], n = 0;
+ for (let [dx, dy] of [[1, 0], [-1, 0], [0, 1], [0, -1], [1, 1], [-1, -1], [1, -1], [-1, 1]]) {
+ let x = (i % w) + dx, y = Math.floor(i / w) + dy;
+ if (x < 0 || y < 0 || x >= w || y >= h) continue;
+ let j = y * w + x;
+ if (glyph[j] || px[j * 4 + 3] == 0) continue;
+ acc[0] += px[j * 4]; acc[1] += px[j * 4 + 1]; acc[2] += px[j * 4 + 2]; n++;
+ }
+ let nl = n ? luminance(acc[0] / n, acc[1] / n, acc[2] / n) : body_mean;
+ rgb = hslToRgb(body_hsl[0], body_hsl[1], body_hsl[2] + (nl - body_mean) * contrast);
+ } else {
+ rgb = hslToRgb(body_hsl[0], body_hsl[1], body_hsl[2] + (l - body_mean) * contrast);
+ }
+ out[i * 4] = rgb[0]; out[i * 4 + 1] = rgb[1]; out[i * 4 + 2] = rgb[2];
+ }
+ image.data.set(out);
+ ctx.putImageData(image, 0, 0);
+ return canvas;
+}
+function suggestColors() {
+ // Most common saturated colors of the trim become the body and accent of the icon
+ let buckets = {};
+ for (let texture of trimTextures()) {
+ if (!texture.canvas || !texture.width) continue;
+ let px = texture.canvas.getContext('2d').getImageData(0, 0, texture.canvas.width, texture.canvas.height).data;
+ for (let i = 0; i < px.length; i += 4) {
+ if (px[i + 3] < 128) continue;
+ let [h, s, l] = rgbToHsl(px[i], px[i + 1], px[i + 2]);
+ let key = s < 0.15 ? 'gray' + Math.round(l * 4) : 'h' + Math.round(h * 24);
+ if (!buckets[key]) buckets[key] = {n: 0, r: 0, g: 0, b: 0};
+ let bucket = buckets[key];
+ bucket.n++; bucket.r += px[i]; bucket.g += px[i + 1]; bucket.b += px[i + 2];
+ }
+ }
+ let sorted = Object.values(buckets).sort((a, b) => b.n - a.n).map(b => {
+ let rgb = [b.r / b.n, b.g / b.n, b.b / b.n];
+ return {rgb, hsl: rgbToHsl(...rgb)};
+ });
+ if (!sorted.length) return null;
+ let main = sorted[0];
+ let accent = sorted.find(c => Math.abs(c.hsl[0] - main.hsl[0]) > 0.08 && c.hsl[1] > 0.2) || sorted[1] || main;
+ let body = hslToRgb(main.hsl[0], Math.min(0.8, main.hsl[1]), clamp(main.hsl[2] * 0.8, 0.22, 0.5));
+ let acc = hslToRgb(accent.hsl[0], Math.max(0.5, accent.hsl[1]), clamp(accent.hsl[2], 0.45, 0.7));
+ return {body: rgbToHex(...body), accent: rgbToHex(...acc)};
+}
+async function iconBaseCanvas(base) {
+ if (base.startsWith('pack:')) {
+ let data = D();
+ let pack = await packStorage(rpTargetPath(data.export)).load();
+ let url = await readPackPNG(pack, base.substring(5));
+ if (url) return dataURLToCanvas(url);
+ }
+ if (base == 'current') {
+ let tex = findTexture('icon');
+ if (tex && tex.canvas) {
+ let {canvas, ctx} = makeCanvas(tex.canvas.width, tex.canvas.height);
+ ctx.drawImage(tex.canvas, 0, 0);
+ return canvas;
+ }
+ }
+ if (base == 'simple') return fallbackTemplateCanvas();
+ try {
+ let url = await Assets.template(base);
+ if (url) return dataURLToCanvas(url);
+ } catch (err) {
+ console.warn('[Trim Editor] template:', err);
+ }
+ return fallbackTemplateCanvas();
+}
+async function packIconFiles(data) {
+ let list = [];
+ try {
+ let target = rpTargetPath(data.export);
+ if (!target || !pathExists(target)) return list;
+ let pack = await packStorage(target).load();
+ let dir = PathModule.posix.dirname(iconRel(data.export.icon_texture, '__id__'));
+ for (let file of pack.listDir(dir)) {
+ if (file.endsWith('.png')) list.push({id: 'pack:' + dir + '/' + file, name: t('pack') + file.replace('.png', '')});
+ }
+ } catch (err) {}
+ return list;
+}
+
+async function openIconGenerator() {
+ let data = D();
+ if (!data) return;
+ let icon_texture = findTexture('icon');
+ if (!icon_texture) return;
+ let gen = data.icon_gen;
+ let bases = [
+ {id: 'current', name: t('current_icon')},
+ {id: 'simple', name: t('simple_tablet')},
+ ...VANILLA_PATTERNS.map(p => ({id: p, name: t('template') + p})),
+ {id: 'netherite_upgrade', name: t('template_netherite_upgrade')},
+ ...await packIconFiles(data),
+ ];
+ let dialog = new Dialog({
+ id: 'armor_trim_editor_icon_generator',
+ title: t('icon_generator'),
+ width: 620,
+ component: {
+ data() {
+ return {bases, gen: Object.assign({}, gen), status: '', glyph_modes: [
+ {id: 'recolor', name: t('recolor_glyph')},
+ {id: 'keep', name: t('keep')},
+ {id: 'remove', name: t('remove_glyph')},
+ ]};
+ },
+ methods: {
+ async render() {
+ try {
+ let base = await iconBaseCanvas(this.gen.base);
+ this.base_canvas = base;
+ let result = recolorIcon(base, this.gen);
+ this.result_canvas = result;
+ for (let [ref, source] of [['before', base], ['after', result]]) {
+ let target = this.$refs[ref];
+ if (!target) continue;
+ let ctx = target.getContext('2d');
+ ctx.imageSmoothingEnabled = false;
+ ctx.clearRect(0, 0, target.width, target.height);
+ ctx.drawImage(source, 0, 0, target.width, target.height);
+ }
+ this.status = '';
+ } catch (err) {
+ this.status = err.message || String(err);
+ }
+ },
+ autoColors() {
+ let colors = suggestColors();
+ if (!colors) {
+ this.status = t('the_trim_is_empty_nothing_to_sample');
+ return;
+ }
+ this.gen.body = colors.body;
+ this.gen.accent = colors.accent;
+ this.render();
+ },
+ },
+ watch: {
+ gen: {deep: true, handler() { this.render(); }},
+ },
+ mounted() {
+ this.render();
+ },
+ template: `
+
+
+
${t('base')}
+ arrow_forward
+
${t('result')}
+
+
+
+
+
+
+
+
+
+
{{ gen.contrast.toFixed(2) }}
+
+
${t('the_glyph_cyan_pixels_of_vanilla')}
+
{{ status }}
+
`,
+ },
+ onConfirm() {
+ let vm = this.content_vue;
+ if (!vm || !vm.result_canvas) return;
+ Object.assign(gen, vm.gen);
+ let result = vm.result_canvas;
+ icon_texture.edit((canvas) => {
+ let ctx = canvas.getContext('2d');
+ ctx.imageSmoothingEnabled = false;
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.drawImage(result, 0, 0, canvas.width, canvas.height);
+ }, {edit_name: t('generate_icon')});
+ notify(t('icon_updated'));
+ },
+ });
+ dialog.show();
+}
+
+// ============================================================================
+// Validation
+// ============================================================================
+
+function usedMask(role, w, h) {
+ let scale = w / 64;
+ let mask = new Uint8Array(w * h);
+ for (let box of USED_BOXES[role] || []) {
+ for (let [x, y, rw, rh] of boxRects(...box)) {
+ for (let yy = y * scale; yy < (y + rh) * scale; yy++) {
+ for (let xx = x * scale; xx < (x + rw) * scale; xx++) mask[yy * w + xx] = 1;
+ }
+ }
+ }
+ return mask;
+}
+const KEY_RGB = PALETTE_KEY.map(hexToRgb);
+function nearestKey(r, g, b) {
+ let best = -1, best_d = Infinity;
+ KEY_RGB.forEach((k, i) => {
+ let d = Math.abs(k[0] - r) + Math.abs(k[1] - g) + Math.abs(k[2] - b);
+ if (d < best_d) { best_d = d; best = i; }
+ });
+ return {index: best, distance: best_d};
+}
+function analyzeTexture(texture) {
+ let w = texture.canvas.width, h = texture.canvas.height;
+ let px = texture.canvas.getContext('2d').getImageData(0, 0, w, h).data;
+ let mask = usedMask(texture.trim_role, w, h);
+ let stats = {texture, w, h, opaque: 0, palette: 0, fixed: 0, semi: 0, unused: 0, near: 0, below_cutout: 0};
+ for (let i = 0; i < w * h; i++) {
+ let a = px[i * 4 + 3];
+ if (a == 0) continue;
+ if (!mask[i]) { stats.unused++; continue; }
+ stats.opaque++;
+ if (a < 255) stats.semi++;
+ if (a < 26) stats.below_cutout++;
+ let near = nearestKey(px[i * 4], px[i * 4 + 1], px[i * 4 + 2]);
+ if (near.distance == 0) stats.palette++;
+ else {
+ stats.fixed++;
+ if (near.distance <= 12) stats.near++;
+ }
+ }
+ return stats;
+}
+function validateTrim() {
+ let data = D();
+ let issues = [];
+ if (!data) return issues;
+ let label = {trim_humanoid: 'humanoid', trim_leggings: 'humanoid_leggings'};
+ let total = 0;
+ for (let texture of trimTextures()) {
+ if (!texture.canvas || !texture.canvas.width) continue;
+ let s = analyzeTexture(texture);
+ total += s.opaque;
+ let name = label[texture.trim_role];
+ if (s.w * 32 != s.h * 64) {
+ issues.push({level: 'error', text: t('size_must_be_2_1_64_32_128_64', [name, s.w, s.h])});
+ }
+ if (s.unused) {
+ issues.push({level: 'warn', text: t('px_outside_the_uv_layout_invisible_in', [name, s.unused]),
+ fix: {id: 'clear_unused', texture, label: t('remove')}});
+ }
+ if (s.semi) {
+ issues.push({level: 'warn', text: t('semi_transparent_px_trims_render_as', [name, s.semi]),
+ fix: {id: 'fix_alpha', texture, label: t('match_game')}});
+ }
+ if (s.near) {
+ issues.push({level: 'info', text: t('px_are_close_to_palette_colors_but_will', [name, s.near]),
+ fix: {id: 'snap_palette', texture, label: t('snap_to_palette')}});
+ }
+ if (s.opaque) {
+ issues.push({level: 'info', text: t('px_follow_the_material_px_keep_their', [name, s.palette, s.fixed])});
+ }
+ }
+ if (!total) issues.unshift({level: 'warn', text: t('the_trim_is_empty')});
+ let icon = findTexture('icon');
+ if (icon && icon.canvas && icon.canvas.width != icon.canvas.height) {
+ issues.push({level: 'warn', text: t('the_icon_is_not_square')});
+ }
+ if (iconTextures().length) issues.push({level: 'info', text: t('armor_icons_count', [filledIconSlots().length, ICON_SLOTS.length])});
+ let id_error = trimIdError(data.trim_id);
+ if (id_error) issues.unshift({level: 'error', text: id_error});
+ return issues;
+}
+function applyFix(fix) {
+ let texture = fix.texture;
+ texture.edit((canvas) => {
+ let ctx = canvas.getContext('2d');
+ let w = canvas.width, h = canvas.height;
+ let image = ctx.getImageData(0, 0, w, h);
+ let px = image.data;
+ let mask = usedMask(texture.trim_role, w, h);
+ for (let i = 0; i < w * h; i++) {
+ let a = px[i * 4 + 3];
+ if (a == 0) continue;
+ if (fix.id == 'clear_unused' && !mask[i]) {
+ px[i * 4] = px[i * 4 + 1] = px[i * 4 + 2] = px[i * 4 + 3] = 0;
+ } else if (fix.id == 'fix_alpha' && a < 255) {
+ px[i * 4 + 3] = a < 26 ? 0 : 255;
+ } else if (fix.id == 'snap_palette') {
+ let near = nearestKey(px[i * 4], px[i * 4 + 1], px[i * 4 + 2]);
+ if (near.distance > 0 && near.distance <= 12) {
+ let k = KEY_RGB[near.index];
+ px[i * 4] = k[0]; px[i * 4 + 1] = k[1]; px[i * 4 + 2] = k[2];
+ }
+ }
+ }
+ ctx.putImageData(image, 0, 0);
+ }, {edit_name: t('fix_trim')});
+}
+function trimIdError(id) {
+ if (!id) return t('trim_id_is_empty');
+ if (!/^[a-z0-9_.\-]+$/.test(id)) return t('trim_id_may_only_contain_a_z_0_9');
+ return '';
+}
+
+function clearPiece(piece) {
+ let boxes = PIECE_BOXES[piece];
+ for (let role in boxes) {
+ let texture = findTexture(role);
+ if (!texture) continue;
+ texture.edit((canvas) => {
+ let ctx = canvas.getContext('2d');
+ let scale = canvas.width / 64;
+ for (let box of boxes[role]) {
+ for (let [x, y, w, h] of boxRects(...box)) ctx.clearRect(x * scale, y * scale, w * scale, h * scale);
+ }
+ }, {edit_name: t('clear_trim_piece')});
+ }
+}
+
+function confirmClearPiece(piece) {
+ Blockbench.showMessageBox({
+ title: t('clear_trim_piece'),
+ message: t('erase_from_the_trim_texture_you_can_undo', [PIECE_NAMES[piece]]),
+ buttons: [t('erase'), t('cancel')], confirm: 0, cancel: 1,
+ }, (button) => { if (button == 0) clearPiece(piece); });
+}
+
+// ============================================================================
+// Pack storage: a resource pack or datapack is either a folder or a zip archive
+// ============================================================================
+
+class FolderPack {
+ constructor(root) {
+ this.kind = 'folder';
+ this.root = root;
+ this.path = root;
+ }
+ async load() {
+ return this;
+ }
+ abs(rel) {
+ return PathModule.join(this.root, ...rel.split('/'));
+ }
+ exists(rel) {
+ return pathExists(this.abs(rel));
+ }
+ async read(rel) {
+ return this.exists(rel) ? getFS().readFileSync(this.abs(rel)) : null;
+ }
+ listDir(rel) {
+ return readDir(this.abs(rel));
+ }
+ listFiles(prefix) {
+ // Every file under a folder, as pack-relative paths
+ let files = [];
+ let walk = (rel, depth) => {
+ let entries;
+ try { entries = getFS().readdirSync(this.abs(rel), {withFileTypes: true}); } catch (err) { return; }
+ for (let entry of entries) {
+ let child = rel + '/' + entry.name;
+ if (entry.isDirectory()) { if (depth < 12) walk(child, depth + 1); }
+ else files.push(child);
+ }
+ };
+ walk(prefix.replace(/\/$/, ''), 0);
+ return files;
+ }
+ write(rel, content, backup_stamp) {
+ let path = this.abs(rel);
+ if (backup_stamp) backupFile(path, this.root, backup_stamp);
+ ensureDir(PathModule.dirname(path));
+ getFS().writeFileSync(path, content);
+ }
+ async save() {}
+}
+
+class ZipPack {
+ constructor(file) {
+ this.kind = 'zip';
+ this.path = file;
+ this.zip = null;
+ this.existed = false;
+ this.dirty = false;
+ }
+ async load() {
+ let fs = getFS();
+ this.existed = fs.existsSync(this.path);
+ this.zip = this.existed ? await JSZip.loadAsync(fs.readFileSync(this.path)) : new JSZip();
+ return this;
+ }
+ exists(rel) {
+ return !!this.zip.file(rel);
+ }
+ async read(rel) {
+ let file = this.zip.file(rel);
+ return file ? Buffer.from(await file.async('uint8array')) : null;
+ }
+ listDir(rel) {
+ let prefix = rel.replace(/\/?$/, '/');
+ let names = new Set();
+ this.zip.forEach((path) => {
+ if (!path.startsWith(prefix)) return;
+ let name = path.substring(prefix.length).split('/')[0];
+ if (name) names.add(name);
+ });
+ return [...names];
+ }
+ listFiles(prefix) {
+ let files = [];
+ this.zip.forEach((path, file) => {
+ if (!file.dir && path.startsWith(prefix)) files.push(path);
+ });
+ return files;
+ }
+ write(rel, content) {
+ this.zip.file(rel, content);
+ this.dirty = true;
+ }
+ async save(backup_stamp) {
+ if (!this.dirty) return;
+ if (this.existed && backup_stamp) backupFile(this.path, PathModule.dirname(this.path), backup_stamp);
+ let content = await this.zip.generateAsync({type: 'uint8array', compression: 'DEFLATE'});
+ ensureDir(PathModule.dirname(this.path));
+ getFS().writeFileSync(this.path, Buffer.from(content));
+ this.existed = true;
+ this.dirty = false;
+ }
+}
+
+function packStorage(path) {
+ return /\.zip$/i.test(path) ? new ZipPack(path) : new FolderPack(path);
+}
+async function readPackText(pack, rel) {
+ let buffer = await pack.read(rel);
+ return buffer ? buffer.toString('utf-8').replace(/^/, '') : null;
+}
+function writeJSON(pack, rel, json, previous_text, backup_stamp) {
+ // Keep the indentation, line endings and trailing newline of the file being replaced
+ let text = previous_text || '';
+ let out = JSON.stringify(json, null, detectIndent(text)) + (text.endsWith('\n') || !text ? '\n' : '');
+ if (text.includes('\r\n')) out = out.replace(/\n/g, '\r\n');
+ pack.write(rel, out, backup_stamp);
+}
+async function writeJSONIfChanged(pack, rel, json, backup_stamp, indent = 2) {
+ // Files whose content is already the same stay untouched, so a pack under git shows only real changes
+ let text = await readPackText(pack, rel);
+ if (text) {
+ try {
+ if (JSON.stringify(JSON.parse(text)) == JSON.stringify(json)) return false;
+ } catch (err) {}
+ writeJSON(pack, rel, json, text, backup_stamp);
+ } else {
+ pack.write(rel, JSON.stringify(json, null, indent) + '\n');
+ }
+ return true;
+}
+async function samePNG(pack, rel, canvas) {
+ // Compares pixels, not bytes: an image saved by another editor is not rewritten if nothing was painted
+ let buffer = await pack.read(rel);
+ if (!buffer || !canvas || !canvas.width) return false;
+ try {
+ let old = await dataURLToCanvas(bufferToDataURL(buffer));
+ if (old.width != canvas.width || old.height != canvas.height) return false;
+ let a = old.getContext('2d').getImageData(0, 0, old.width, old.height).data;
+ let b = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height).data;
+ for (let i = 0; i < a.length; i += 4) {
+ if (a[i + 3] == 0 && b[i + 3] == 0) continue;
+ if (a[i] != b[i] || a[i + 1] != b[i + 1] || a[i + 2] != b[i + 2] || a[i + 3] != b[i + 3]) return false;
+ }
+ return true;
+ } catch (err) {
+ return false;
+ }
+}
+async function writeTextureIfChanged(pack, rel, texture, backup_stamp) {
+ if (await samePNG(pack, rel, texture.canvas)) return false;
+ pack.write(rel, textureBuffer(texture), backup_stamp);
+ return true;
+}
+function zipFileName(name) {
+ name = String(name || '').trim().replace(/\.zip$/i, '');
+ return /^[^\\/:*?"<>|]+$/.test(name) ? name : '';
+}
+
+// ============================================================================
+// Minecraft versions
+// ============================================================================
+
+// Versions whose resource pack layout matches what the plugin exports (1.21.2+)
+const MC_VERSIONS = [
+ {id: '26.2', name: '26.2', rp: 88, dp: 107, new_meta: true},
+ {id: '26.1.2', name: '26.1.2', rp: 84, dp: 101, new_meta: true},
+ {id: '1.21.11', name: '1.21.11', rp: 75, dp: 94, new_meta: true},
+ {id: '1.21.9', name: '1.21.9 – 1.21.10', rp: 69, dp: 88, new_meta: true},
+ {id: '1.21.7', name: '1.21.7 – 1.21.8', rp: 64, dp: 81},
+ {id: '1.21.6', name: '1.21.6', rp: 63, dp: 80},
+ {id: '1.21.5', name: '1.21.5', rp: 55, dp: 71},
+ {id: '1.21.4', name: '1.21.4', rp: 46, dp: 61, template_item: true},
+ {id: '1.21.2', name: '1.21.2 – 1.21.3', rp: 42, dp: 57, template_item: true},
+];
+const DEFAULT_MC_VERSION = '1.21.11';
+
+function mcVersion(id) {
+ return MC_VERSIONS.find(v => v.id == id) || MC_VERSIONS.find(v => v.id == DEFAULT_MC_VERSION);
+}
+function versionOptions() {
+ let options = {};
+ for (let v of MC_VERSIONS) options[v.id] = v.name;
+ return options;
+}
+function mcmetaText(version, kind) {
+ let format = kind == 'rp' ? version.rp : version.dp;
+ let pack = {description: 'Armor trims'};
+ if (version.new_meta) {
+ pack.min_format = format;
+ pack.max_format = format;
+ } else {
+ pack.pack_format = format;
+ }
+ return JSON.stringify({pack}, null, '\t') + '\n';
+}
+function mcmetaFormat(json) {
+ let pack = json && json.pack || {};
+ let value = pack.max_format ?? pack.pack_format ?? pack.min_format;
+ return Array.isArray(value) ? value[0] : value;
+}
+
+// ============================================================================
+// Export to resource pack
+// ============================================================================
+
+function rpTargetPath(e) {
+ if (e.pack_type == 'folder') return e.pack_path || '';
+ let name = zipFileName(e.zip_name);
+ return e.zip_dir && name ? PathModule.join(e.zip_dir, name + '.zip') : '';
+}
+function exportPlan(data) {
+ let e = data.export;
+ let id = data.trim_id;
+ let ns = e.namespace || 'minecraft';
+ let plan = {target: rpTargetPath(e), type: e.pack_type, id, ns, files: [], atlas: null, version: mcVersion(data.mc_version)};
+ plan.files.push({kind: 'texture', role: 'trim_humanoid', rel: `assets/${ns}/textures/trims/entity/humanoid/${id}.png`});
+ plan.files.push({kind: 'texture', role: 'trim_leggings', rel: `assets/${ns}/textures/trims/entity/humanoid_leggings/${id}.png`});
+ if (e.icon) {
+ let tex_id = parseResourceId(e.icon_texture.replace(/\{id\}/g, id));
+ let model_id = parseResourceId(e.icon_model.replace(/\{id\}/g, id));
+ plan.icon_texture_id = tex_id.ns + ':' + tex_id.path;
+ plan.icon_model_id = model_id.ns + ':' + model_id.path;
+ plan.files.push({kind: 'texture', role: 'icon', icon: true, rel: `assets/${tex_id.ns}/textures/${tex_id.path}.png`});
+ plan.files.push({kind: 'model', icon: true, rel: `assets/${model_id.ns}/models/${model_id.path}.json`,
+ content: JSON.stringify({parent: e.icon_parent || 'minecraft:item/generated', textures: {layer0: plan.icon_texture_id}}, null, 4)});
+ }
+ // Vanilla patterns are already listed in the vanilla atlas
+ plan.vanilla = ns == 'minecraft' && VANILLA_PATTERNS.includes(id);
+ if (e.register_atlas && !plan.vanilla) plan.atlas = 'assets/minecraft/atlases/armor_trims.json';
+ return plan;
+}
+function exportPlanErrors(data, plan) {
+ let errors = [];
+ let e = data.export;
+ let id_error = trimIdError(data.trim_id);
+ if (id_error) errors.push(id_error);
+ if (e.pack_type == 'folder') {
+ if (!e.pack_path) errors.push(t('no_resource_pack_folder_selected'));
+ else if (!isDirectory(e.pack_path)) errors.push(t('resource_pack_folder_not_found') + e.pack_path);
+ } else {
+ if (!e.zip_dir) errors.push(t('no_zip_folder'));
+ else if (pathExists(e.zip_dir) && !isDirectory(e.zip_dir)) errors.push(t('dp_not_folder') + e.zip_dir);
+ if (!zipFileName(e.zip_name)) errors.push(t('invalid_zip_name'));
+ }
+ if (!isValidNamespace(e.namespace || 'minecraft')) errors.push(t('invalid_texture_namespace'));
+ if (e.icon) {
+ for (let id of [plan.icon_texture_id, plan.icon_model_id]) {
+ let p = parseResourceId(id);
+ if (!isValidNamespace(p.ns) || !isValidPath(p.path)) errors.push(t('invalid_icon_path') + id);
+ }
+ }
+ return errors;
+}
+function detectIndent(text) {
+ let m = text && text.match(/\n([ \t]+)"/);
+ if (!m) return 4;
+ return m[1].includes('\t') ? '\t' : m[1].length;
+}
+function updateAtlasJSON(text, texture_ids, sync_permutations, permutations = VANILLA_PERMUTATIONS) {
+ let json;
+ if (text) {
+ json = JSON.parse(text);
+ } else {
+ json = {sources: []};
+ }
+ if (!Array.isArray(json.sources)) json.sources = [];
+ let is_palette_source = (s) => s && /(^|:)paletted_permutations$/.test(s.type || '') &&
+ normalizeId(s.palette_key || '') == 'minecraft:trims/color_palettes/trim_palette';
+ let source = json.sources.find(is_palette_source);
+ let changes = [];
+ // Follow the style already used in the file (with or without "minecraft:")
+ let prefixed = source && Array.isArray(source.textures) && source.textures.length ? source.textures.some(t => t.startsWith('minecraft:')) : false;
+ if (!source) {
+ source = {type: 'paletted_permutations', textures: [], palette_key: 'trims/color_palettes/trim_palette', permutations: {}};
+ for (let perm of permutations) source.permutations[perm] = 'trims/color_palettes/' + perm;
+ json.sources.push(source);
+ changes.push(t('created_paletted_permutations_source'));
+ }
+ if (!Array.isArray(source.textures)) source.textures = [];
+ for (let id of texture_ids) {
+ let listed = json.sources.some(s => Array.isArray(s.textures) && s.textures.some(t => normalizeId(t) == normalizeId(id)));
+ if (!listed) {
+ let p = parseResourceId(id);
+ source.textures.push(p.ns == 'minecraft' && !prefixed ? p.path : p.ns + ':' + p.path);
+ changes.push(t('added_texture') + id);
+ }
+ }
+ if (sync_permutations) {
+ if (!source.permutations || typeof source.permutations != 'object') source.permutations = {};
+ let perm_prefixed = Object.values(source.permutations).some(v => String(v).startsWith('minecraft:'));
+ for (let perm of permutations) {
+ if (!(perm in source.permutations)) {
+ source.permutations[perm] = (perm_prefixed ? 'minecraft:' : '') + 'trims/color_palettes/' + perm;
+ changes.push(t('added_palette') + perm);
+ }
+ }
+ }
+ return {json, changes};
+}
+function textureBuffer(texture) {
+ return dataURLToBuffer(texture.canvas.toDataURL('image/png'));
+}
+function packIconBuffer() {
+ // pack.png for a new pack: the template icon scaled up without smoothing
+ let icon = findTexture('icon');
+ if (!icon || !icon.canvas || !icon.canvas.width) return null;
+ let {canvas, ctx} = makeCanvas(128, 128);
+ ctx.drawImage(icon.canvas, 0, 0, 128, 128);
+ return dataURLToBuffer(canvas.toDataURL('image/png'));
+}
+const BACKUPS_KEPT = 10;
+function isUnderGit(path) {
+ // A folder pack (or the folder of a zip) inside a git work tree already has its history
+ if (!path) return false;
+ let dir = /\.zip$/i.test(path) ? PathModule.dirname(path) : path;
+ for (let i = 0; i < 32 && dir; i++) {
+ if (pathExists(PathModule.join(dir, '.git'))) return true;
+ let parent = PathModule.dirname(dir);
+ if (parent == dir) break;
+ dir = parent;
+ }
+ return false;
+}
+function backupStamp(data, target) {
+ if (!data.export.backup || isUnderGit(target)) return null;
+ return new Date().toISOString().replace(/[:.]/g, '-');
+}
+function pruneBackups() {
+ let root = PathModule.join(SystemInfo.user_data_directory, 'armor_trim_editor_backups');
+ let stamps = readDir(root).filter(name => /^\d{4}-\d\d-\d\dT/.test(name)).sort();
+ for (let name of stamps.slice(0, Math.max(0, stamps.length - BACKUPS_KEPT))) {
+ try { getFS().rmSync(PathModule.join(root, name), {recursive: true, force: true}); } catch (err) { console.warn('[Trim Editor] backup cleanup:', err); }
+ }
+}
+function backupFile(path, pack, stamp) {
+ let fs = getFS();
+ if (!fs.existsSync(path)) return;
+ let rel = PathModule.relative(pack, path);
+ let target = PathModule.join(SystemInfo.user_data_directory, 'armor_trim_editor_backups', stamp, PathModule.basename(pack), rel);
+ ensureDir(PathModule.dirname(target));
+ fs.copyFileSync(path, target);
+}
+function planHeader(pack) {
+ if (pack.kind == 'zip') return `📦 ${PathModule.basename(pack.path)} — ${pack.existed ? t('archive_update') : t('archive_new')}`;
+ return `📁 ${pack.path}`;
+}
+async function describePlan(plan, data) {
+ let pack = await packStorage(plan.target).load();
+ let mark = (rel) => pack.exists(rel) ? '♻ ' : '+ ';
+ let lines = [planHeader(pack)];
+ lines.push((pack.exists('pack.mcmeta') ? '· ' : '+ ') + 'pack.mcmeta');
+ if (!pack.exists('pack.png') && (pack.kind == 'zip' || !pack.exists('pack.mcmeta')) && findTexture('icon')) lines.push('+ pack.png');
+ let icon_empty = iconIsEmpty(findTexture('icon'));
+ for (let file of plan.files) lines.push(file.icon && icon_empty ? '· ' + t('template_icon_empty_skipped') + ': ' + file.rel : mark(file.rel) + file.rel);
+ if (plan.atlas) lines.push((pack.exists(plan.atlas) ? '✎ ' : '+ ') + plan.atlas);
+ if (data) lines.push(...await describeArmorIcons(pack, data));
+ return lines;
+}
+async function runExport(quiet = false) {
+ let data = D();
+ if (!data) return;
+ let plan = exportPlan(data);
+ let errors = exportPlanErrors(data, plan);
+ if (errors.length) {
+ Blockbench.showMessageBox({title: t('cannot_export'), icon: 'error', message: errors.map(escapeHTML).join(' ')});
+ return;
+ }
+ let written = [];
+ let stamp = backupStamp(data, plan.target);
+ try {
+ let pack = await packStorage(plan.target).load();
+ // Folder packs back up each overwritten file, zip archives are backed up as a whole on save
+ let file_stamp = pack.kind == 'folder' ? stamp : null;
+ let created = !pack.exists('pack.mcmeta');
+ if (created) {
+ pack.write('pack.mcmeta', mcmetaText(plan.version, 'rp'));
+ written.push('pack.mcmeta');
+ }
+ if (!pack.exists('pack.png') && (pack.kind == 'zip' || created)) {
+ let icon = packIconBuffer();
+ if (icon) {
+ pack.write('pack.png', icon);
+ written.push('pack.png');
+ }
+ }
+ let unchanged = 0;
+ let notes = [];
+ // An empty template icon would only replace a real one or add junk files
+ let icon_empty = iconIsEmpty(findTexture('icon'));
+ if (icon_empty && plan.files.some(file => file.icon)) notes.push(t('template_icon_empty_skipped'));
+ for (let file of plan.files) {
+ if (file.icon && icon_empty) continue;
+ let changed;
+ if (file.kind == 'texture') {
+ let texture = findTexture(file.role);
+ if (!texture) continue;
+ changed = await writeTextureIfChanged(pack, file.rel, texture, file_stamp);
+ } else {
+ changed = await writeJSONIfChanged(pack, file.rel, JSON.parse(file.content), file_stamp, 4);
+ }
+ if (changed) written.push(file.rel);
+ else unchanged++;
+ }
+ let atlas_changes = [];
+ if (plan.atlas) {
+ let text = await readPackText(pack, plan.atlas) || '';
+ let ids = [`${plan.ns}:trims/entity/humanoid/${plan.id}`, `${plan.ns}:trims/entity/humanoid_leggings/${plan.id}`];
+ // Resin came with 1.21.4, copper_darker with 1.21.9
+ let permutations = VANILLA_PERMUTATIONS.filter(perm => (perm != 'copper_darker' || plan.version.rp >= 69) && (perm != 'resin' || plan.version.rp >= 46));
+ let result = updateAtlasJSON(text, ids, data.export.sync_permutations, permutations);
+ if (result.changes.length) {
+ writeJSON(pack, plan.atlas, result.json, text, file_stamp);
+ written.push(plan.atlas);
+ }
+ atlas_changes = result.changes;
+ }
+ if (data.export.backup && !stamp) notes.push(t('backup_skipped_git'));
+ let icons_summary = data.export.armor_icons ? await exportArmorIcons(pack, data, file_stamp, written, notes) : '';
+ await pack.save(stamp);
+ if (stamp) pruneBackups();
+ let e = data.export;
+ Prefs.set({pack_type: e.pack_type, pack_path: e.pack_path, zip_dir: e.zip_dir, zip_name: e.zip_name, namespace: e.namespace,
+ icon_texture: e.icon_texture, icon_model: e.icon_model, icon_parent: e.icon_parent, mc_version: data.mc_version});
+ data.last_export = {time: Date.now(), files: written.length};
+ if (quiet) {
+ let extra = notes.length ? notes[0] : unchanged ? t('files_unchanged', [unchanged]) : '';
+ notify(t('trim_exported_files', [plan.id, written.length]) + (extra ? ' · ' + extra : ''), notes.length ? 5000 : 2500);
+ } else {
+ showExportResult(plan, pack, written, atlas_changes, notes, icons_summary, unchanged);
+ }
+ } catch (err) {
+ showError(t('export_failed'), err);
+ }
+}
+function itemSnippet(plan) {
+ return JSON.stringify({threshold: 0, model: {type: 'minecraft:model', model: plan.icon_model_id}}, null, 4);
+}
+function showExportResult(plan, pack, written, atlas_changes, notes = [], icons_summary = '', unchanged = 0) {
+ let html = `
`).join('') || t('no_problems_found');
+ Blockbench.showMessageBox({title: t('trim_check'), message: html});
+ },
+ }));
+ actions.armor_icons = track(new Action('armor_trim_editor_armor_icons', {
+ name: t('armor_icons_generators_action'), icon: 'auto_awesome', category: 'edit', condition,
+ click: () => openArmorIconGenerators(),
+ }));
+ actions.icon_grid = track(new Action('armor_trim_editor_icon_grid', {
+ name: t('icon_grid_title'), icon: 'apps', category: 'view', condition,
+ click: () => openIconGrid(),
+ }));
+ actions.icon_focus = track(new Action('armor_trim_editor_icon_focus', {
+ name: t('paint_armor_icons'), icon: 'crop_free', category: 'view', condition,
+ click: () => setIconFocus(!isIconFocus()),
+ }));
+ actions.icons_help = track(new Action('armor_trim_editor_armor_icons_help', {
+ name: t('armor_icons_full'), icon: 'help_outline', category: 'help',
+ click: () => openArmorIconsHelp(),
+ }));
+ actions.datapack = track(new Action('armor_trim_editor_datapack', {
+ name: t('datapack'), icon: 'dns', category: 'file', condition,
+ click: () => openDatapackDialog(),
+ }));
+ actions.guide = track(new Action('armor_trim_editor_guide', {
+ name: t('guide_menu'), icon: 'sports_esports', category: 'help',
+ click: () => openGameGuide(),
+ }));
+ actions.settings = track(new Action('armor_trim_editor_settings', {
+ name: t('trim_editor_settings_2'), icon: 'settings', category: 'settings',
+ click: () => { try { openSettingsDialog(); } catch (err) { showError(t('error'), err); } },
+ }));
+ actions.help = track(new Action('armor_trim_editor_help', {
+ name: t('how_trims_work'), icon: 'help', category: 'help',
+ click: () => openHelpDialog(),
+ }));
+
+ menu = new BarMenu('armor_trim_editor', [
+ 'armor_trim_editor_new', 'armor_trim_editor_import', '_',
+ 'armor_trim_editor_export', 'armor_trim_editor_quick_export', 'armor_trim_editor_datapack', '_',
+ 'armor_trim_editor_icon', 'armor_trim_editor_check',
+ {name: t('clear_trim_piece'), id: 'armor_trim_editor_clear', icon: 'layers_clear', condition: () => isTrimProject(),
+ children: PIECE_ORDER.map(piece => ({name: PIECE_NAMES[piece], icon: 'clear', click: () => confirmClearPiece(piece)}))},
+ '_',
+ 'armor_trim_editor_icon_focus', 'armor_trim_editor_armor_icons', 'armor_trim_editor_icon_grid',
+ '_',
+ 'armor_trim_editor_settings', 'armor_trim_editor_guide', 'armor_trim_editor_help', 'armor_trim_editor_armor_icons_help',
+ ], {name: t('trim'), condition: () => isTrimProject()});
+ // Keep "Help" as the last menu
+ if (MenuBar.menus.help) {
+ let help = MenuBar.menus.help;
+ delete MenuBar.menus.help;
+ MenuBar.menus.help = help;
+ }
+ MenuBar.update();
+ MenuBar.addAction(actions.import, 'file.import');
+ MenuBar.addAction(actions.export, 'file.export');
+}
+
+function onProjectChange() {
+ PoseRuntime.last_time = 0;
+ if (icon_focus && !isIconFocus()) {
+ // The flat icon view belongs to the project it was opened in
+ icon_focus = null;
+ if (Preview.selected) Preview.selected.controls.enableRotate = true;
+ }
+ if (isTrimProject()) {
+ D();
+ setTimeout(() => {
+ if (!isTrimProject()) return;
+ // Projects from 1.0 get the armor icons on first open
+ if (ensureArmorIcons()) refreshArmorIcons();
+ updatePreviewUniforms();
+ applyVisibility();
+ refreshPanels();
+ }, 50);
+ }
+}
+
+let frame_counter = 0;
+function onFrame() {
+ if (!isTrimProject()) return;
+ PoseRuntime.frame();
+ // Pixel grids on the locked reference cubes only add noise
+ for (let cube of Cube.all) {
+ let grid = cube.mesh && cube.mesh.grid_box;
+ if (grid && grid.visible && cube.trim_role && (cube.trim_role.startsWith('skin/') || cube.trim_role.startsWith('armor/') || cube.trim_role.startsWith('aiconbase/'))) {
+ grid.visible = false;
+ }
+ }
+ if (++frame_counter % 60 == 0) {
+ // Materials get rebuilt when textures reload; re-apply the preview patch
+ for (let texture of trimTextures()) {
+ let mat = texture.getOwnMaterial && texture.getOwnMaterial();
+ if (mat && mat.uniforms && (!mat.uniforms.TRIM_MODE || mat.uniforms.TRIM_ARMOR_MAP.value !== armorMapFor(texture))) {
+ updatePreviewUniforms();
+ return;
+ }
+ }
+ for (let texture of iconTextures()) {
+ let mat = texture.getOwnMaterial && texture.getOwnMaterial();
+ if (mat && mat.uniforms && !mat.uniforms.TRIM_MODE) {
+ updatePreviewUniforms();
+ return;
+ }
+ }
+ }
+}
+function onPointer(event) {
+ if (event.type == 'pointerdown' && event.target && event.target.tagName == 'CANVAS' && event.target.closest && event.target.closest('.preview')) {
+ PoseRuntime.mouse_down = true;
+ } else if (event.type == 'pointerup') {
+ PoseRuntime.mouse_down = false;
+ }
+}
+
+Plugin.register(PLUGIN_ID, {
+ title: 'Armor Trim Editor',
+ author: 'BbIJABNPOBATEJb',
+ description: 'Paint Minecraft: Java Edition armor trims on an exact armor model with poses, skins and a live material preview, draw how they look on armor icons, then export them straight into a resource pack and a datapack.',
+ icon: 'checkroom',
+ version: PLUGIN_VERSION,
+ min_version: '5.0.0',
+ variant: 'desktop',
+ tags: ['Minecraft: Java Edition', 'Paint', 'Exporter'],
+ creation_date: '2026-09-27',
+ has_changelog: true,
+ contributes: {
+ formats: [FORMAT_ID],
+ },
+ website: 'https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor',
+ repository: 'https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor',
+ bug_tracker: 'https://github.com/BbIJABNPOBATEJb/Armor-Trim-Editor/issues',
+ onload() {
+ track(Blockbench.addCSS(CSS));
+ registerFormat();
+ registerActions();
+ createPanels();
+ track(Blockbench.on('select_project', onProjectChange));
+ track(Blockbench.on('load_project', onProjectChange));
+ track(Blockbench.on('render_frame', onFrame));
+ document.addEventListener('pointerdown', onPointer, true);
+ document.addEventListener('pointerup', onPointer, true);
+ if (isTrimProject()) onProjectChange();
+ },
+ onunload() {
+ document.removeEventListener('pointerdown', onPointer, true);
+ document.removeEventListener('pointerup', onPointer, true);
+ clearInterval(icon_timer);
+ if (icon_focus && Preview.selected) Preview.selected.controls.enableRotate = true;
+ icon_focus = null;
+ try { PoseRuntime.reset(); } catch (err) {}
+ for (let project of ModelProject.all || []) {
+ for (let texture of project.textures || []) {
+ try { unpatchMaterial(texture); } catch (err) {}
+ }
+ }
+ MenuBar.removeAction('file.import.armor_trim_editor_import');
+ MenuBar.removeAction('file.export.armor_trim_editor_export');
+ for (let item of deletables.splice(0)) {
+ try { item.delete(); } catch (err) { console.warn(err); }
+ }
+ if (menu) { menu.delete(); menu = null; MenuBar.update(); }
+ for (let property of properties.splice(0)) property.delete();
+ if (format) { format.delete(); format = null; }
+ },
+});
+
+// ============================================================================
+// Translations. English is the base language, others are added through Language.addTranslations
+// ============================================================================
+
+function getTranslations() {
+ return {
+ en: {
+ quartz: "Quartz",
+ iron: "Iron",
+ netherite: "Netherite",
+ redstone: "Redstone",
+ copper: "Copper",
+ gold: "Gold",
+ emerald: "Emerald",
+ diamond: "Diamond",
+ lapis: "Lapis",
+ amethyst: "Amethyst",
+ resin: "Resin",
+ no_armor: "No armor",
+ leather: "Leather",
+ chainmail: "Chainmail",
+ iron_2: "Iron",
+ copper_2: "Copper",
+ gold_2: "Gold",
+ diamond_2: "Diamond",
+ netherite_2: "Netherite",
+ turtle_shell: "Turtle shell",
+ helmet: "helmet",
+ helmet_outer_layer: "helmet, outer layer",
+ chestplate_body: "chestplate, body",
+ chestplate_right_arm: "chestplate, right arm",
+ chestplate_left_arm: "chestplate, left arm",
+ leggings_waist: "leggings, waist",
+ leggings_right_leg: "leggings, right leg",
+ leggings_left_leg: "leggings, left leg",
+ boots_right: "boots, right",
+ boots_left: "boots, left",
+ head: "head",
+ hat_layer: "hat layer",
+ body: "body",
+ jacket: "jacket",
+ right_arm: "right arm",
+ right_sleeve: "right sleeve",
+ left_arm: "left arm",
+ left_sleeve: "left sleeve",
+ right_leg: "right leg",
+ right_pants: "right pants",
+ left_leg: "left leg",
+ left_pants: "left pants",
+ helmet_2: "Helmet",
+ chestplate: "Chestplate",
+ leggings: "Leggings",
+ boots: "Boots",
+ file_access_requires_the_desktop_app: "File access requires the desktop app.",
+ needed_to_read_the_minecraft_jar_skins: "Needed to read the Minecraft jar (skins, armor, palettes) and to write trims into your resource pack.",
+ file_access_was_denied: "File access was denied.",
+ to_reveal_the_exported_trim_in_the_file: "To reveal the exported trim in the file explorer.",
+ minecraft_client_jar_not_found_set_it_in: "Minecraft client jar not found. Set it in \"Trim → Settings\".",
+ armor_preview: "⚙ armor (preview)",
+ armor_leggings_preview: "⚙ armor leggings (preview)",
+ skin_preview: "⚙ skin (preview)",
+ trim: "Trim",
+ armor: "Armor",
+ skin: "Skin",
+ item_icon: "Item icon",
+ could_not_create_trim: "Could not create trim",
+ player_not_found: "Player not found",
+ standing: "Standing",
+ idle: "Idle",
+ walking: "Walking",
+ sprinting: "Sprinting",
+ sneaking: "Sneaking",
+ sneak_walk: "Sneak walk",
+ riding: "Riding",
+ attack: "Attack",
+ bow: "Bow",
+ crossbow: "Crossbow",
+ shield: "Shield",
+ trident: "Trident",
+ spyglass: "Spyglass",
+ arms_forward: "Arms forward",
+ t_pose: "T-pose",
+ waving: "Waving",
+ swimming: "Swimming",
+ elytra: "Elytra",
+ pack: "Pack: ",
+ current_icon: "Current icon",
+ simple_tablet: "Simple tablet",
+ template: "Template: ",
+ template_netherite_upgrade: "Template: netherite upgrade",
+ icon_generator: "Icon generator",
+ recolor_glyph: "Recolor glyph",
+ keep: "Keep",
+ remove_glyph: "Remove glyph",
+ the_trim_is_empty_nothing_to_sample: "The trim is empty, nothing to sample.",
+ base: "Base",
+ result: "Result",
+ body_color: "Body color",
+ glyph_color: "Glyph color",
+ glyph: "Glyph",
+ contrast: "Contrast",
+ sample_colors_from_trim: "Sample colors from trim",
+ the_glyph_cyan_pixels_of_vanilla: "The glyph (cyan pixels of vanilla templates) is recolored separately. Touch the icon up by hand afterwards — texture \"icon\".",
+ generate_icon: "Generate icon",
+ icon_updated: "Icon updated",
+ size_must_be_2_1_64_32_128_64: "%0: size %1×%2 must be 2:1 (64×32, 128×64…)",
+ px_outside_the_uv_layout_invisible_in: "%0: %1 px outside the UV layout — invisible in game",
+ remove: "Remove",
+ semi_transparent_px_trims_render_as: "%0: %1 semi-transparent px — trims render as cutout: alpha < 10% vanishes, the rest becomes opaque",
+ match_game: "Match game",
+ px_are_close_to_palette_colors_but_will: "%0: %1 px are close to palette colors but will not be recolored",
+ snap_to_palette: "Snap to palette",
+ px_follow_the_material_px_keep_their: "%0: %1 px follow the material, %2 px keep their color",
+ the_trim_is_empty: "The trim is empty.",
+ the_icon_is_not_square: "The icon is not square.",
+ fix_trim: "Fix trim",
+ trim_id_is_empty: "Trim ID is empty.",
+ trim_id_may_only_contain_a_z_0_9: "Trim ID may only contain a-z, 0-9, _ . -",
+ clear_trim_piece: "Clear trim piece",
+ erase_from_the_trim_texture_you_can_undo: "Erase \"%0\" from the trim texture? You can undo it (Ctrl+Z).",
+ erase: "Erase",
+ cancel: "Cancel",
+ no_resource_pack_folder_selected: "No resource pack folder selected.",
+ resource_pack_folder_not_found: "Resource pack folder not found: ",
+ invalid_texture_namespace: "Invalid texture namespace.",
+ invalid_icon_path: "Invalid icon path: ",
+ created_paletted_permutations_source: "created paletted_permutations source",
+ added_texture: "added texture ",
+ added_palette: "added palette ",
+ cannot_export: "Cannot export",
+ trim_exported_files: "Trim \"%0\" exported (%1 files)",
+ export_failed: "Export failed",
+ files_written: "Files written",
+ atlas: "Atlas",
+ in_game_press_f3_t_to_reload_resources: "In game: press F3+T to reload resources.",
+ trim_exported: "Trim exported",
+ copy_items_entry: "Copy items entry",
+ open_folder: "Open folder",
+ done: "Done",
+ copied_fill_in_the_threshold: "Copied (fill in the threshold)",
+ export_trim_to_resource_pack: "Export trim to resource pack",
+ trim_id: "Trim ID",
+ file_name_and_pattern_asset_id_as_in_the: "File name and pattern asset_id (as in the datapack trim_pattern).",
+ resource_pack_folder: "Resource pack folder",
+ texture_namespace: "Texture namespace",
+ namespace_of_the_pattern_asset_id: "Namespace of the pattern asset_id.",
+ atlas_assets_minecraft_atlases_armor: "**Atlas** `assets/minecraft/atlases/armor_trims.json`",
+ register_in_atlas: "Register in atlas",
+ add_missing_vanilla_palettes: "Add missing vanilla palettes",
+ e_g_copper_darker_without_it_a_copper: "E.g. copper_darker: without it a copper trim on copper armor shows a missing texture.",
+ template_icon_id_is_replaced_with_the: "**Template icon** (`{id}` is replaced with the trim ID)",
+ export_icon_and_model: "Export icon and model",
+ icon_texture: "Icon texture",
+ icon_model: "Icon model",
+ model_parent: "Model parent",
+ other: "**Other**",
+ back_up_overwritten_files: "Back up overwritten files",
+ copies_go_to_blockbench_data_armor_trim: "Copies go to Blockbench data/armor_trim_editor_backups. Not for packs under git, which already keep the history; only the latest 10 backups are kept.",
+ open_trim_from_resource_pack: "Open trim from resource pack",
+ no_trims_found_in_this_pack: "No trims found in this pack.",
+ pack_2: "Pack",
+ icon: "Icon",
+ search: "Search",
+ atlas_2: "atlas",
+ empty: "Empty",
+ vanilla: "Vanilla: ",
+ new_armor_trim: "New armor trim",
+ start_from: "Start from",
+ resolution: "Resolution",
+ armor_under_trim: "Armor under trim",
+ could_not_load_vanilla_trim: "Could not load vanilla trim",
+ other_file: "Other file…",
+ trim_editor_settings: "Trim Editor settings",
+ minecraft_client_jar: "Minecraft client jar",
+ jar_path: "Jar path",
+ the_jar_provides_default_skins_armor: "The jar provides default skins, armor textures, template icons and vanilla trims. Nothing from it is copied into your pack.",
+ jar_saved: "Jar saved",
+ helmet_0_0_at_1_0_and_outer_hat_32_0_at: "helmet (0,0) at 1.0 and outer \"hat\" (32,0) at 1.5; chestplate body (16,16) and arms (40,16) at 1.0; boots: legs (0,16) at 0.9",
+ leggings_waist_16_16_at_0_5_legs_0_16_at: "leggings: waist (16,16) at 0.5, legs (0,16) at 0.4",
+ a_trim_is_drawn_on_the_same_model_as_the: "A trim is drawn on the same model as the armor. Numbers are how far each box is inflated around the player (in pixels).",
+ two_layers_on_the_helmet_are_the_left: "\"Two layers\" on the helmet are the left (head, 1.0) and right (hat, 1.5) halves of the humanoid top row. Pixels on the right float 0.5 px above the helmet.",
+ left_arm_and_leg_reuse_the_right_side: "Left arm and leg reuse the right side area (mirrored) — they cannot differ.",
+ palette_only_the_8_grays_e0e0e0_000000: "Palette: only the 8 grays (#E0E0E0 … #000000) are recolored by the material. Any other color stays as painted. A trim material matching the armor (gold on gold) uses the \"_darker\" palette.",
+ transparency_trims_render_as_cutout: "Transparency: trims render as cutout — alpha below 10% is discarded, everything else is opaque.",
+ server_the_pattern_is_registered_by_a: "Server: the pattern is registered by a datapack (data/<ns>/trim_pattern/<id>.json, asset_id = <ns>:<id>). decal: true draws the trim only on top of armor pixels.",
+ how_armor_trims_work: "How armor trims work",
+ trim_preview: "Trim: preview",
+ skin_overlay: "Skin overlay",
+ from_file: "from file",
+ as_painted: "as painted",
+ darker_palette: " (darker palette)",
+ skin_not_loaded: "Skin not loaded",
+ invalid_nickname: "Invalid nickname",
+ loading: "loading…",
+ view: "View",
+ pose: "Pose",
+ armor_pieces: "Armor pieces",
+ vanilla_atlas_note: "This is a vanilla pattern name, so the vanilla atlas already registers it.",
+ right_click_solo: "right click — solo",
+ left_half_of_the_humanoid_top_row_0_0: "Left half of the humanoid top row (0,0)",
+ helmet_1_0: "Helmet 1.0",
+ right_half_of_the_humanoid_top_row_32_0: "Right half of the humanoid top row (32,0), floats 0.5 px above the helmet",
+ helmet_1_5_outer: "Helmet 1.5 (outer)",
+ leather_dye: "Leather dye",
+ trim_material: "Trim material",
+ as_painted_2: "As painted",
+ pink_follow_the_material_cyan_keep_their: "Pink follow the material, cyan keep their color",
+ highlight_palette: "Highlight palette",
+ play: "Play",
+ pause: "Pause",
+ speed: "Speed",
+ reset_head: "Reset head",
+ head_2: "Head ↔",
+ head_3: "Head ↕",
+ animation_freezes_while_you_paint_poses: "Animation freezes while you paint. Poses are preview-only and never saved into the textures.",
+ slim_arms: "slim arms",
+ wide_arms: "wide arms",
+ default_skins: "Default skins",
+ player_skin_by_name: "Player skin by name",
+ name: "Name",
+ load: "Load",
+ skin_from_file: "Skin from file",
+ wide_arms_2: "Wide arms",
+ slim_arms_2: "Slim arms",
+ armor_uses_the_same_wide_arms_for_slim: "Armor uses the same wide arms for slim skins in game.",
+ trim_palette_export: "Trim: palette & export",
+ no_resource_pack: "no resource pack",
+ trim_palette: "Trim palette",
+ top_color_to_paint_with_bottom_result: "Top: color to paint with, bottom: result with the selected material. Other colors stay fixed.",
+ export: "Export",
+ export_with_the_last_settings_ctrl_alt_e: "Export with the last settings (Ctrl+Alt+E)",
+ quick: "Quick",
+ check: "Check",
+ no_problems_found: "No problems found.",
+ armor_trim: "Armor Trim",
+ paint_minecraft_armor_trims_on_an: "Paint Minecraft armor trims on an accurate armor model with poses and resource pack export",
+ exact_armor_model_from_the_game_client: "* Exact armor model from the game client: helmet (1.0 + outer 1.5), chestplate, leggings, boots\n* Material preview (quartz, gold, …) while painting\n* Player poses and animations, skins (default, file, player name)\n* Template icon generator and resource pack export with atlas registration",
+ new_trim: "New trim",
+ new_trim_2: "New trim…",
+ open_trim_from_resource_pack_2: "Open trim from resource pack…",
+ error: "Error",
+ export_trim_to_resource_pack_2: "Export trim to resource pack…",
+ quick_export_trim: "Quick export trim",
+ icon_generator_2: "Icon generator…",
+ check_trim: "Check trim",
+ trim_check: "Trim check",
+ trim_editor_settings_2: "Trim Editor settings…",
+ how_trims_work: "How trims work",
+ datapack: "Datapack…",
+ datapack_short: "Datapack",
+ dp_title: "Trim pattern datapack",
+ dp_pattern_info: "Pattern **%0**. The trim ID and namespace come from the export settings.",
+ dp_version: "Minecraft version",
+ dp_decal_desc: "Draw the trim only over armor pixels. Preview it with the Decal switch in the View tab.",
+ dp_names: "Names",
+ dp_names_desc: "One per line: language=name, e.g. en_us=Clouds. Written to assets/minecraft/lang/.json of the resource pack as trim_pattern.%0.",
+ dp_will_be_written: "Will be written (♻ overwrite, ✎ modify, · unchanged):",
+ dp_no_folder: "No datapacks folder selected.",
+ dp_not_folder: "Not a folder: ",
+ dp_rp: "resource pack: ",
+ dp_names_need_pack: "Names are skipped: choose the resource pack in the export settings first.",
+ dp_bad_name_line: "Skipped line (expected language=name): %0",
+ dp_format_mismatch: "pack.mcmeta was kept as is, but its format is %0 while %1 uses %2.",
+ dp_done_title: "Datapack updated",
+ copy_give: "Copy /give",
+ copy_code: "Copy Paper code",
+ copied: "Copied",
+ guide_menu: "How to use a trim in game",
+ guide_title: "Using the trim in game",
+ guide_server_h: "Server",
+ guide_server_1: "Put the datapack zip into world/datapacks of the main world, or pick that folder in the generator right away.",
+ guide_server_2: "Restart the server: new trim patterns are loaded only when the world starts, /reload does not add them.",
+ guide_server_3: "Players need the resource pack with the textures (the Export button).",
+ guide_give_h: "Command",
+ guide_material: "The material only recolors the 8 palette grays; a trim painted in its own colors looks the same with any material, e.g. redstone.",
+ guide_smithing: "The pattern has no smithing template, so it can only be applied by commands or plugins.",
+ guide_plugin_h: "Bukkit / Paper plugin",
+ guide_plugin_note: "On Spigot use Registry.TRIM_PATTERN.get(key). If the pattern is null, the datapack was not loaded.",
+ rp_type: "Save as",
+ rp_type_zip: "Zip archive",
+ rp_type_folder: "Folder",
+ zip_dir: "Archive folder",
+ zip_dir_desc: "For example .minecraft/resourcepacks. A new archive gets pack.mcmeta and pack.png.",
+ zip_name: "Archive name",
+ zip_name_desc: "Without .zip. An existing archive is updated, everything else in it is kept.",
+ rp_folder_desc: "An unpacked resource pack. pack.mcmeta is created if the folder has none.",
+ mc_version_desc: "Sets the format in pack.mcmeta of a new pack.",
+ no_zip_folder: "No folder for the archive selected.",
+ invalid_zip_name: "Invalid archive name.",
+ archive_new: "new archive",
+ archive_update: "will be updated",
+ written_to: "Written to",
+ dp_dir: "Datapacks folder",
+ dp_dir_desc: "For example saves//datapacks. The datapack is saved as a zip archive.",
+ dp_name_desc: "Without .zip. An existing datapack is updated, its other trims are kept.",
+ folder_or_zip: "Folder or .zip",
+ pose_spread: "Standing, parts apart",
+ pose_tpose_spread: "T-pose, parts apart",
+ decal_preview_desc: "Preview of \"decal\": true — trim pixels are only drawn over armor pixels, so the outer helmet layer and holes in the armor stay empty. The same setting goes into the datapack.",
+ armor_icons: "Armor icons",
+ armor_icons_full: "Trim on armor icons",
+ icons_tab: "Icons",
+ armor_icon_bases: "⚙ armor items (preview)",
+ armor_icon_card: "Armor icon: %0",
+ armor_icon_base_card: "⚙ item: %0",
+ slot_helmet: "Helmet",
+ slot_chestplate: "Chestplate",
+ slot_leggings: "Leggings",
+ slot_boots: "Boots",
+ slot_netherite_helmet: "Netherite helmet",
+ slot_turtle_helmet: "Turtle shell",
+ slot_netherite_boots: "Netherite boots",
+ armor_icons_short: "In vanilla every trim looks the same on armor items in the inventory. Here you draw how this trim looks on each armor shape.",
+ what_is_this: "How it works",
+ paint_icons: "Paint icons",
+ paint_armor_icons: "Paint armor icons",
+ back_to_player: "Back to player",
+ all_variants: "All variants",
+ armor_icons_generators: "Generators",
+ armor_icons_generators_action: "Armor icon generators…",
+ icon_colors: "Icon colors",
+ icon_colors_palette: "Follow the material",
+ icon_colors_fixed: "Fixed (no material)",
+ icon_colors_palette_hint: "Palette grays are recolored to the trim material, like the trim on the player.",
+ icon_colors_fixed_hint: "The icon is used as drawn with every material. For colorful, non-monochrome trims.",
+ armor_icons_title: "Armor icon generators",
+ armor_icons_click_cards: "click a card to include or skip it",
+ select_all: "All",
+ select_none: "None",
+ icon_source: "Source",
+ icon_source_project: "From the trim on the player",
+ icon_source_vanilla: "Vanilla overlay",
+ icon_source_shape: "Shape",
+ icon_source_copy: "Copy from the common helmet and boots",
+ icon_source_clear: "Clear",
+ icon_source_project_hint: "The front of the painted armor piece is fitted into the item silhouette. A quick start: touch it up by hand afterwards.",
+ icon_source_vanilla_hint: "The overlay the game shows for every pattern. A starting point to draw on.",
+ icon_source_copy_hint: "The netherite helmet, turtle shell and netherite boots get the drawing of the common helmet or boots, fitted to their own shape.",
+ icon_palette_hint: "Shapes are clipped to the item silhouette. Palette grays follow the trim material, other colors stay as they are.",
+ shape: "Shape",
+ shape_step: "Spacing",
+ shape_size: "Thickness",
+ shape_color: "Color",
+ custom_color: "Custom color",
+ shape_outline: "Outline",
+ shape_inner_outline: "Inner outline",
+ shape_stripes_h: "Horizontal stripes",
+ shape_stripes_v: "Vertical stripes",
+ shape_diagonal: "Diagonal stripes",
+ shape_diagonal2: "Diagonal stripes, other way",
+ shape_checker: "Checkerboard",
+ shape_dots: "Dots",
+ shape_band_top: "Band at the top",
+ shape_band_middle: "Band in the middle",
+ shape_band_bottom: "Band at the bottom",
+ shape_fill: "Fill",
+ icon_mode: "Current drawing",
+ icon_mode_replace: "Replace",
+ icon_mode_add: "Draw on top",
+ preview_material: "Preview material",
+ generate_armor_icons: "Generate armor icons",
+ icon_grid_title: "Armor icons: all variants",
+ icon_grid_hint: "Rows are armor types, columns are trim materials; the first column shows the icon as drawn. Where the trim material matches the armor, the darker palette is used, as in game.",
+ icon_grid_hint_fixed: "Fixed colors: the icon looks the same with every trim material.",
+ armor_icons_help_why: "Why. In vanilla Minecraft a trimmed helmet, chestplate, leggings or boots in the inventory always shows the same overlay, only its color follows the trim material. Chestplates with different trims look identical.",
+ armor_icons_help_what: "What this does. Here you draw how this trim looks on the item icon. The resource pack gets an overlay for each armor shape, recolored for every trim material. This is the approach of the Visual Armor Trims resource pack by Thanos (CC BY-SA 4.0).",
+ armor_icons_help_slots: "Seven icons. Helmet, chestplate, leggings and boots are shared by leather, chainmail, iron, gold, diamond and copper armor and the netherite chestplate and leggings. The netherite helmet, turtle shell and netherite boots have shapes of their own and get separate icons. Empty icons are not exported: the pack keeps whatever it already has for those items.",
+ armor_icons_help_colors: "Colors. Paint with the 8 palette grays, like the trim itself: they become the material colors (the darker palette on armor of the same material). Other colors stay as drawn. For colorful trims choose Fixed (no material): the icon is then the same with every material.",
+ armor_icons_help_paint: "Painting.Paint icons puts the icons flat in front of the camera; the armor item under each icon is only a preview. You can also select an icon texture and paint in the 2D editor. Generators fill icons from the trim on the player, the vanilla overlay or simple shapes; All variants shows every armor with every material.",
+ armor_icons_help_export: "Export. If the resource pack already has Visual Armor Trims (also inside an overlay), the trim is added to it: textures, atlas, models and item definitions. Otherwise the plugin writes its own item definitions based on the vanilla ones. Needs Minecraft 1.21.5 or newer.",
+ armor_icons_help_short: "Armor icons: in vanilla the trim looks the same on every armor item in the inventory. The Icons tab lets you draw a separate look for this trim, exported in the Visual Armor Trims format.",
+ armor_icons_count: "Armor icons: %0 of %1 drawn. Empty ones are not exported, the pack keeps what it has for them.",
+ armor_icons_export_info: "**Armor icons** — the trim on armor items in the inventory",
+ export_armor_icons: "Export armor icons",
+ export_armor_icons_desc: "Pattern-specific icons for trimmed armor items. Visual Armor Trims in the pack is found and extended.",
+ armor_icons_old_version: "Armor icons were not exported: they need Minecraft 1.21.5 or newer.",
+ armor_icons_no_vanilla_item: "%0: no item definition in the Minecraft jar, skipped.",
+ armor_icons_unknown_item: "%0 has an unexpected format and was not changed.",
+ armor_icons_written: "Armor icons: %0 models, %1 item definitions (%2)",
+ pack_root: "pack root",
+ armor_icons_plan: "armor icons: %0 of %1 → %2, %3",
+ armor_icons_mode_vat: "added to Visual Armor Trims",
+ armor_icons_mode_own: "own item definitions",
+ armor_icons_tag: "armor icons",
+ new_icons_desc: "Icons of this trim on armor items in the inventory. You can regenerate or paint them later.",
+ new_icons_project: "Generate from the trim",
+ new_icons_vanilla: "Vanilla overlay",
+ new_icons_empty: "Empty",
+ files_unchanged: "Unchanged, not rewritten: %0",
+ import_multi_hint: "Ctrl or Shift to open several, each in its own tab",
+ trims_opened: "Trims opened: %0",
+ template_icon_empty_skipped: "The template icon is empty and was not exported",
+ backup_skipped_git: "No backup: the pack is under git",
+ icons_kept_empty_result: "Kept as drawn: %0 (the generator gave an empty icon)",
+ icon_pattern_guessed: "Template icons were found in the pack, the path was filled in automatically.",
+ },
+ ru: {
+ quartz: "Кварц",
+ iron: "Железо",
+ netherite: "Незерит",
+ redstone: "Редстоун",
+ copper: "Медь",
+ gold: "Золото",
+ emerald: "Изумруд",
+ diamond: "Алмаз",
+ lapis: "Лазурит",
+ amethyst: "Аметист",
+ resin: "Смола",
+ no_armor: "Без брони",
+ leather: "Кожаная",
+ chainmail: "Кольчужная",
+ iron_2: "Железная",
+ copper_2: "Медная",
+ gold_2: "Золотая",
+ diamond_2: "Алмазная",
+ netherite_2: "Незеритовая",
+ turtle_shell: "Черепаший шлем",
+ helmet: "шлем",
+ helmet_outer_layer: "шлем, внешний слой",
+ chestplate_body: "нагрудник, торс",
+ chestplate_right_arm: "нагрудник, правая рука",
+ chestplate_left_arm: "нагрудник, левая рука",
+ leggings_waist: "поножи, пояс",
+ leggings_right_leg: "поножи, правая нога",
+ leggings_left_leg: "поножи, левая нога",
+ boots_right: "ботинки, правый",
+ boots_left: "ботинки, левый",
+ head: "голова",
+ hat_layer: "голова, внешний слой",
+ body: "торс",
+ jacket: "торс, внешний слой",
+ right_arm: "правая рука",
+ right_sleeve: "правая рука, внешний слой",
+ left_arm: "левая рука",
+ left_sleeve: "левая рука, внешний слой",
+ right_leg: "правая нога",
+ right_pants: "правая нога, внешний слой",
+ left_leg: "левая нога",
+ left_pants: "левая нога, внешний слой",
+ helmet_2: "Шлем",
+ chestplate: "Нагрудник",
+ leggings: "Поножи",
+ boots: "Ботинки",
+ file_access_requires_the_desktop_app: "Работа с файлами доступна только в десктопной версии Blockbench.",
+ needed_to_read_the_minecraft_jar_skins: "Нужно для чтения jar-файла Minecraft (скины, броня, палитры) и записи отделки в ресурспак.",
+ file_access_was_denied: "Доступ к файлам не выдан.",
+ to_reveal_the_exported_trim_in_the_file: "Чтобы открыть папку с экспортированной отделкой.",
+ minecraft_client_jar_not_found_set_it_in: "Не найден jar-клиент Minecraft. Укажите его в меню «Отделка → Настройки».",
+ armor_preview: "⚙ броня (превью)",
+ armor_leggings_preview: "⚙ броня: поножи (превью)",
+ skin_preview: "⚙ скин (превью)",
+ trim: "Отделка",
+ armor: "Броня",
+ skin: "Скин",
+ item_icon: "Иконка предмета",
+ could_not_create_trim: "Не удалось создать отделку",
+ player_not_found: "Игрок не найден",
+ standing: "Стойка",
+ idle: "Дыхание",
+ walking: "Ходьба",
+ sprinting: "Бег",
+ sneaking: "Присед",
+ sneak_walk: "Крадётся",
+ riding: "Сидит",
+ attack: "Удар",
+ bow: "Лук",
+ crossbow: "Арбалет",
+ shield: "Щит",
+ trident: "Трезубец",
+ spyglass: "Подзорная труба",
+ arms_forward: "Руки вперёд",
+ t_pose: "T-поза",
+ waving: "Машет",
+ swimming: "Плавание",
+ elytra: "Элитры",
+ pack: "РП: ",
+ current_icon: "Текущая иконка",
+ simple_tablet: "Простая табличка",
+ template: "Шаблон: ",
+ template_netherite_upgrade: "Шаблон: улучшение до незерита",
+ icon_generator: "Генератор иконки",
+ recolor_glyph: "Перекрасить узор",
+ keep: "Оставить как есть",
+ remove_glyph: "Убрать узор",
+ the_trim_is_empty_nothing_to_sample: "Отделка пустая — не из чего брать цвета.",
+ base: "Основа",
+ result: "Результат",
+ body_color: "Цвет таблички",
+ glyph_color: "Цвет узора",
+ glyph: "Узор",
+ contrast: "Контраст",
+ sample_colors_from_trim: "Взять цвета из отделки",
+ the_glyph_cyan_pixels_of_vanilla: "Узор (бирюзовые пиксели ванильных шаблонов) перекрашивается отдельно. После генерации иконку можно дорисовать вручную — текстура «icon».",
+ generate_icon: "Генерация иконки",
+ icon_updated: "Иконка обновлена",
+ size_must_be_2_1_64_32_128_64: "%0: размер %1×%2 — нужно соотношение 2:1 (64×32, 128×64…)",
+ px_outside_the_uv_layout_invisible_in: "%0: %1 пикс. вне развёртки — в игре не видны",
+ remove: "Удалить",
+ semi_transparent_px_trims_render_as: "%0: %1 полупрозрачных пикс. — игра рисует отделку без смешивания (cutout): альфа < 10% пропадёт, остальное станет непрозрачным",
+ match_game: "Сделать как в игре",
+ px_are_close_to_palette_colors_but_will: "%0: %1 пикс. почти совпадают с палитрой, но не перекрасятся материалом",
+ snap_to_palette: "Привязать к палитре",
+ px_follow_the_material_px_keep_their: "%0: %1 пикс. перекрашиваются материалом, %2 — фиксированного цвета",
+ the_trim_is_empty: "Отделка пустая.",
+ the_icon_is_not_square: "Иконка не квадратная.",
+ fix_trim: "Исправление отделки",
+ trim_id_is_empty: "Не указан ID отделки.",
+ trim_id_may_only_contain_a_z_0_9: "ID отделки: только a-z, 0-9, _ . -",
+ clear_trim_piece: "Очистить часть отделки",
+ erase_from_the_trim_texture_you_can_undo: "Стереть «%0» в текстуре отделки? Действие можно отменить (Ctrl+Z).",
+ erase: "Стереть",
+ cancel: "Отмена",
+ no_resource_pack_folder_selected: "Не выбрана папка ресурспака.",
+ resource_pack_folder_not_found: "Папка ресурспака не найдена: ",
+ invalid_texture_namespace: "Неверный namespace текстур.",
+ invalid_icon_path: "Неверный путь иконки: ",
+ created_paletted_permutations_source: "создан источник paletted_permutations",
+ added_texture: "добавлена текстура ",
+ added_palette: "добавлена палитра ",
+ cannot_export: "Экспорт невозможен",
+ trim_exported_files: "Отделка «%0» экспортирована (%1 файл.)",
+ export_failed: "Ошибка экспорта",
+ files_written: "Записано файлов",
+ atlas: "Атлас",
+ in_game_press_f3_t_to_reload_resources: "В игре: F3+T для перезагрузки ресурсов.",
+ trim_exported: "Отделка экспортирована",
+ copy_items_entry: "Копировать запись для items",
+ open_folder: "Открыть папку",
+ done: "Готово",
+ copied_fill_in_the_threshold: "Скопировано (threshold заполните сами)",
+ export_trim_to_resource_pack: "Экспорт отделки в ресурспак",
+ trim_id: "ID отделки",
+ file_name_and_pattern_asset_id_as_in_the: "Имя файлов и asset_id паттерна (как в trim_pattern датапака).",
+ resource_pack_folder: "Папка ресурспака",
+ texture_namespace: "Namespace текстур",
+ namespace_of_the_pattern_asset_id: "Namespace из asset_id паттерна (обычно minecraft).",
+ atlas_assets_minecraft_atlases_armor: "**Атлас** `assets/minecraft/atlases/armor_trims.json`",
+ register_in_atlas: "Регистрировать в атласе",
+ add_missing_vanilla_palettes: "Добавить недостающие ванильные палитры",
+ e_g_copper_darker_without_it_a_copper: "Например copper_darker: без неё медная отделка на медной броне будет «missing texture».",
+ template_icon_id_is_replaced_with_the: "**Иконка шаблона** (`{id}` заменяется на ID отделки)",
+ export_icon_and_model: "Экспортировать иконку и модель",
+ icon_texture: "Текстура иконки",
+ icon_model: "Модель иконки",
+ model_parent: "Parent модели",
+ other: "**Прочее**",
+ back_up_overwritten_files: "Резервные копии перезаписываемых файлов",
+ copies_go_to_blockbench_data_armor_trim: "Копии складываются в папку данных Blockbench/armor_trim_editor_backups. Не делается для паков под git — там уже есть история; хранятся 10 последних копий.",
+ open_trim_from_resource_pack: "Открыть отделку из ресурспака",
+ no_trims_found_in_this_pack: "В этом ресурспаке отделок не найдено.",
+ pack_2: "Ресурспак",
+ icon: "Иконка",
+ search: "Поиск",
+ atlas_2: "атлас",
+ empty: "Пустой",
+ vanilla: "Ванильный: ",
+ new_armor_trim: "Новая отделка брони",
+ start_from: "Основа",
+ resolution: "Разрешение",
+ armor_under_trim: "Броня под отделкой",
+ could_not_load_vanilla_trim: "Не удалось загрузить ванильную отделку",
+ other_file: "Другой файл…",
+ trim_editor_settings: "Настройки Trim Editor",
+ minecraft_client_jar: "Jar клиента Minecraft",
+ jar_path: "Путь к jar",
+ the_jar_provides_default_skins_armor: "Из jar берутся ванильные скины, текстуры брони, шаблоны иконок и ванильные отделки. В ресурспак ничего из jar не копируется.",
+ jar_saved: "Jar сохранён",
+ helmet_0_0_at_1_0_and_outer_hat_32_0_at: "шлем (0,0) — слой 1.0 и внешний слой «hat» (32,0) — 1.5; нагрудник: торс (16,16) и руки (40,16) — 1.0; ботинки: ноги (0,16) — 0.9",
+ leggings_waist_16_16_at_0_5_legs_0_16_at: "поножи: пояс (16,16) — 0.5, ноги (0,16) — 0.4",
+ a_trim_is_drawn_on_the_same_model_as_the: "Отделка рисуется поверх брони той же моделью, что и броня. Числа — насколько куб раздут относительно тела игрока (в пикселях).",
+ two_layers_on_the_helmet_are_the_left: "«Два слоя» на шлеме — это левая (голова, 1.0) и правая (hat, 1.5) половины верхней части humanoid. Пиксели справа висят над шлемом на 0.5 пикселя.",
+ left_arm_and_leg_reuse_the_right_side: "Левые рука и нога используют ту же область текстуры, что и правые (зеркально) — нарисовать их по-разному нельзя.",
+ palette_only_the_8_grays_e0e0e0_000000: "Палитра: только 8 серых оттенков (#E0E0E0 … #000000) перекрашиваются материалом. Любой другой цвет остаётся как нарисован. Отделка из того же материала, что и броня (золото на золоте), берёт палитру «_darker».",
+ transparency_trims_render_as_cutout: "Прозрачность: отделка рисуется как cutout — альфа < 10% отбрасывается, остальное становится непрозрачным.",
+ server_the_pattern_is_registered_by_a: "Сервер: паттерн регистрируется датапаком (data/<ns>/trim_pattern/<id>.json, поле asset_id = <ns>:<id>). Параметр decal: true рисует отделку только там, где есть броня.",
+ how_armor_trims_work: "Как устроена отделка брони",
+ trim_preview: "Отделка",
+ skin_overlay: "Слой скина",
+ from_file: "из файла",
+ as_painted: "как нарисовано",
+ darker_palette: " (тёмная палитра)",
+ skin_not_loaded: "Скин не загружен",
+ invalid_nickname: "Неверный ник",
+ loading: "загрузка…",
+ view: "Вид",
+ pose: "Поза",
+ armor_pieces: "Части брони",
+ vanilla_atlas_note: "Это имя ванильного паттерна — он уже зарегистрирован в ванильном атласе.",
+ right_click_solo: "ПКМ — только эта",
+ left_half_of_the_humanoid_top_row_0_0: "Левая половина верха humanoid (0,0)",
+ helmet_1_0: "Шлем 1.0",
+ right_half_of_the_humanoid_top_row_32_0: "Правая половина верха humanoid (32,0), висит на 0.5 px над шлемом",
+ helmet_1_5_outer: "Шлем 1.5 (внешний)",
+ leather_dye: "Цвет кожаной брони",
+ trim_material: "Материал отделки",
+ as_painted_2: "Как нарисовано",
+ pink_follow_the_material_cyan_keep_their: "Розовые — перекрашиваются материалом, голубые — фиксированный цвет",
+ highlight_palette: "Подсветить палитру",
+ play: "Продолжить",
+ pause: "Пауза",
+ speed: "Скорость",
+ reset_head: "Сбросить поворот головы",
+ head_2: "Голова ↔",
+ head_3: "Голова ↕",
+ animation_freezes_while_you_paint_poses: "Во время рисования анимация замирает. Позы только для просмотра — в файл не записываются.",
+ slim_arms: "тонкие руки",
+ wide_arms: "широкие руки",
+ default_skins: "Стандартные скины",
+ player_skin_by_name: "Скин игрока по нику",
+ name: "Ник",
+ load: "Загрузить",
+ skin_from_file: "Скин из файла",
+ wide_arms_2: "Широкие руки",
+ slim_arms_2: "Тонкие руки",
+ armor_uses_the_same_wide_arms_for_slim: "Броня для тонких рук в игре та же, что и для широких.",
+ trim_palette_export: "Отделка: палитра и экспорт",
+ no_resource_pack: "ресурспак не выбран",
+ trim_palette: "Палитра отделки",
+ top_color_to_paint_with_bottom_result: "Верх — цвет для рисования, низ — результат у выбранного материала. Остальные цвета не перекрашиваются.",
+ export: "Экспорт",
+ export_with_the_last_settings_ctrl_alt_e: "Экспорт с последними настройками (Ctrl+Alt+E)",
+ quick: "Быстро",
+ check: "Проверка",
+ no_problems_found: "Проблем не найдено.",
+ armor_trim: "Отделка брони",
+ paint_minecraft_armor_trims_on_an: "Рисование отделки брони Minecraft с точной моделью брони, позами и экспортом в ресурспак",
+ exact_armor_model_from_the_game_client: "* Точная модель брони из клиента игры: шлем (1.0 + внешний слой 1.5), нагрудник, поножи, ботинки\n* Превью материалов (кварц, золото, …) прямо во время рисования\n* Позы и анимации игрока, смена скина (ванильные, файл, ник)\n* Генератор иконки шаблона и экспорт в ресурспак с регистрацией в атласе",
+ new_trim: "Новая отделка",
+ new_trim_2: "Новая отделка…",
+ open_trim_from_resource_pack_2: "Открыть отделку из ресурспака…",
+ error: "Ошибка",
+ export_trim_to_resource_pack_2: "Экспорт отделки в ресурспак…",
+ quick_export_trim: "Быстрый экспорт отделки",
+ icon_generator_2: "Генератор иконки…",
+ check_trim: "Проверить отделку",
+ trim_check: "Проверка отделки",
+ trim_editor_settings_2: "Настройки Trim Editor…",
+ how_trims_work: "Как устроена отделка",
+ datapack: "Датапак…",
+ datapack_short: "Датапак",
+ dp_title: "Датапак паттерна отделки",
+ dp_pattern_info: "Паттерн **%0**. ID отделки и namespace берутся из настроек экспорта.",
+ dp_version: "Версия Minecraft",
+ dp_decal_desc: "Рисовать отделку только поверх пикселей брони. Посмотреть результат — переключатель Decal во вкладке «Вид».",
+ dp_names: "Названия",
+ dp_names_desc: "По одному в строке: язык=название, например ru_ru=Облака. Записываются в assets/minecraft/lang/<язык>.json ресурспака как trim_pattern.%0.",
+ dp_will_be_written: "Будут записаны (♻ — перезапись, ✎ — изменение, · — без изменений):",
+ dp_no_folder: "Не выбрана папка datapacks.",
+ dp_not_folder: "Это не папка: ",
+ dp_rp: "ресурспак: ",
+ dp_names_need_pack: "Названия пропущены: сначала выберите ресурспак в настройках экспорта.",
+ dp_bad_name_line: "Строка пропущена (нужно язык=название): %0",
+ dp_format_mismatch: "pack.mcmeta оставлен как есть, но его формат %0, а для %1 нужен %2.",
+ dp_done_title: "Датапак обновлён",
+ copy_give: "Копировать /give",
+ copy_code: "Копировать код Paper",
+ copied: "Скопировано",
+ guide_menu: "Как выдать отделку в игре",
+ guide_title: "Как выдать отделку в игре",
+ guide_server_h: "Сервер",
+ guide_server_1: "Положите zip датапака в world/datapacks основного мира или сразу выберите эту папку в генераторе.",
+ guide_server_2: "Перезапустите сервер: новые паттерны отделки загружаются только при запуске мира, /reload их не добавит.",
+ guide_server_3: "Игрокам нужен ресурспак с текстурами (кнопка Экспорт).",
+ guide_give_h: "Командой",
+ guide_material: "Материал перекрашивает только 8 серых оттенков палитры; отделка, нарисованная своими цветами, выглядит одинаково с любым материалом, например redstone.",
+ guide_smithing: "У паттерна нет кузнечного шаблона, поэтому наложить его можно только командой или плагином.",
+ guide_plugin_h: "Плагин Bukkit / Paper",
+ guide_plugin_note: "На Spigot используйте Registry.TRIM_PATTERN.get(key). Если паттерн null — датапак не загрузился.",
+ rp_type: "Сохранить как",
+ rp_type_zip: "Zip-архив",
+ rp_type_folder: "Папка",
+ zip_dir: "Папка для архива",
+ zip_dir_desc: "Например .minecraft/resourcepacks. В новый архив добавляются pack.mcmeta и pack.png.",
+ zip_name: "Имя архива",
+ zip_name_desc: "Без .zip. Если архив уже есть, он обновляется, всё остальное в нём сохраняется.",
+ rp_folder_desc: "Распакованный ресурспак. Если в папке нет pack.mcmeta, он будет создан.",
+ mc_version_desc: "Задаёт формат в pack.mcmeta нового пака.",
+ no_zip_folder: "Не выбрана папка для архива.",
+ invalid_zip_name: "Недопустимое имя архива.",
+ archive_new: "новый архив",
+ archive_update: "будет обновлён",
+ written_to: "Записано в",
+ dp_dir: "Папка datapacks",
+ dp_dir_desc: "Например saves/<мир>/datapacks. Датапак сохраняется zip-архивом.",
+ dp_name_desc: "Без .zip. Если датапак уже есть, он обновляется, остальные отделки в нём сохраняются.",
+ folder_or_zip: "Папка или .zip",
+ pose_spread: "Стойка, части раздвинуты",
+ pose_tpose_spread: "T-поза, части раздвинуты",
+ decal_preview_desc: "Превью «decal»: true — пиксели отделки рисуются только поверх пикселей брони, поэтому внешний слой шлема и дыры в броне остаются пустыми. Эта же настройка пишется в датапак.",
+ armor_icons: "Иконки брони",
+ armor_icons_full: "Отделка на иконках брони",
+ icons_tab: "Иконки",
+ armor_icon_bases: "⚙ предметы брони (превью)",
+ armor_icon_card: "Иконка брони: %0",
+ armor_icon_base_card: "⚙ предмет: %0",
+ slot_helmet: "Шлем",
+ slot_chestplate: "Нагрудник",
+ slot_leggings: "Поножи",
+ slot_boots: "Ботинки",
+ slot_netherite_helmet: "Незеритовый шлем",
+ slot_turtle_helmet: "Черепаший панцирь",
+ slot_netherite_boots: "Незеритовые ботинки",
+ armor_icons_short: "В ванилле любая отделка на предметах брони в инвентаре выглядит одинаково. Здесь вы рисуете, как эта отделка выглядит на каждой форме брони.",
+ what_is_this: "Как это работает",
+ paint_icons: "Рисовать иконки",
+ paint_armor_icons: "Рисовать иконки брони",
+ back_to_player: "Назад к игроку",
+ all_variants: "Все варианты",
+ armor_icons_generators: "Генераторы",
+ armor_icons_generators_action: "Генераторы иконок брони…",
+ icon_colors: "Цвета иконок",
+ icon_colors_palette: "По материалу",
+ icon_colors_fixed: "Свои (без материала)",
+ icon_colors_palette_hint: "Серые цвета палитры перекрашиваются в материал отделки, как на игроке.",
+ icon_colors_fixed_hint: "Иконка используется как нарисована, с любым материалом. Для цветных, не монохромных отделок.",
+ armor_icons_title: "Генераторы иконок брони",
+ armor_icons_click_cards: "нажмите на карточку, чтобы включить или пропустить её",
+ select_all: "Все",
+ select_none: "Ни одной",
+ icon_source: "Источник",
+ icon_source_project: "Из отделки на игроке",
+ icon_source_vanilla: "Ванильный рисунок",
+ icon_source_shape: "Фигура",
+ icon_source_copy: "Копия с обычных шлема и ботинок",
+ icon_source_clear: "Очистить",
+ icon_source_project_hint: "Вид спереди нарисованной части брони вписывается в силуэт предмета. Быстрый старт: потом поправьте вручную.",
+ icon_source_vanilla_hint: "Рисунок, который игра показывает для любой отделки. Основа, поверх которой можно рисовать.",
+ icon_source_copy_hint: "Незеритовый шлем, черепаший панцирь и незеритовые ботинки получают рисунок обычного шлема или ботинок, вписанный в их форму.",
+ icon_palette_hint: "Фигуры обрезаются по силуэту предмета. Серые цвета палитры следуют за материалом, остальные цвета остаются как есть.",
+ shape: "Фигура",
+ shape_step: "Шаг",
+ shape_size: "Толщина",
+ shape_color: "Цвет",
+ custom_color: "Свой цвет",
+ shape_outline: "Контур",
+ shape_inner_outline: "Внутренний контур",
+ shape_stripes_h: "Горизонтальные полосы",
+ shape_stripes_v: "Вертикальные полосы",
+ shape_diagonal: "Диагональные полосы",
+ shape_diagonal2: "Диагональ в другую сторону",
+ shape_checker: "Шахматка",
+ shape_dots: "Точки",
+ shape_band_top: "Полоса сверху",
+ shape_band_middle: "Полоса посередине",
+ shape_band_bottom: "Полоса снизу",
+ shape_fill: "Заливка",
+ icon_mode: "Текущий рисунок",
+ icon_mode_replace: "Заменить",
+ icon_mode_add: "Рисовать поверх",
+ preview_material: "Материал превью",
+ generate_armor_icons: "Генерация иконок брони",
+ icon_grid_title: "Иконки брони: все варианты",
+ icon_grid_hint: "Строки — виды брони, столбцы — материалы отделки; первый столбец — иконка как нарисована. Где материал отделки совпадает с бронёй, используется тёмная палитра, как в игре.",
+ icon_grid_hint_fixed: "Свои цвета: иконка одинакова с любым материалом отделки.",
+ armor_icons_help_why: "Зачем. В ванильном Minecraft шлем, нагрудник, поножи или ботинки с отделкой в инвентаре всегда показывают один и тот же рисунок, меняется только цвет материала. Нагрудники с разными отделками выглядят одинаково.",
+ armor_icons_help_what: "Что делает. Здесь вы рисуете, как именно эта отделка выглядит на иконке предмета. В ресурспак пишется свой рисунок для каждой формы брони, перекрашенный под каждый материал. Так работает ресурспак Visual Armor Trims от Thanos (CC BY-SA 4.0).",
+ armor_icons_help_slots: "Семь иконок. Шлем, нагрудник, поножи и ботинки общие для кожаной, кольчужной, железной, золотой, алмазной и медной брони, а также незеритовых нагрудника и поножей. Незеритовый шлем, черепаший панцирь и незеритовые ботинки имеют свою форму и получают отдельные иконки. Пустые иконки не экспортируются: для таких предметов в паке остаётся то, что там уже есть.",
+ armor_icons_help_colors: "Цвета. Рисуйте 8 серыми цветами палитры, как саму отделку: они станут цветами материала (на броне из того же материала — тёмная палитра). Остальные цвета остаются как есть. Для цветных отделок выберите Свои (без материала): тогда иконка одинакова с любым материалом.",
+ armor_icons_help_paint: "Рисование.Рисовать иконки показывает иконки плоско перед камерой; предмет брони под иконкой — только превью. Можно также выбрать текстуру иконки и рисовать в 2D-редакторе. Генераторы заполняют иконки из отделки на игроке, ванильного рисунка или простых фигур; Все варианты показывает каждую броню с каждым материалом.",
+ armor_icons_help_export: "Экспорт. Если в ресурспаке уже есть Visual Armor Trims (в том числе в оверлее), отделка добавляется в него: текстуры, атлас, модели и определения предметов. Иначе плагин пишет свои определения предметов на основе ванильных. Нужен Minecraft 1.21.5 или новее.",
+ armor_icons_help_short: "Иконки брони: в ванилле отделка на любом предмете брони в инвентаре выглядит одинаково. Во вкладке «Иконки» можно нарисовать для этой отделки свой вид, он экспортируется в формате Visual Armor Trims.",
+ armor_icons_count: "Иконки брони: нарисовано %0 из %1. Пустые не экспортируются, для них в паке остаётся то, что есть.",
+ armor_icons_export_info: "**Иконки брони** — отделка на предметах брони в инвентаре",
+ export_armor_icons: "Экспортировать иконки брони",
+ export_armor_icons_desc: "Свои иконки предметов брони для этой отделки. Visual Armor Trims в паке находится и дополняется.",
+ armor_icons_old_version: "Иконки брони не экспортированы: нужен Minecraft 1.21.5 или новее.",
+ armor_icons_no_vanilla_item: "%0: нет определения предмета в jar Minecraft, пропущено.",
+ armor_icons_unknown_item: "%0 имеет неожиданный формат и не изменён.",
+ armor_icons_written: "Иконки брони: моделей %0, определений предметов %1 (%2)",
+ pack_root: "корень пака",
+ armor_icons_plan: "иконки брони: %0 из %1 → %2, %3",
+ armor_icons_mode_vat: "добавляются в Visual Armor Trims",
+ armor_icons_mode_own: "свои определения предметов",
+ armor_icons_tag: "иконки брони",
+ new_icons_desc: "Иконки этой отделки на предметах брони в инвентаре. Их можно перегенерировать или дорисовать позже.",
+ new_icons_project: "Сгенерировать из отделки",
+ new_icons_vanilla: "Ванильный рисунок",
+ new_icons_empty: "Пустые",
+ files_unchanged: "Без изменений, не перезаписано: %0",
+ import_multi_hint: "Ctrl или Shift — открыть несколько, каждую в своей вкладке",
+ trims_opened: "Открыто отделок: %0",
+ template_icon_empty_skipped: "Иконка шаблона пустая и не экспортирована",
+ backup_skipped_git: "Без резервной копии: пак под git",
+ icons_kept_empty_result: "Оставлено как нарисовано: %0 (генератор дал пустую иконку)",
+ icon_pattern_guessed: "Иконки шаблонов найдены в паке, путь подставлен автоматически.",
+ },
+ };
+}
+
+})();
diff --git a/plugins/armor_trim_editor/changelog.json b/plugins/armor_trim_editor/changelog.json
new file mode 100644
index 00000000..9570018b
--- /dev/null
+++ b/plugins/armor_trim_editor/changelog.json
@@ -0,0 +1,42 @@
+{
+ "1.0.0": {
+ "title": "1.0.0",
+ "date": "2026-09-27",
+ "author": "BbIJABNPOBATEJb",
+ "categories": [
+ {
+ "title": "New Features",
+ "list": [
+ "Initial release"
+ ]
+ }
+ ]
+ },
+ "1.1.0": {
+ "title": "1.1.0",
+ "date": "2026-09-29",
+ "author": "BbIJABNPOBATEJb",
+ "categories": [
+ {
+ "title": "New Features",
+ "list": [
+ "Armor icons: draw how the trim looks on armor items in the inventory, with a preview on every armor type and trim material",
+ "Armor icon generators: from the trim on the player, the vanilla overlay or simple shapes",
+ "Armor icons are exported in the Visual Armor Trims format, into Visual Armor Trims itself if the pack contains it"
+ ]
+ },
+ {
+ "title": "Improvements",
+ "list": [
+ "Vanilla palettes are only added to the atlas for Minecraft versions that have them (copper_darker, resin)",
+ "Several trims can be opened from a resource pack at once, each in its own tab; a trim that is already open gets its tab back",
+ "Export only rewrites files whose content changed and keeps the line endings of edited JSON files",
+ "Re-exporting armor icons keeps the order of existing item model cases",
+ "Empty armor icons leave the pack entries of those items untouched, and a generator never replaces a drawn icon with an empty one",
+ "An empty template icon is not exported; the import finds the template icon path by itself",
+ "No backups for packs under git, and only the latest 10 backups are kept"
+ ]
+ }
+ ]
+ }
+}