feat: made item name invisible when no Item is held
This commit is contained in:
parent
76cf923aec
commit
3d253f6cf9
3 changed files with 5 additions and 3 deletions
|
@ -11,7 +11,7 @@ plugins {
|
||||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
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 modId: String by project
|
||||||
val modName: String by project
|
val modName: String by project
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ class MainHandItem: MovableModule("Main Hand item", Category.HUD) {
|
||||||
val playerEntity = MinecraftClient.getInstance().player!!
|
val playerEntity = MinecraftClient.getInstance().player!!
|
||||||
val stack = playerEntity.getStackInHand(Hand.MAIN_HAND)
|
val stack = playerEntity.getStackInHand(Hand.MAIN_HAND)
|
||||||
val itemName = if (stack.item.name.string == "Air") "Empty" else stack.item.name.string
|
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}"
|
return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ class OffHandItem: MovableModule("Off Hand item", Category.HUD) {
|
||||||
val playerEntity = MinecraftClient.getInstance().player!!
|
val playerEntity = MinecraftClient.getInstance().player!!
|
||||||
val stack = playerEntity.getStackInHand(Hand.OFF_HAND)
|
val stack = playerEntity.getStackInHand(Hand.OFF_HAND)
|
||||||
val itemName = if (stack.item.name.string == "Air") "Empty" else stack.item.name.string
|
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}"
|
return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue