diff --git a/src/main/java/net/ccbluex/liquidbounce/event/Event.kt b/src/main/java/net/ccbluex/liquidbounce/event/Event.kt index fffd318f59..031bc9f0a6 100644 --- a/src/main/java/net/ccbluex/liquidbounce/event/Event.kt +++ b/src/main/java/net/ccbluex/liquidbounce/event/Event.kt @@ -25,5 +25,6 @@ open class CancellableEvent : Event() { } enum class EventState(val stateName: String) { - PRE("PRE"), POST("POST") + PRE("PRE"), POST("POST"), // MotionEvent + SEND("SEND"), RECEIVE("RECEIVE") // PacketEvent } diff --git a/src/main/java/net/ccbluex/liquidbounce/event/Events.kt b/src/main/java/net/ccbluex/liquidbounce/event/Events.kt index 1badb0b71e..0a1b436f36 100644 --- a/src/main/java/net/ccbluex/liquidbounce/event/Events.kt +++ b/src/main/java/net/ccbluex/liquidbounce/event/Events.kt @@ -26,20 +26,6 @@ import net.minecraft.util.EnumFacing */ class AttackEvent(val targetEntity: Entity) : CancellableEvent() -class FogColorEvent(var red: Float, var green: Float, var blue: Float, var alpha: Int) : Event(){ - @JvmName("setRed1") - fun setRed(red: Int) { - this.red = red.toFloat() - } - @JvmName("setGreen1") - fun setGreen(green: Int) { - this.green = green.toFloat() - } - @JvmName("setBlue1") - fun setBlue(blue: Int) { - this.blue = blue.toFloat() - } -} /** * Called when player killed other entity * @@ -120,6 +106,12 @@ class UpdateModelEvent(val player: EntityPlayer, val model: ModelPlayer) : Event */ class EntityDamageEvent(val damagedEntity: Entity): Event() + +/** + * Called after motion + */ +class PostMotionEvent: Event() + /** * Called in "onLivingUpdate" when the player is using a use item. * diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/FakeLag.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/FakeLag.kt index 13b89296f8..12fc649db0 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/FakeLag.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/FakeLag.kt @@ -54,8 +54,8 @@ object FakeLag : Module() { private var hasPlace = false override fun onDisable() { releasePackets() - hasPlace = false; - clear(); + hasPlace = false + clear() } fun fakeLagPacket(event: PacketEvent) { @@ -425,4 +425,4 @@ private class PosData { --increment } } -} \ No newline at end of file +} diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt index dd8d07b605..803bdff51b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt @@ -17,6 +17,8 @@ import net.ccbluex.liquidbounce.features.module.modules.visual.FreeCam import net.ccbluex.liquidbounce.handler.protocol.api.ProtocolFixer import net.ccbluex.liquidbounce.ui.font.Fonts import net.ccbluex.liquidbounce.utils.* +import net.ccbluex.liquidbounce.utils.ClientUtils.runTimeTicks +import net.ccbluex.liquidbounce.utils.EntityUtils.isLookingOnEntities import net.ccbluex.liquidbounce.utils.extensions.getDistanceToEntityBox import net.ccbluex.liquidbounce.utils.extensions.hitBox import net.ccbluex.liquidbounce.utils.extensions.rayTraceWithServerSideRotation @@ -130,7 +132,10 @@ object KillAura : Module() { ).displayable { modeDisplay.get() } private val targetModeValue = ListValue("TargetMode", arrayOf("Single", "Switch", "Multi"), "Switch").displayable { modeDisplay.get() } + + private val maxSwitchFOV = FloatValue("MaxSwitchFOV", 90f, 30f,180f).displayable { targetModeValue.equals("Switch") && modeDisplay.get() } private val switchDelayValue = IntegerValue("SwitchDelay", 15, 1, 2000).displayable { targetModeValue.equals("Switch") && modeDisplay.get() } + private val limitedMultiTargetsValue = IntegerValue("LimitedMultiTargets", 0, 0, 50).displayable { targetModeValue.equals("Multi") && modeDisplay.get() } // AutoBlock @@ -152,6 +157,10 @@ object KillAura : Module() { private val blinkBlockMode = ListValue("BlinkBlockType", arrayOf("Blatant", "Legit3tick", "Legit4tick", "Legit5tick", "Dynamic"), "Legit3tick").displayable { autoBlockPacketValue.displayable && autoBlockPacketValue.equals("Blink") } private val alwaysBlockDisplayValue = BoolValue("AlwaysRenderBlocking", true).displayable { autoBlockValue.displayable && autoBlockValue.equals("Range") } + // Hit delay + private val useHitDelay = BoolValue("UseHitDelay", false) + private val hitDelayTicks = IntegerValue("HitDelayTicks", 1, 1,5).displayable { useHitDelay.get() } + // Rotations private val rotationDisplay = BoolValue("Rotation Options:", true) @@ -287,6 +296,7 @@ object KillAura : Module() { private val rotationTimer = MSTimer() private var attackDelay = 0L private var clicks = 0 + private var attackTickTimes = mutableListOf>() // Container Delay private var containerOpen = -1L @@ -363,6 +373,7 @@ object KillAura : Module() { discoveredTargets.clear() inRangeDiscoveredTargets.clear() attackTimer.reset() + attackTickTimes.clear() clicks = 0 canSwing = false @@ -445,6 +456,11 @@ object KillAura : Module() { } + @EventTarget + fun onWorldChange(event: WorldEvent) { + attackTickTimes.clear() + } + /** * Update event */ @@ -780,7 +796,8 @@ object KillAura : Module() { val entityFov = RotationUtils.getRotationDifference(entity) if (distance <= discoverRangeValue.get() && (fov == 180F || entityFov <= fov)) { - discoveredTargets.add(entity) + if (switchMode && isLookingOnEntities(entity, maxSwitchFOV.get().toDouble()) || !switchMode) + discoveredTargets.add(entity) } } @@ -1212,6 +1229,24 @@ object KillAura : Module() { return TimeUtils.randomClickDelay(minCps.coerceAtMost(maxCps), minCps.coerceAtLeast(maxCps)) } + /** + * Check if raycast landed on a different object + * + * The game requires at least 1 tick of cooldown on raycast object type change (miss, block, entity) + * We are doing the same thing here but allow more cool down. + */ + + // no finished + private fun shouldDelayClick(type: MovingObjectPosition.MovingObjectType): Boolean { + if (!useHitDelay.get()) { + return false + } + + val lastAttack = attackTickTimes.lastOrNull() + + return lastAttack != null && lastAttack.first.typeOfHit != type && runTimeTicks - lastAttack.second <= hitDelayTicks.get() + } + /** * Check if run should be cancelled */ diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/matrix/MatrixDisabler.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/matrix/MatrixDisabler.kt new file mode 100644 index 0000000000..89636063d9 --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/matrix/MatrixDisabler.kt @@ -0,0 +1,81 @@ +/* + * 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.features.module.modules.exploit.disablers.matrix + +import net.ccbluex.liquidbounce.FDPClient +import net.ccbluex.liquidbounce.event.PacketEvent +import net.ccbluex.liquidbounce.event.PostMotionEvent +import net.ccbluex.liquidbounce.features.module.modules.exploit.disablers.DisablerMode +import net.ccbluex.liquidbounce.features.module.modules.movement.Flight +import net.ccbluex.liquidbounce.features.module.modules.movement.Speed +import net.ccbluex.liquidbounce.utils.ClientUtils.displayChatMessage +import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving +import net.ccbluex.liquidbounce.utils.PacketUtils +import net.ccbluex.liquidbounce.utils.RotationUtils +import net.ccbluex.liquidbounce.value.BoolValue +import net.minecraft.network.play.client.C03PacketPlayer +import net.minecraft.network.play.client.C09PacketHeldItemChange +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement +import net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook +import net.minecraft.util.BlockPos + +class MatrixDisabler : DisablerMode("Matrix") { + + private val matrixNoCheck = BoolValue("NoModuleCheck", false) + private val matrixMoveFix = BoolValue("MoveFix", true) + private val matrixMoveOnly = BoolValue("MoveOnly", false) + private val matrixNoMovePacket = BoolValue("NoMovePacket", true) + private val matrixHotbarChange = BoolValue("HotbarChange", true) + + override fun onPacket(event: PacketEvent) { + val packet = event.packet + if (matrixNoCheck.get() || FDPClient.moduleManager.getModule(Speed::class.java)!!.state || FDPClient.moduleManager.getModule(Flight::class.java)!!.state) { + if (packet is C03PacketPlayer) { + if (matrixNoMovePacket.get() && !packet.isMoving) { + event.cancelEvent() + displayChatMessage("no move, cancelled") + return + } + if (matrixMoveFix.get()) { + packet.onGround = true + if (!packet.rotating) { + packet.rotating = true + packet.yaw = mc.thePlayer.rotationYaw + packet.pitch = mc.thePlayer.rotationPitch + } + } + } + } + } + + @Override + fun onPostMotion(event: PostMotionEvent) { + if (!matrixMoveOnly.get() || isMoving()) + if (matrixNoCheck.get() || FDPClient.moduleManager[Flight::class.java]!!.state || FDPClient.moduleManager[Speed::class.java]!!.state) { + var changed = false + if (matrixHotbarChange.get()) for (i in 0..8) { + // find an empty inventory slot + if(mc.thePlayer.inventory.mainInventory[i] == null && i != mc.thePlayer.inventory.currentItem) { + PacketUtils.sendPacketNoEvent(C09PacketHeldItemChange(i)) + changed = true + displayChatMessage("found empty slot $i, switching") + break + } + } + + RotationUtils.serverRotation?.let { C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, it.yaw, RotationUtils.serverRotation!!.pitch, mc.thePlayer.onGround) } + ?.let { PacketUtils.sendPacketNoEvent(it) } + mc.netHandler.addToSendQueue(C08PacketPlayerBlockPlacement(BlockPos(-1, -1, -1), -1, null, 0f, 0f, 0f)) + displayChatMessage("sent placement") + + if (changed) { + PacketUtils.sendPacketNoEvent(C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem)) + displayChatMessage("switched back") + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/DelayedTranscation.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/DelayedTranscation.kt new file mode 100644 index 0000000000..99c9f06eec --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/DelayedTranscation.kt @@ -0,0 +1,90 @@ +/* + * 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.features.module.modules.exploit.disablers.other + +import net.ccbluex.liquidbounce.event.PacketEvent +import net.ccbluex.liquidbounce.event.Render2DEvent +import net.ccbluex.liquidbounce.features.module.modules.exploit.disablers.DisablerMode +import net.ccbluex.liquidbounce.utils.ClientUtils +import net.ccbluex.liquidbounce.utils.PacketUtils +import net.ccbluex.liquidbounce.utils.Rotation +import net.ccbluex.liquidbounce.utils.timer.MSTimer +import net.ccbluex.liquidbounce.value.IntegerValue +import net.minecraft.network.play.client.C0FPacketConfirmTransaction +import net.minecraft.network.play.server.S08PacketPlayerPosLook +import net.minecraft.network.play.server.S32PacketConfirmTransaction +import net.minecraft.network.play.INetHandlerPlayServer +import net.minecraft.network.Packet + +/** + * A disabler that delay transaction on some anticheat like Grim (<=2.3.59) and old Intave + * @author Fyxar + */ +class DelayedTranscation : DisablerMode("DelayedTranscation") { + private val holdSeconds = IntegerValue("HoldSeconds", 20, 1, 50) + private val timer = MSTimer() + + private var delay = false + private var lastRotation = Rotation(0f, 0f) + + private val packets = mutableListOf>() + + override fun onEnable() { + timer.reset() + } + + override fun onDisable() { + mc.timer.timerSpeed = 1F + + if (mc.thePlayer != null) + packets.forEach { PacketUtils.sendPacketNoEvent(it)} + + packets.clear() + delay = false + } + + fun onRender2D(event: Render2DEvent) { + if (delay) { + val seconds = timer.reachedTime / 1000L + ClientUtils.displayChatMessage("Anticheat will be back after ${holdSeconds.get() - seconds} seconds") + } + } + + override fun onPacket(event: PacketEvent) { + if (mc.thePlayer == null || mc.thePlayer.ticksExisted < 20) { + packets.clear() + return + } + + val packet = event.packet + + if (packet is S08PacketPlayerPosLook) { + if (mc.thePlayer.capabilities.isFlying || mc.thePlayer.capabilities.allowFlying) { + if (!delay) { + timer.reset() + delay = true + } + } + } + + if (delay) { + if (timer.hasTimePassed(holdSeconds.get() * 1000L)) { + packets.forEach {PacketUtils.sendPacketNoEvent(it)} + delay = false + packets.clear() + timer.reset() + } + + if (packet is S32PacketConfirmTransaction) { + packets.add(packet as Packet) + event.cancelEvent() + + PacketUtils.sendPacketNoEvent(C0FPacketConfirmTransaction()) + } + } + + } +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/FakeLagDisabler.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/FakeLagDisabler.kt index 8ddc2fa937..86334d670b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/FakeLagDisabler.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/other/FakeLagDisabler.kt @@ -1,3 +1,8 @@ +/* + * 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.features.module.modules.exploit.disablers.other import net.ccbluex.liquidbounce.FDPClient diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanAutoblock.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanAutoblock.kt index 1593702f5d..98df26b947 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanAutoblock.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanAutoblock.kt @@ -1,3 +1,8 @@ +/* + * 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.features.module.modules.exploit.disablers.vulcan import net.ccbluex.liquidbounce.features.module.modules.exploit.disablers.DisablerMode diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanCombatDisabler.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanCombatDisabler.kt index f58786a6b4..17be6f37f2 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanCombatDisabler.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanCombatDisabler.kt @@ -1,3 +1,8 @@ +/* + * 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.features.module.modules.exploit.disablers.vulcan import net.ccbluex.liquidbounce.event.PacketEvent @@ -22,9 +27,9 @@ class VulcanCombatDisabler : DisablerMode("VulcanCombat") { private val minBuffValue = IntegerValue("VulcanMinBuff", 5, 0, 12) private val noC0BValue = BoolValue("NoC0BPacket", false) private var currentTrans = 0 - + //已经死了一半的 Disabler,稍微复活一下。已经无法(只靠这个 Disabler)绕过的 Bypass:Vanilla Velocity / None Rotation - + private var currentDelay = 5000 private var currentBuffer = 4 private var currentDec = -1 diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanSprintDisabler.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanSprintDisabler.kt index ca5f07404c..cbd23e013d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanSprintDisabler.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanSprintDisabler.kt @@ -1,3 +1,8 @@ +/* + * 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.features.module.modules.exploit.disablers.vulcan import net.ccbluex.liquidbounce.event.UpdateEvent diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanStrafeDisabler.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanStrafeDisabler.kt index f7856db2dd..94a15fce88 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanStrafeDisabler.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablers/vulcan/VulcanStrafeDisabler.kt @@ -1,3 +1,8 @@ +/* + * 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.features.module.modules.exploit.disablers.vulcan import net.ccbluex.liquidbounce.event.PacketEvent diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Scaffold.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Scaffold.kt index 3fd68bbf74..2abb7d4be9 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Scaffold.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Scaffold.kt @@ -232,7 +232,7 @@ class Scaffold : Module() { private var zitterDirection = false // Delay - var placing = false + private var placing = false private val delayTimer = MSTimer() private val zitterTimer = MSTimer() private val clickTimer = MSTimer() @@ -443,7 +443,7 @@ class Scaffold : Module() { var dif = 0.5 val blockPos = BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0, mc.thePlayer.posZ) if (edgeDistanceValue.get() > 0) { - for (facingType in EnumFacing.values()) { + for (facingType in EnumFacing.entries) { if (facingType == EnumFacing.UP || facingType == EnumFacing.DOWN) { continue } @@ -737,14 +737,14 @@ class Scaffold : Module() { if (mc.thePlayer.posY % 1 <= 0.00153598) { mc.thePlayer.setPosition( mc.thePlayer.posX, - Math.floor(mc.thePlayer.posY), + floor(mc.thePlayer.posY), mc.thePlayer.posZ ) mc.thePlayer.motionY = 0.41998 } else if (mc.thePlayer.posY % 1 < 0.1 && offGroundTicks != 0) { mc.thePlayer.setPosition( mc.thePlayer.posX, - Math.floor(mc.thePlayer.posY), + floor(mc.thePlayer.posY), mc.thePlayer.posZ ) } @@ -926,7 +926,7 @@ class Scaffold : Module() { } else { BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ).down() } - if (!expand && (!BlockUtils.isReplaceable(blockPosition) || search(blockPosition, !shouldGoDown))) return + if (!expand && (!isReplaceable(blockPosition) || search(blockPosition, !shouldGoDown))) return if (expand) { for (i in 0 until expandLengthValue.get()) { if (search(blockPosition.add(if (mc.thePlayer.horizontalFacing == EnumFacing.WEST) -i else if (mc.thePlayer.horizontalFacing == EnumFacing.EAST) i else 0, @@ -1051,7 +1051,8 @@ class Scaffold : Module() { lockRotation = null mc.timer.timerSpeed = 1f shouldGoDown = false - val limitedRotation = RotationUtils.limitAngleChange(RotationUtils.serverRotation!!, Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch)!!, 58f) + val limitedRotation = RotationUtils.limitAngleChange(RotationUtils.serverRotation!!, + Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch), 58f) RotationUtils.setTargetRotation(limitedRotation, 2) SpoofItemUtils.stopSpoof() } @@ -1188,7 +1189,7 @@ class Scaffold : Module() { mc.thePlayer.posZ + if (mc.thePlayer.horizontalFacing == EnumFacing.NORTH) -i else if (mc.thePlayer.horizontalFacing == EnumFacing.SOUTH) i else 0 ) val placeInfo = get(blockPos) - if (BlockUtils.isReplaceable(blockPos) && placeInfo != null) { + if (isReplaceable(blockPos) && placeInfo != null) { RenderUtils.drawBlockBox(blockPos, Color(markRedValue.get(), markGreenValue.get(), markBlueValue.get(), 100), false, true, 1f) break } @@ -1203,7 +1204,7 @@ class Scaffold : Module() { * @return */ private fun search(blockPosition: BlockPos, checks: Boolean): Boolean { - if (!BlockUtils.isReplaceable(blockPosition)) return false + if (!isReplaceable(blockPosition)) return false val eyesPos = Vec3( mc.thePlayer.posX, mc.thePlayer.entityBoundingBox.minY + mc.thePlayer.getEyeHeight(), @@ -1293,10 +1294,10 @@ class Scaffold : Module() { "backwards" -> { var calcyaw = ((MovementUtils.movingYaw - 180) / 45).roundToInt() * 45 var calcpitch = 0f - if (calcyaw % 90 == 0) { - calcpitch = 82f + calcpitch = if (calcyaw % 90 == 0) { + 82f } else { - calcpitch = 78f + 78f } Rotation(calcyaw.toFloat(), calcpitch) } @@ -1364,10 +1365,10 @@ class Scaffold : Module() { "backwards" -> { var calcyaw = ((MovementUtils.movingYaw - 180) / 45).roundToInt() * 45 var calcpitch = 0f - if (calcyaw % 90 == 0) { - calcpitch = 82f + calcpitch = if (calcyaw % 90 == 0) { + 82f } else { - calcpitch = 78f + 78f } Rotation(calcyaw.toFloat(), calcpitch) } diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Sneak.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Sneak.kt index c7290ff33f..0355268303 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Sneak.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/Sneak.kt @@ -72,6 +72,8 @@ object Sneak : Module() { else -> null } } + + else -> {} } } } diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/FlagCheck.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/FlagCheck.kt new file mode 100644 index 0000000000..9269e45ef8 --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/FlagCheck.kt @@ -0,0 +1,178 @@ +/* + * 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.features.module.modules.other + +import net.ccbluex.liquidbounce.features.module.Module +import net.ccbluex.liquidbounce.features.module.ModuleCategory +import net.ccbluex.liquidbounce.features.module.ModuleInfo +import net.ccbluex.liquidbounce.utils.ClientUtils +import net.ccbluex.liquidbounce.utils.extensions.onPlayerRightClick +import net.ccbluex.liquidbounce.event.* +import net.ccbluex.liquidbounce.value.* +import net.minecraft.network.login.server.S00PacketDisconnect +import net.minecraft.network.play.server.S01PacketJoinGame +import net.minecraft.network.play.server.S08PacketPlayerPosLook +import net.minecraft.util.BlockPos +import net.minecraft.util.EnumFacing +import net.minecraft.util.Vec3 +import kotlin.math.abs +import kotlin.math.roundToLong +import kotlin.math.sqrt + +@ModuleInfo(name = "FlagCheck", category = ModuleCategory.OTHER) +object FlagCheck : Module() { + + private val resetFlagCounterTicks = IntegerValue("ResetCounterTicks", 600, 100, 1000) + private val rubberbandCheck = BoolValue("RubberbandCheck", false) + private val rubberbandThreshold = FloatValue("RubberBandThreshold", 5.0f, 0.05f,10.0f).displayable { rubberbandCheck.get() } + + private var flagCount = 0 + private var lastYaw = 0F + private var lastPitch = 0F + + private fun clearFlags() { + flagCount = 0 + } + + private var lagbackDetected = false + private var forceRotateDetected = false + private var ghostBlockDetected = false + + private var lastMotionX = 0.0 + private var lastMotionY = 0.0 + private var lastMotionZ = 0.0 + + private var lastPosX = 0.0 + private var lastPosY = 0.0 + private var lastPosZ = 0.0 + + override fun onDisable() { + clearFlags() + } + + @EventTarget + fun onPacket(event: PacketEvent) { + val player = mc.thePlayer ?: return + val packet = event.packet + + if (player.ticksExisted <= 100) + return + + if (player.isDead || (player.capabilities.isFlying && player.capabilities.disableDamage && !player.onGround)) + return + + if (packet is S08PacketPlayerPosLook) { + val deltaYaw = calculateAngleDelta(packet.yaw, lastYaw) + val deltaPitch = calculateAngleDelta(packet.pitch, lastPitch) + + if (deltaYaw > 90 || deltaPitch > 90) { + forceRotateDetected = true + flagCount++ + ClientUtils.displayChatMessage("§7(§9FlagCheck§7) §dDetected §3Force-Rotate §e(${deltaYaw.roundToLong()}° | ${deltaPitch.roundToLong()}°) §b(§c${flagCount}x§b)") + } else { + forceRotateDetected = false + } + + // Idk still testing :/ + // TODO: Make better check for ghostblock + if (player.onGround && player.onPlayerRightClick(BlockPos.ORIGIN, EnumFacing.DOWN, Vec3(packet.x, packet.y, packet.z)) + && player.lookVec.rotatePitch(-90f) != null) { + ghostBlockDetected = true + flagCount++ + ClientUtils.displayChatMessage("§7(§9FlagCheck§7) §dDetected §3GhostBlock §b(§eS08Packet§b) §b(§c${flagCount}x§b)") + } else { + ghostBlockDetected = false + } + + if (!forceRotateDetected && !ghostBlockDetected) { + lagbackDetected = true + flagCount++ + ClientUtils.displayChatMessage("§7(§9FlagCheck§7) §dDetected §3Lagback §b(§c${flagCount}x§b)") + } + + if (mc.thePlayer.ticksExisted % 3 == 0) { + lagbackDetected = false + } + + lastYaw = mc.thePlayer.rotationYawHead + lastPitch = mc.thePlayer.rotationPitch + } + + when (packet) { + is S01PacketJoinGame, is S00PacketDisconnect -> { + clearFlags() + } + } + } + + private fun calculateAngleDelta(newAngle: Float, oldAngle: Float): Float { + var delta = newAngle - oldAngle + if (delta > 180) delta -= 360 + if (delta < -180) delta += 360 + return abs(delta) + } + + /** + * Rubberband Checks (Still Under Testing) + */ + @EventTarget + fun onUpdate(event: UpdateEvent) { + val player = mc.thePlayer ?: return + + if (!rubberbandCheck.get() || player.ticksExisted <= 100) + return + + if (player.isDead || (player.capabilities.isFlying && player.capabilities.disableDamage && !player.onGround)) + return + + val motionX = player.motionX + val motionY = player.motionY + val motionZ = player.motionZ + + val deltaX = player.posX - lastPosX + val deltaY = player.posY - lastPosY + val deltaZ = player.posZ - lastPosZ + + val distanceTraveled = sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) + + val rubberbandReason = mutableListOf() + + if (distanceTraveled > rubberbandThreshold.get()) { + rubberbandReason.add("Invalid Position") + } + + if (abs(motionX) > rubberbandThreshold.get() || abs(motionY) > rubberbandThreshold.get() || abs(motionZ) > rubberbandThreshold.get()) { + if (!player.isCollided && !player.onGround) { + rubberbandReason.add("Invalid Motion") + } + } + + if (rubberbandReason.isNotEmpty()) { + flagCount++ + val reasonString = rubberbandReason.joinToString(" §8|§e ") + ClientUtils.displayChatMessage("§7(§9FlagCheck§7) §dDetected §3Rubberband §8(§e$reasonString§8) §b(§c${flagCount}x§b)") + } + + // Update last position and motion + lastPosX = player.prevPosX + lastPosY = player.prevPosY + lastPosZ = player.prevPosZ + + lastMotionX = motionX + lastMotionY = motionY + lastMotionZ = motionZ + + // Automatically clear flags (Default: 10 minutes) + if (player.ticksExisted % (resetFlagCounterTicks.get() * 20) == 0) { + clearFlags() + } + } + + @EventTarget + fun onWorld(event: WorldEvent) { + clearFlags() + } +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AutoItem.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AutoItem.kt index a2c4e45096..12f1cc7864 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AutoItem.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AutoItem.kt @@ -1,3 +1,8 @@ +/* + * 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.features.module.modules.player import net.ccbluex.liquidbounce.FDPClient @@ -123,4 +128,4 @@ object AutoItem : Module() { } } } -} +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AvoidHazards.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AvoidHazards.kt new file mode 100644 index 0000000000..ffbd1e455f --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AvoidHazards.kt @@ -0,0 +1,58 @@ +/* + * 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.features.module.modules.player + +import net.ccbluex.liquidbounce.event.BlockBBEvent +import net.ccbluex.liquidbounce.event.EventTarget +import net.ccbluex.liquidbounce.features.module.Module +import net.ccbluex.liquidbounce.features.module.ModuleCategory +import net.ccbluex.liquidbounce.features.module.ModuleInfo +import net.ccbluex.liquidbounce.value.BoolValue +import net.minecraft.init.Blocks +import net.minecraft.util.AxisAlignedBB + +@ModuleInfo(name = "AvoidHazards", category = ModuleCategory.PLAYER) +object AvoidHazards : Module() { + + private val fire = BoolValue("Fire", true) + private val cobweb = BoolValue("Cobweb", true) + private val cactus = BoolValue("Cactus", true) + private val lava = BoolValue("Lava", true) + private val water = BoolValue("Water", true) + private val plate = BoolValue("PressurePlate", true) + private val snow = BoolValue("Snow", true) + + @EventTarget + fun onBlockBB(e: BlockBBEvent) { + val thePlayer = mc.thePlayer ?: return + + when (e.block) { + Blocks.fire -> if (!fire.get()) return + + Blocks.web -> if (!cobweb.get()) return + + Blocks.snow -> if (!snow.get()) return + + Blocks.cactus -> if (!cactus.get()) return + + Blocks.water, Blocks.flowing_water -> + // Don't prevent water from cancelling fall damage. + if (!water.get() || thePlayer.fallDistance >= 3.34627 || thePlayer.isInWater) return + + Blocks.lava, Blocks.flowing_lava -> if (!lava.get()) return + + Blocks.wooden_pressure_plate, Blocks.stone_pressure_plate, Blocks.light_weighted_pressure_plate, Blocks.heavy_weighted_pressure_plate -> { + if (plate.get()) + e.boundingBox = AxisAlignedBB(e.x.toDouble(), e.y.toDouble(), e.z.toDouble(), e.x + 1.0, e.y + 0.25, e.z + 1.0) + return + } + + else -> return + } + + e.boundingBox = AxisAlignedBB(e.x.toDouble(), e.y.toDouble(), e.z.toDouble(), e.x + 1.0, e.y + 1.0, e.z + 1.0) + } +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Breaker.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Breaker.kt index 66bcc9a298..9c036a95f4 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Breaker.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Breaker.kt @@ -101,7 +101,7 @@ object Breaker : Module() { private val posList: MutableList = ArrayList() private var color = Color.CYAN private var thread: Thread? = null - var rotTicks = 0 + private var rotTicks = 0 override fun onEnable() { @@ -172,8 +172,8 @@ object Breaker : Module() { val targetId = blockValue.get() - if (pos == null || Block.getIdFromBlock(BlockUtils.getBlock(pos)) != targetId || - BlockUtils.getCenterDistance(pos!!) > rangeValue.get()) { + if (pos == null || Block.getIdFromBlock(getBlock(pos)) != targetId || + getCenterDistance(pos!!) > rangeValue.get()) { pos = find(targetId) } @@ -193,10 +193,10 @@ object Breaker : Module() { if (throughWallsValue.equals("Hypixel")) { val blockPos = find(26) ?: return - if (BlockUtils.isFullBlock(blockPos.up())) { - pos = blockPos.up()?: return + pos = if (BlockUtils.isFullBlock(blockPos.up())) { + blockPos.up()?: return } else { - pos = blockPos?: return + blockPos } } @@ -410,11 +410,11 @@ object Breaker : Module() { val timeLeft = "Cooldown: ${(coolDownTimer.hasTimeLeft(coolDownValue.get().toLong() * 1000L) / 1000L).toInt()}s" val strWidth = Fonts.minecraftFont.getStringWidth(timeLeft) - Fonts.minecraftFont.drawString(timeLeft, sc.getScaledWidth() / 2 - strWidth / 2 - 1, sc.getScaledHeight() / 2 - 70, 0x000000) - Fonts.minecraftFont.drawString(timeLeft, sc.getScaledWidth() / 2 - strWidth / 2 + 1, sc.getScaledHeight() / 2 - 70, 0x000000) - Fonts.minecraftFont.drawString(timeLeft, sc.getScaledWidth() / 2 - strWidth / 2, sc.getScaledHeight() / 2 - 69, 0x000000) - Fonts.minecraftFont.drawString(timeLeft, sc.getScaledWidth() / 2 - strWidth / 2, sc.getScaledHeight() / 2 - 71, 0x000000) - Fonts.minecraftFont.drawString(timeLeft, sc.getScaledWidth() / 2 - strWidth / 2, sc.getScaledHeight() / 2 - 70, -1) + Fonts.minecraftFont.drawString(timeLeft, sc.scaledWidth / 2 - strWidth / 2 - 1, sc.scaledHeight / 2 - 70, 0x000000) + Fonts.minecraftFont.drawString(timeLeft, sc.scaledWidth / 2 - strWidth / 2 + 1, sc.scaledHeight / 2 - 70, 0x000000) + Fonts.minecraftFont.drawString(timeLeft, sc.scaledWidth / 2 - strWidth / 2, sc.scaledHeight / 2 - 69, 0x000000) + Fonts.minecraftFont.drawString(timeLeft, sc.scaledWidth / 2 - strWidth / 2, sc.scaledHeight / 2 - 71, 0x000000) + Fonts.minecraftFont.drawString(timeLeft, sc.scaledWidth / 2 - strWidth / 2, sc.scaledHeight / 2 - 70, -1) } } @@ -459,7 +459,7 @@ object Breaker : Module() { if (ignoreFirstBlockValue.get() && nearestBlock != null) { if (firstPos == null) { firstPos = nearestBlock - FDPClient.hud.addNotification(Notification(name,"Found first ${getBlockName(targetID)} block at ${nearestBlock!!.x.toInt()} ${nearestBlock!!.y.toInt()} ${nearestBlock!!.z.toInt()}", NotifyType.SUCCESS)) + FDPClient.hud.addNotification(Notification(name,"Found first ${getBlockName(targetID)} block at ${nearestBlock.x} ${nearestBlock.y} ${nearestBlock.z}", NotifyType.SUCCESS)) } if (targetID == 26 && firstPos != null && firstPosBed == null) { // bed firstPosBed = when (true) { @@ -471,7 +471,7 @@ object Breaker : Module() { false -> TODO() } if (firstPosBed != null) - FDPClient.hud.addNotification(Notification(name,"Found second ${getBlockName(targetID)} block at ${firstPosBed!!.x.toInt()} ${firstPosBed!!.y.toInt()} ${firstPosBed!!.z.toInt()}", NotifyType.SUCCESS)) + FDPClient.hud.addNotification(Notification(name,"Found second ${getBlockName(targetID)} block at ${firstPosBed!!.x} ${firstPosBed!!.y} ${firstPosBed!!.z}", NotifyType.SUCCESS)) } } return if (ignoreFirstBlockValue.get() && (firstPos == nearestBlock || firstPosBed == nearestBlock)) null else nearestBlock @@ -530,7 +530,7 @@ object Breaker : Module() { } } - fun switchSlot(blockPos: BlockPos) { + private fun switchSlot(blockPos: BlockPos) { var bestSpeed = 1F var bestSlot = -1 @@ -552,5 +552,5 @@ object Breaker : Module() { } override val tag: String - get() = BlockUtils.getBlockName(blockValue.get()) + get() = getBlockName(blockValue.get()) } diff --git a/src/main/java/net/ccbluex/liquidbounce/handler/script/api/ScriptModule.kt b/src/main/java/net/ccbluex/liquidbounce/handler/script/api/ScriptModule.kt index dc029b1f88..c277230ce6 100644 --- a/src/main/java/net/ccbluex/liquidbounce/handler/script/api/ScriptModule.kt +++ b/src/main/java/net/ccbluex/liquidbounce/handler/script/api/ScriptModule.kt @@ -31,7 +31,7 @@ class ScriptModule(private val moduleObject: JSObject) : Module() { description = moduleObject.getMember("description") as String val categoryString = moduleObject.getMember("category") as String - for (category in ModuleCategory.values()) + for (category in ModuleCategory.entries) if (categoryString.equals(category.configName, true)) { this.category = category } @@ -86,6 +86,8 @@ class ScriptModule(private val moduleObject: JSObject) : Module() { when(motionEvent.eventState) { EventState.PRE -> callEvent("premotion", motionEvent) EventState.POST -> callEvent("postmotion", motionEvent) + EventState.SEND -> TODO() + EventState.RECEIVE -> TODO() } } @EventTarget diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/client/MixinMinecraft.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/client/MixinMinecraft.java index 20c636d330..c42ed734cc 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/client/MixinMinecraft.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/client/MixinMinecraft.java @@ -40,9 +40,9 @@ import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Util; import net.minecraftforge.client.MinecraftForgeClient; import org.apache.commons.lang3.SystemUtils; +import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.objectweb.asm.Opcodes; @@ -90,7 +90,7 @@ public abstract class MixinMinecraft { @Shadow public int leftClickCounter; @Unique - private long fDPClient$lastFrame = Minecraft.getSystemTime(); + private long fDPClient$lastFrame = getTime(); @Shadow public abstract RenderManager getRenderManager(); @@ -220,6 +220,15 @@ private void runGameLoop(final CallbackInfo callbackInfo) { RenderUtils.deltaTime = deltaTime; } + public long getTime() { + return (Sys.getTime() * 1000) / Sys.getTimerResolution(); + } + + @Inject(method = "runTick", at = @At("HEAD")) + private void injectGameRuntimeTicks(CallbackInfo ci) { + ClientUtils.INSTANCE.setRunTimeTicks(ClientUtils.INSTANCE.getRunTimeTicks() + 1); + } + @Inject(method = "runTick", at = @At("HEAD")) private void runTick(final CallbackInfo callbackInfo) { StaticStorage.scaledResolution = new ScaledResolution((Minecraft)(Object) this); diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiDownloadTerrain.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiDownloadTerrain.java index 99ad7fd00b..4f190fba65 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiDownloadTerrain.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiDownloadTerrain.java @@ -22,6 +22,7 @@ public abstract class MixinGuiDownloadTerrain extends MixinGuiScreen { @Inject(method = "initGui", at = @At(value = "RETURN")) private void injectDisconnectButton(CallbackInfo ci) { this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel"))); + } @Override diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiScreen.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiScreen.java index c428f8ae93..f0e4032d4d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiScreen.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiScreen.java @@ -56,6 +56,8 @@ public abstract class MixinGuiScreen { @Shadow protected abstract void actionPerformed(GuiButton p_actionPerformed_1_); + @Shadow public abstract void initGui(); + @Inject(method = "drawWorldBackground", at = @At("HEAD"), cancellable = true) private void drawWorldBackground(final CallbackInfo callbackInfo) { if (!fDPClient$shouldRenderBackground()) { diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/SideGui/SideGui.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/SideGui/SideGui.java index ae1b8a608d..8c8e29e1a1 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/SideGui/SideGui.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/SideGui/SideGui.java @@ -12,14 +12,25 @@ import net.ccbluex.liquidbounce.ui.clickgui.style.styles.fdpdropdown.utils.normal.TimerUtil; import net.ccbluex.liquidbounce.ui.clickgui.style.styles.fdpdropdown.utils.objects.Drag; import net.ccbluex.liquidbounce.ui.clickgui.style.styles.fdpdropdown.utils.render.DrRenderUtils; +import net.ccbluex.liquidbounce.ui.font.cf.FontLoaders; import net.ccbluex.liquidbounce.ui.font.fontmanager.impl.Fonts; +import net.ccbluex.liquidbounce.ui.gui.colortheme.ClientTheme; import net.ccbluex.liquidbounce.utils.MathUtils; +import net.ccbluex.liquidbounce.utils.render.BlendUtils; +import net.ccbluex.liquidbounce.utils.render.RenderUtils; import net.ccbluex.liquidbounce.utils.render.RoundedUtil; +import net.ccbluex.liquidbounce.utils.render.Stencil; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.HashMap; +import static net.ccbluex.liquidbounce.utils.MouseUtils.mouseWithinBounds; + public class SideGui extends GuiPanel { // private final ConfigPanel configPanel = new ConfigPanel(); @@ -35,6 +46,9 @@ public class SideGui extends GuiPanel { private String currentCategory = "Configs"; private TimerUtil timerUtil; + private float scroll = 0F; + private boolean text = false; + private float animScroll = 0F; @Override @@ -77,6 +91,7 @@ public void keyTyped(char typedChar, int keyCode) { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks, int alpha) { + // if (configPanel.reInit) { // configPanel.initGui(); // configPanel.reInit = false; @@ -151,6 +166,57 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks, int alpha) { DrRenderUtils.drawRect2(x + 20, y + 50, rectWidth - 40, 1, new Color(45, 45, 45, alpha).getRGB()); + if (currentCategory.equals("Design")) { + + // Text + text = ClientTheme.INSTANCE.getTextValue().get(); + RenderUtils.drawRoundedRect(25F, 350.0f, 40F, 365.0f, 5F, textColor); + RenderUtils.drawRoundedOutline(25F, 350.0f, 40F, 365.0f, 7F, 1F, Color.WHITE.getRGB()); + FontLoaders.C12.drawStringWithShadow("Text White Color", 43.0, 351.5, Color.WHITE.getRGB()); + FontLoaders.C12.drawStringWithShadow("Fade Side : " + ClientTheme.INSTANCE.getUpdown().get(), 25.0, 376.5, Color.WHITE.getRGB()); + FontLoaders.C12.drawStringWithShadow("FadeSpeed : " + ClientTheme.INSTANCE.getFadespeed().get(), 25.0, 401.5, Color.WHITE.getRGB()); + GlStateManager.resetColor(); + + Fonts.SFBOLD.SFBOLD_26.SFBOLD_26.drawString("Not Finished - SOOOOOOOOON", x + rectWidth / 2, y + rectHeight / 2, DrRenderUtils.applyOpacity(-1, alpha / 255f)); + + int wheel = Mouse.getDWheel(); + if (wheel != 0) { + if (wheel > 0) { + scroll += 15f; + } else { + scroll -= 15f; + } + } + if (scroll < -100F) { + scroll = -100F; + } + if (scroll > 0F) { + scroll = 0F; + } + + RenderUtils.drawRoundedOutline( + x + 22f, + y + 163.0f + scroll, + x + 126.4f, + y + 237.0f + scroll, + 23.5F, + 4F, + new Color(255, 255, 255).getRGB() + ); + RenderUtils.drawRoundedGradientRectCorner( + x + 24F, + y + 164.5F + scroll, + x + 124.5F, + y + 235F + scroll, + 20F, + ClientTheme.INSTANCE.getColorFromName("Tree", 0).getRGB(), + ClientTheme.INSTANCE.getColorFromName("Tree", 90).getRGB(), + ClientTheme.INSTANCE.getColorFromName("Tree", 180).getRGB(), + ClientTheme.INSTANCE.getColorFromName("Tree", 270).getRGB() + ); + FontLoaders.F18.drawStringWithShadow("Tree", x + 60.0, y + 240.0 + scroll, ClientTheme.INSTANCE.getColorFromName("Tree", 1).getRGB()); + + } if (currentCategory.equals("Scripts")) { /* scriptPanel.x = x; @@ -210,9 +276,116 @@ public void mouseClicked(int mouseX, int mouseY, int button) { } else { } - } + if (currentCategory.equals("Design")) { + if (mouseWithinBounds(mouseX, mouseY, 25, 70 + animScroll, 122, 140 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Cherry"); + } + + if (mouseWithinBounds(mouseX, mouseY, 150, 70 + animScroll, 247, 140 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Water"); + } + + if (mouseWithinBounds(mouseX, mouseY, 275, 70 + animScroll, 372, 140 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Magic"); + } + + if (mouseWithinBounds(mouseX, mouseY, 400, 70 + animScroll, 497, 140 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("DarkNight"); + } + + if (mouseWithinBounds(mouseX, mouseY, 525, 70 + animScroll, 622, 140 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Sun"); + } + + // Line 2 + + if (mouseWithinBounds(mouseX, mouseY, 25, 165 + animScroll, 122, 235 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Tree"); + } + + if (mouseWithinBounds(mouseX, mouseY, 150, 165 + animScroll, 247, 235 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Flower"); + } + + if (mouseWithinBounds(mouseX, mouseY, 275, 165 + animScroll, 372, 235 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Loyoi"); + } + + if (mouseWithinBounds(mouseX, mouseY, 400, 165 + animScroll, 497, 235 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Cero"); + } + + if (mouseWithinBounds(mouseX, mouseY, 525, 165 + animScroll, 622, 235 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Soniga"); + } + + // Line 3 + + if (mouseWithinBounds(mouseX, mouseY, 25, 260 + animScroll, 122, 330 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("May"); + } + if (mouseWithinBounds(mouseX, mouseY, 150, 260 + animScroll, 247, 330 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Mint"); + } + if (mouseWithinBounds(mouseX, mouseY, 275, 260 + animScroll, 372, 330 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Azure"); + } + if (mouseWithinBounds(mouseX, mouseY, 400, 260 + animScroll, 497, 330 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Rainbow"); + } + if (mouseWithinBounds(mouseX, mouseY, 525, 260 + animScroll, 622, 330 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Astolfo"); + } + + // Line 4 + if (animScroll < -75) { + if (mouseWithinBounds(mouseX, mouseY, 25, 355 + animScroll, 122, 425 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Pumpkin"); + } + if (mouseWithinBounds(mouseX, mouseY, 150, 355 + animScroll, 247, 425 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Polarized"); + } + if (mouseWithinBounds(mouseX, mouseY, 275, 355 + animScroll, 372, 425 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Sundae"); + } + if (mouseWithinBounds(mouseX, mouseY, 400, 355 + animScroll, 497, 425 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Terminal"); + } + if (mouseWithinBounds(mouseX, mouseY, 525, 355 + animScroll, 622, 425 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Coral"); + } + } + // Line 5 + if (animScroll < -115) { + if (mouseWithinBounds(mouseX, mouseY, 25, 450 + animScroll, 122, 520 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Fire"); + } + if (mouseWithinBounds(mouseX, mouseY, 150, 450 + animScroll, 247, 520 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Aqua"); + } + if (mouseWithinBounds(mouseX, mouseY, 275, 450 + animScroll, 372, 520 + animScroll)) { + ClientTheme.INSTANCE.getClientColorMode().set("Peony"); + } + + } + + if (mouseWithinBounds(mouseX, mouseY, 25, 350, 40, 365)) { + ClientTheme.INSTANCE.getTextValue().set(!ClientTheme.INSTANCE.getTextValue().get()); + } + if (mouseWithinBounds(mouseX, mouseY, 90, 375, 140, 390)) { + ClientTheme.INSTANCE.getUpdown().set(!ClientTheme.INSTANCE.getUpdown().get()); + } + if (mouseWithinBounds(mouseX, mouseY, 160, 380, 180, 400)) { + if (ClientTheme.INSTANCE.getFadespeed().get() != 20) + ClientTheme.INSTANCE.getFadespeed().set(ClientTheme.INSTANCE.getFadespeed().get() + 1); + } + if (mouseWithinBounds(mouseX, mouseY, 160, 410, 180, 430)) { + if (ClientTheme.INSTANCE.getFadespeed().get() != 0) + ClientTheme.INSTANCE.getFadespeed().set(ClientTheme.INSTANCE.getFadespeed().get() - 1); + } + } } @Override diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java index c7cfc6dc97..b98b2a8689 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/ModuleRect.java @@ -124,7 +124,6 @@ public void drawScreen(int mouseX, int mouseY) { } settingSize = settingHeight; - } public void mouseClicked(int mouseX, int mouseY, int button) { diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/SettingComponents.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/SettingComponents.java index 22cca2ed2b..a65bf3eb87 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/SettingComponents.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/impl/SettingComponents.java @@ -22,6 +22,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; +import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -30,6 +31,7 @@ import static org.lwjgl.opengl.GL11.*; public class SettingComponents extends Component { + public static float scale; private final Module module; public Animation settingHeightScissor; @@ -90,8 +92,6 @@ public SettingComponents(Module module) { modesHoverAnimation.put(modeSetting, modeMap); } - - } } @@ -102,7 +102,7 @@ public void initGui() { @Override public void keyTyped(char typedChar, int keyCode) { - /* + if (binding != null) { selectedField = null; selectedStringSetting = null; @@ -114,8 +114,6 @@ public void keyTyped(char typedChar, int keyCode) { return; } - */ - if (selectedField != null) { if (keyCode == 1) { selectedField = null; @@ -145,12 +143,8 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { Color accentedColor = DrRenderUtils.applyOpacity(colors[0], alphaAnimation / 255f); Color accentedColor2 = DrRenderUtils.applyOpacity(colors[1], alphaAnimation / 255f); - double count = 0; - - - // for (Value setting : module.getValues()) { if (!setting.getDisplayable()) continue; @@ -173,7 +167,6 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.drawString(value, titleX + regularFontWidth, titleY, textColor.getRGB()); - Animation hoverAnimation = sliderfloatAnimMap.get(numberSetting)[0]; Animation selectAnimtion = sliderfloatAnimMap.get(numberSetting)[1]; @@ -189,10 +182,8 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { draggingNumber = numberSetting; } - double currentValue = numberSetting.getValue(); - if (draggingNumber != null && draggingNumber == setting) { float percent = Math.min(1, Math.max(0, (mouseX - (x + 5)) / totalSliderWidth)); double newValue = (percent * (numberSetting.getMaximum() @@ -203,7 +194,6 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { float sliderMath = (float) (((currentValue) - numberSetting.getMinimum()) / (numberSetting.getMaximum() - numberSetting.getMinimum())); - sliderfloatMap.put(numberSetting, (float) DrRenderUtils.animate(totalSliderWidth * sliderMath, sliderfloatMap.get(numberSetting), .1)); @@ -235,7 +225,6 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.drawString(value, titleX + regularFontWidth, titleY, textColor.getRGB()); - Animation hoverAnimation = sliderintAnimMap.get(numberSetting)[0]; Animation selectAnimtion = sliderintAnimMap.get(numberSetting)[1]; @@ -251,10 +240,8 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { draggingNumber = numberSetting; } - double currentValue = numberSetting.getValue(); - if (draggingNumber != null && draggingNumber == setting) { float percent = Math.min(1, Math.max(0, (mouseX - (x + 5)) / totalSliderWidth)); double newValue = (percent * (numberSetting.getMaximum() @@ -265,10 +252,8 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { float sliderMath = (float) (((currentValue) - numberSetting.getMinimum()) / (numberSetting.getMaximum() - numberSetting.getMinimum())); - sliderintMap.put(numberSetting, (float) DrRenderUtils.animate(totalSliderWidth * sliderMath, sliderintMap.get(numberSetting), .1)); - float sliderY = (settingY + 18); RoundedUtil.drawRound(x + 5, sliderY, totalSliderWidth, 3, 1.5f, DrRenderUtils.applyOpacity(darkRectHover, (float) (.4f + (.2 * hoverAnimation.getOutput())))); RoundedUtil.drawRound(x + 5, sliderY, Math.max(4, sliderintMap.get(numberSetting)), 3, 1.5f, accent ? accentedColor2 : textColor); @@ -297,7 +282,6 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.drawString(value, titleX + regularFontWidth, titleY, textColor.getRGB()); - Animation hoverAnimation = sliderAnimMap.get(numberSetting)[0]; Animation selectAnimtion = sliderAnimMap.get(numberSetting)[1]; @@ -313,10 +297,8 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { draggingNumber = numberSetting; } - double currentValue = numberSetting.getValue(); - if (draggingNumber != null && draggingNumber == setting) { float percent = Math.min(1, Math.max(0, (mouseX - (x + 5)) / totalSliderWidth)); double newValue = (percent * (numberSetting.getMaximum() @@ -327,10 +309,8 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { float sliderMath = (float) (((currentValue) - numberSetting.getMinimum()) / (numberSetting.getMaximum() - numberSetting.getMinimum())); - sliderMap.put(numberSetting, (float) DrRenderUtils.animate(totalSliderWidth * sliderMath, sliderMap.get(numberSetting), .1)); - float sliderY = (settingY + 18); RoundedUtil.drawRound(x + 5, sliderY, totalSliderWidth, 3, 1.5f, DrRenderUtils.applyOpacity(darkRectHover, (float) (.4f + (.2 * hoverAnimation.getOutput())))); RoundedUtil.drawRound(x + 5, sliderY, Math.max(4, sliderMap.get(numberSetting)), 3, 1.5f, accent ? accentedColor2 : textColor); @@ -382,7 +362,6 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { settingY + Fonts.SF.SF_18.SF_18.getMiddleOfBox(rectHeight) + 1, 6.5f, 6.5f, 3, textColor); - } if (setting instanceof ListValue) { ListValue modeSetting = (ListValue) setting; @@ -414,17 +393,12 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { float modeY = (float) (settingY + rectHeight + 11 + ((8 + (modeCount * rectHeight)) * openAnimation.getOutput())); DrRenderUtils.resetColor(); - //指针所指的String boolean hoveringMode = isClickable(modeY - 5) && openAnimation.getDirection().equals(Direction.FORWARDS) && DrRenderUtils.isHovering(x + 5, modeY - 5, width - 10, rectHeight, mouseX, mouseY); Animation modeHoverAnimation = modesHoverAnimation.get(modeSetting).get(mode); - - - modeHoverAnimation.setDirection(hoveringMode ? Direction.FORWARDS : Direction.BACKWARDS); - if (modeHoverAnimation.finished(Direction.FORWARDS) || !modeHoverAnimation.isDone()) { RoundedUtil.drawRound(x + 5, modeY - 5, width - 10, rectHeight, 3, DrRenderUtils.applyOpacity(textColor, (float) (.2f * modeHoverAnimation.getOutput()))); @@ -433,12 +407,10 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { modeSettingClick.put(modeSetting, !modeSettingClick.get(modeSetting)); modeSetting.set(mode); } + if (openAnimation.isDone() && openAnimation.getDirection().equals(Direction.FORWARDS) || !openAnimation.isDone()) { - // RoundedUtil.drawRound(x + 5 + ((width - 10) / 2f - selectRectWidth / 2f), settingY + rectHeight + 10.5f, - // Math.max(2, selectRectWidth), 1.5f, .5f, accent ? accentedColor2 : textColor); Fonts.SF.SF_18.SF_18.drawString(mode, x + 13, modeY,DrRenderUtils.applyOpacity(textColor, (float) openAnimation.getOutput()).getRGB()); } - // Fonts.SF.SF_18.SF_18.drawString(mode, x + 13, modeY,DrRenderUtils.applyOpacity(textColor, (float) openAnimation.getOutput()).getRGB()); modeCount++; } if (!openAnimation.isDone() && type == GuiEvents.DRAW) { @@ -456,24 +428,21 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { float selectRectWidth = (float) ((width - 10) * openAnimation.getOutput()); - // DrRenderUtils.renderRoundedRect(x + 5, settingY + rectHeight + 7, width - 10, 2, .5f, disabledTextColor.getRGB()); if (openAnimation.isDone() && openAnimation.getDirection().equals(Direction.FORWARDS) || !openAnimation.isDone()) { + RoundedUtil.drawRound(x + 5 + ((width - 10) / 2f - selectRectWidth / 2f), settingY + rectHeight + 10.5f, Math.max(2, selectRectWidth), 1.5f, .5f, accent ? accentedColor2 : textColor); - // Fonts.SF.SF_18.SF_18.drawString(mode, x + 13, modeY,DrRenderUtils.applyOpacity(textColor, (float) openAnimation.getOutput()).getRGB()); } - //Mode的名字 Fonts.SF.SF_14.SF_14.drawString(modeSetting.getName(), x + 13, settingY + 9, textColor.getRGB()); DrRenderUtils.resetColor(); - //当先选择的mode + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.drawString(modeSetting.get(), x + 13, (float) (settingY + 17.5), textColor.getRGB()); DrRenderUtils.resetColor(); DrRenderUtils.drawClickGuiArrow(x + width - 15, settingY + 17, 5, openAnimation, textColor.getRGB()); - count += 1 + ((math / rectHeight) * openAnimation.getOutput()); } if (setting instanceof TextValue) { @@ -501,52 +470,50 @@ public void handle(int mouseX, int mouseY, int button, GuiEvents type) { } stringSettingField.drawTextBox(); - //Writes to StringSetting + stringSetting.set(stringSettingField.getText()); count++; } - /* - String bind = Keyboard.getKeyName(module.getKeyBind()); - boolean hoveringBindRect = isClickable(settingY + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) - 1) - && DrRenderUtils.isHovering((float) (x + width - (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 7)), - settingY + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) - 1, (float) (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 4), - Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getHeight() + 4, mouseX, mouseY); - - if (type == GuiEvents.CLICK && hoveringBindRect && button == 0) { - binding = module; - return; - } - Animation[] animations = keySettingAnimMap.get(module); + // Render bind option first + String bind = Keyboard.getKeyName(module.getKeyBind()); - animations[1].setDirection(binding == module ? Direction.FORWARDS : Direction.BACKWARDS); + boolean hoveringBindRect = isClickable(y + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) - 1) + && DrRenderUtils.isHovering(x + width - (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 10), + y + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) - 1, (float) (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 8), + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getHeight() + 6, mouseX, mouseY); - Fonts.SF.SF_18.SF_18.drawString("Bind", x + 5, - settingY + Fonts.SF.SF_18.SF_18.getMiddleOfBox(rectHeight) + 1, - textColor.getRGB()); + if (type == GuiEvents.CLICK && hoveringBindRect && button == 0) { + binding = module; + return; + } + Animation[] animations = keySettingAnimMap.get(module); - animations[0].setDirection(hoveringBindRect ? Direction.FORWARDS : Direction.BACKWARDS); + animations[1].setDirection(binding == module ? Direction.FORWARDS : Direction.BACKWARDS); + animations[0].setDirection(hoveringBindRect ? Direction.FORWARDS : Direction.BACKWARDS); - RoundedUtil.drawRound((float) (x + width - (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 9)), - settingY + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) - 1, (float) (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 5), - Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getHeight() + 3.5f, 5, DrRenderUtils.applyOpacity(darkRectHover, (float) (.4 + (.2 * animations[0].getOutput())))); + /* + please guys dont delete it - Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.drawString(bind, x + width - (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 6), - settingY + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) + 1, - DrRenderUtils.interpolateColor(textColor.getRGB(), accentedColor2.getRGB(), (float) animations[1].getOutput())); + int offsetX = 10; + float bindButtonY = y + 4; // Ajuste conforme necessário + RoundedUtil.drawRound(x + width - (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 12) + offsetX, + bindButtonY, (float) (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 8), + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getHeight() + 6, 5, DrRenderUtils.applyOpacity(darkRectHover, (float) (.4 + (.2 * animations[0].getOutput())))); + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.drawString(bind, x + width - (Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.stringWidth(bind) + 9) + offsetX, + bindButtonY + Fonts.SFBOLD.SFBOLD_18.SFBOLD_18.getMiddleOfBox(rectHeight) + 1, + DrRenderUtils.interpolateColor(textColor.getRGB(), accentedColor2.getRGB(), (float) animations[1].getOutput())); */ count++; } settingSize = count; - // settingSize = count; } - @Override public void drawScreen(int mouseX, int mouseY) { handle(mouseX, mouseY, -1, GuiEvents.DRAW); @@ -562,7 +529,6 @@ public void mouseReleased(int mouseX, int mouseY, int state) { handle(mouseX, mouseY, state, GuiEvents.RELEASE); } - public boolean isClickable(float y) { return y > panelLimitY && y < panelLimitY + 17 + Main.allowedClickGuiHeight; } diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/animations/Animation.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/animations/Animation.java index 3dba352c6e..f145e0a870 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/animations/Animation.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/animations/Animation.java @@ -17,6 +17,7 @@ public abstract class Animation { @Getter @Setter protected double endPoint; + @Getter protected Direction direction; public Animation(int ms, double endPoint) { @@ -25,7 +26,6 @@ public Animation(int ms, double endPoint) { this.direction = Direction.FORWARDS; } - public Animation(int ms, double endPoint, Direction direction) { this.duration = ms; //Time in milliseconds of how long you want the animation to take. this.endPoint = endPoint; //The desired distance for the animated object to go. @@ -52,10 +52,6 @@ public void changeDirection() { setDirection(direction.opposite()); } - public Direction getDirection() { - return direction; - } - public void setDirection(Direction direction) { if (this.direction != direction) { this.direction = direction; diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/normal/TimerUtil.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/normal/TimerUtil.java index 62fe8296b5..077a6647e5 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/normal/TimerUtil.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/normal/TimerUtil.java @@ -13,7 +13,6 @@ public void reset() { lastMS = System.currentTimeMillis(); } - public boolean hasTimeElapsed(long time) { return System.currentTimeMillis() - lastMS > time; } diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/objects/PasswordField.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/objects/PasswordField.java index d11eece39c..7e6304cdbb 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/objects/PasswordField.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/objects/PasswordField.java @@ -96,6 +96,7 @@ public class PasswordField extends Gui { /** * True if this textbox is visible */ + @Setter private boolean visible = true; private GuiPageButtonList.GuiResponder field_175210_x; private Predicate field_175209_y = s -> true; @@ -680,11 +681,4 @@ public void setSelectionPos(int p_146199_1_) { public boolean getVisible() { return this.visible; } - - /** - * Sets whether or not this textbox is visible - */ - public void setVisible(boolean p_146189_1_) { - this.visible = p_146189_1_; - } } diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/render/DrRenderUtils.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/render/DrRenderUtils.java index fd93a4a536..d5f3f30f02 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/render/DrRenderUtils.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/fdpdropdown/utils/render/DrRenderUtils.java @@ -29,10 +29,10 @@ public static void drawModalRectWithCustomSizedTexture(float x, float y, float u Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((double) x, (double) (y + height), 0.0D).tex((double) (u * f), (double) ((v + (float) height) * f1)).endVertex(); - worldrenderer.pos((double) (x + width), (double) (y + height), 0.0D).tex((double) ((u + (float) width) * f), (double) ((v + (float) height) * f1)).endVertex(); - worldrenderer.pos((double) (x + width), (double) y, 0.0D).tex((double) ((u + (float) width) * f), (double) (v * f1)).endVertex(); - worldrenderer.pos((double) x, (double) y, 0.0D).tex((double) (u * f), (double) (v * f1)).endVertex(); + worldrenderer.pos(x, y + height, 0.0D).tex(u * f, (v + height) * f1).endVertex(); + worldrenderer.pos(x + width, y + height, 0.0D).tex((u + width) * f, (v + height) * f1).endVertex(); + worldrenderer.pos(x + width, y, 0.0D).tex((u + width) * f, v * f1).endVertex(); + worldrenderer.pos(x, y, 0.0D).tex(u * f, v * f1).endVertex(); tessellator.draw(); } public static void drawGradientRect2(double x, double y, double width, double height, int startColor, int endColor) { diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/fontmanager/impl/Fonts.java b/src/main/java/net/ccbluex/liquidbounce/ui/font/fontmanager/impl/Fonts.java index 7ded9fece5..a170e00656 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/fontmanager/impl/Fonts.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/fontmanager/impl/Fonts.java @@ -34,7 +34,6 @@ interface CheckFont { final class CheckFont_20 { public static final FontRenderer CheckFont_20 = CheckFont.ofSize(20); private CheckFont_20() {} } } - interface SF { FontFamily SF = FONT_MANAGER.fontFamily(FontType.SF); diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/gui/colortheme/GuiTheme.kt b/src/main/java/net/ccbluex/liquidbounce/ui/gui/colortheme/GuiTheme.kt index df918251f6..de63ead16d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/gui/colortheme/GuiTheme.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/gui/colortheme/GuiTheme.kt @@ -8,10 +8,12 @@ package net.ccbluex.liquidbounce.ui.gui.colortheme import net.ccbluex.liquidbounce.ui.gui.colortheme.ClientTheme.fadespeed import net.ccbluex.liquidbounce.ui.gui.colortheme.ClientTheme.textValue import net.ccbluex.liquidbounce.ui.gui.colortheme.ClientTheme.updown -import net.ccbluex.liquidbounce.ui.clickgui.style.styles.animLinear import net.ccbluex.liquidbounce.ui.font.cf.FontLoaders import net.ccbluex.liquidbounce.utils.MouseUtils.mouseWithinBounds +import net.ccbluex.liquidbounce.utils.animations.animLinear +import net.ccbluex.liquidbounce.utils.animations.animSmooth import net.ccbluex.liquidbounce.utils.render.BlendUtils +import net.ccbluex.liquidbounce.utils.render.GlowUtils import net.ccbluex.liquidbounce.utils.render.RenderUtils import net.ccbluex.liquidbounce.utils.render.Stencil import net.minecraft.client.gui.GuiScreen @@ -25,21 +27,23 @@ class GuiTheme : GuiScreen() { private var text = false private var textsmooth = 0F private var scroll = 0F + private var animScroll = 0F override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { val wheel = Mouse.getDWheel() if (wheel != 0) { - if (wheel > 0) { - scroll += 15f - } else { - scroll -= 15f - } + if (wheel > 0) { + scroll += 15f + } else { + scroll -= 15f + } } - if (scroll < -100F) { - scroll = -100F + if (scroll < -200F) { + scroll = -200F } if (scroll > 0F) { scroll = 0F } + animScroll = animScroll.animSmooth(scroll, 0.5F) text = textValue.get() RenderUtils.drawRoundedRect(10F, 10F, 628F, 428F, 5F, Color(0, 0, 0, 150).rgb, 3F, ClientTheme.getColor(1).rgb) RenderUtils.drawImage(ResourceLocation("fdpclient/gui/design/arrowup.png"), 160, 381, 25, 25) @@ -52,570 +56,64 @@ class GuiTheme : GuiScreen() { GL11.glDisable(GL11.GL_TEXTURE_2D) GL11.glEnable(GL11.GL_BLEND) GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA) - RenderUtils.fastRoundedRect(22.15F, 66.5F, 630F, 345F, 0F) + RenderUtils.fastRoundedRect(21F, 66.5F, 635F, 345F, 0F) GL11.glDisable(GL11.GL_BLEND) GL11.glEnable(GL11.GL_TEXTURE_2D) Stencil.erase(true) - /** - * Line 1 - */ - //Zywl - if (ClientTheme.ClientColorMode.equals("Zywl")) - RenderUtils.drawRoundedOutline( - 22F, - 68F + scroll, - 126.4F, - 142F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 24F, - 69.5F + scroll, - 124.5F, - 140F + scroll, - 20F, - ClientTheme.getColorFromName("Zywl", 0).rgb, - ClientTheme.getColorFromName("Zywl", 90).rgb, - ClientTheme.getColorFromName("Zywl", 180).rgb, - ClientTheme.getColorFromName("Zywl", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Zywl", - 58.0, - 145.0 + scroll, - ClientTheme.getColorFromName("Zywl", 1).rgb - ) - //FDP - if (ClientTheme.ClientColorMode.equals("FDP")) - RenderUtils.drawRoundedOutline( - 147F, - 68F + scroll, - 251.4F, - 142F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 149F, - 69.5F + scroll, - 249.5F, - 140F + scroll, - 20F, - ClientTheme.getColorFromName("FDP", 0).rgb, - ClientTheme.getColorFromName("FDP", 90).rgb, - ClientTheme.getColorFromName("FDP", 180).rgb, - ClientTheme.getColorFromName("FDP", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "FDP", - 184.0, - 145.0 + scroll, - ClientTheme.getColorFromName("FDP", 1).rgb - ) - //Magic - if (ClientTheme.ClientColorMode.equals("Magic")) - RenderUtils.drawRoundedOutline( - 272.0f, - 68F + scroll, - 251.4F + 125F, - 142F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 274F, - 69.5F + scroll, - 374.5F, - 140F + scroll, - 20F, - ClientTheme.getColorFromName("Magic", 0).rgb, - ClientTheme.getColorFromName("Magic", 90).rgb, - ClientTheme.getColorFromName("Magic", 180).rgb, - ClientTheme.getColorFromName("Magic", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Magic", - 310.0, - 145.0 + scroll, - ClientTheme.getColorFromName("Magic", 1).rgb - ) - //DarkNight - if (ClientTheme.ClientColorMode.equals("DarkNight")) - RenderUtils.drawRoundedOutline( - 397.0f, - 68F + scroll, - 501.4f, - 142F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 399F, - 69.5F + scroll, - 499.5F, - 140F + scroll, - 20F, - ClientTheme.getColorFromName("DarkNight", 0).rgb, - ClientTheme.getColorFromName("DarkNight", 90).rgb, - ClientTheme.getColorFromName("DarkNight", 180).rgb, - ClientTheme.getColorFromName("DarkNight", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "DarkNight", - 427.0, - 145.0 + scroll, - ClientTheme.getColorFromName("DarkNight", 1).rgb - ) - //Sun - if (ClientTheme.ClientColorMode.equals("Sun")) - RenderUtils.drawRoundedOutline( - 522.0f, - 68F + scroll, - 626.4f, - 142F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 524F, - 69.5F + scroll, - 624.5F, - 140F + scroll, - 20F, - ClientTheme.getColorFromName("Sun", 0).rgb, - ClientTheme.getColorFromName("Sun", 90).rgb, - ClientTheme.getColorFromName("Sun", 180).rgb, - ClientTheme.getColorFromName("Sun", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow("Sun", 565.0, 145.0 + scroll, ClientTheme.getColorFromName("Sun", 1).rgb) - - /** - * Line 2 - */ + fun drawMode( + mode: String, + x1: Float, + y1: Float, + x2: Float, + y2: Float, + gradientColors: List, + text: String, + textX: Double, + textY: Double + ) { + GlowUtils.drawGlow(x1 - 2F, y1 + 35F + animScroll,108.4f, 40F, 10, Color(20, 20, 20, 100)) + GlowUtils.drawGlow(x1 - 1F, y1 + animScroll - 2F,62f, 39F, 10, ClientTheme.getColorFromName(mode, 0)) + GlowUtils.drawGlow(x1 - 4F + 54.2F, y1 + animScroll -2F,56.2f, 39F, 10, ClientTheme.getColorFromName(mode, 90)) + RenderUtils.drawRoundedGradientRectCorner(x1 + 2, y1 + 1.5F + animScroll, x2 - 2, y2 - 2.5F + animScroll, 20F, gradientColors[0], gradientColors[1]) + RenderUtils.customRounded(x1 + 2, y1 + 35F + animScroll, x2 - 2, y2 - 2.5F + animScroll, 0F, 0F, 10F, 10F, Color(20, 20, 20).rgb) + if (ClientTheme.ClientColorMode.get() == mode) { + RenderUtils.drawRoundedOutline(x1, y1 - 0.5F + animScroll, x2, y2 - 1.3F + animScroll, 23.5F, 4F, Color(255, 255, 255).rgb) + } + FontLoaders.F18.drawStringWithShadow(text, textX, textY + animScroll, ClientTheme.getColorFromName(mode, 1).rgb) + } - //Tree - if (ClientTheme.ClientColorMode.equals("Tree")) - RenderUtils.drawRoundedOutline( - 22f, - 163.0f + scroll, - 126.4f, - 237.0f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 24F, - 164.5F + scroll, - 124.5F, - 235F + scroll, - 20F, - ClientTheme.getColorFromName("Tree", 0).rgb, - ClientTheme.getColorFromName("Tree", 90).rgb, - ClientTheme.getColorFromName("Tree", 180).rgb, - ClientTheme.getColorFromName("Tree", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow("Tree", 60.0, 240.0 + scroll, ClientTheme.getColorFromName("Tree", 1).rgb) - //Flower - if (ClientTheme.ClientColorMode.equals("Flower")) - RenderUtils.drawRoundedOutline( - 147.0f, - 163.0f + scroll, - 251.4f, - 237f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 149F, - 164.5F + scroll, - 249.5F, - 235F + scroll, - 20F, - ClientTheme.getColorFromName("Flower", 0).rgb, - ClientTheme.getColorFromName("Flower", 90).rgb, - ClientTheme.getColorFromName("Flower", 180).rgb, - ClientTheme.getColorFromName("Flower", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Flower", - 184.0, - 240.0 + scroll, - ClientTheme.getColorFromName("Flower", 1).rgb - ) - //Loyoi - if (ClientTheme.ClientColorMode.equals("Loyoi")) - RenderUtils.drawRoundedOutline( - 272.0f, - 163.0f + scroll, - 376.4f, - 237f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 274F, - 164.5F + scroll, - 374.5F, - 235F + scroll, - 20F, - ClientTheme.getColorFromName("Loyoi", 0).rgb, - ClientTheme.getColorFromName("Loyoi", 90).rgb, - ClientTheme.getColorFromName("Loyoi", 180).rgb, - ClientTheme.getColorFromName("Loyoi", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Loyoi", - 310.0, - 240.0 + scroll, - ClientTheme.getColorFromName("Loyoi", 1).rgb + val modes = listOf( + "Zywl", "FDP", "Magic", "DarkNight", "Sun", + "Tree", "Flower", "Loyoi", "Cero", "Soniga", + "May", "Mint", "Azure", "Rainbow", "Astolfo", + "Pumpkin", "Polarized", "Sundae", "Terminal", "Coral", + "Fire", "Aqua", "Peony" ) - //Cero - if (ClientTheme.ClientColorMode.equals("Cero")) - RenderUtils.drawRoundedOutline( - 397.0f, - 163.0f + scroll, - 501.4f, - 237f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 399F, - 164.5F + scroll, - 499.5F, - 235F + scroll, - 20F, - ClientTheme.getColorFromName("Cero", 0).rgb, - ClientTheme.getColorFromName("Cero", 90).rgb, - ClientTheme.getColorFromName("Cero", 180).rgb, - ClientTheme.getColorFromName("Cero", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Cero", - 434.0, - 240.0 + scroll, - ClientTheme.getColorFromName("Cero", 1).rgb - ) - //Soniga - if (ClientTheme.ClientColorMode.equals("Soniga")) - RenderUtils.drawRoundedOutline( - 522.0f, - 163.0f + scroll, - 626.4f, - 237f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 524F, - 164.5F + scroll, - 624.5F, - 235F + scroll, - 20F, - ClientTheme.getColorFromName("Soniga", 0).rgb, - ClientTheme.getColorFromName("Soniga", 90).rgb, - ClientTheme.getColorFromName("Soniga", 180).rgb, - ClientTheme.getColorFromName("Soniga", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Soniga", - 560.0, - 240.0 + scroll, - ClientTheme.getColorFromName("Soniga", 1).rgb - ) - - /** - * Line 3 - */ - if (ClientTheme.ClientColorMode.equals("May")) - RenderUtils.drawRoundedOutline( - 22f, - 258.0f + scroll, - 126.4f, - 332.0f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 24F, - 259.5f + scroll, - 124.5F, - 330.0f + scroll, - 20F, - ClientTheme.getColorFromName("May", 0).rgb, - ClientTheme.getColorFromName("May", 90).rgb, - ClientTheme.getColorFromName("May", 180).rgb, - ClientTheme.getColorFromName("May", 270).rgb + val modePositions = listOf( + Pair(22f, 68F), Pair(147f, 68F), Pair(272f, 68F), Pair(397f, 68F), Pair(522f, 68F), + Pair(22f, 163.0f), Pair(147f, 163.0f), Pair(272f, 163.0f), Pair(397f, 163.0f), Pair(522f, 163.0f), + Pair(22f, 258.0f), Pair(147f, 258.0f), Pair(272f, 258.0f), Pair(397f, 258.0f), Pair(522f, 258.0f), + Pair(22f, 353f), Pair(147f, 353f), Pair(272f, 353f), Pair(397f, 353f), Pair(522f, 353f), + Pair(22f, 448f), Pair(147f, 448f), Pair(272F, 448F) ) - FontLoaders.F18.drawStringWithShadow("May", 60.0, 335.0 + scroll, ClientTheme.getColorFromName("May", 1).rgb) - //Flower - if (ClientTheme.ClientColorMode.equals("Mint")) - RenderUtils.drawRoundedOutline( - 147.0f, - 258.0f + scroll, - 251.4f, - 332.0f + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 149F, - 259.5f + scroll, - 249.5F, - 330.0f + scroll, - 20F, - ClientTheme.getColorFromName("Mint", 0).rgb, - ClientTheme.getColorFromName("Mint", 90).rgb, - ClientTheme.getColorFromName("Mint", 180).rgb, - ClientTheme.getColorFromName("Mint", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Mint", - 187.0, - 335.0 + scroll, - ClientTheme.getColorFromName("Mint", 1).rgb - ) - //Azure - if (ClientTheme.ClientColorMode.equals("Azure")) - RenderUtils.drawRoundedOutline( - 272.0f, - 258.0f + scroll, - 376.4f, - 332F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 274F, - 259.5F + scroll, - 374.5F, - 330F + scroll, - 20F, - ClientTheme.getColorFromName("Azure", 0).rgb, - ClientTheme.getColorFromName("Azure", 90).rgb, - ClientTheme.getColorFromName("Azure", 180).rgb, - ClientTheme.getColorFromName("Azure", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Azure", - 310.0, - 335.0 + scroll, - ClientTheme.getColorFromName("Azure", 1).rgb - ) - //Rainbow - if (ClientTheme.ClientColorMode.equals("Rainbow")) - RenderUtils.drawRoundedOutline( - 397.0f, - 258.0f + scroll, - 501.4f, - 332F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 399F, - 259.5F + scroll, - 499.5F, - 330F + scroll, - 20F, - ClientTheme.getColorFromName("Rainbow", 0).rgb, - ClientTheme.getColorFromName("Rainbow", 90).rgb, - ClientTheme.getColorFromName("Rainbow", 180).rgb, - ClientTheme.getColorFromName("Rainbow", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Rainbow", - 428.0, - 335.0 + scroll, - ClientTheme.getColorFromName("Rainbow", 1).rgb - ) - if (ClientTheme.ClientColorMode.equals("Astolfo")) - RenderUtils.drawRoundedOutline( - 522.0f, - 258.0f + scroll, - 626.4f, - 332F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 524.0f, - 259.5F + scroll, - 624.5f, - 330F + scroll, - 20F, - ClientTheme.getColorFromName("Astolfo", 0).rgb, - ClientTheme.getColorFromName("Astolfo", 90).rgb, - ClientTheme.getColorFromName("Astolfo", 180).rgb, - ClientTheme.getColorFromName("Astolfo", 270).rgb - ) - FontLoaders.F18 - .drawStringWithShadow( - "Astolfo", - 560.0, - 335.0 + scroll, - ClientTheme.getColorFromName("Astolfo", 1).rgb + + val textPositions = listOf( + Pair(58.0, 145.0), Pair(184.0, 145.0), Pair(310.0, 145.0), Pair(427.0, 145.0), Pair(565.0, 145.0), + Pair(60.0, 240.0), Pair(184.0, 240.0), Pair(310.0, 240.0), Pair(434.0, 240.0), Pair(560.0, 240.0), + Pair(60.0, 335.0), Pair(187.0, 335.0), Pair(310.0, 335.0), Pair(428.0, 335.0), Pair(560.0, 335.0), + Pair(53.0, 430.0), Pair(180.0, 430.0), Pair(305.0, 430.0), Pair(428.0, 430.0), Pair(563.0, 430.0), + Pair(58.0, 525.0), Pair(185.0, 525.0), Pair(305.0, 525.0) ) - /** - * Line 4 - */ + for (i in modes.indices) { + val mode = modes[i] + val position = modePositions[i] + val textPosition = textPositions[i] + val gradientColors = List(4) { ClientTheme.getColorFromName(mode, it * 90).rgb } - if (ClientTheme.ClientColorMode.equals("Pumpkin")) - RenderUtils.drawRoundedOutline( - 22f, - 353F + scroll, - 126.4f, - 427F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 24F, - 354.5F + scroll, - 124.5F, - 425F + scroll, - 20F, - ClientTheme.getColorFromName("Pumpkin", 0).rgb, - ClientTheme.getColorFromName("Pumpkin", 90).rgb, - ClientTheme.getColorFromName("Pumpkin", 180).rgb, - ClientTheme.getColorFromName("Pumpkin", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Pumpkin", - 53.0, - 430.0 + scroll, - ClientTheme.getColorFromName("Pumpkin", 1).rgb - ) - //Flower - if (ClientTheme.ClientColorMode.equals("Polarized")) - RenderUtils.drawRoundedOutline( - 147.0f, - 353F + scroll, - 251.4f, - 427F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 149F, - 354.5F + scroll, - 249.5F, - 425F + scroll, - 20F, - ClientTheme.getColorFromName("Polarized", 0).rgb, - ClientTheme.getColorFromName("Polarized", 90).rgb, - ClientTheme.getColorFromName("Polarized", 180).rgb, - ClientTheme.getColorFromName("Polarized", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Polarized", - 180.0, - 430.0 + scroll, - ClientTheme.getColorFromName("Polarized", 1).rgb - ) - //Azure - if (ClientTheme.ClientColorMode.equals("Sundae")) - RenderUtils.drawRoundedOutline( - 272.0f, - 353F + scroll, - 376.4f, - 427F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 274F, - 354.5F + scroll, - 374.5F, - 425F + scroll, - 20F, - ClientTheme.getColorFromName("Sundae", 0).rgb, - ClientTheme.getColorFromName("Sundae", 90).rgb, - ClientTheme.getColorFromName("Sundae", 180).rgb, - ClientTheme.getColorFromName("Sundae", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Sundae", - 305.0, - 430.0 + scroll, - ClientTheme.getColorFromName("Sundae", 1).rgb - ) - //Rainbow - if (ClientTheme.ClientColorMode.equals("Terminal")) - RenderUtils.drawRoundedOutline( - 397.0f, - 353F + scroll, - 501.4f, - 427F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 399F, - 354.5F + scroll, - 499.5F, - 425F + scroll, - 20F, - ClientTheme.getColorFromName("Terminal", 0).rgb, - ClientTheme.getColorFromName("Terminal", 90).rgb, - ClientTheme.getColorFromName("Terminal", 180).rgb, - ClientTheme.getColorFromName("Terminal", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Terminal", - 428.0, - 430.0 + scroll, - ClientTheme.getColorFromName("Terminal", 1).rgb - ) - if (ClientTheme.ClientColorMode.equals("Coral")) - RenderUtils.drawRoundedOutline( - 522.0f, - 353F + scroll, - 626.4f, - 427F + scroll, - 23.5F, - 4F, - Color(255, 255, 255).rgb - ) - RenderUtils.drawRoundedGradientRectCorner( - 524.0f, - 354.5F + scroll, - 624.5f, - 425F + scroll, - 20F, - ClientTheme.getColorFromName("Coral", 0).rgb, - ClientTheme.getColorFromName("Coral", 90).rgb, - ClientTheme.getColorFromName("Coral", 180).rgb, - ClientTheme.getColorFromName("Coral", 270).rgb - ) - FontLoaders.F18.drawStringWithShadow( - "Coral", - 563.0, - 430.0 + scroll, - ClientTheme.getColorFromName("Coral", 1).rgb - ) + drawMode(mode, position.first, position.second, position.first + 104.4f, position.second + 74f, gradientColors, mode, textPosition.first, textPosition.second) + } Stencil.dispose() GL11.glPopMatrix() @@ -632,95 +130,96 @@ class GuiTheme : GuiScreen() { } override fun mouseClicked(mouseX: Int, mouseY: Int, mouseButton: Int) { - if (mouseWithinBounds(mouseX, mouseY, 25F, 70F + scroll, 122F, 140F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 25F, 70F + animScroll, 122F, 140F + animScroll)) { ClientTheme.ClientColorMode.set("Zywl") } - if (mouseWithinBounds(mouseX, mouseY, 150F, 70F + scroll, 247F, 140F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 150F, 70F + animScroll, 247F, 140F + animScroll)) { ClientTheme.ClientColorMode.set("FDP") } - if (mouseWithinBounds(mouseX, mouseY, 275F, 70F + scroll, 372F, 140F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 275F, 70F + animScroll, 372F, 140F + animScroll)) { ClientTheme.ClientColorMode.set("Magic") } - if (mouseWithinBounds(mouseX, mouseY, 400F, 70F + scroll, 497F, 140F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 400F, 70F + animScroll, 497F, 140F + animScroll)) { ClientTheme.ClientColorMode.set("DarkNight") } - if (mouseWithinBounds(mouseX, mouseY, 525F, 70F + scroll, 622F, 140F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 525F, 70F + animScroll, 622F, 140F + animScroll)) { ClientTheme.ClientColorMode.set("Sun") } //Line 2 - if (mouseWithinBounds(mouseX, mouseY, 25F, 165F + scroll, 122F, 235F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 25F, 165F + animScroll, 122F, 235F + animScroll)) { ClientTheme.ClientColorMode.set("Tree") } - if (mouseWithinBounds(mouseX, mouseY, 150F, 165F + scroll, 247F, 235F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 150F, 165F + animScroll, 247F, 235F + animScroll)) { ClientTheme.ClientColorMode.set("Flower") } - if (mouseWithinBounds(mouseX, mouseY, 275F, 165F + scroll, 372F, 235F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 275F, 165F + animScroll, 372F, 235F + animScroll)) { ClientTheme.ClientColorMode.set("Loyoi") } - if (mouseWithinBounds(mouseX, mouseY, 400F, 165F + scroll, 497F, 235F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 400F, 165F + animScroll, 497F, 235F + animScroll)) { ClientTheme.ClientColorMode.set("Cero") } - if (mouseWithinBounds(mouseX, mouseY, 525F, 165F + scroll, 622F, 235F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 525F, 165F + animScroll, 622F, 235F + animScroll)) { ClientTheme.ClientColorMode.set("Soniga") } //Line 3 - if (mouseWithinBounds(mouseX, mouseY, 25F, 260F + scroll, 122F, 330F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 25F, 260F + animScroll, 122F, 330F + animScroll)) { ClientTheme.ClientColorMode.set("May") } - if (mouseWithinBounds(mouseX, mouseY, 150F, 260F + scroll, 247F, 330F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 150F, 260F + animScroll, 247F, 330F + animScroll)) { ClientTheme.ClientColorMode.set("Mint") } - if (mouseWithinBounds(mouseX, mouseY, 275F, 260F + scroll, 372F, 330F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 275F, 260F + animScroll, 372F, 330F + animScroll)) { ClientTheme.ClientColorMode.set("Azure") } - if (mouseWithinBounds(mouseX, mouseY, 400F, 260F + scroll, 497F, 330F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 400F, 260F + animScroll, 497F, 330F + animScroll)) { ClientTheme.ClientColorMode.set("Rainbow") } - if (mouseWithinBounds(mouseX, mouseY, 525F, 260F + scroll, 622F, 330F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 525F, 260F + animScroll, 622F, 330F + animScroll)) { ClientTheme.ClientColorMode.set("Astolfo") } //Line 4 - if (scroll < -75F) { - if (mouseWithinBounds(mouseX, mouseY, 25F, 355F + scroll, 122F, 425F + scroll)) { + if (animScroll < -75F) { + if (mouseWithinBounds(mouseX, mouseY, 25F, 355F + animScroll, 122F, 425F + animScroll)) { ClientTheme.ClientColorMode.set("Pumpkin") } - if (mouseWithinBounds(mouseX, mouseY, 150F, 355F + scroll, 247F, 425F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 150F, 355F + animScroll, 247F, 425F + animScroll)) { ClientTheme.ClientColorMode.set("Polarized") } - if (mouseWithinBounds(mouseX, mouseY, 275F, 355F + scroll, 372F, 425F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 275F, 355F + animScroll, 372F, 425F + animScroll)) { ClientTheme.ClientColorMode.set("Sundae") } - if (mouseWithinBounds(mouseX, mouseY, 400F, 355F + scroll, 497F, 425F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 400F, 355F + animScroll, 497F, 425F + animScroll)) { ClientTheme.ClientColorMode.set("Terminal") } - if (mouseWithinBounds(mouseX, mouseY, 525F, 355F + scroll, 622F, 425F + scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 525F, 355F + animScroll, 622F, 425F + animScroll)) { ClientTheme.ClientColorMode.set("Coral") } } - - if (scroll < -115f) { - if (mouseWithinBounds(mouseX, mouseY, 25F, 450F + this.scroll, 122F, 520F + this.scroll)) { + //Line 5 + if (animScroll < -115F) { + if (mouseWithinBounds(mouseX, mouseY, 25F, 450F + animScroll, 122F, 520F + animScroll)) { ClientTheme.ClientColorMode.set("Fire") } - if (mouseWithinBounds(mouseX, mouseY, 150F, 450F + this.scroll, 247F, 520F + this.scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 150F, 450F + animScroll, 247F, 520F + animScroll)) { ClientTheme.ClientColorMode.set("Aqua") } - if (mouseWithinBounds(mouseX, mouseY, 275F, 450F + this.scroll, 372F, 520F + this.scroll)) { + if (mouseWithinBounds(mouseX, mouseY, 275F, 450F + animScroll, 372F, 520F + animScroll)) { ClientTheme.ClientColorMode.set("Peony") } + } if (mouseWithinBounds(mouseX, mouseY, 25F, 350.0f, 40F, 365.0f)) { diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/gui/menu/GuiMainMenu.java b/src/main/java/net/ccbluex/liquidbounce/ui/gui/menu/GuiMainMenu.java index 7fe355f617..c9d7ed6282 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/gui/menu/GuiMainMenu.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/gui/menu/GuiMainMenu.java @@ -229,7 +229,6 @@ private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_) { GlStateManager.enableDepth(); } - private void rotateAndBlurSkybox(float p_73968_1_) { GL11.glTexParameteri(3553, 10241, 9729); GL11.glTexParameteri(3553, 10240, 9729); diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/hud/HUD.kt b/src/main/java/net/ccbluex/liquidbounce/ui/hud/HUD.kt index 38b40bc3ed..5374934315 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/hud/HUD.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/hud/HUD.kt @@ -5,8 +5,6 @@ */ package net.ccbluex.liquidbounce.ui.hud -import net.ccbluex.liquidbounce.FDPClient.CLIENT_NAME -import net.ccbluex.liquidbounce.FDPClient.CLIENT_VERSION import net.ccbluex.liquidbounce.FDPClient.isInDev import net.ccbluex.liquidbounce.injection.access.StaticStorage import net.ccbluex.liquidbounce.ui.font.Fonts diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/Notifications.kt b/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/Notifications.kt index 047b1b66cf..61ba87f313 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/Notifications.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/Notifications.kt @@ -19,7 +19,6 @@ import org.lwjgl.opengl.GL11 import java.awt.Color import kotlin.math.max - /** * CustomHUD Notification element */ @@ -34,7 +33,7 @@ class Notifications(x: Double = 0.0, y: Double = 0.0, scale: Float = 1F,side: Si private val whiteText = BoolValue("WhiteTextColor", true) private val modeColored = BoolValue("CustomModeColored", true) companion object { - val styleValue = ListValue("Mode", arrayOf("Classic", "FDP", "Modern", "LiquidBounce"), "FDP") + val styleValue = ListValue("Mode", arrayOf("Classic", "FDP", "Modern"), "FDP") } /** @@ -189,7 +188,7 @@ class Notification( val nTypeError = type.renderColor == Color(0xFF2F2F) - if (style.equals("Modern")) { + if (style == "Modern") { if (blurRadius != 0f) { BlurUtils.draw(4 + (x + transX).toFloat() * scale, (y + transY).toFloat() * scale, (width * scale), (27f - 5f) * scale, blurRadius) @@ -293,7 +292,7 @@ class Notification( return false } - if(style.equals("Classic")) { + if(style == "Classic") { if (blurRadius != 0f) BlurUtils.draw((x + transX).toFloat() * scale, (y + transY).toFloat() * scale, width * scale, classicHeight * scale, blurRadius) diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/ScoreboardElement.kt b/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/ScoreboardElement.kt index 0344188e78..ef9afb283a 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/ScoreboardElement.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/hud/element/elements/ScoreboardElement.kt @@ -8,7 +8,6 @@ package net.ccbluex.liquidbounce.ui.hud.element.elements import com.google.common.collect.Iterables import com.google.common.collect.Lists import net.ccbluex.liquidbounce.FDPClient -import net.ccbluex.liquidbounce.ui.gui.colortheme.ClientTheme import net.ccbluex.liquidbounce.ui.hud.element.Border import net.ccbluex.liquidbounce.ui.hud.element.Element import net.ccbluex.liquidbounce.ui.hud.element.ElementInfo @@ -16,21 +15,16 @@ import net.ccbluex.liquidbounce.ui.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.utils.render.ShadowUtils -import net.ccbluex.liquidbounce.utils.render.shadowRenderUtils import net.ccbluex.liquidbounce.value.BoolValue import net.ccbluex.liquidbounce.value.FontValue import net.ccbluex.liquidbounce.value.IntegerValue import net.ccbluex.liquidbounce.value.ListValue -import net.ccbluex.liquidbounce.value.FloatValue import net.minecraft.client.gui.Gui import net.minecraft.client.renderer.GlStateManager import net.minecraft.scoreboard.ScoreObjective import net.minecraft.scoreboard.ScorePlayerTeam import net.minecraft.scoreboard.Scoreboard -import net.minecraft.util.EnumChatFormatting import java.awt.Color -import org.lwjgl.opengl.GL11 /** * CustomHUD scoreboard diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/ClientUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/ClientUtils.kt index ae512de395..c5c6a91969 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/ClientUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/ClientUtils.kt @@ -14,6 +14,9 @@ import org.lwjgl.opengl.Display object ClientUtils : MinecraftInstance() { + + var runTimeTicks = 0 + @JvmStatic val logger = LogManager.getLogger("FDPClient") diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/EntityUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/EntityUtils.kt index 7b7c956dfd..72efad75c4 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/EntityUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/EntityUtils.kt @@ -13,6 +13,7 @@ import net.ccbluex.liquidbounce.features.module.modules.client.Target.mobValue import net.ccbluex.liquidbounce.features.module.modules.client.Target.playerValue import net.ccbluex.liquidbounce.features.module.modules.other.AntiBot.isBot import net.ccbluex.liquidbounce.features.module.modules.other.Teams +import net.ccbluex.liquidbounce.utils.extensions.toRadiansD import net.ccbluex.liquidbounce.utils.render.ColorUtils.stripColor import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase @@ -26,6 +27,9 @@ import net.minecraft.entity.passive.EntityBat import net.minecraft.entity.passive.EntitySquid import net.minecraft.entity.passive.EntityVillager import net.minecraft.entity.player.EntityPlayer +import net.minecraft.util.Vec3 +import kotlin.math.cos +import kotlin.math.sin object EntityUtils : MinecraftInstance() { fun isSelected(entity: Entity, canAttackCheck: Boolean): Boolean { @@ -64,6 +68,28 @@ object EntityUtils : MinecraftInstance() { } return false } + + fun isLookingOnEntities(entity: Entity, maxAngleDifference: Double): Boolean { + val player = mc.thePlayer ?: return false + val playerRotation = player.rotationYawHead + val playerPitch = player.rotationPitch + + val maxAngleDifferenceRadians = Math.toRadians(maxAngleDifference) + + val lookVec = Vec3( + -sin(playerRotation.toRadiansD()), + -sin(playerPitch.toRadiansD()), + cos(playerRotation.toRadiansD()) + ).normalize() + + val playerPos = player.positionVector.addVector(0.0, player.eyeHeight.toDouble(), 0.0) + val entityPos = entity.positionVector.addVector(0.0, entity.eyeHeight.toDouble(), 0.0) + + val directionToEntity = entityPos.subtract(playerPos).normalize() + val dotProductThreshold = lookVec.dotProduct(directionToEntity) + + return dotProductThreshold > cos(maxAngleDifferenceRadians) + } fun canRayCast(entity: Entity): Boolean { if (entity is EntityLivingBase) { diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt index 13af5ab092..327d04af1a 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt @@ -8,6 +8,7 @@ package net.ccbluex.liquidbounce.utils import net.ccbluex.liquidbounce.event.EventTarget import net.ccbluex.liquidbounce.event.Listenable import net.ccbluex.liquidbounce.event.PacketEvent +import net.ccbluex.liquidbounce.utils.PacketUtils.sendPacket import net.ccbluex.liquidbounce.utils.timer.MSTimer import net.minecraft.block.Block import net.minecraft.init.Blocks @@ -15,10 +16,7 @@ import net.minecraft.item.Item import net.minecraft.item.ItemBlock import net.minecraft.item.ItemPotion import net.minecraft.item.ItemStack -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement -import net.minecraft.network.play.client.C0DPacketCloseWindow -import net.minecraft.network.play.client.C0EPacketClickWindow -import net.minecraft.network.play.client.C16PacketClientStatus +import net.minecraft.network.play.client.* import net.minecraft.potion.Potion object InventoryUtils : MinecraftInstance(), Listenable { @@ -29,6 +27,19 @@ object InventoryUtils : MinecraftInstance(), Listenable { Blocks.dispenser, Blocks.stone_pressure_plate, Blocks.wooden_pressure_plate, Blocks.red_flower, Blocks.flower_pot, Blocks.yellow_flower, Blocks.noteblock, Blocks.dropper, Blocks.standing_banner, Blocks.wall_banner, Blocks.tnt) + var serverSlot + get() = _serverSlot + set(value) { + if (value != _serverSlot) { + sendPacket(C09PacketHeldItemChange(value)) + + _serverSlot = value + } + } + + private var _serverSlot = 0 + + fun findItem(startSlot: Int, endSlot: Int, item: Item): Int { for (i in startSlot until endSlot) { val stack = mc.thePlayer.inventoryContainer.getSlot(i).stack diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/PacketUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/PacketUtils.kt index a9d8cffe00..3c87c85d4b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/PacketUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/PacketUtils.kt @@ -21,6 +21,15 @@ object PacketUtils : MinecraftInstance() { return false } + @JvmStatic + @JvmOverloads + fun sendPacket(packet: Packet<*>, triggerEvent: Boolean = true) { + if (triggerEvent) { + mc.netHandler?.addToSendQueue(packet) + return + } + } + @JvmStatic fun sendPacketNoEvent(packet: Packet) { packets.add(packet) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/RaycastUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/RaycastUtils.kt index f56b695b9e..c433b7419b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/RaycastUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/RaycastUtils.kt @@ -5,7 +5,7 @@ */ package net.ccbluex.liquidbounce.utils -import net.ccbluex.liquidbounce.features.module.modules.combat.Backtrack +import net.ccbluex.liquidbounce.features.module.modules.combat.Backtrack.loopThroughBacktrackData import net.ccbluex.liquidbounce.utils.RotationUtils.Companion.getVectorForRotation import net.ccbluex.liquidbounce.utils.RotationUtils.Companion.serverRotation import net.ccbluex.liquidbounce.utils.extensions.eyes @@ -78,7 +78,7 @@ object RaycastUtils : MinecraftInstance() { // Check newest entity first checkEntity() - Backtrack.loopThroughBacktrackData(entity, checkEntity) + loopThroughBacktrackData(entity, checkEntity) } return pointedEntity diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt index 3a7ac008ad..3248784506 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt @@ -9,6 +9,7 @@ import net.ccbluex.liquidbounce.FDPClient import net.ccbluex.liquidbounce.event.* import net.ccbluex.liquidbounce.features.module.modules.combat.BowModule import net.ccbluex.liquidbounce.utils.RaycastUtils.raycastEntity +import net.ccbluex.liquidbounce.utils.extensions.eyes import net.ccbluex.liquidbounce.utils.misc.RandomUtils import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/AnimHelper.kt b/src/main/java/net/ccbluex/liquidbounce/utils/animations/AnimHelper.kt similarity index 92% rename from src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/AnimHelper.kt rename to src/main/java/net/ccbluex/liquidbounce/utils/animations/AnimHelper.kt index 1252662e0d..e3f09335b0 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/AnimHelper.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/animations/AnimHelper.kt @@ -3,7 +3,7 @@ * 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.clickgui.style.styles +package net.ccbluex.liquidbounce.utils.animations import net.ccbluex.liquidbounce.utils.AnimationUtils import net.ccbluex.liquidbounce.utils.render.RenderUtils diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt index f1f31b331e..00b042e195 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt @@ -23,12 +23,16 @@ fun BlockPos.getBlock() = BlockUtils.getBlock(this) */ fun BlockPos.getVec() = Vec3(x + 0.5, y + 0.5, z + 0.5) +fun BlockPos.toVec() = Vec3(this) + +fun BlockPos.isReplaceable() = BlockUtils.isReplaceable(this) + +fun BlockPos.canBeClicked() = BlockUtils.canBeClicked(this) + fun BlockPos.getMaterial() = getBlock()?.material fun BlockPos.isFullBlock() = getBlock()?.isFullBlock -fun BlockPos.isReplaceable() = getMaterial()?.isReplaceable ?: false - fun BlockPos.getCenterDistance() = mc.thePlayer.getDistance(x + 0.5, y + 0.5, z + 0.5) /** @@ -78,5 +82,4 @@ inline fun collideBlock(aabb: AxisAlignedBB, predicate: (Block?) -> Boolean): Bo } return true -} - +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/EntityExtension.kt b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/EntityExtension.kt index f31c65e34b..992d49c4e2 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/EntityExtension.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/EntityExtension.kt @@ -6,10 +6,14 @@ package net.ccbluex.liquidbounce.utils.extensions import net.ccbluex.liquidbounce.utils.ClientUtils.mc +import net.ccbluex.liquidbounce.utils.InventoryUtils.serverSlot +import net.ccbluex.liquidbounce.utils.PacketUtils import net.ccbluex.liquidbounce.utils.Rotation import net.ccbluex.liquidbounce.utils.RotationUtils +import net.ccbluex.liquidbounce.utils.block.BlockUtils.getState import net.ccbluex.liquidbounce.utils.render.GLUtils import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP import net.minecraft.client.resources.DefaultPlayerSkin import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase @@ -23,12 +27,13 @@ import net.minecraft.entity.passive.EntityBat import net.minecraft.entity.passive.EntitySquid import net.minecraft.entity.passive.EntityVillager import net.minecraft.entity.player.EntityPlayer -import net.minecraft.util.AxisAlignedBB -import net.minecraft.util.MovingObjectPosition -import net.minecraft.util.ResourceLocation -import net.minecraft.util.Vec3 +import net.minecraft.item.ItemBlock +import net.minecraft.item.ItemStack +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement +import net.minecraft.util.* import net.minecraft.world.World import net.minecraft.world.chunk.Chunk +import net.minecraftforge.event.ForgeEventFactory import javax.vecmath.Vector3d import kotlin.math.* @@ -138,5 +143,65 @@ fun World.getEntitiesInRadius(entity: Entity, radius: Double = 16.0): List, private val step: Double = 0.1, +) : Iterator { + private var value = range.start + + override fun hasNext() = value < range.endInclusive + + override fun next(): Double { + val returned = value + value = (value + step).coerceAtMost(range.endInclusive) + return returned + } +} + +operator fun ClosedFloatingPointRange.iterator() = RangeIterator(this) +infix fun ClosedFloatingPointRange.step(step: Double) = RangeIterator(this, step) + +fun ClosedFloatingPointRange.random(): Double { + require(start.isFinite()) + require(endInclusive.isFinite()) + return start + (endInclusive - start) * Math.random() +} + +/** + * Conditionally shuffles an `Iterable` + * @param shuffle determines if the returned `Iterable` is shuffled + */ +fun Iterable.shuffled(shuffle: Boolean) = toMutableList().apply { if (shuffle) shuffle() } + +fun AxisAlignedBB.lerpWith(x: Double, y: Double, z: Double) = + Vec3(minX + (maxX - minX) * x, minY + (maxY - minY) * y, minZ + (maxZ - minZ) * z) + +fun AxisAlignedBB.lerpWith(point: Vec3) = lerpWith(point.xCoord, point.yCoord, point.zCoord) +fun AxisAlignedBB.lerpWith(value: Double) = lerpWith(value, value, value) + +val AxisAlignedBB.center + get() = lerpWith(0.5) + +fun Block.lerpWith(x: Double, y: Double, z: Double) = Vec3( + blockBoundsMinX + (blockBoundsMaxX - blockBoundsMinX) * x, + blockBoundsMinY + (blockBoundsMaxY - blockBoundsMinY) * y, + blockBoundsMinZ + (blockBoundsMaxZ - blockBoundsMinZ) * z +) \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/timer/MSTimer.kt b/src/main/java/net/ccbluex/liquidbounce/utils/timer/MSTimer.kt index e36312b3a9..59c1ca8250 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/timer/MSTimer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/timer/MSTimer.kt @@ -16,9 +16,8 @@ class MSTimer { return MS + time - System.currentTimeMillis() } - fun timePassed(): Long { - return System.currentTimeMillis() - time - } + val reachedTime: Long + get() = System.currentTimeMillis() - time fun zero() { time = -1L diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/back.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/back.png deleted file mode 100644 index ecf9cefa56..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/back.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/brush.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/brush.png deleted file mode 100644 index b18f3c3549..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/brush.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/download.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/download.png deleted file mode 100644 index e4ec79818f..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/download.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/error.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/error.png deleted file mode 100644 index 7baf75e5da..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/error.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/import.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/import.png deleted file mode 100644 index dcc6e2ecdf..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/import.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/remove.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/remove.png deleted file mode 100644 index 2323c6a400..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/remove.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/search.png b/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/search.png deleted file mode 100644 index 15b08cf476..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/gui/clickgui/new/search.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/gui/design/japanesebackground.png b/src/main/resources/assets/minecraft/fdpclient/gui/design/japanesebackground.png new file mode 100644 index 0000000000..545b8aecaf Binary files /dev/null and b/src/main/resources/assets/minecraft/fdpclient/gui/design/japanesebackground.png differ