Skip to content

Commit

Permalink
fix(legacy): Fixed FPS Issues with RectNew (#3174)
Browse files Browse the repository at this point in the history
Have to revert to old renderutils, due to new one not well optimized in fps usage. So now you should get more fps :)
  • Loading branch information
EclipsesDev authored May 31, 2024
1 parent 51306e1 commit 192c233
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import net.ccbluex.liquidbounce.utils.render.ColorUtils
import net.ccbluex.liquidbounce.utils.render.RenderUtils.disableGlCap
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawTexturedModalRect
import net.ccbluex.liquidbounce.utils.render.RenderUtils.enableGlCap
import net.ccbluex.liquidbounce.utils.render.RenderUtils.quickDrawBorderedRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.quickDrawRectNew2
import net.ccbluex.liquidbounce.utils.render.RenderUtils.quickDrawBorderedRect
import net.ccbluex.liquidbounce.utils.render.RenderUtils.quickDrawRect
import net.ccbluex.liquidbounce.utils.render.RenderUtils.resetCaps
import net.ccbluex.liquidbounce.value.*
import net.minecraft.client.renderer.GlStateManager.*
Expand Down Expand Up @@ -213,7 +213,7 @@ object NameTags : Module("NameTags", Category.RENDER, hideModule = false) {

val borderColor = Color(borderColorRed, borderColorGreen, borderColorBlue, borderColorAlpha)

if (border) quickDrawBorderedRectNew(
if (border) quickDrawBorderedRect(
-width - 2F,
-2F,
width + 4F,
Expand All @@ -222,19 +222,19 @@ object NameTags : Module("NameTags", Category.RENDER, hideModule = false) {
borderColor.rgb,
bgColor.rgb
)
else quickDrawRectNew2(
else quickDrawRect(
-width - 2F, -2F, width + 4F, fontRenderer.FONT_HEIGHT + 2F + if (healthBar) 2F else 0F, bgColor.rgb
)

if (healthBar) {
quickDrawRectNew2(
quickDrawRect(
-width - 2F,
fontRenderer.FONT_HEIGHT + 3F,
-width - 2F + dist,
fontRenderer.FONT_HEIGHT + 4F,
Color(50, 50, 50).rgb
)
quickDrawRectNew2(
quickDrawRect(
-width - 2F,
fontRenderer.FONT_HEIGHT + 3F,
-width - 2F + (dist * (getHealth(entity, healthFromScoreboard) / entity.maxHealth).coerceIn(0F, 1F)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import net.ccbluex.liquidbounce.utils.inventory.InventoryManager.canClickInvento
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils.countSpaceInInventory
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils.hasSpaceInInventory
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils.serverSlot
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.ccbluex.liquidbounce.utils.timing.TimeUtils.randomDelay
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.IntegerValue
Expand Down Expand Up @@ -337,9 +337,9 @@ object ChestStealer : Module("ChestStealer", Category.WORLD, hideModule = false)

easingProgress += (progress - easingProgress) / 6f * event.partialTicks

drawRectNew(minX - 2, minY - 2, maxX + 2, maxY + 2, Color(200, 200, 200).rgb)
drawRectNew(minX, minY, maxX, maxY, Color(50, 50, 50).rgb)
drawRectNew(minX, minY, minX + (maxX - minX) * easingProgress, maxY, Color.HSBtoRGB(easingProgress / 5, 1f, 1f) or 0xFF0000)
drawRect(minX - 2, minY - 2, maxX + 2, maxY + 2, Color(200, 200, 200).rgb)
drawRect(minX, minY, maxX, maxY, Color(50, 50, 50).rgb)
drawRect(minX, minY, minX + (maxX - minX) * easingProgress, maxY, Color.HSBtoRGB(easingProgress / 5, 1f, 1f) or 0xFF0000)
}

@EventTarget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import net.ccbluex.liquidbounce.utils.misc.HttpUtils.get
import net.ccbluex.liquidbounce.utils.misc.HttpUtils.requestStream
import net.ccbluex.liquidbounce.utils.render.CustomTexture
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawLoadingCircle
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.GuiSlot
Expand Down Expand Up @@ -54,7 +54,7 @@ class GuiContributors(private val prevGui: GuiScreen) : GuiScreen() {

list.drawScreen(mouseX, mouseY, partialTicks)

drawRectNew(width / 4f, 40f, width.toFloat(), height - 40f, Integer.MIN_VALUE)
drawRect(width / 4f, 40f, width.toFloat(), height - 40f, Integer.MIN_VALUE)

if (credits.isNotEmpty()) {
val credit = credits[list.selectedSlot]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package net.ccbluex.liquidbounce.ui.client
import net.ccbluex.liquidbounce.lang.translationMenu
import net.ccbluex.liquidbounce.ui.font.Fonts
import net.ccbluex.liquidbounce.utils.misc.HttpUtils.responseCode
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import org.lwjgl.input.Keyboard
Expand Down Expand Up @@ -38,7 +38,7 @@ class GuiServerStatus(private val prevGui: GuiScreen) : GuiScreen() {
drawBackground(0)

var i = height / 4 + 40
drawRectNew(
drawRect(
width / 2f - 115,
i - 5f,
width / 2f + 115,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import net.ccbluex.liquidbounce.ui.client.altmanager.GuiAltManager
import net.ccbluex.liquidbounce.ui.elements.GuiPasswordField
import net.ccbluex.liquidbounce.ui.font.Fonts
import net.ccbluex.liquidbounce.utils.misc.MiscUtils
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.GuiTextField
Expand Down Expand Up @@ -71,7 +71,7 @@ class GuiDonatorCape(private val prevGui: GuiAltManager) : GuiScreen() {
override fun drawScreen(mouseX : Int, mouseY : Int, partialTicks : Float) {
// Draw background to screen
drawBackground(0)
drawRectNew(30f, 30f, width - 30f, height - 30f, Integer.MIN_VALUE)
drawRect(30f, 30f, width - 30f, height - 30f, Integer.MIN_VALUE)

// Draw title and status
Fonts.font40.drawCenteredString("Donator Cape", width / 2f, 45f, 0xffffff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import net.ccbluex.liquidbounce.ui.client.altmanager.GuiAltManager
import net.ccbluex.liquidbounce.ui.font.Fonts
import net.ccbluex.liquidbounce.utils.ClientUtils.LOGGER
import net.ccbluex.liquidbounce.utils.login.LoginUtils
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.GuiTextField
Expand Down Expand Up @@ -59,7 +59,7 @@ class GuiSessionLogin(private val prevGui: GuiAltManager) : GuiScreen() {
override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
// Draw background to screen
drawBackground(0)
drawRectNew(30f, 30f, width - 30f, height - 30f, Integer.MIN_VALUE)
drawRect(30f, 30f, width - 30f, height - 30f, Integer.MIN_VALUE)

// Draw title and status
Fonts.font40.drawCenteredString("Session Login", width / 2f, height / 2 - 150f, 0xffffff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import net.ccbluex.liquidbounce.ui.font.Fonts
import net.ccbluex.liquidbounce.utils.ClientUtils.LOGGER
import net.ccbluex.liquidbounce.utils.TabUtils
import net.ccbluex.liquidbounce.utils.misc.MiscUtils
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNew
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.GuiTextField
Expand Down Expand Up @@ -83,7 +83,7 @@ class GuiTheAltening(private val prevGui: GuiAltManager) : GuiScreen() {
override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
// Draw background to screen
drawBackground(0)
drawRectNew(30f, 30f, width - 30f, height - 30f, Integer.MIN_VALUE)
drawRect(30f, 30f, width - 30f, height - 30f, Integer.MIN_VALUE)

// Draw title and status
Fonts.font40.drawCenteredString("TheAltening", width / 2f, height / 2 - 180f, 0xffffff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import net.ccbluex.liquidbounce.utils.extensions.component1
import net.ccbluex.liquidbounce.utils.extensions.component2
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawBorderedRect
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawFilledCircle
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNewInt
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.ccbluex.liquidbounce.value.*
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.util.StringUtils
Expand Down Expand Up @@ -79,7 +79,7 @@ object BlackStyle : Style() {
}

override fun drawButtonElement(mouseX: Int, mouseY: Int, buttonElement: ButtonElement) {
drawRectNewInt(
drawRect(
buttonElement.x - 1,
buttonElement.y - 1,
buttonElement.x + buttonElement.width + 1,
Expand All @@ -94,11 +94,11 @@ object BlackStyle : Style() {
}

override fun drawModuleElementAndClick(mouseX: Int, mouseY: Int, moduleElement: ModuleElement, mouseButton: Int?): Boolean {
drawRectNewInt(
drawRect(
moduleElement.x - 1, moduleElement.y - 1, moduleElement.x + moduleElement.width + 1, moduleElement.y + moduleElement.height + 1,
getHoverColor(Color(40, 40, 40), moduleElement.hoverTime)
)
drawRectNewInt(
drawRect(
moduleElement.x - 1, moduleElement.y - 1, moduleElement.x + moduleElement.width + 1, moduleElement.y + moduleElement.height + 1,
getHoverColor(Color(20, 20, 20, moduleElement.slowlyFade), moduleElement.hoverTime, !moduleElement.module.isActive)
)
Expand Down Expand Up @@ -231,8 +231,8 @@ object BlackStyle : Style() {
if (mouseButton == 0) return true
}

drawRectNewInt(x, y, x + width, y + 2, Int.MAX_VALUE)
drawRectNewInt(x, y, sliderValue, y + 2, color.rgb)
drawRect(x, y, x + width, y + 2, Int.MAX_VALUE)
drawRect(x, y, sliderValue, y + 2, color.rgb)
drawFilledCircle(sliderValue, y + 1, 3f, color)

font35.drawString(text, minX + 2, yPos + 3, Color.WHITE.rgb)
Expand Down Expand Up @@ -269,8 +269,8 @@ object BlackStyle : Style() {
if (mouseButton == 0) return true
}

drawRectNewInt(x, y, x + width, y + 2, Int.MAX_VALUE)
drawRectNewInt(x, y, sliderValue, y + 2, color.rgb)
drawRect(x, y, x + width, y + 2, Int.MAX_VALUE)
drawRect(x, y, sliderValue, y + 2, color.rgb)
drawFilledCircle(sliderValue, y + 1, 3f, color)

font35.drawString(text, minX + 2, yPos + 3, Color.WHITE.rgb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import net.ccbluex.liquidbounce.utils.block.BlockUtils.getBlockName
import net.ccbluex.liquidbounce.utils.extensions.component1
import net.ccbluex.liquidbounce.utils.extensions.component2
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawBorderedRect
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRectNewInt
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawRect
import net.ccbluex.liquidbounce.value.*
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.util.StringUtils
Expand All @@ -36,7 +36,7 @@ object LiquidBounceStyle : Style() {
font35.drawString(panel.name, xPos, panel.y + 7, Color.WHITE.rgb)

if (panel.scrollbar && panel.fade > 0) {
drawRectNewInt(panel.x - 2, panel.y + 21, panel.x, panel.y + 16 + panel.fade, Color.DARK_GRAY.rgb)
drawRect(panel.x - 2, panel.y + 21, panel.x, panel.y + 16 + panel.fade, Color.DARK_GRAY.rgb)

val visibleRange = panel.getVisibleRange()
val minY = panel.y + 21 + panel.fade *
Expand All @@ -46,7 +46,7 @@ object LiquidBounceStyle : Style() {
if (visibleRange.last > 0) visibleRange.last / panel.elements.lastIndex.toFloat()
else 0f

drawRectNewInt(panel.x - 2, minY.roundToInt(), panel.x, maxY.roundToInt(), Color.GRAY.rgb)
drawRect(panel.x - 2, minY.roundToInt(), panel.x, maxY.roundToInt(), Color.GRAY.rgb)
}
}

Expand Down Expand Up @@ -106,7 +106,7 @@ object LiquidBounceStyle : Style() {

moduleElement.settingsWidth = font35.getStringWidth(text) + 8

drawRectNewInt(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)

if (mouseButton == 0
&& mouseX in minX..maxX
Expand Down Expand Up @@ -137,7 +137,7 @@ object LiquidBounceStyle : Style() {
return true
}

drawRectNewInt(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)

font35.drawString("§c$text", minX + 2, yPos + 4, Color.WHITE.rgb)
font35.drawString(
Expand All @@ -151,7 +151,7 @@ object LiquidBounceStyle : Style() {
moduleElement.settingsWidth = font35.getStringWidth(valueOfList) + 16

if (value.openList) {
drawRectNewInt(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)

if (mouseButton == 0
&& mouseX in minX..maxX
Expand Down Expand Up @@ -192,12 +192,12 @@ object LiquidBounceStyle : Style() {
if (mouseButton == 0) return true
}

drawRectNewInt(minX, yPos + 2, maxX, yPos + 24, Int.MIN_VALUE)
drawRectNewInt(minX + 4, yPos + 18, maxX - 4, yPos + 19, Int.MAX_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 24, Int.MIN_VALUE)
drawRect(minX + 4, yPos + 18, maxX - 4, yPos + 19, Int.MAX_VALUE)

val displayValue = value.get().coerceIn(value.range)
val sliderValue = (moduleElement.x + moduleElement.width + (moduleElement.settingsWidth - 12) * (displayValue - value.minimum) / (value.maximum - value.minimum)).roundToInt()
drawRectNewInt(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor)
drawRect(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor)

font35.drawString(text, minX + 2, yPos + 4, Color.WHITE.rgb)

Expand All @@ -222,12 +222,12 @@ object LiquidBounceStyle : Style() {
if (mouseButton == 0) return true
}

drawRectNewInt(minX, yPos + 2, maxX, yPos + 24, Int.MIN_VALUE)
drawRectNewInt(minX + 4, yPos + 18, maxX - 4, yPos + 19, Int.MAX_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 24, Int.MIN_VALUE)
drawRect(minX + 4, yPos + 18, maxX - 4, yPos + 19, Int.MAX_VALUE)

val displayValue = value.get().coerceIn(value.range)
val sliderValue = moduleElement.x + moduleElement.width + (moduleElement.settingsWidth - 12) * (displayValue - value.minimum) / (value.maximum - value.minimum)
drawRectNewInt(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor)
drawRect(8 + sliderValue, yPos + 15, sliderValue + 11, yPos + 21, guiColor)

font35.drawString(text, minX + 2, yPos + 4, Color.WHITE.rgb)

Expand All @@ -248,7 +248,7 @@ object LiquidBounceStyle : Style() {
return true
}

drawRectNewInt(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)

font35.drawString(displayString, minX + 2, yPos + 4, Color.WHITE.rgb)

Expand All @@ -259,7 +259,7 @@ object LiquidBounceStyle : Style() {

moduleElement.settingsWidth = font35.getStringWidth(text) + 8

drawRectNewInt(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)
drawRect(minX, yPos + 2, maxX, yPos + 14, Int.MIN_VALUE)

font35.drawString(text, minX + 2, yPos + 4, Color.WHITE.rgb)

Expand Down
Loading

0 comments on commit 192c233

Please sign in to comment.