[Kotlin]ModuleInfo Element
-
Firse you should add this into Module.kt
var key = false set(key) { field = key if (!LiquidBounce.isStarting) LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.modulesConfig) }
Then add this into ModulesConfig.java and register this command
module.setKey(jsonModule.get("KeyShow").getAsBoolean());
/* * LiquidBounce Hacked Client * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge. * https://github.com/CCBlueX/LiquidBounce/ */ package net.ccbluex.liquidbounce.features.command.commands import net.ccbluex.liquidbounce.LiquidBounce import net.ccbluex.liquidbounce.features.command.Command import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification import net.ccbluex.liquidbounce.ui.client.hud.element.elements.NotifyType import org.lwjgl.input.Keyboard class KeyShowCommand : Command("moduleinfo", emptyArray()) { /** * Execute commands with provided [args] */ override fun execute(args: Array<String>) { if (args.size > 1) { // Get module by name val module = LiquidBounce.moduleManager.getModule(args[1]) if (module == null) { chat("Module §a§l" + args[1] + "§3 not found.") return } // Response to user if(!module.key){ module.key = true // LiquidBounce.hud.addNotification(Notification("ModuleInfo","Add Module Show in ModuleInfo Element", NotifyType.INFO)) } else if(module.key){ module.key = false // LiquidBounce.hud.addNotification(Notification("ModuleInfo","Delete Module Show in ModuleInfo Element", NotifyType.INFO)) } return } chatSyntax(arrayOf("<module> <on/off>")) } override fun tabComplete(args: Array<String>): List<String> { if (args.isEmpty()) return emptyList() val moduleName = args[0] return when (args.size) { 1 -> LiquidBounce.moduleManager.modules .map { it.name } .filter { it.startsWith(moduleName, true) } .toList() else -> emptyList() } } }
At last, use this and register elemnt
package net.ccbluex.liquidbounce.ui.client.hud.element.elements import net.ccbluex.liquidbounce.LiquidBounce import net.ccbluex.liquidbounce.ui.client.hud.element.Border import net.ccbluex.liquidbounce.ui.client.hud.element.Element import net.ccbluex.liquidbounce.ui.client.hud.element.ElementInfo import net.ccbluex.liquidbounce.utils.PlayerListObject import net.ccbluex.liquidbounce.utils.render.GLUtils import net.ccbluex.liquidbounce.utils.render.RenderUtils import net.ccbluex.liquidbounce.value.IntegerValue import net.ccbluex.liquidbounce.value.ListValue import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraft.util.EnumChatFormatting import org.lwjgl.input.Keyboard import org.lwjgl.opengl.GL11 import java.awt.Color import java.util.concurrent.CopyOnWriteArrayList /** * CustomHUD Armor element * * Shows a horizontal display of current armor */ @ElementInfo(name = "ModuleInfo") class ModuleInfo(x: Double = 10.0, y: Double = 10.0, scale: Float = 1F) : Element(x, y, scale) { /** * Draw element */ override fun drawElement(): Border { var textY: Float = 0f RenderUtils.drawRect(-1f, -11f, mc.fontRendererObj.getStringWidth("Module Info") + 90f, mc.fontRendererObj.FONT_HEIGHT.toFloat() / 2 - 5, Color(30, 30, 35, 220).rgb) mc.fontRendererObj.drawString("Module Info", 2F, -10f,-1,true) for (module in LiquidBounce.moduleManager.modules) { if(!module.key) continue RenderUtils.drawRect(-1f, -1f+textY, mc.fontRendererObj.getStringWidth("Module Info") + 90f, textY + mc.fontRendererObj.FONT_HEIGHT, Color(30, 30, 35, 170).rgb) mc.fontRendererObj.drawString(module.name, 3F, (0 + textY).toInt().toFloat(), -1,true) mc.fontRendererObj.drawString(if(module.state) EnumChatFormatting.GREEN.toString()+ "Enable" else EnumChatFormatting.RED.toString() + "Disable", 83F, (0 + textY).toInt().toFloat(), -1,true) mc.fontRendererObj.drawString(Keyboard.getKeyName(module.keyBind), 123F, (0 + textY).toInt().toFloat(), -1,true) textY += 10.0f } return Border(0f,0f,150f,textY) } }
Like this
-
What if you add an error
-
-
This post is deleted!
-
-
@mike-melony @CCblue6y just remove the import
-
Why is that?