Skip to content

Commit

Permalink
make base more dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Oct 9, 2024
1 parent 6ac587d commit 3ea56ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/main/java/mcjty/theoneprobe/items/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
21 changes: 4 additions & 17 deletions src/main/java/mcjty/theoneprobe/items/ProbeArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";
}
}
}

0 comments on commit 3ea56ec

Please sign in to comment.