From 71c911b55575f7cf65c5780d922e1dc6e8b5cf3f Mon Sep 17 00:00:00 2001 From: Zywl <86253343+opZywl@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:00:16 -0300 Subject: [PATCH] feat: Breadcrumbs with line height support. --- .../features/module/modules/player/Blink.kt | 5 +- .../module/modules/visual/Breadcrumbs.kt | 87 ++++-- .../style/styles/fdpdropdown/MainScreen.kt | 270 +++++++++--------- .../styles/fdpdropdown/impl/ModuleRect.java | 2 +- .../fdpdropdown/utils/render/Scroll.java | 2 +- .../utils/extensions/ColorExtensions.kt | 10 + .../utils/extensions/MathExtensions.kt | 1 + 7 files changed, 212 insertions(+), 165 deletions(-) create mode 100644 src/main/java/net/ccbluex/liquidbounce/utils/extensions/ColorExtensions.kt diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Blink.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Blink.kt index 549f5eda16..9fb6a893c6 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Blink.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Blink.kt @@ -17,7 +17,6 @@ import net.ccbluex.liquidbounce.value.boolean import net.ccbluex.liquidbounce.value.choices import net.ccbluex.liquidbounce.value.int import org.lwjgl.opengl.GL11.* -import java.awt.Color object Blink : Module("Blink", Category.PLAYER, gameDetecting = false, hideModule = false) { @@ -98,8 +97,8 @@ object Blink : Module("Blink", Category.PLAYER, gameDetecting = false, hideModul @EventTarget fun onRender3D(event: Render3DEvent) { val color = - if (Breadcrumbs.colorRainbow) rainbow() - else Color(Breadcrumbs.colorRed, Breadcrumbs.colorGreen, Breadcrumbs.colorBlue) + if (Breadcrumbs.rainbow) rainbow() + else Breadcrumbs.colors.color() synchronized(BlinkUtils.positions) { glPushMatrix() diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/Breadcrumbs.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/Breadcrumbs.kt index ea9ffdbb91..b927f220b3 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/Breadcrumbs.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/Breadcrumbs.kt @@ -7,50 +7,96 @@ package net.ccbluex.liquidbounce.features.module.modules.visual import net.ccbluex.liquidbounce.event.EventTarget import net.ccbluex.liquidbounce.event.Render3DEvent -import net.ccbluex.liquidbounce.event.UpdateEvent +import net.ccbluex.liquidbounce.event.WorldEvent import net.ccbluex.liquidbounce.features.module.Category import net.ccbluex.liquidbounce.features.module.Module +import net.ccbluex.liquidbounce.utils.extensions.* +import net.ccbluex.liquidbounce.utils.render.ColorSettingsInteger import net.ccbluex.liquidbounce.utils.render.ColorUtils.rainbow import net.ccbluex.liquidbounce.utils.render.RenderUtils.glColor import net.ccbluex.liquidbounce.value.boolean -import net.ccbluex.liquidbounce.value.int +import net.ccbluex.liquidbounce.value.float import org.lwjgl.opengl.GL11.* -import java.awt.Color object Breadcrumbs : Module("Breadcrumbs", Category.VISUAL, hideModule = false) { - val colorRainbow by boolean("Rainbow", false) - val colorRed by int("R", 255, 0..255) { !colorRainbow } - val colorGreen by int("G", 179, 0..255) { !colorRainbow } - val colorBlue by int("B", 72, 0..255) { !colorRainbow } + val rainbow by boolean("Rainbow", false) + val colors = ColorSettingsInteger(this, "Color", withAlpha = false) { !rainbow } + private val lineHeight by float("LineHeight", 0.25F, 0.25F..2F) + private val temporary by boolean("Temporary", true) + private val fade by boolean("Fade", true) { temporary } + private val lifeTime by float("LifeTime", 1F, 0F..10F) { temporary } - private val positions = mutableListOf() + private val positions = mutableListOf() @EventTarget fun onRender3D(event: Render3DEvent) { - val color = if (colorRainbow) rainbow() else Color(colorRed, colorGreen, colorBlue) + val player = mc.thePlayer ?: return + + if (positions.isEmpty() && !player.isMoving) { + return + } + + val currentTime = System.currentTimeMillis() + val fadeSeconds = lifeTime * 1000L glPushMatrix() + glDisable(GL_TEXTURE_2D) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glEnable(GL_LINE_SMOOTH) glEnable(GL_BLEND) glDisable(GL_DEPTH_TEST) + glDisable(GL_CULL_FACE) + + glEnable(GL_ALPHA_TEST) + glAlphaFunc(GL_GREATER, 0.0f) + + player.interpolatedPosition(player.prevPos).let { pos -> + val data = PositionData(pos.toDoubleArray(), currentTime) + + val lastData = positions.lastOrNull()?.array + + if (lastData == null || !lastData.contentEquals(data.array)) + positions += data + } mc.entityRenderer.disableLightmap() - glBegin(GL_LINE_STRIP) - glColor(color) + glBegin(GL_QUADS) val renderPosX = mc.renderManager.viewerPosX val renderPosY = mc.renderManager.viewerPosY val renderPosZ = mc.renderManager.viewerPosZ - for (pos in positions) - glVertex3d(pos[0] - renderPosX, pos[1] - renderPosY, pos[2] - renderPosZ) + positions.removeAll { + val timestamp = System.currentTimeMillis() - it.time + val transparency = if (fade) { + (0f..150f).lerpWith(1 - (timestamp / fadeSeconds).coerceAtMost(1.0F)) + } else 150f + + val startPos = it.array + val endPos = positions.getOrNull(positions.indexOf(it) + 1)?.array + + if (endPos != null) { + val color = if (rainbow) rainbow() else colors.color() + + glColor(color.withAlpha(transparency.toInt())) + + glVertex3d(startPos[0] - renderPosX, startPos[1] - renderPosY, startPos[2] - renderPosZ) + glVertex3d(startPos[0] - renderPosX, startPos[1] - renderPosY + lineHeight, startPos[2] - renderPosZ) + glVertex3d(endPos[0] - renderPosX, endPos[1] - renderPosY + lineHeight, endPos[2] - renderPosZ) + glVertex3d(endPos[0] - renderPosX, endPos[1] - renderPosY, endPos[2] - renderPosZ) + } + + temporary && timestamp > fadeSeconds + } glColor4d(1.0, 1.0, 1.0, 1.0) glEnd() + + glEnable(GL_CULL_FACE) glEnable(GL_DEPTH_TEST) + glDisable(GL_ALPHA_TEST) glDisable(GL_LINE_SMOOTH) glDisable(GL_BLEND) glEnable(GL_TEXTURE_2D) @@ -58,18 +104,13 @@ object Breadcrumbs : Module("Breadcrumbs", Category.VISUAL, hideModule = false) } @EventTarget - fun onUpdate(event: UpdateEvent) { - positions += doubleArrayOf(mc.thePlayer.posX, mc.thePlayer.entityBoundingBox.minY, mc.thePlayer.posZ) - } - - override fun onEnable() { - val thePlayer = mc.thePlayer ?: return - - positions += doubleArrayOf(thePlayer.posX, thePlayer.posY + thePlayer.eyeHeight * 0.5f, thePlayer.posZ) - positions += doubleArrayOf(thePlayer.posX, thePlayer.posY, thePlayer.posZ) + fun onWorld(event: WorldEvent) { + positions.clear() } override fun onDisable() { positions.clear() } -} \ No newline at end of file +} + +data class PositionData(val array: DoubleArray, val time: Long) \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/MainScreen.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/MainScreen.kt index cb2854af31..e0462cfe6c 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/MainScreen.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/MainScreen.kt @@ -3,163 +3,159 @@ * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. * https://github.com/SkidderMC/FDPClient/ */ -package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown; - -import net.ccbluex.liquidbounce.FDPClient; -import net.ccbluex.liquidbounce.features.module.Category; -import net.ccbluex.liquidbounce.features.module.Module; -import net.ccbluex.liquidbounce.features.module.modules.client.ClickGUIModule; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.impl.ModuleRect; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.animations.Animation; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.animations.Direction; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.animations.impl.DecelerateAnimation; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.normal.Main; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.normal.Screen; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.render.DrRenderUtils; -import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.render.StencilUtil; -import net.ccbluex.liquidbounce.ui.font.fontmanager.impl.Fonts; -import net.ccbluex.liquidbounce.utils.extensions.MathExtensionsKt; -import net.minecraft.client.gui.ScaledResolution; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.stream.Collectors; - -public class MainScreen implements Screen { - - private final Category category; - private final float rectWidth = 110; - private final float categoryRectHeight = 18; - public Animation animation; - public HashMap moduleAnimMap = new HashMap<>(); - public Animation openingAnimation; - private List moduleRects; - - public MainScreen(Category category) { - this.category = category; - } - - @Override - public void initGui() { +package net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown + +import net.ccbluex.liquidbounce.FDPClient.moduleManager +import net.ccbluex.liquidbounce.features.module.Category +import net.ccbluex.liquidbounce.features.module.modules.client.ClickGUIModule.clickHeight +import net.ccbluex.liquidbounce.features.module.modules.client.ClickGUIModule.scrollMode +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.impl.ModuleRect +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.animations.Animation +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.animations.Direction +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.animations.impl.DecelerateAnimation +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.normal.Main +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.normal.Screen +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.normal.Utils +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.render.DrRenderUtils +import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.fdpdropdown.utils.render.StencilUtil +import net.ccbluex.liquidbounce.ui.font.fontmanager.impl.Fonts +import net.ccbluex.liquidbounce.utils.extensions.roundToHalf +import net.minecraft.client.gui.ScaledResolution +import java.awt.Color +import kotlin.math.max +import kotlin.math.min + +class MainScreen(private val category: Category) : Screen { + + private val rectWidth = 110f + private val categoryRectHeight = 18f + var animation: Animation? = null + private var moduleAnimMap = HashMap() + var openingAnimation: Animation? = null + private var moduleRects: MutableList? = null + + override fun initGui() { if (moduleRects == null) { - moduleRects = new ArrayList<>(); - for (Module module : Main.getModulesInCategory(category, FDPClient.INSTANCE.getModuleManager()).stream().sorted(Comparator.comparing(Module::getName)).collect(Collectors.toList())) { - ModuleRect moduleRect = new ModuleRect(module); - moduleRects.add(moduleRect); - moduleAnimMap.put(moduleRect, new DecelerateAnimation(250, 1)); + moduleRects = mutableListOf().apply { + Main.getModulesInCategory(category, moduleManager) + .sortedBy { it.name } + .forEach { module -> + val moduleRect = ModuleRect(module) + add(moduleRect) + moduleAnimMap[moduleRect] = DecelerateAnimation(250, 1.0) + } } } - - if (moduleRects != null) { - moduleRects.forEach(ModuleRect::initGui); - } - + moduleRects?.forEach { it.initGui() } } - @Override - public void keyTyped(char typedChar, int keyCode) { - if (moduleRects != null) { - moduleRects.forEach(moduleRect -> moduleRect.keyTyped(typedChar, keyCode)); - } + override fun keyTyped(typedChar: Char, keyCode: Int) { + moduleRects?.forEach { it.keyTyped(typedChar, keyCode) } } - @Override - public void drawScreen(int mouseX, int mouseY) { - float animClamp = (float) Math.max(0, Math.min(255, 255 * animation.getOutput())); - int alphaAnimation = (int) animClamp; - int categoryRectColor = new Color(29, 29, 29, alphaAnimation).getRGB(); - int textColor = new Color(255, 255, 255, alphaAnimation).getRGB(); - - category.getDrag().onDraw(mouseX, mouseY); - float x = category.getDrag().getX(), y = category.getDrag().getY(); - DrRenderUtils.drawRect2(x, y, rectWidth, categoryRectHeight, categoryRectColor); - DrRenderUtils.setAlphaLimit(0); - Fonts.SFBOLD.SFBOLD_26.SFBOLD_26.drawString(category.name(), x + 5, y + Fonts.SFBOLD.SFBOLD_26.SFBOLD_26.getMiddleOfBox(categoryRectHeight), textColor); - - String l = ""; - if (category.name().equalsIgnoreCase("Combat")) { - l = "D"; - } else if (category.name().equalsIgnoreCase("Movement")) { - l = "A"; - } else if (category.name().equalsIgnoreCase("Player")) { - l = "B"; - } else if (category.name().equalsIgnoreCase("Visual")) { - l = "C"; - } else if (category.name().equalsIgnoreCase("Exploit")) { - l = "G"; - } else if (category.name().equalsIgnoreCase("Other")) { - l = "F"; + override fun drawScreen(mouseX: Int, mouseY: Int) { + val animClamp = max(0.0, min(255.0, 255 * (animation?.output ?: 0.0))).toFloat() + val alphaAnimation = animClamp.toInt() + val categoryRectColor = Color(29, 29, 29, alphaAnimation).rgb + val textColor = Color(255, 255, 255, alphaAnimation).rgb + + val x = category.drag.x + val y = category.drag.y + + category.drag.onDraw(mouseX, mouseY) + + DrRenderUtils.drawRect2(x.toDouble(), y.toDouble(), rectWidth.toDouble(), categoryRectHeight.toDouble(), categoryRectColor) + DrRenderUtils.setAlphaLimit(0f) + Fonts.SFBOLD.SFBOLD_26.SFBOLD_26.drawString( + category.name, + x + 5, + y + Fonts.SFBOLD.SFBOLD_26.SFBOLD_26.getMiddleOfBox(categoryRectHeight), + textColor + ) + + val icon = when (category.name.lowercase()) { + "combat" -> "D" + "movement" -> "A" + "player" -> "B" + "visual" -> "C" + "exploit" -> "G" + "other" -> "F" + else -> "" } - - DrRenderUtils.setAlphaLimit(0); - DrRenderUtils.resetColor(); - Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.drawString(l, x + rectWidth - (Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.stringWidth(l) + 5), - y + Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.getMiddleOfBox(categoryRectHeight), textColor); - - if (category.name().equalsIgnoreCase("Client")){ - Fonts.CheckFont.CheckFont_20.CheckFont_20.drawString("b", x + rectWidth - (Fonts.CheckFont.CheckFont_20.CheckFont_20.stringWidth("b") + 5), - y + Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.getMiddleOfBox(categoryRectHeight), textColor); + Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.drawString( + icon, + x + rectWidth - (Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.stringWidth(icon) + 5), + y + Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.getMiddleOfBox(categoryRectHeight), + textColor + ) + + if (category.name.equals("Client", ignoreCase = true)) { + Fonts.CheckFont.CheckFont_20.CheckFont_20.drawString( + "b", + x + rectWidth - (Fonts.CheckFont.CheckFont_20.CheckFont_20.stringWidth("b") + 5), + y + Fonts.ICONFONT.ICONFONT_20.ICONFONT_20.getMiddleOfBox(categoryRectHeight), + textColor + ) } - if (ClickGUIModule.INSTANCE.getScrollMode().equals("Value")) { - Main.allowedClickGuiHeight = ClickGUIModule.INSTANCE.getClickHeight(); + val allowedHeight = if (scrollMode == "Value") { + clickHeight.toFloat() } else { - ScaledResolution sr = new ScaledResolution(mc); - Main.allowedClickGuiHeight = 2 * sr.getScaledHeight() / 3f; + val sr = ScaledResolution(Utils.mc) + 2 * sr.scaledHeight / 3f } - - float allowedHeight = Main.allowedClickGuiHeight; - - - boolean hoveringMods = DrRenderUtils.isHovering(x, y + categoryRectHeight, rectWidth, allowedHeight, mouseX, mouseY); - - StencilUtil.initStencilToWrite(); - DrRenderUtils.drawRect2(x - 100, y + categoryRectHeight, rectWidth + 150, allowedHeight, -1); - StencilUtil.readStencilBuffer(1); - - double scroll = category.getScroll().getScroll(); - double count = 0; - for (ModuleRect moduleRect : moduleRects) { - Animation animation = moduleAnimMap.get(moduleRect); - animation.setDirection(moduleRect.module.getExpanded() ? Direction.FORWARDS : Direction.BACKWARDS); - - moduleRect.settingAnimation = animation; - moduleRect.alphaAnimation = alphaAnimation; - moduleRect.x = x; - moduleRect.height = 17; - moduleRect.panelLimitY = y; - moduleRect.openingAnimation = openingAnimation; - moduleRect.y = (float) (y + categoryRectHeight + (count * 17) + MathExtensionsKt.roundToHalf(scroll)); - moduleRect.width = rectWidth; - moduleRect.drawScreen(mouseX, mouseY); - - count += 1 + (moduleRect.getSettingSize()); + Main.allowedClickGuiHeight = allowedHeight + + val hoveringMods = DrRenderUtils.isHovering(x, y + categoryRectHeight, rectWidth, allowedHeight, mouseX, mouseY) + + StencilUtil.initStencilToWrite() + DrRenderUtils.drawRect2( + (x - 100).toDouble(), + (y + categoryRectHeight).toDouble(), + (rectWidth + 150).toDouble(), + allowedHeight.toDouble(), + -1 + ) + StencilUtil.readStencilBuffer(1) + + val scroll = category.scroll.scroll.toDouble() + var count = 0.0 + + moduleRects?.forEach { moduleRect -> + val animation = moduleAnimMap[moduleRect] + animation?.setDirection(if (moduleRect.module.expanded) Direction.FORWARDS else Direction.BACKWARDS) + + moduleRect.settingAnimation = animation + moduleRect.alphaAnimation = alphaAnimation + moduleRect.x = x + moduleRect.height = 17f + moduleRect.panelLimitY = y + moduleRect.openingAnimation = openingAnimation + moduleRect.y = (y + categoryRectHeight + (count * 17) + roundToHalf(scroll)).toFloat() + moduleRect.width = rectWidth + moduleRect.drawScreen(mouseX, mouseY) + + count += 1 + moduleRect.settingSize } if (hoveringMods) { - category.getScroll().onScroll(30); - float hiddenHeight = (float) ((count * 17) - allowedHeight); - category.getScroll().setMaxScroll(Math.max(0, hiddenHeight)); + category.scroll.onScroll(30) + val hiddenHeight = ((count * 17) - allowedHeight).toFloat() + category.scroll.maxScroll = max(0.0, hiddenHeight.toDouble()).toFloat() } - StencilUtil.uninitStencilBuffer(); - + StencilUtil.uninitStencilBuffer() } - @Override - public void mouseClicked(int mouseX, int mouseY, int button) { - boolean canDrag = DrRenderUtils.isHovering(category.getDrag().getX(), category.getDrag().getY(), rectWidth, categoryRectHeight, mouseX, mouseY); - category.getDrag().onClick(mouseX, mouseY, button, canDrag); - moduleRects.forEach(moduleRect -> moduleRect.mouseClicked(mouseX, mouseY, button)); + override fun mouseClicked(mouseX: Int, mouseY: Int, button: Int) { + val canDrag = DrRenderUtils.isHovering(category.drag.x, category.drag.y, rectWidth, categoryRectHeight, mouseX, mouseY) + category.drag.onClick(mouseX, mouseY, button, canDrag) + moduleRects?.forEach { it.mouseClicked(mouseX, mouseY, button) } } - @Override - public void mouseReleased(int mouseX, int mouseY, int state) { - category.getDrag().onRelease(state); - moduleRects.forEach(moduleRect -> moduleRect.mouseReleased(mouseX, mouseY, state)); + override fun mouseReleased(mouseX: Int, mouseY: Int, state: Int) { + category.drag.onRelease(state) + moduleRects?.forEach { it.mouseReleased(mouseX, mouseY, state) } } -} \ No newline at end of file +} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java index 2bf0209796..58f1ee20b9 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java @@ -34,7 +34,7 @@ public class ModuleRect extends Component { public int alphaAnimation; int clickX, clickY; @Getter - private double settingSize; + public double settingSize; public ModuleRect(Module module) { this.module = module; diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/utils/render/Scroll.java b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/utils/render/Scroll.java index 1a34c8da0a..52de467874 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/utils/render/Scroll.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/fdpdropdown/utils/render/Scroll.java @@ -16,7 +16,7 @@ public class Scroll { @Getter @Setter - private float maxScroll = Float.MAX_VALUE, minScroll = 0, rawScroll; + public float maxScroll = Float.MAX_VALUE, minScroll = 0, rawScroll; private float scroll; private Animation scrollAnimation = new SmoothStepAnimation(0, 0, Direction.BACKWARDS); diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/ColorExtensions.kt b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/ColorExtensions.kt new file mode 100644 index 0000000000..dad6b05717 --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/ColorExtensions.kt @@ -0,0 +1,10 @@ +/* + * FDPClient Hacked Client + * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. + * https://github.com/SkidderMC/FDPClient/ + */ +package net.ccbluex.liquidbounce.utils.extensions + +import java.awt.Color + +fun Color.withAlpha(a: Int) = Color(red, green, blue, a) \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/MathExtensions.kt b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/MathExtensions.kt index f486db383a..2ef47e0cbd 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/MathExtensions.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/MathExtensions.kt @@ -96,6 +96,7 @@ val RenderManager.renderPos get() = Vec3(renderPosX, renderPosY, renderPosZ) fun Vec3.toFloatTriple() = Triple(xCoord.toFloat(), yCoord.toFloat(), zCoord.toFloat()) +fun Vec3.toDoubleArray() = doubleArrayOf(xCoord, yCoord, zCoord) fun Float.toRadians() = this * 0.017453292f fun Float.toRadiansD() = toRadians().toDouble()