feat!: converted Durability modules to HandItemInfos
This commit is contained in:
parent
fbb2c9f4fa
commit
76cf923aec
4 changed files with 6 additions and 12 deletions
|
@ -19,8 +19,8 @@ object ModuleManager {
|
||||||
XYZ(),
|
XYZ(),
|
||||||
Direction(),
|
Direction(),
|
||||||
AntiFatFinger(),
|
AntiFatFinger(),
|
||||||
DurabilityMainHand(),
|
MainHandItem(),
|
||||||
DurabilityOffHand(),
|
OffHandItem(),
|
||||||
)
|
)
|
||||||
lgr.info("Registered ${modules.size} Modules!")
|
lgr.info("Registered ${modules.size} Modules!")
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
package net.moonleay.etaorion.client.modules.hud
|
package net.moonleay.etaorion.client.modules.hud
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient
|
import net.minecraft.client.MinecraftClient
|
||||||
import net.minecraft.text.Text
|
|
||||||
import net.minecraft.util.Hand
|
import net.minecraft.util.Hand
|
||||||
import net.moonleay.etaorion.client.modules.component.Category
|
import net.moonleay.etaorion.client.modules.component.Category
|
||||||
import net.moonleay.etaorion.client.modules.component.MovableModule
|
import net.moonleay.etaorion.client.modules.component.MovableModule
|
||||||
|
|
||||||
class DurabilityMainHand: MovableModule("Durability (Main Hand)", Category.HUD) {
|
class MainHandItem: MovableModule("Main Hand item", Category.HUD) {
|
||||||
override fun getText4Render(): String {
|
override fun getText4Render(): String {
|
||||||
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 itemName
|
if(stack.maxDamage == 0) return " x" + stack.count + itemName
|
||||||
return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}"
|
return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,12 +5,12 @@ import net.minecraft.util.Hand
|
||||||
import net.moonleay.etaorion.client.modules.component.Category
|
import net.moonleay.etaorion.client.modules.component.Category
|
||||||
import net.moonleay.etaorion.client.modules.component.MovableModule
|
import net.moonleay.etaorion.client.modules.component.MovableModule
|
||||||
|
|
||||||
class DurabilityOffHand: MovableModule("Durability (Off Hand)", Category.HUD) {
|
class OffHandItem: MovableModule("Off Hand item", Category.HUD) {
|
||||||
override fun getText4Render(): String {
|
override fun getText4Render(): String {
|
||||||
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 itemName
|
if(stack.maxDamage == 0) return " x" + stack.count + itemName
|
||||||
return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}"
|
return "${itemName} ${stack.maxDamage - stack.damage}/${stack.maxDamage}"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -66,11 +66,6 @@ class AutoTextScreen(val parent: Screen) : Screen(Text.of("AutoText Manager")) {
|
||||||
MinecraftClient.getInstance().setScreen(parent)
|
MinecraftClient.getInstance().setScreen(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun tick() {
|
|
||||||
// addressField!!.tick()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
|
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
|
||||||
if (this.addressField!!.active && focused === addressField && (keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER)) {
|
if (this.addressField!!.active && focused === addressField && (keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER)) {
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue