Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c66ee28
generate new item model definitions
SpecialBuilder32 Jan 26, 2025
01614cf
item-model merge policy
SpecialBuilder32 Jan 26, 2025
d147ca5
Generate 1.21.3 RP models into an overlay
SpecialBuilder32 Feb 11, 2025
ea3aebd
Add CMD range padding into new item_def files
SpecialBuilder32 Feb 11, 2025
1e21a42
Replace manual predicate-entry into model data config (for end fishin…
SpecialBuilder32 Mar 14, 2025
dde3e24
Manually provide end fishing elytra item model in overlay
SpecialBuilder32 Mar 14, 2025
35a4105
Update shamir model/texture generation code for 1.21.4
SpecialBuilder32 Mar 27, 2025
3dd7d91
Add backwards compatibility for 1.21.3 metallurgy textures
SpecialBuilder32 Mar 28, 2025
d343c93
Fix references to item references that only exist as block references
SpecialBuilder32 Apr 17, 2025
217b561
Add support for special-case vanilla tempates
SpecialBuilder32 Apr 17, 2025
1cba6c7
Add rename for guidebook broken elytra texture
SpecialBuilder32 Apr 17, 2025
03d6562
[Incomplete] fixing missing advancement icon model forwarding
SpecialBuilder32 Apr 17, 2025
a4437fa
[Incomplete] Move item-def handling to Templates
SpecialBuilder32 Apr 24, 2025
d22f0bd
VanillaTemplate pulls in default model settings
SpecialBuilder32 Apr 24, 2025
2317b6c
[Incomplete] progress from desktop
SpecialBuilder32 Apr 24, 2025
edc07b1
Advancement models inherit from VanillaTemplate
SpecialBuilder32 May 6, 2025
b09bc2b
Fix shield models being invisible
SpecialBuilder32 May 20, 2025
a7447e8
Sunken treasure chests and metallurgy elytra
SpecialBuilder32 May 21, 2025
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
2 changes: 1 addition & 1 deletion beet-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pipeline:
directory: resource_pack
pipeline:
- resource_pack.dev_description
- gm4.plugins.resource_pack.pad_model_overrides
- gm4.plugins.resource_pack.pad_item_def_range_dispatch
- gm4.plugins.resource_pack.link_resource_pack
- gm4.plugins.output.resource_pack
- gm4.plugins.resource_pack.dump_registry
Expand Down
2 changes: 1 addition & 1 deletion beet-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pipeline:
- gm4.plugins.output.release_resource_pack
- gm4.plugins.write_mcmeta
- gm4.plugins.manifest.update_patch
- gm4.plugins.resource_pack.pad_model_overrides
- gm4.plugins.resource_pack.pad_item_def_range_dispatch
meta:
pack_scan: resource_pack

Expand Down
30 changes: 13 additions & 17 deletions docs/resource-pack-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This document explains Gamemode 4's Resource Pack management tools, which use cu
* [Extending `TemplateOptions`](#extending-templateoptions)
* [Extending `TransformOptions`](#extending-transformoptions)
* [Extending `ContainerGuiOptions`](#extending-containerguioptions)
* [Extending `ItemModelOptions`](#extending-itemmodeloptions)

## Getting Started
Just like how data pack resources are stored in a `data` directory, resource pack assets are stored in an `assets` directory for each module, and follow the same structure as an ordinary minecraft resource pack.
Expand Down Expand Up @@ -166,27 +167,16 @@ model:
apple: item/my_model_apple
potato: item/my_model_potato
```
More complex model predicates for items with multiple vanilla models (e.g. elytra & broken elytra, clock ect) can be specified here as a list of predicates, following the same syntax as model files e.g.
More complex model styles, like for items with multiple vanilla models (e.g. elytra & broken elytra, clock ect) are handled through a special-case syntax. Currently only broken elytra are supported, so packs utlizing conditions in item model definitions will need to provide handlers.
```yaml
item: elytra
model:
- predicate: {broken: 0}
model: item/elytra/captains_wings
- predicate: {broken: 1}
model: item/elytra/broken_captains_wings
type: condition_broken
unbroken: item/elytra/captains_wings
broken: item/elytra/broken_captains_wings
```
This list of predicates may also be mapped to a specific item as above.

```yaml
item: [apple, elytra]
model:
apple: my_model_apple
elytra:
- predicate: {broken: 0}
model: item/elytra/captains_wings
- predicate: {broken: 1}
model: item/elytra/broken_captains_wings
```
Items who have multiple vanilla models, like clocks, who do not have the manual predicates specified in model will have the same provided model file applied to all variants.
Items who have multiple vanilla models, like clocks, who do not utilize special-case providers in the model config will have the same provided model file applied to all variants.

- `template` (optional), a model-file generating template to apply. Accepts a string name of a template, or a compound containing template configuration values. Defaults to `custom`, which generates no Model files. See [here](#model-templates) for details on available templates.
- `transforms` (optional), a list of model transforms to apply. Accepts a compound of configuration data. See [here](#model-transforms) for details on available transforms.
Expand Down Expand Up @@ -267,3 +257,9 @@ Additionally, there are two extendable subclasses already available for containe

#### Methods
- `process(self, config: GuiFont, counter_cache: Cache) -> tuple[str, list[dict[str, Any]]]`: Requisitions unique characters and returns the translation value (usually made of these characters), and a list of font providers, which usually reference `config.texture`.

### Extending ItemModelOptions
Individual modules may add additional handlers for special-case item model definitions by extending `ItemModelOptions` in a beet plugin. This subclass defines the additional config fields and a method that generates the model compound used in the item model definition.

#### Methods
- 'generate_json(self) -> dict[str,Any]`: Returns the model object used in the item model defintion. e.g. ```{"type": "minecraft:condition"...}```
1 change: 1 addition & 0 deletions gm4/plugins/autoload.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ def beet_default(ctx: Context):
ctx.require(
"beet.contrib.default",
"beet.contrib.model_merging",
"gm4.plugins.resource_pack.merge_policy",
"gm4_metallurgy.shamir_model_template.merge_policy"
)
14 changes: 14 additions & 0 deletions gm4/plugins/backwards.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, Tuple, Callable
from beet import Context, Pack, TextFileBase, Recipe, Function, NamespaceFile
from beet.core.utils import SupportedFormats
from gm4.plugins.resource_pack import GM4ResourcePack

logger = logging.getLogger("gm4.backwards")

Expand All @@ -18,6 +19,19 @@ def beet_default(ctx: Context):
backport(ctx.data, 48, rewrite_attributes)
backport(ctx.data, 48, rewrite_recipe)

yield from resource_pack(ctx) # bypass the yield clause, since we're already in the exit phase

# Create old resource pack assets for 1.21.3, used standalone for libraries
def resource_pack(ctx: Context):
yield
rp = ctx.inject(GM4ResourcePack)

# use a draft generator to ensure merge rules are followed
with ctx.generate.draft() as draft:
overlay = draft.assets.overlays[f"backport_42"]
overlay.supported_formats = { "min_inclusive": 0, "max_inclusive": 42 }
rp.generate_model_overrides_1_21_3(overlay)


FURNACE_RENAMES = {
"cooking_time_spent": "CookTime",
Expand Down
Loading
Loading