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.

fixed #6 by checking if player has mount

authored by

LegoRaft and committed by
GitHub
23f6437a 0e51b012

+14
+14
src/main/java/net/legoraft/armorhud/mixin/hudMixin.java
··· 3 3 import net.minecraft.client.MinecraftClient; 4 4 import net.minecraft.client.gui.hud.InGameHud; 5 5 import net.minecraft.client.util.math.MatrixStack; 6 + import net.minecraft.entity.LivingEntity; 6 7 import net.minecraft.entity.player.PlayerEntity; 7 8 import net.minecraft.item.ItemStack; 8 9 import org.spongepowered.asm.mixin.Final; ··· 21 22 @Shadow private int scaledHeight; 22 23 @Shadow protected abstract void renderHotbarItem(int x, int y, float tickDelta, PlayerEntity player, ItemStack stack, int seed); 23 24 25 + @Shadow protected abstract LivingEntity getRiddenEntity(); 26 + 24 27 @Inject(at = @At("HEAD"), method = "renderHotbar") 25 28 public void renderArmorHud(float tickDelta, MatrixStack matrices, CallbackInfo ci) { 26 29 assert this.client.player != null; ··· 35 38 // Moves armorhud down if player is in creative 36 39 if (client.player.isCreative()) { 37 40 i = this.scaledHeight - 39; 41 + } 42 + // Moves armorhud up if player is on mount 43 + if (client.player.hasVehicle() && getRiddenEntity() != null) { 44 + if (getRiddenEntity().isAlive()) { 45 + if (getRiddenEntity().getMaxHealth() > 20) { 46 + i = this.scaledHeight - 65; 47 + } 48 + else { 49 + i = this.scaledHeight - 55; 50 + } 51 + } 38 52 } 39 53 40 54 // Render all armor items from player