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: cleaned up code a bit

+4 -10
+4 -10
src/client/java/com/armorhud/mixin/client/armorHudMixin.java
··· 10 10 import net.minecraft.entity.EquipmentSlot; 11 11 import net.minecraft.entity.LivingEntity; 12 12 import net.minecraft.entity.player.PlayerEntity; 13 - import net.minecraft.entity.player.PlayerInventory; 14 13 import net.minecraft.item.ItemStack; 15 14 import org.spongepowered.asm.mixin.Final; 16 15 import org.spongepowered.asm.mixin.Mixin; ··· 27 26 28 27 @Shadow protected abstract LivingEntity getRiddenEntity(); 29 28 30 - @Shadow public abstract void tick(boolean paused); 31 - 32 - @Shadow private ItemStack currentStack; 33 29 @Unique int armorHeight; 34 30 @Unique boolean initialized; 35 31 ··· 44 40 initialized = true; 45 41 } 46 42 47 - renderArmor(context, tickCounter); 43 + renderArmor(context); 48 44 moveArmor(context); 49 45 } 50 46 51 47 @Unique 52 - private void renderArmor(DrawContext context, RenderTickCounter tickCounter) { 48 + private void renderArmor(DrawContext context) { 53 49 int scaledWidth = context.getScaledWindowWidth(); 54 50 55 51 assert client.player != null; 56 52 57 53 ArmorAccessor armorAccessor = armorHud.getArmorAccessor(); 58 - int pieces = armorAccessor.getPieces(client.player); 59 - // System.out.println(pieces); 60 54 61 55 final int hungerWidth = 14; // Magic number to center 4 armor pieces 62 56 final int armorWidth = 15; ··· 71 65 x -= armorWidth; 72 66 73 67 if (slot.isArmorSlot()) { 74 - renderArmorPiece(context, x, armorHeight, tickCounter, client.player, armorAccessor.getArmorPiece(client.player, slot)); 68 + renderArmorPiece(context, x, armorHeight, client.player, armorAccessor.getArmorPiece(client.player, slot)); 75 69 } 76 70 } 77 71 } 78 72 79 73 // Pretty much the same as renderHotbarItem but with x and y as float parameters. 80 74 @Unique 81 - private void renderArmorPiece(DrawContext context, float x, float y, RenderTickCounter tickCounter, PlayerEntity player, ItemStack stack) { 75 + private void renderArmorPiece(DrawContext context, float x, float y, PlayerEntity player, ItemStack stack) { 82 76 if (stack.isEmpty()) return; 83 77 84 78 context.getMatrices().push();