Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Player head management plugin (#888)
* Merge branch 'ver/1.16' of https://github.com/Bloo-dev/lib_player_heads into ver/1.16 * Merge pull request #1 from Luexa/enhance-code-and-examples Enhance code and examples (version 1.1) * Recursive json-dict key retrieval * Dirty existing skin data gathering This is a very very gross and terribly code implementation to extract existing skin data into a cache file. This code was half to learn how to interact with mecha AST rules. Most of this commit's changes *will* be reverted or overwritten in a later commit * Dirty skin download to source A quick-and-dirty utility script to process the texture url data from the previous commit and interactively download and name each skin file. This script will be deleted in a future commit but is included here so it can be retrieved by git at a future date if needed * Custom container for skin textures Creates and registers a custom container on the datapack object for skin textures, allowing them to be auto-mounted to the pack object upon load * Use bind() to process Skin objects - adds PIL (pillow) as dependancy - serializes skin images immediately on load to prepare for hash comparison * Bind the Skin container to a custom mecha rule processor * Structural pattern matching on AST First attempt to match the ast structure of the SkullOwner nbt compound. Ran into issues where the ast stores ordered entries, but we want to match unordered. * Evaluate ast to libnbt dict for robust syntax matching Matches the following cases of SkullOwner: ```SkullOwner:$texture SkullOwner:{Value:"$texture"} SkullOwner:{Value:"$texture",Name:"foo",Signature:"bar"} SkullOwner:{Name:"foo",Properties:{textures:[{Value:"$texture",Signature:"bar"}]}}```, with each additional field functioning as optional if needed * mineskin_upload function for api calls * trims unneeded data from skin texture url * Use provided random uuid from mineskin Apparently, the uuid no longer *must* be unique for the skin to work, but for safety we'll keep using a unique uuid since one is already provided by mineskin. * Save skin cache out when finished * Prompt the user for an API token if needed for submitting new skin textures * cached uuid is list of ints * Output uuid is array, not string * Untested ratelimited request resubmit * Use traceback diagnostics to report invalid textures and unhandled cases * Log unused cache entries * Store NbtTransformer in `ctx.inject` so it can be used on loot_tables * Apply ast rule to snbt within advancements and loot tables * [WIP] Usable Diagnostics on LootTables * Cleanup diagnostic printing. * Fix diagnostics on json files with multiple lines needing subs Since we're faking database entries, the lookup key for loottables needs to be unique, which it cant be when one file has two strings needing parsing. Instead we use an enumerated resource location * Spring cleaning * Update heart-canisters to new shortcuts * Fix typos * substitutions in lib_player_heads registry Also updates mecha to fix a bug with raising diagnostics within subcommands * Missing skin texture for compilation errors uses mecha's `yield Diagnostic` magic syntax to both raise errors and return a valid ast, which gets a magenta/black missing-texture * Pass proper location for lib_player_heads invalid skin names * Remove unused name field in skin_cache * Fix skin value subs for other structural cases * Error if GH Action needs to upload skin * REVERTABLE: GH Action Test Case * REVERTABLE: Enale GH Action on test branch * Allow processing of list-root item modifiers * REVERTABLE: Fix gh action skin test typo * Escape newlines in nbt from loot-tables, so mecha parses them right * Try raising exception to quit gh action * Try systemexit exception for gh action * Try sys.exit for gh action * Comment * Revert "REVERTABLE: GH Action Test Case" This reverts commit 11a74ba. Revert "REVERTABLE: Fix gh action skin test typo" This reverts commit 3a25f69. Revert "REVERTABLE: Enale GH Action on test branch" This reverts commit fdf3ad0. * Eliminate many #type:ignore with better type annotations * Support un-prefixed item modifier functions * small typo * Apply substitutions to all modules - first pass * Delete skin_downloader.py * Record parent_module on new skins * Cache record of any skins from other modules * Increment patch on non-native skin reference diff * Output wraps the build pipeline Moves gm4.output to use its exit phase instead, this allows all other plugins to process their exit phases first, doing things like cleaning up extra file containers or saving important data * Configure mecha to keep comments * Sub-modules properly record nonnative references * Clarify metallurgy mould naming * Initial commit * Metallurgy skins cleanup * Disable unused thoriub_brass substitution * Experimental lib_player_heads versioning warnings * Revert "Experimental lib_player_heads versioning warnings" This reverts commit ac60b4d. This functionality would be better served in some hypothetical linting checker rather than here; additionally, this should ideally belong to the library files itself, not the player head management tool. For now, the maintainers will need to keep in mind that skin file changes should accompany lib_player_heads registry edits * Baryte lump typo * Update init.mcfunction * Cleanup unused OLD textures and correct some typos * Update mecha version to add 1.20 command tree support * Legacy loot_table * Update skin_cache.json --------- Co-authored-by: Bloo-dev <[email protected]>
- Loading branch information