From 3ea56ec5032ebd2480c5200174737d859cc9a09a Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Tue, 8 Oct 2024 20:22:06 -0500 Subject: [PATCH] make base more dynamic --- .../mcjty/theoneprobe/items/ModItems.java | 10 ++++----- .../mcjty/theoneprobe/items/ProbeArmor.java | 21 ++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/main/java/mcjty/theoneprobe/items/ModItems.java b/src/main/java/mcjty/theoneprobe/items/ModItems.java index 2d24be56..06c48cf7 100644 --- a/src/main/java/mcjty/theoneprobe/items/ModItems.java +++ b/src/main/java/mcjty/theoneprobe/items/ModItems.java @@ -59,9 +59,9 @@ public static void init() { 15, new int[]{2, 5, 6, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F); bar.step("Creating Armor Probes"); - diamondHelmetProbe = makeHelmet(materialDiamondHelmet, 3, "diamond_helmet_probe", 1); - goldHelmetProbe = makeHelmet(materialGoldHelmet, 4, "gold_helmet_probe", 2); - ironHelmetProbe = makeHelmet(materialIronHelmet, 2, "iron_helmet_probe", 3); + diamondHelmetProbe = makeHelmet(materialDiamondHelmet, 3, "diamond_helmet_probe", "minecraft:textures/models/armor/diamond_layer_1.png"); + goldHelmetProbe = makeHelmet(materialGoldHelmet, 4, "gold_helmet_probe", "minecraft:textures/models/armor/gold_layer_1.png"); + ironHelmetProbe = makeHelmet(materialIronHelmet, 2, "iron_helmet_probe", "minecraft:textures/models/armor/iron_layer_1.png"); bar.step("Initializing Probe Note"); probeNote = new ProbeNote(); @@ -74,8 +74,8 @@ public static void init() { ProgressManager.pop(bar); } - private static Item makeHelmet(ItemArmor.ArmorMaterial material, int renderIndex, String name, int type) { - Item item = new ProbeArmor(material, renderIndex, EntityEquipmentSlot.HEAD, type) { + private static Item makeHelmet(ItemArmor.ArmorMaterial material, int renderIndex, String name, String baseTexture) { + Item item = new ProbeArmor(material, renderIndex, EntityEquipmentSlot.HEAD, baseTexture) { @Override public boolean getHasSubtypes() { return true; diff --git a/src/main/java/mcjty/theoneprobe/items/ProbeArmor.java b/src/main/java/mcjty/theoneprobe/items/ProbeArmor.java index 57724a21..2e7b585a 100644 --- a/src/main/java/mcjty/theoneprobe/items/ProbeArmor.java +++ b/src/main/java/mcjty/theoneprobe/items/ProbeArmor.java @@ -8,11 +8,11 @@ public class ProbeArmor extends ItemArmor { - private int armorType; + private String baseTexture; - public ProbeArmor(ArmorMaterial material, int renderIndex, EntityEquipmentSlot equipmentSlot, int armorType) { + public ProbeArmor(ArmorMaterial material, int renderIndex, EntityEquipmentSlot equipmentSlot, String baseTexture) { super(material, renderIndex, equipmentSlot); - this.armorType = armorType; + this.baseTexture = baseTexture; } @Override @@ -28,23 +28,10 @@ public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlo } if (slot == EntityEquipmentSlot.HEAD) { - return getArmorTexture(this.armorType); + return this.baseTexture; } // Call the parent method for layer0 return super.getArmorTexture(stack, entity, slot, type); } - - public String getArmorTexture(int type){ - switch (type){ - case 1: - return "minecraft:textures/models/armor/diamond_layer_1.png"; - case 2: - return "minecraft:textures/models/armor/gold_layer_1.png"; - case 3: - return "minecraft:textures/models/armor/iron_layer_1.png"; - default: - return "minecraft:textures/models/armor/diamond_layer_1.png"; - } - } }