Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player head management plugin #888

Merged
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
98a0ccf
Merge branch 'ver/1.16' of https://github.com/Bloo-dev/lib_player_hea…
Bloo-dev Apr 26, 2021
473f7c3
Merge pull request #1 from Luexa/enhance-code-and-examples
Bloo-dev Nov 4, 2021
d075a4c
Recursive json-dict key retrieval
SpecialBuilder32 Jul 2, 2023
07cc103
Dirty existing skin data gathering
SpecialBuilder32 Jul 2, 2023
9aeb512
Dirty skin download to source
SpecialBuilder32 Jul 3, 2023
1482aaf
Custom container for skin textures
SpecialBuilder32 Jul 4, 2023
96a1e1b
Use bind() to process Skin objects
SpecialBuilder32 Jul 4, 2023
ae656dd
Bind the Skin container to a custom mecha rule processor
SpecialBuilder32 Jul 4, 2023
0f86b65
Structural pattern matching on AST
SpecialBuilder32 Jul 4, 2023
6225776
Evaluate ast to libnbt dict for robust syntax matching
SpecialBuilder32 Jul 4, 2023
28aa76d
mineskin_upload function for api calls
SpecialBuilder32 Jul 5, 2023
2391047
trims unneeded data from skin texture url
SpecialBuilder32 Jul 5, 2023
0a0bd08
Use provided random uuid from mineskin
SpecialBuilder32 Jul 5, 2023
0cc88c5
Save skin cache out when finished
SpecialBuilder32 Jul 5, 2023
b3f1bfb
Prompt the user for an API token if needed for submitting new skin te…
SpecialBuilder32 Jul 5, 2023
c4e0211
cached uuid is list of ints
SpecialBuilder32 Jul 5, 2023
d89eebb
Output uuid is array, not string
SpecialBuilder32 Jul 5, 2023
eec888a
Untested ratelimited request resubmit
SpecialBuilder32 Jul 5, 2023
eaf8fec
Use traceback diagnostics to report invalid textures and unhandled cases
SpecialBuilder32 Jul 6, 2023
1f1bb11
Log unused cache entries
SpecialBuilder32 Jul 6, 2023
75a31b7
Store NbtTransformer in `ctx.inject` so it can be used on loot_tables
SpecialBuilder32 Jul 6, 2023
40f1006
Apply ast rule to snbt within advancements and loot tables
SpecialBuilder32 Jul 7, 2023
e83a43b
[WIP] Usable Diagnostics on LootTables
SpecialBuilder32 Jul 10, 2023
e5498d5
Cleanup diagnostic printing.
SpecialBuilder32 Jul 10, 2023
07b29c9
Fix diagnostics on json files with multiple lines needing subs
SpecialBuilder32 Jul 12, 2023
1819544
Spring cleaning
SpecialBuilder32 Jul 12, 2023
75bdbdc
Update heart-canisters to new shortcuts
SpecialBuilder32 Jul 12, 2023
7cfd5ae
Fix typos
SpecialBuilder32 Jul 12, 2023
3019b41
substitutions in lib_player_heads registry
SpecialBuilder32 Jul 21, 2023
a7d9b1f
Missing skin texture for compilation errors
SpecialBuilder32 Jul 21, 2023
3a01532
Pass proper location for lib_player_heads invalid skin names
SpecialBuilder32 Jul 21, 2023
d5fd5df
Remove unused name field in skin_cache
SpecialBuilder32 Jul 21, 2023
a04d103
Fix skin value subs for other structural cases
SpecialBuilder32 Jul 21, 2023
8dd9e3e
Error if GH Action needs to upload skin
SpecialBuilder32 Jul 21, 2023
11a74ba
REVERTABLE: GH Action Test Case
SpecialBuilder32 Jul 21, 2023
fdf3ad0
REVERTABLE: Enale GH Action on test branch
SpecialBuilder32 Jul 21, 2023
85bf93a
Allow processing of list-root item modifiers
SpecialBuilder32 Jul 21, 2023
c616b16
Merge branch 'master' of https://github.com/Gamemode4Dev/GM4_Datapack…
SpecialBuilder32 Jul 21, 2023
3a25f69
REVERTABLE: Fix gh action skin test typo
SpecialBuilder32 Jul 22, 2023
4d15890
Escape newlines in nbt from loot-tables, so mecha parses them right
SpecialBuilder32 Jul 22, 2023
dc2717d
Try raising exception to quit gh action
SpecialBuilder32 Jul 23, 2023
216df38
Try systemexit exception for gh action
SpecialBuilder32 Jul 23, 2023
a6f62ac
Try sys.exit for gh action
SpecialBuilder32 Jul 23, 2023
8898cb9
Comment
SpecialBuilder32 Jul 23, 2023
843ceae
Revert "REVERTABLE: GH Action Test Case"
SpecialBuilder32 Jul 23, 2023
fc847c1
Eliminate many #type:ignore with better type annotations
SpecialBuilder32 Jul 23, 2023
bf69fed
Support un-prefixed item modifier functions
SpecialBuilder32 Jul 23, 2023
036b878
small typo
SpecialBuilder32 Jul 23, 2023
31f4e1e
Apply substitutions to all modules - first pass
SpecialBuilder32 Jul 23, 2023
f26d954
Delete skin_downloader.py
SpecialBuilder32 Jul 23, 2023
43b4594
Record parent_module on new skins
SpecialBuilder32 Jul 23, 2023
c2fcf40
Cache record of any skins from other modules
SpecialBuilder32 Jul 24, 2023
f859947
Increment patch on non-native skin reference diff
SpecialBuilder32 Jul 24, 2023
308cec8
Output wraps the build pipeline
SpecialBuilder32 Jul 24, 2023
0296187
Configure mecha to keep comments
SpecialBuilder32 Jul 25, 2023
839287a
Sub-modules properly record nonnative references
SpecialBuilder32 Jul 25, 2023
57b1c5b
Clarify metallurgy mould naming
SpecialBuilder32 Jul 25, 2023
eb8f16b
Initial commit
Bloo-dev Apr 26, 2021
afa0df0
Metallurgy skins cleanup
SpecialBuilder32 Jul 26, 2023
7989726
Disable unused thoriub_brass substitution
SpecialBuilder32 Jul 26, 2023
ac60b4d
Experimental lib_player_heads versioning warnings
SpecialBuilder32 Jul 26, 2023
0dc8175
Revert "Experimental lib_player_heads versioning warnings"
SpecialBuilder32 Jul 26, 2023
c6d9255
Baryte lump typo
SpecialBuilder32 Jul 26, 2023
894a83a
Update init.mcfunction
SpecialBuilder32 Aug 12, 2023
b03ac06
Cleanup unused OLD textures and correct some typos
SpecialBuilder32 Aug 29, 2023
6cd8e31
Merge remote-tracking branch 'upstream/master' into player_head_manag…
SpecialBuilder32 Aug 29, 2023
22835ba
Update mecha version to add 1.20 command tree support
SpecialBuilder32 Aug 29, 2023
3d70bc9
Legacy loot_table
SpecialBuilder32 Aug 29, 2023
98d8d2f
Update skin_cache.json
SpecialBuilder32 Aug 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion beet-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ pipeline:
- gm4.plugins.manifest.write_meta
- broadcast: 'gm4_*'
extend: 'beet.yaml'
require:
- gm4.plugins.output.release
- gm4.plugins.player_heads
pipeline:
- gm4.plugins.manifest.write_updates
- gm4.plugins.manifest.write_credits
- require: [beet.contrib.copy_files]
meta: {copy_files: {data_pack: {LICENSE.md: "../LICENSE.md"}}}
- gm4.plugins.readme_generator
- gm4.plugins.write_mcmeta
- gm4.plugins.output.release
meta:
mecha:
formatting:
layout: preserve
nbt_compact: True

meta:
autosave:
Expand Down
9 changes: 8 additions & 1 deletion beet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ pipeline:
- gm4.plugins.manifest.create
- broadcast: 'gm4_*'
extend: 'beet.yaml'
require:
- gm4.plugins.output
- gm4.plugins.player_heads
pipeline:
- gm4.plugins.write_mcmeta
- gm4.plugins.output
meta:
mecha:
layout: preserve
nbt_compact: True
cmd_compact: True
21 changes: 17 additions & 4 deletions gm4/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,24 @@ def dev(ctx: click.Context, project: Project, modules: tuple[str], watch: bool,
config = {
"broadcast": modules,
"extend": "beet.yaml",
"require": ["beet.contrib.livereload"] if reload else [],
"require": [
"gm4.plugins.output",
"beet.contrib.livereload",
"gm4.plugins.player_heads"
] if reload else [
"gm4.plugins.output",
"gm4.plugins.player_heads"
],
"pipeline": [
"gm4.plugins.write_mcmeta",
"gm4.plugins.output"
]
"gm4.plugins.write_mcmeta"
],
"meta": {
"mecha" : {
"formatting":{
"layout": "preserve",
"nbt_compact": True,
"cmd_compact": True
} } }
}
project.config_overrides = [
f"pipeline[] = {json.dumps(config)}",
Expand Down
14 changes: 12 additions & 2 deletions gm4/plugins/manifest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from beet import Context, TextFile
from beet import Context, TextFile, JsonFile
from pathlib import Path
from typing import Any
from functools import cache
Expand Down Expand Up @@ -97,6 +97,7 @@ def update_patch(ctx: Context):
release_dir = Path('release') / version
manifest_file = release_dir / "meta.json"
logger = parent_logger.getChild("update_patch")
skin_cache = JsonFile(source_path="gm4/skin_cache.json").data

modules = ctx.cache["gm4_manifest"].json["modules"]

Expand All @@ -119,7 +120,16 @@ def update_patch(ctx: Context):
deps = _traverse_includes(id) | {"base"}
deps_dirs = [element for sublist in [[f"{d}/data", f"{d}/*py"] for d in deps] for element in sublist]

diff = run(["git", "diff", last_commit, "--shortstat", "--", f"{id}/data", f"{id}/*.py"] + deps_dirs) if last_commit else True
# add watches to skins this module uses from other modules. NOTE this could be done in a more extendable way in the future, rather than "hardcoded"
skin_dep_dirs: list[str] = []
for skin_ref in skin_cache["nonnative_references"].get(id, []):
d = skin_cache["skins"][skin_ref]["parent_module"]
ns, path = skin_ref.split(":")
skin_dep_dirs.append(f"{d}/data/{ns}/skins/{path}.png")

watch_dirs = deps_dirs+skin_dep_dirs

diff = run(["git", "diff", last_commit, "--shortstat", "--", f"{id}/data", f"{id}/*.py"] + watch_dirs) if last_commit else True

if not diff and released:
# No changes were made, keep the same patch version
Expand Down
11 changes: 6 additions & 5 deletions gm4/plugins/output.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from beet import Context
from pathlib import Path
from bolt import Module
import os
import json
import requests
Expand All @@ -18,12 +17,13 @@
USER_AGENT = "Gamemode4Dev/GM4_Datapacks/release-pipeline ([email protected])"

def beet_default(ctx: Context):
"""Saves the datapack to the ./out folder."""
"""Saves the datapack to the ./out folder in it's exit phase.
Should be first in pipeline to properly wrap all other plugins cleanup phases"""
version = os.getenv("VERSION", "1.20")
out_dir = Path("out")

ctx.data[Module].clear() # manually cleanup bolt modules

yield # wait for exit phase, after other plugins cleanup
ctx.data.save(
path=out_dir / f"{ctx.project_id}_{version.replace('.', '_')}",
overwrite=True,
Expand All @@ -33,6 +33,7 @@ def beet_default(ctx: Context):
def release(ctx: Context):
"""
Saves the zipped datapack and metadata to the ./release/{version} folder.
Should be first in pipeline to properly wrap all other plugins cleanup phases

If the module has the `version` and `meta.modrinth.project_id` fields, and
`BEET_MODRINTH_TOKEN` environment variable is set, will try to publish a
Expand All @@ -46,7 +47,7 @@ def release(ctx: Context):
release_dir = Path("release") / version_dir
file_name = f"{ctx.project_id}_{version_dir.replace('.', '_')}.zip"

ctx.data[Module].clear() # manually cleanup bolt modules
yield # wait for exit phase, after other plugins cleanup

ctx.data.save(
path=release_dir / file_name,
Expand Down
Loading