A mod that adds your armor to the hud modrinth.com/mod/simple-armor-hud
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: removed all old armorAccessor code

legoraft add99743 f1eb4165

-57
-2
src/client/java/com/armorhud/armor/ArmorAccessor.java
··· 1 1 package com.armorhud.armor; 2 2 3 3 import net.minecraft.client.player.LocalPlayer; 4 - import net.minecraft.world.entity.EquipmentSlot; 5 4 import net.minecraft.world.item.ItemStack; 6 5 7 6 import java.util.List; ··· 14 13 } 15 14 16 15 List<ItemStack> getArmorPieces(LocalPlayer player); 17 - ItemStack getArmorPiece(LocalPlayer player, EquipmentSlot slot); 18 16 }
-6
src/client/java/com/armorhud/armor/CombinedArmorAccessor.java
··· 1 1 package com.armorhud.armor; 2 2 3 3 import net.minecraft.client.player.LocalPlayer; 4 - import net.minecraft.world.entity.EquipmentSlot; 5 4 import net.minecraft.world.item.ItemStack; 6 5 7 6 import java.util.ArrayList; ··· 27 26 } 28 27 29 28 return armorList; 30 - } 31 - 32 - @Override 33 - public ItemStack getArmorPiece(LocalPlayer player, EquipmentSlot slot) { 34 - return null; 35 29 } 36 30 }
-8
src/client/java/com/armorhud/armor/VanillaArmorAccessor.java
··· 26 26 27 27 return armorList; 28 28 } 29 - 30 - public ItemStack getArmorPiece(LocalPlayer player, EquipmentSlot slot) { 31 - if (!slot.isArmor()) { 32 - throw new IllegalArgumentException("Invalid slot type: " + slot); 33 - } 34 - 35 - return player.getItemBySlot(slot); 36 - } 37 29 }
-41
src/client/java/com/armorhud/mixin/client/armorHudMixin.java
··· 8 8 import net.minecraft.client.gui.Gui; 9 9 import net.minecraft.client.AttackIndicatorStatus; 10 10 import net.minecraft.client.DeltaTracker; 11 - import net.minecraft.world.entity.EquipmentSlot; 12 11 import net.minecraft.world.entity.LivingEntity; 13 12 import net.minecraft.world.entity.player.Player; 14 13 import net.minecraft.world.item.ItemStack; ··· 76 75 ArmorAccessor armorAccessor = armorHud.getArmorAccessor(); 77 76 List<ItemStack> armorPieces = armorAccessor.getArmorPieces(minecraft.player); 78 77 79 - // EquipmentSlot[] slots = EquipmentSlot.values(); 80 - 81 78 final int hungerWidth = 14; // Magic number to center 4 armor pieces 82 79 final int armorWidth = 15; 83 80 ··· 89 86 } 90 87 } 91 88 } 92 - /* 93 - if (config.TRIM_EMPTY_SLOTS) { 94 - for (EquipmentSlot slot : slots) { 95 - if (slot.isArmor()) { 96 - ItemStack stack = armorAccessor.getArmorPiece(minecraft.player, slot); 97 - if (stack.isEmpty()) { 98 - emptyArmorSlots++; 99 - } 100 - } 101 - } 102 - } 103 - 104 - */ 105 89 106 90 float hungerX = scaledWidth / 2f + startXPosition; 107 91 float x = hungerX + hungerWidth - (7 * emptyArmorSlots) + 2 - (armorWidth * 2); ··· 117 101 118 102 renderArmorPiece(context, x, armorHeight, minecraft.player, armor); 119 103 } 120 - 121 - /*for ( int i = slots.length - 1; i > 0; i-- ) { 122 - EquipmentSlot slot = slots[i]; 123 - if (!slot.isArmor()) continue; 124 - ItemStack armor = armorAccessor.getArmorPiece(minecraft.player, slot); 125 - 126 - if (config.TRIM_EMPTY_SLOTS && armor.isEmpty()) continue; 127 - x -= armorWidth; 128 - 129 - renderArmorPiece(context, x, armorHeight, minecraft.player, armor); 130 - } 131 - 132 - */ 133 104 } else { 134 105 if ( config.TRIM_EMPTY_SLOTS ) { x += ( (float) hungerWidth / 2 ); } 135 106 for ( ItemStack armor : armorPieces ) { ··· 138 109 139 110 renderArmorPiece(context, x, armorHeight, minecraft.player, armor); 140 111 } 141 - 142 - /*for ( EquipmentSlot slot : slots ) { 143 - if ( !slot.isArmor() ) continue; 144 - ItemStack armor = armorAccessor.getArmorPiece(minecraft.player, slot); 145 - 146 - if ( config.TRIM_EMPTY_SLOTS && armor.isEmpty() ) continue; 147 - x -= armorWidth; 148 - 149 - renderArmorPiece(context, x, armorHeight, minecraft.player, armor); 150 - } 151 - 152 - */ 153 112 } 154 113 } 155 114