Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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. A Notifications like Tenacity Client

A Notifications like Tenacity Client

Scheduled Pinned Locked Moved Kotlin/Java
5 Posts 4 Posters 2.5k Views 2 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.
  • LarissaL Offline
    LarissaL Offline
    Larissa
    wrote on last edited by Larissa
    #1

    first,you should add this into the Easeutils

    
    @JvmStatic
        fun easeInExpo(x: Double): Double {
            return if(x == 0.0){0.0}else{2.0.pow(10 * x - 10)}
        }
    
        @JvmStatic
        fun easeOutExpo(x: Double): Double {
            return if(x == 1.0){1.0}else{1 - 2.0.pow(-10 * x)}
        }
    
    

    and this is the code in the elements files

    
    package net.ccbluex.liquidbounce.ui.client.hud.element.elements
    
    import com.sun.tracing.dtrace.ModuleName
    import net.ccbluex.liquidbounce.LiquidBounce
    import net.ccbluex.liquidbounce.ui.client.hud.designer.GuiHudDesigner
    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.EaseUtils
    import net.ccbluex.liquidbounce.utils.render.RenderUtils
    import net.minecraft.util.ResourceLocation
    import org.lwjgl.opengl.GL11
    import java.awt.Color
    
    @ElementInfo(name = "Notifications")
    class Notifications(x: Double = 6.0, y: Double = 60.0, scale: Float = 1F,
                        side: Side = Side(Side.Horizontal.RIGHT, Side.Vertical.DOWN)) : Element(x, y, scale, side) {
    
        override fun drawElement(): Border? {
    
            LiquidBounce.hud.notifications.map { it }.forEachIndexed { index, notify ->
                GL11.glPushMatrix()
                if(notify.drawNotification(index)){
                    LiquidBounce.hud.notifications.remove(notify)
                }
                GL11.glPopMatrix()
            }
            if (mc.currentScreen is GuiHudDesigner) {
            }
            return null
        }
    }
    
    class Notification(val title: String, val content: String, val type: NotifyType, val time: Int=1500, val animeTime: Int=500) {
        val width=100.coerceAtLeast(Fonts.fontRegular38.getStringWidth(this.title)
                .coerceAtLeast(Fonts.fontRegular38.getStringWidth(this.content)) + 20)
        val height=27
        var fadeState = FadeState.IN
        var nowY=-height
        var animeXTime=System.currentTimeMillis()
        var animeYTime=System.currentTimeMillis()
        val error = ResourceLocation("liquidbounce/notification/disable.png")
        val successful = ResourceLocation("liquidbounce/notification/enable.png")
    
        fun drawNotification(index: Int):Boolean {
            val realY=(-(index)*height*1.25).toInt()
            val nowTime=System.currentTimeMillis()
    
            if(nowY!=realY){
                var pct=(nowTime-animeYTime)/animeTime.toDouble()
                if(pct>1){
                    nowY=realY
                    pct=1.0
                }else{
                    pct=EaseUtils.easeOutExpo(pct)
                }
                GL11.glTranslated(0.0,(realY-nowY)*pct,0.0)
            }else{
                animeYTime=nowTime
            }
            GL11.glTranslated(0.0,nowY.toDouble(),0.0)
    
            var larissa=(nowTime-animeXTime)/animeTime.toDouble()
            when(fadeState){
                FadeState.IN -> {
                    if(larissa>1){
                        fadeState=FadeState.STAY
                        animeXTime=nowTime
                        larissa=1.0
                    }
                    larissa=EaseUtils.easeOutExpo(larissa)
                }
                FadeState.STAY -> {
                    larissa=1.0
                    if((nowTime-animeXTime)>time){
                        fadeState=FadeState.OUT
                        animeXTime=nowTime
                    }
                }
                FadeState.OUT -> {
                    if(larissa>1){
                        fadeState=FadeState.END
                        animeXTime=nowTime
                        larissa=1.0
                    }
                    larissa=1-EaseUtils.easeInExpo(larissa)
                }
                FadeState.END -> {
                    return true
                }
            }
            GL11.glTranslated(width-(width*larissa),0.0,0.0)
            GL11.glTranslatef(-width.toFloat(),0F,0F)
    
            if(type.renderColor == Color(0xFF2F2F)){
                RenderUtils.drawCircleRect(-18F,0F,width.toFloat(),height.toFloat(),6f,Color(180,0,0,190).rgb,true)
                RenderUtils.drawImage(error,-13,5,18,18)
                Fonts.fontBold35.drawString(title,9F,17F,Color(255,255,255,255).rgb)
                Fonts.fontBold40.drawString(content,9F,6F,Color(255,255,255,255).rgb)
            }else if(type.renderColor == Color(0x60E092)){
                RenderUtils.drawCircleRect(-16F,0F,width.toFloat(),height.toFloat(),6f,Color(0,180,0,190).rgb,true)
                RenderUtils.drawImage(successful,-13,5,18,18)
                Fonts.fontBold35.drawString(title,9F,17F,Color(255,255,255,255).rgb)
                Fonts.fontBold40.drawString(content,9F,6F,Color(255,255,255,255).rgb)
            }
            return false
        }
    }
    enum class NotifyType(var renderColor: Color) {
        SUCCESS(Color(0x60E092)),
        ERROR(Color(0xFF2F2F)),
    
    }
    
    enum class FadeState { IN, STAY, OUT, END }
    
    

    but it is not good to copy into the liquidbounceplus
    the assets and photos:
    D6EF1710-3DE8-476F-A7D6-756D08666F11.png CBEDE78F-B6B4-40F4-B3E0-83827AB90C96.jpeg 927189E0-06DD-4B2F-8902-FAB82C4DA1B9.png

    kumri owoK keke_mcK 2 Replies Last reply
    3
    • LarissaL Larissa

      first,you should add this into the Easeutils

      
      @JvmStatic
          fun easeInExpo(x: Double): Double {
              return if(x == 0.0){0.0}else{2.0.pow(10 * x - 10)}
          }
      
          @JvmStatic
          fun easeOutExpo(x: Double): Double {
              return if(x == 1.0){1.0}else{1 - 2.0.pow(-10 * x)}
          }
      
      

      and this is the code in the elements files

      
      package net.ccbluex.liquidbounce.ui.client.hud.element.elements
      
      import com.sun.tracing.dtrace.ModuleName
      import net.ccbluex.liquidbounce.LiquidBounce
      import net.ccbluex.liquidbounce.ui.client.hud.designer.GuiHudDesigner
      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.EaseUtils
      import net.ccbluex.liquidbounce.utils.render.RenderUtils
      import net.minecraft.util.ResourceLocation
      import org.lwjgl.opengl.GL11
      import java.awt.Color
      
      @ElementInfo(name = "Notifications")
      class Notifications(x: Double = 6.0, y: Double = 60.0, scale: Float = 1F,
                          side: Side = Side(Side.Horizontal.RIGHT, Side.Vertical.DOWN)) : Element(x, y, scale, side) {
      
          override fun drawElement(): Border? {
      
              LiquidBounce.hud.notifications.map { it }.forEachIndexed { index, notify ->
                  GL11.glPushMatrix()
                  if(notify.drawNotification(index)){
                      LiquidBounce.hud.notifications.remove(notify)
                  }
                  GL11.glPopMatrix()
              }
              if (mc.currentScreen is GuiHudDesigner) {
              }
              return null
          }
      }
      
      class Notification(val title: String, val content: String, val type: NotifyType, val time: Int=1500, val animeTime: Int=500) {
          val width=100.coerceAtLeast(Fonts.fontRegular38.getStringWidth(this.title)
                  .coerceAtLeast(Fonts.fontRegular38.getStringWidth(this.content)) + 20)
          val height=27
          var fadeState = FadeState.IN
          var nowY=-height
          var animeXTime=System.currentTimeMillis()
          var animeYTime=System.currentTimeMillis()
          val error = ResourceLocation("liquidbounce/notification/disable.png")
          val successful = ResourceLocation("liquidbounce/notification/enable.png")
      
          fun drawNotification(index: Int):Boolean {
              val realY=(-(index)*height*1.25).toInt()
              val nowTime=System.currentTimeMillis()
      
              if(nowY!=realY){
                  var pct=(nowTime-animeYTime)/animeTime.toDouble()
                  if(pct>1){
                      nowY=realY
                      pct=1.0
                  }else{
                      pct=EaseUtils.easeOutExpo(pct)
                  }
                  GL11.glTranslated(0.0,(realY-nowY)*pct,0.0)
              }else{
                  animeYTime=nowTime
              }
              GL11.glTranslated(0.0,nowY.toDouble(),0.0)
      
              var larissa=(nowTime-animeXTime)/animeTime.toDouble()
              when(fadeState){
                  FadeState.IN -> {
                      if(larissa>1){
                          fadeState=FadeState.STAY
                          animeXTime=nowTime
                          larissa=1.0
                      }
                      larissa=EaseUtils.easeOutExpo(larissa)
                  }
                  FadeState.STAY -> {
                      larissa=1.0
                      if((nowTime-animeXTime)>time){
                          fadeState=FadeState.OUT
                          animeXTime=nowTime
                      }
                  }
                  FadeState.OUT -> {
                      if(larissa>1){
                          fadeState=FadeState.END
                          animeXTime=nowTime
                          larissa=1.0
                      }
                      larissa=1-EaseUtils.easeInExpo(larissa)
                  }
                  FadeState.END -> {
                      return true
                  }
              }
              GL11.glTranslated(width-(width*larissa),0.0,0.0)
              GL11.glTranslatef(-width.toFloat(),0F,0F)
      
              if(type.renderColor == Color(0xFF2F2F)){
                  RenderUtils.drawCircleRect(-18F,0F,width.toFloat(),height.toFloat(),6f,Color(180,0,0,190).rgb,true)
                  RenderUtils.drawImage(error,-13,5,18,18)
                  Fonts.fontBold35.drawString(title,9F,17F,Color(255,255,255,255).rgb)
                  Fonts.fontBold40.drawString(content,9F,6F,Color(255,255,255,255).rgb)
              }else if(type.renderColor == Color(0x60E092)){
                  RenderUtils.drawCircleRect(-16F,0F,width.toFloat(),height.toFloat(),6f,Color(0,180,0,190).rgb,true)
                  RenderUtils.drawImage(successful,-13,5,18,18)
                  Fonts.fontBold35.drawString(title,9F,17F,Color(255,255,255,255).rgb)
                  Fonts.fontBold40.drawString(content,9F,6F,Color(255,255,255,255).rgb)
              }
              return false
          }
      }
      enum class NotifyType(var renderColor: Color) {
          SUCCESS(Color(0x60E092)),
          ERROR(Color(0xFF2F2F)),
      
      }
      
      enum class FadeState { IN, STAY, OUT, END }
      
      

      but it is not good to copy into the liquidbounceplus
      the assets and photos:
      D6EF1710-3DE8-476F-A7D6-756D08666F11.png CBEDE78F-B6B4-40F4-B3E0-83827AB90C96.jpeg 927189E0-06DD-4B2F-8902-FAB82C4DA1B9.png

      kumri owoK Offline
      kumri owoK Offline
      kumri owo
      wrote on last edited by
      #2

      @larissa also how do you even install these? Do I have to edit the main code or smth

      Plumer ManP 1 Reply Last reply
      0
      • kumri owoK kumri owo

        @larissa also how do you even install these? Do I have to edit the main code or smth

        Plumer ManP Offline
        Plumer ManP Offline
        Plumer Man
        wrote on last edited by
        #3

        you have to edit source yes.

        kumri owoK 1 Reply Last reply
        0
        • Plumer ManP Plumer Man

          you have to edit source yes.

          kumri owoK Offline
          kumri owoK Offline
          kumri owo
          wrote on last edited by
          #4

          @plumer-man ok

          1 Reply Last reply
          0
          • LarissaL Larissa

            first,you should add this into the Easeutils

            
            @JvmStatic
                fun easeInExpo(x: Double): Double {
                    return if(x == 0.0){0.0}else{2.0.pow(10 * x - 10)}
                }
            
                @JvmStatic
                fun easeOutExpo(x: Double): Double {
                    return if(x == 1.0){1.0}else{1 - 2.0.pow(-10 * x)}
                }
            
            

            and this is the code in the elements files

            
            package net.ccbluex.liquidbounce.ui.client.hud.element.elements
            
            import com.sun.tracing.dtrace.ModuleName
            import net.ccbluex.liquidbounce.LiquidBounce
            import net.ccbluex.liquidbounce.ui.client.hud.designer.GuiHudDesigner
            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.EaseUtils
            import net.ccbluex.liquidbounce.utils.render.RenderUtils
            import net.minecraft.util.ResourceLocation
            import org.lwjgl.opengl.GL11
            import java.awt.Color
            
            @ElementInfo(name = "Notifications")
            class Notifications(x: Double = 6.0, y: Double = 60.0, scale: Float = 1F,
                                side: Side = Side(Side.Horizontal.RIGHT, Side.Vertical.DOWN)) : Element(x, y, scale, side) {
            
                override fun drawElement(): Border? {
            
                    LiquidBounce.hud.notifications.map { it }.forEachIndexed { index, notify ->
                        GL11.glPushMatrix()
                        if(notify.drawNotification(index)){
                            LiquidBounce.hud.notifications.remove(notify)
                        }
                        GL11.glPopMatrix()
                    }
                    if (mc.currentScreen is GuiHudDesigner) {
                    }
                    return null
                }
            }
            
            class Notification(val title: String, val content: String, val type: NotifyType, val time: Int=1500, val animeTime: Int=500) {
                val width=100.coerceAtLeast(Fonts.fontRegular38.getStringWidth(this.title)
                        .coerceAtLeast(Fonts.fontRegular38.getStringWidth(this.content)) + 20)
                val height=27
                var fadeState = FadeState.IN
                var nowY=-height
                var animeXTime=System.currentTimeMillis()
                var animeYTime=System.currentTimeMillis()
                val error = ResourceLocation("liquidbounce/notification/disable.png")
                val successful = ResourceLocation("liquidbounce/notification/enable.png")
            
                fun drawNotification(index: Int):Boolean {
                    val realY=(-(index)*height*1.25).toInt()
                    val nowTime=System.currentTimeMillis()
            
                    if(nowY!=realY){
                        var pct=(nowTime-animeYTime)/animeTime.toDouble()
                        if(pct>1){
                            nowY=realY
                            pct=1.0
                        }else{
                            pct=EaseUtils.easeOutExpo(pct)
                        }
                        GL11.glTranslated(0.0,(realY-nowY)*pct,0.0)
                    }else{
                        animeYTime=nowTime
                    }
                    GL11.glTranslated(0.0,nowY.toDouble(),0.0)
            
                    var larissa=(nowTime-animeXTime)/animeTime.toDouble()
                    when(fadeState){
                        FadeState.IN -> {
                            if(larissa>1){
                                fadeState=FadeState.STAY
                                animeXTime=nowTime
                                larissa=1.0
                            }
                            larissa=EaseUtils.easeOutExpo(larissa)
                        }
                        FadeState.STAY -> {
                            larissa=1.0
                            if((nowTime-animeXTime)>time){
                                fadeState=FadeState.OUT
                                animeXTime=nowTime
                            }
                        }
                        FadeState.OUT -> {
                            if(larissa>1){
                                fadeState=FadeState.END
                                animeXTime=nowTime
                                larissa=1.0
                            }
                            larissa=1-EaseUtils.easeInExpo(larissa)
                        }
                        FadeState.END -> {
                            return true
                        }
                    }
                    GL11.glTranslated(width-(width*larissa),0.0,0.0)
                    GL11.glTranslatef(-width.toFloat(),0F,0F)
            
                    if(type.renderColor == Color(0xFF2F2F)){
                        RenderUtils.drawCircleRect(-18F,0F,width.toFloat(),height.toFloat(),6f,Color(180,0,0,190).rgb,true)
                        RenderUtils.drawImage(error,-13,5,18,18)
                        Fonts.fontBold35.drawString(title,9F,17F,Color(255,255,255,255).rgb)
                        Fonts.fontBold40.drawString(content,9F,6F,Color(255,255,255,255).rgb)
                    }else if(type.renderColor == Color(0x60E092)){
                        RenderUtils.drawCircleRect(-16F,0F,width.toFloat(),height.toFloat(),6f,Color(0,180,0,190).rgb,true)
                        RenderUtils.drawImage(successful,-13,5,18,18)
                        Fonts.fontBold35.drawString(title,9F,17F,Color(255,255,255,255).rgb)
                        Fonts.fontBold40.drawString(content,9F,6F,Color(255,255,255,255).rgb)
                    }
                    return false
                }
            }
            enum class NotifyType(var renderColor: Color) {
                SUCCESS(Color(0x60E092)),
                ERROR(Color(0xFF2F2F)),
            
            }
            
            enum class FadeState { IN, STAY, OUT, END }
            
            

            but it is not good to copy into the liquidbounceplus
            the assets and photos:
            D6EF1710-3DE8-476F-A7D6-756D08666F11.png CBEDE78F-B6B4-40F4-B3E0-83827AB90C96.jpeg 927189E0-06DD-4B2F-8902-FAB82C4DA1B9.png

            keke_mcK Offline
            keke_mcK Offline
            keke_mc
            wrote on last edited by
            #5

            @Larissa Why does IDEA show that there is no Notifications class?

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            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