From 3d253f6cf944a46b0bc86acbf675415a16993673 Mon Sep 17 00:00:00 2001 From: moonleay Date: Wed, 31 Jan 2024 14:04:34 +0100 Subject: [PATCH] feat: made item name invisible when no Item is held --- build.gradle.kts | 2 +- .../net/moonleay/etaorion/client/modules/hud/MainHandItem.kt | 3 ++- .../net/moonleay/etaorion/client/modules/hud/OffHandItem.kt | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d950c4c..116f279 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { id("org.jetbrains.gradle.plugin.idea-ext") } -val mavenVersion = System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" } ?: "0.4.0-snap" +val mavenVersion = System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" } ?: "0.4.2-snap" val modId: String by project val modName: String by project diff --git a/src/main/java/net/moonleay/etaorion/client/modules/hud/MainHandItem.kt b/src/main/java/net/moonleay/etaorion/client/modules/hud/MainHandItem.kt index 18e3a55..e63c32b 100644 --- a/src/main/java/net/moonleay/etaorion/client/modules/hud/MainHandItem.kt +++ b/src/main/java/net/moonleay/etaorion/client/modules/hud/MainHandItem.kt @@ -10,7 +10,8 @@ class MainHandItem: MovableModule("Main Hand item", Category.HUD) { val playerEntity = MinecraftClient.getInstance().player!! val stack = playerEntity.getStackInHand(Hand.MAIN_HAND) val itemName = if (stack.item.name.string == "Air") "Empty" else stack.item.name.string - if(stack.maxDamage == 0) return " x" + stack.count + itemName + if (itemName == "Empty") return "" + if(stack.maxDamage == 0) return itemName + " x" + stack.count return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}" } } diff --git a/src/main/java/net/moonleay/etaorion/client/modules/hud/OffHandItem.kt b/src/main/java/net/moonleay/etaorion/client/modules/hud/OffHandItem.kt index aa2ee6c..88794cc 100644 --- a/src/main/java/net/moonleay/etaorion/client/modules/hud/OffHandItem.kt +++ b/src/main/java/net/moonleay/etaorion/client/modules/hud/OffHandItem.kt @@ -10,7 +10,8 @@ class OffHandItem: MovableModule("Off Hand item", Category.HUD) { val playerEntity = MinecraftClient.getInstance().player!! val stack = playerEntity.getStackInHand(Hand.OFF_HAND) val itemName = if (stack.item.name.string == "Air") "Empty" else stack.item.name.string - if(stack.maxDamage == 0) return " x" + stack.count + itemName + if (itemName == "Empty") return "" + if(stack.maxDamage == 0) return itemName + " x" + stack.count return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}" } }