Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. Kotlin/Java
  3. [Kotlin] KeyStrokes

[Kotlin] KeyStrokes

Scheduled Pinned Locked Moved Kotlin/Java
20 Posts 12 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mateuszM mateusz

    how to
    add the kotlin keystrokes?

    qwq LiulihaocaiQ Offline
    qwq LiulihaocaiQ Offline
    qwq Liulihaocai
    wrote on last edited by
    #10

    @mateusz modify liquidbounce code

    1 Reply Last reply
    0
    • skiddermaster412S skiddermaster412

      @mateusz sell your soul to the demon

      mateuszM Offline
      mateuszM Offline
      mateusz
      wrote on last edited by
      #11

      @skiddermaster412 lol

      1 Reply Last reply
      0
      • melih_gmc2M Offline
        melih_gmc2M Offline
        melih_gmc2
        wrote on last edited by
        #12

        wtf sigma hator

        1 Reply Last reply
        0
        • GkingG Offline
          GkingG Offline
          Gking
          wrote on last edited by
          #13

          好ooooooooooo

          1 Reply Last reply
          0
          • qwq LiulihaocaiQ qwq Liulihaocai

            a simple keystrokes
            animation like skidma
            pic
            keys.png

            package net.ccbluex.liquidbounce.ui.client.hud.element.elements
            
            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.ui.client.hud.element.Side
            import net.ccbluex.liquidbounce.ui.font.Fonts
            import net.ccbluex.liquidbounce.utils.render.ColorUtils
            import net.ccbluex.liquidbounce.utils.render.RenderUtils
            import net.ccbluex.liquidbounce.value.BoolValue
            import net.ccbluex.liquidbounce.value.FloatValue
            import net.ccbluex.liquidbounce.value.FontValue
            import net.ccbluex.liquidbounce.value.IntegerValue
            import net.minecraft.client.gui.FontRenderer
            import net.minecraft.client.settings.KeyBinding
            import org.lwjgl.input.Keyboard
            import java.awt.Color
            
            @ElementInfo(name = "KeyStrokes")
            class KeyStrokes : Element(5.0,25.0,1.25F, Side.default()) {
                private val keys=ArrayList<KeyStroke>()
            
                private val backGroundRedValue = IntegerValue("BackGroundRed", 0, 0, 255)
                private val backGroundGreenValue = IntegerValue("BackGroundGreen", 0, 0, 255)
                private val backGroundBlueValue = IntegerValue("BackGroundBlue", 0, 0, 255)
                private val backGroundAlphaValue = IntegerValue("BackGroundAlpha", 170, 0, 255)
                private val textRedValue = IntegerValue("TextRed", 255, 0, 255)
                private val textGreenValue = IntegerValue("TextGreen", 255, 0, 255)
                private val textBlueValue = IntegerValue("TextBlue", 255, 0, 255)
                private val textAlphaValue = IntegerValue("TextAlpha", 255, 0, 255)
                private val highLightPercent = FloatValue("HighLightPercent",0.5F,0F,1F)
                private val animSpeedValue = IntegerValue("AnimationSpeed", 300, 0, 700)
                private val outline = BoolValue("Outline", false)
                private val outlineBoldValue = IntegerValue("OutlineBold", 1,0,5)
                private val outlineRainbow = BoolValue("OutLineRainbow", false)
                private val fontValue = FontValue("Font", Fonts.font35)
            
                init {
                    keys.add(KeyStroke(mc.gameSettings.keyBindForward,16,0,15,15).initKeyName())
                    keys.add(KeyStroke(mc.gameSettings.keyBindLeft,0,16,15,15).initKeyName())
                    keys.add(KeyStroke(mc.gameSettings.keyBindBack,16,16,15,15).initKeyName())
                    keys.add(KeyStroke(mc.gameSettings.keyBindRight,32,16,15,15).initKeyName())
                    keys.add(KeyStroke(mc.gameSettings.keyBindAttack,0,32,23,15).initKeyName("L"))
                    keys.add(KeyStroke(mc.gameSettings.keyBindUseItem,24,32,23,15).initKeyName("R"))
                }
            
                override fun drawElement(partialTicks: Float): Border {
                    val backGroundColor=Color(backGroundRedValue.get(),backGroundGreenValue.get(),backGroundBlueValue.get(),backGroundAlphaValue.get())
                    val textColor=if(outlineRainbow.get()){
                        ColorUtils.rainbow(textAlphaValue.get())
                    }else{
                        Color(textRedValue.get(),textGreenValue.get(),textBlueValue.get(),textAlphaValue.get())
                    }
            
                    for(keyStroke in keys){
                        keyStroke.render(animSpeedValue.get(), backGroundColor, textColor, highLightPercent.get(), outline.get(), outlineBoldValue.get(), fontValue.get())
                    }
            
                    return Border(0F,0F,47F,47F)
                }
            }
            
            class KeyStroke(val key:KeyBinding,val posX:Int,val posY:Int, val width:Int, val height:Int){
                var keyName="KEY"
            
                private var lastClick=false
                private val animations=ArrayList<Long>()
            
                fun render(speed: Int, bgColor: Color, textColor: Color, highLightPct: Float, outline: Boolean, outlineBold: Int, font: FontRenderer){
                    val highLightColor=Color(255-((255-bgColor.red)*highLightPct).toInt(),255-((255-bgColor.blue)*highLightPct).toInt(),255-((255-bgColor.green)*highLightPct).toInt())
                    val clickAlpha=255-(255-bgColor.alpha)*highLightPct
                    val centerX=posX+(width/2)
                    val centerY=posY+(height/2)
                    val nowTime=System.currentTimeMillis()
            
                    val rectColor=if(lastClick&&animations.isEmpty()){ ColorUtils.reAlpha(highLightColor,clickAlpha.toInt()) }else{ bgColor }
                    RenderUtils.drawRect(posX.toFloat(),posY.toFloat(),(posX+width).toFloat(),(posY+height).toFloat()
                        ,rectColor)
            
                    val removeAble=ArrayList<Long>()
                    for(time in animations){
                        val pct=(nowTime-time)/(speed.toFloat())
                        if(pct>1){
                            removeAble.add(time)
                            continue
                        }
                        RenderUtils.drawLimitedCircle(posX.toFloat(),posY.toFloat(),(posX+width).toFloat(),(posY+height).toFloat(),
                            centerX,centerY,(width*0.7F)*pct
                            ,Color(255-((255-highLightColor.red)*pct).toInt(),255-((255-highLightColor.green)*pct).toInt(),255-((255-highLightColor.blue)*pct).toInt(),255-((255-clickAlpha)*pct).toInt()))
                    }
                    for(time in removeAble){
                        animations.remove(time)
                    }
                    if(!lastClick && key.isKeyDown){
                        animations.add(nowTime)
                    }
                    lastClick=key.isKeyDown
            
                    font.drawString(keyName,centerX-(font.getStringWidth(keyName)/2),centerY-(font.FONT_HEIGHT/2)
                        ,textColor.rgb)
                    if(outline){
                        RenderUtils.drawRect(posX.toFloat(),posY.toFloat(),(posX+outlineBold).toFloat(),(posY+height).toFloat(),textColor.rgb)
                        RenderUtils.drawRect((posX+width-outlineBold).toFloat(),posY.toFloat(),(posX+width).toFloat(),(posY+height).toFloat(),textColor.rgb)
                        RenderUtils.drawRect((posX+outlineBold).toFloat(),posY.toFloat(),(posX+width-outlineBold).toFloat(),(posY+outlineBold).toFloat(),textColor.rgb)
                        RenderUtils.drawRect((posX+outlineBold).toFloat(),(posY+height-outlineBold).toFloat(),(posX+width-outlineBold).toFloat(),(posY+height).toFloat(),textColor.rgb)
                    }
                }
            
                fun initKeyName():KeyStroke{
                    keyName=Keyboard.getKeyName(key.keyCode)
                    return this
                }
            
                fun initKeyName(name:String):KeyStroke{
                    keyName=name
                    return this
                }
            }
            

            depends
            ColorUtils

                @JvmStatic
                fun reAlpha(color: Color,alpha: Int): Color{
                    return Color(color.red,color.green,color.blue,alpha)
                }
            

            RenderUtils

                public static void drawLimitedCircle(final float lx, final float ly, final float x2, final float y2,final int xx, final int yy, final float radius, final Color color) {
                    int sections = 50;
                    double dAngle = 2 * Math.PI / sections;
                    float x, y;
            
                    glPushAttrib(GL_ENABLE_BIT);
            
                    glEnable(GL_BLEND);
                    glDisable(GL_TEXTURE_2D);
                    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                    glEnable(GL_LINE_SMOOTH);
                    glBegin(GL_TRIANGLE_FAN);
            
                    for (int i = 0; i < sections; i++) {
                        x = (float) (radius * Math.sin((i * dAngle)));
                        y = (float) (radius * Math.cos((i * dAngle)));
            
                        glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F);
                        glVertex2f(Math.min(x2,Math.max(xx + x,lx)), Math.min(y2,Math.max(yy + y,ly)));
                    }
            
                    GlStateManager.color(0, 0, 0);
            
                    glEnd();
            
                    glPopAttrib();
                }
            
            DreamWasFuckedD Offline
            DreamWasFuckedD Offline
            DreamWasFucked
            wrote on last edited by
            #14

            @qwq-liulihaocai said in [Kotlin] KeyStrokes:

            skidma

            sigma hatar...

            RightedR 1 Reply Last reply
            0
            • DreamWasFuckedD DreamWasFucked

              @qwq-liulihaocai said in [Kotlin] KeyStrokes:

              skidma

              sigma hatar...

              RightedR Offline
              RightedR Offline
              Righted
              wrote on last edited by
              #15

              @skidma sigma niggar

              1 Reply Last reply
              0
              • B Offline
                B Offline
                BRBB
                wrote on last edited by
                #16

                does it register the clicks when autoclicking?

                natalkaN 1 Reply Last reply
                0
                • B BRBB

                  does it register the clicks when autoclicking?

                  natalkaN Offline
                  natalkaN Offline
                  natalka
                  wrote on last edited by
                  #17

                  @brbb It's not about keystrokes mod, but whether the autoclicker supports it or not. If your autoclicker doesn't support clicking through keystrokes, that's the fault of autoclicker not the keystrokes.

                  skiddermaster412S B 2 Replies Last reply
                  0
                  • natalkaN natalka

                    @brbb It's not about keystrokes mod, but whether the autoclicker supports it or not. If your autoclicker doesn't support clicking through keystrokes, that's the fault of autoclicker not the keystrokes.

                    skiddermaster412S Offline
                    skiddermaster412S Offline
                    skiddermaster412
                    wrote on last edited by
                    #18

                    @natalka when the me the explain today download the when in the moment the online server me minecraft r

                    1 Reply Last reply
                    0
                    • natalkaN natalka

                      @brbb It's not about keystrokes mod, but whether the autoclicker supports it or not. If your autoclicker doesn't support clicking through keystrokes, that's the fault of autoclicker not the keystrokes.

                      B Offline
                      B Offline
                      BRBB
                      wrote on last edited by
                      #19

                      @natalka oh ok, but i dont use any autoclickers i just use the built in autoclicker in liquid bounce so i thought it would work with this script.

                      C 1 Reply Last reply
                      0
                      • B BRBB

                        @natalka oh ok, but i dont use any autoclickers i just use the built in autoclicker in liquid bounce so i thought it would work with this script.

                        C Offline
                        C Offline
                        Co丶Dynamic
                        wrote on last edited by Co丶Dynamic
                        #20

                        @brbb it only detects your keyboard and mouse changes
                        anyway it works with Physical Autoclicker

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        About
                        • Terms of Service
                        • Privacy Policy
                        • Status
                        • Contact Us
                        Downloads
                        • Releases
                        • Source code
                        • License
                        Docs
                        • Tutorials
                        • CustomHUD
                        • AutoSettings
                        • ScriptAPI
                        Community
                        • Forum
                        • Guilded
                        • YouTube
                        • Twitter
                        • D.Tube
                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups