From 599ce66f933e98b334919292d2cf4dd891bcc054 Mon Sep 17 00:00:00 2001 From: mrsterner Date: Thu, 19 Dec 2024 15:47:40 +0100 Subject: [PATCH] malm --- .../malum/models/item/catalyst_lobber.json | 4 +-- .../malum/models/item/ritual_shard.json | 10 +++--- .../malum/models/item/soulwoven_banner.json | 34 +++++++++---------- .../common/item/SoulwovenBannerBlockItem.java | 4 +-- .../item/curiosities/CatalystLobberItem.java | 13 +++++-- .../common/item/spirit/RitualShardItem.java | 4 +-- .../data/item/MalumItemModelSmithTypes.java | 14 +++++--- 7 files changed, 48 insertions(+), 35 deletions(-) diff --git a/src/generated/resources/assets/malum/models/item/catalyst_lobber.json b/src/generated/resources/assets/malum/models/item/catalyst_lobber.json index 6de102e1f..e00c2c91e 100644 --- a/src/generated/resources/assets/malum/models/item/catalyst_lobber.json +++ b/src/generated/resources/assets/malum/models/item/catalyst_lobber.json @@ -4,13 +4,13 @@ { "model": "malum:item/catalyst_lobber_open", "predicate": { - "malum:state": 1.0 + "malum:state": 0.2 } }, { "model": "malum:item/catalyst_lobber_loaded", "predicate": { - "malum:state": 2.0 + "malum:state": 0.1 } } ], diff --git a/src/generated/resources/assets/malum/models/item/ritual_shard.json b/src/generated/resources/assets/malum/models/item/ritual_shard.json index 3ac7e1148..38451a164 100644 --- a/src/generated/resources/assets/malum/models/item/ritual_shard.json +++ b/src/generated/resources/assets/malum/models/item/ritual_shard.json @@ -4,31 +4,31 @@ { "model": "malum:item/ritual_shard_dim", "predicate": { - "malum:tier": 2.0 + "malum:tier": 0.2 } }, { "model": "malum:item/ritual_shard_vague", "predicate": { - "malum:tier": 3.0 + "malum:tier": 0.3 } }, { "model": "malum:item/ritual_shard_bright", "predicate": { - "malum:tier": 4.0 + "malum:tier": 0.4 } }, { "model": "malum:item/ritual_shard_vivid", "predicate": { - "malum:tier": 5.0 + "malum:tier": 0.5 } }, { "model": "malum:item/ritual_shard_radiant", "predicate": { - "malum:tier": 6.0 + "malum:tier": 0.6 } } ], diff --git a/src/generated/resources/assets/malum/models/item/soulwoven_banner.json b/src/generated/resources/assets/malum/models/item/soulwoven_banner.json index 22ecf3758..0122af289 100644 --- a/src/generated/resources/assets/malum/models/item/soulwoven_banner.json +++ b/src/generated/resources/assets/malum/models/item/soulwoven_banner.json @@ -1,62 +1,62 @@ { "parent": "minecraft:item/generated", - "textures": { - "layer0": "malum:item/soulwoven_banner_default" - }, "overrides": [ { + "model": "malum:item/soulwoven_banner_sequence", "predicate": { - "malum:pattern": 1 - }, - "model": "malum:item/soulwoven_banner_sequence" + "malum:pattern": 0.1 + } }, { + "model": "malum:item/soulwoven_banner_sanity", "predicate": { - "malum:pattern": 2 - }, - "model": "malum:item/soulwoven_banner_sanity" + "malum:pattern": 0.2 + } }, { "model": "malum:item/soulwoven_banner_breeze", "predicate": { - "malum:pattern": 3 + "malum:pattern": 0.3 } }, { "model": "malum:item/soulwoven_banner_breath", "predicate": { - "malum:pattern": 4 + "malum:pattern": 0.4 } }, { "model": "malum:item/soulwoven_banner_break", "predicate": { - "malum:pattern": 5 + "malum:pattern": 0.5 } }, { "model": "malum:item/soulwoven_banner_hunger", "predicate": { - "malum:pattern": 6 + "malum:pattern": 0.6 } }, { "model": "malum:item/soulwoven_banner_horns", "predicate": { - "malum:pattern": 7 + "malum:pattern": 0.7 } }, { "model": "malum:item/soulwoven_banner_heft", "predicate": { - "malum:pattern": 8 + "malum:pattern": 0.8 } }, { "model": "malum:item/soulwoven_banner_hallucination", "predicate": { - "malum:pattern": 9 + "malum:pattern": 0.9 } } - ] + ], + "textures": { + "layer0": "malum:item/soulwoven_banner_default" + } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/common/item/SoulwovenBannerBlockItem.java b/src/main/java/com/sammy/malum/common/item/SoulwovenBannerBlockItem.java index e28dda116..8768a21be 100644 --- a/src/main/java/com/sammy/malum/common/item/SoulwovenBannerBlockItem.java +++ b/src/main/java/com/sammy/malum/common/item/SoulwovenBannerBlockItem.java @@ -30,8 +30,8 @@ public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { + var data = stack.get(DataComponentRegistry.CATALYST_LOBBER_STATE.get()); + tooltipComponents.add(Component.literal(String.valueOf(data.state()))); + super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); + } + + public static float getStateDisplay(ItemStack stack) { var data = stack.get(DataComponentRegistry.CATALYST_LOBBER_STATE.get()); if (data == null) { return -1; } - return data.state(); + return data.state() / 10f; } @Override public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { diff --git a/src/main/java/com/sammy/malum/common/item/spirit/RitualShardItem.java b/src/main/java/com/sammy/malum/common/item/spirit/RitualShardItem.java index 0545cd73b..4631b2b97 100644 --- a/src/main/java/com/sammy/malum/common/item/spirit/RitualShardItem.java +++ b/src/main/java/com/sammy/malum/common/item/spirit/RitualShardItem.java @@ -27,12 +27,12 @@ public RitualShardItem(Properties properties) { super(properties); } - public static int getStateDisplay(ItemStack stack) { + public static float getStateDisplay(ItemStack stack) { var data = stack.get(DataComponentRegistry.RITUAL_DATA.get()); if (data == null) { return -1; } - return data.ritualTier().potency; + return data.ritualTier().potency / 10f; } @Override diff --git a/src/main/java/com/sammy/malum/data/item/MalumItemModelSmithTypes.java b/src/main/java/com/sammy/malum/data/item/MalumItemModelSmithTypes.java index e36228464..c0c0772fd 100644 --- a/src/main/java/com/sammy/malum/data/item/MalumItemModelSmithTypes.java +++ b/src/main/java/com/sammy/malum/data/item/MalumItemModelSmithTypes.java @@ -39,7 +39,7 @@ public class MalumItemModelSmithTypes { String path = ritualTier.identifier.getPath(); ResourceLocation itemTexturePath = provider.getItemTexture(base + "_" + path); provider.getBuilder(BuiltInRegistries.ITEM.getKey(item).getPath()).override() - .predicate(MalumMod.malumPath("tier"), ritualTier.potency) + .predicate(MalumMod.malumPath("tier"), ritualTier.potency / 10f) .model(provider.withExistingParent(provider.getItemName(item) + "_" + path, GENERATED).texture("layer0", itemTexturePath)) .end(); } @@ -59,7 +59,7 @@ public class MalumItemModelSmithTypes { String base = provider.getItemName(item); provider.createGenericModel(item, GENERATED, provider.getItemTexture(base + "_default")); for (SoulwovenBannerPatternData pattern : SoulwovenBannerPatternData.REGISTERED_PATTERNS) { - final int i = SoulwovenBannerPatternData.REGISTERED_PATTERNS.indexOf(pattern); + final float i = SoulwovenBannerPatternData.REGISTERED_PATTERNS.indexOf(pattern) / 10f; if (pattern.equals(SoulwovenBannerPatternData.DEFAULT)) { continue; } @@ -75,11 +75,15 @@ public class MalumItemModelSmithTypes { public static ItemModelSmith CATALYST_LOBBER = new ItemModelSmith((item, provider) -> { String base = provider.getItemName(item); provider.createGenericModel(item, HANDHELD, provider.getItemTexture(base)); - for (int i = 1; i <= 2; i++) { - String affix = i == 1 ? "open" : "loaded"; + + float[] states = {0.2f, 0.1f}; + String[] affixes = {"open", "loaded"}; + + for (int i = 0; i < states.length; i++) { + String affix = affixes[i]; ResourceLocation itemTexturePath = provider.getItemTexture(base + "_" + affix); provider.getBuilder(BuiltInRegistries.ITEM.getKey(item).getPath()).override() - .predicate(MalumMod.malumPath("state"), i) + .predicate(MalumMod.malumPath("state"), states[i]) .model(provider.withExistingParent(base + "_" + affix, HANDHELD).texture("layer0", itemTexturePath)) .end(); }