Skip to content

Commit

Permalink
Update pack generator
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenBagTwo committed Dec 10, 2024
1 parent c5f1fe1 commit 0cef6f0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions foxnap_rpg/assets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

RP_MCMETA: str = r"""{
"pack": {
"pack_format": 31,
"pack_format": 46,
"supported_formats": {"min_inclusive": 15, "max_inclusive": 999},
"description": [
{
Expand All @@ -25,7 +25,7 @@

DP_MCMETA: str = r""" {
"pack": {
"pack_format": 45,
"pack_format": 61,
"supported_formats": {"min_inclusive": 45, "max_inclusive": 999},
"description": "%%title%%"
}
Expand Down
25 changes: 25 additions & 0 deletions foxnap_rpg/pack_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,15 @@ def generate_resource_pack(
)

models = foxnap_root / "models" / "item"
model_meta = foxnap_root / "items"
models.mkdir(parents=True, exist_ok=True)
model_meta.mkdir(parents=True, exist_ok=True)
LOGGER.info("Writing record item model jsons")
for track in tracks:
with (models / f"track_{track.num}.json").open("w") as f:
json.dump(generate_model(track.num), f, **json_opts)
with (model_meta / f"track_{track.num}.json").open("w") as f:
json.dump(generate_model_meta(track.num), f, **json_opts)

item_textures = foxnap_root / "textures" / "item"
item_textures.mkdir(exist_ok=True, parents=True)
Expand Down Expand Up @@ -385,6 +389,27 @@ def generate_model(track_number: int) -> dict:
}


def generate_model_meta(track_number: int) -> dict:
"""Generate a model metadata JSON for a new record
Parameters
----------
track_number : int
The number of the track to generate
Returns
-------
dict
The model info, all set to be written as JSON
"""
return {
"model": {
"type": "minecraft:model",
"model": f"foxnap:item/track_{track_number}",
}
}


def create_colored_vinyl(
template: Image.Image | None = None, hue_shift: float | None = None
) -> Image.Image:
Expand Down

0 comments on commit 0cef6f0

Please sign in to comment.