Skip to content

Commit e5cbe37

Browse files
SpecialBuilder32misode
authored andcommitted
[Incomplete] progress from desktop
1 parent 9f1fdeb commit e5cbe37

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

gm4/plugins/resource_pack.py

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

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

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

933937
m = models_container[f"gm4:gui/advancements/{advancement_name}"] = Model({
934938
"parent": self.forward
935939
})
936-
config.model = MapOption(__root__={config.item.entries()[0]: f"gm4:gui/advancements/{advancement_name}"})
940+
# config.model = MapOption(__root__={config.item.entries()[0]: f"gm4:gui/advancements/{advancement_name}"})
937941
return [m]
938942

939943
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)