Skip to content

Commit 2317b6c

Browse files
[Incomplete] progress from desktop
1 parent d22f0bd commit 2317b6c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

gm4/plugins/resource_pack.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,21 +1003,25 @@ def get_item_def_entry(self, config: ModelData, item: str):
10031003
return self._item_def_map.get(item)
10041004

10051005
class AdvancementIconTemplate(VanillaTemplate, TemplateOptions): # TODO make this inheritance work properly. Treat as single-vanilla forward or create new where needed
1006+
"""Creates a model for advancement icons, either pointing to the vanilla model, or to a specified other item model"""
10061007
name = "advancement"
10071008
forward: Optional[str]
10081009
tints: Optional[ListOption[int|tuple[float,float,float]]] # optional constant tints to apply to the item model
10091010

10101011
# NOTE since advancements are all in the gm4 namespace, so are these models. This template ignores the 'model' field of ModelData
10111012
def create_models(self, config: ModelData, models_container: NamespaceProxy[Model]) -> list[Model]:
10121013
advancement_name = config.reference.split("/")[-1]
1014+
10131015
if not self.forward:
1016+
# then we use the vanilla item's model and settings - inheriting from VanillaTemplate for this
10141017
item = config.item.entries()[0]
1015-
self.forward = self.vanilla_jar.assets.item_models[add_namespace(item, "minecraft")].data.get("model", {}).get("model", "") # type: ignore ; json access is string
1018+
config_copy = config.copy(update={"model": MapOption(__root__={config.item.entries()[0]: f"gm4:gui/advancements/{advancement_name}"})})
1019+
TemplateOptions.create_models(self, config_copy, models_container)
10161020

10171021
m = models_container[f"gm4:gui/advancements/{advancement_name}"] = Model({
10181022
"parent": self.forward
10191023
})
1020-
config.model = MapOption(__root__={config.item.entries()[0]: f"gm4:gui/advancements/{advancement_name}"})
1024+
# config.model = MapOption(__root__={config.item.entries()[0]: f"gm4:gui/advancements/{advancement_name}"})
10211025
return [m]
10221026

10231027
def get_item_def_entry(self, config: ModelData, item: str):

gm4_better_armour_stands/beet.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,4 @@ meta:
3838
model_data:
3939
- item: armor_stand
4040
reference: gui/advancement/better_armour_stands
41-
template:
42-
name: advancement
43-
forward: minecraft:item/armor_stand
41+
template: advancement

gm4_better_fire/beet.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,4 @@ meta:
3939
template: generated
4040
- item: bow
4141
reference: gui/advancement/better_fire
42-
template:
43-
name: advancement
44-
forward: minecraft:item/bow
42+
template: advancement

0 commit comments

Comments
 (0)