From 018737d1033c39af299c13c600f37d84ac1cbc2d Mon Sep 17 00:00:00 2001 From: XeContrast <1683481541@qq.com> Date: Fri, 1 Nov 2024 20:36:14 +0800 Subject: [PATCH] AntiBot Update --- .../module/modules/combat/KillAura.kt | 2 +- .../module/modules/movement/NoSlow.kt | 1 + .../features/module/modules/other/AntiBot.kt | 110 +++++++++++------- .../module/modules/player/AntiSuffocate.kt | 4 +- .../module/modules/player/AntiVoid.kt | 34 +++--- .../module/modules/player/InvManager.kt | 1 + .../modules/{world => player}/Stealer.kt | 66 ++++++----- .../module/modules/visual/SuperheroFX.kt | 110 ++++++++++++++++++ .../forge/mixins/gui/MixinGuiContainer.java | 2 +- .../liquidbounce/utils/InventoryUtils.kt | 5 +- .../ccbluex/liquidbounce/utils/PlayerUtils.kt | 16 ++- 11 files changed, 254 insertions(+), 97 deletions(-) rename src/main/java/net/ccbluex/liquidbounce/features/module/modules/{world => player}/Stealer.kt (89%) create mode 100644 src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/SuperheroFX.kt 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 4a7e166..34598b6 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 @@ -1170,7 +1170,7 @@ object KillAura : Module() { } "stopmotion" -> { if (mc.playerController.currentGameType != WorldSettings.GameType.SPECTATOR) { - mc.thePlayer.attackTargetEntityWithCurrentItem(entity) + PlayerUtils.attackTargetEntityWithCurrentItem(entity) } } "stopsprint" -> mc.thePlayer.serverSprintState = false diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/NoSlow.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/NoSlow.kt index f55efc1..4086e29 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/NoSlow.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/NoSlow.kt @@ -41,6 +41,7 @@ object NoSlow : Module() { "WatchDog2", "UNCP", "NCP", + "NewMatrix", "AAC", "AAC4", "AAC5", diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/AntiBot.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/AntiBot.kt index 71b4851..ef7b233 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/AntiBot.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/other/AntiBot.kt @@ -17,6 +17,7 @@ import net.ccbluex.liquidbounce.script.api.global.Chat import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification import net.ccbluex.liquidbounce.ui.client.hud.element.elements.NotifyType import net.ccbluex.liquidbounce.utils.RotationUtils +import net.ccbluex.liquidbounce.utils.isMoving import net.ccbluex.liquidbounce.utils.render.ColorUtils.stripColor import net.minecraft.client.network.NetworkPlayerInfo import net.minecraft.entity.Entity @@ -24,10 +25,12 @@ import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.player.EntityPlayer import net.minecraft.item.ItemArmor import net.minecraft.network.play.server.* +import net.minecraft.potion.Potion import net.minecraft.world.WorldSettings import java.util.* import java.util.concurrent.CopyOnWriteArrayList import kotlin.math.abs +import kotlin.math.sqrt @ModuleInfo("AntiBot","Prevents KillAura from attacking AntiCheat bots.", category = ModuleCategory.OTHER) object AntiBot : Module() { @@ -44,6 +47,7 @@ object AntiBot : Module() { private val groundValue = BoolValue("Ground", true).displayable { modeValue.get() == "Custom"} private val airValue = BoolValue("Air", false).displayable { modeValue.get() == "Custom"} private val invalidGroundValue = BoolValue("InvalidGround", true).displayable { modeValue.get() == "Custom"} + private val invalidSpeedValue = BoolValue("InvalidSpeed", true).displayable { modeValue.get() == "Custom"} private val swingValue = BoolValue("Swing", false).displayable { modeValue.get() == "Custom"} private val healthValue = BoolValue("Health", false).displayable { modeValue.get() == "Custom"} private val derpValue = BoolValue("Derp", true).displayable { modeValue.get() == "Custom"} @@ -119,6 +123,7 @@ object AntiBot : Module() { private val duplicate = mutableListOf() private val noClip = mutableListOf() private val matrix = mutableListOf() + private val invalidSpeedList = mutableSetOf() private val hasRemovedEntities = mutableListOf() private val regex = Regex("\\w{3,16}") private var wasAdded = mc.thePlayer != null @@ -303,6 +308,9 @@ object AntiBot : Module() { } } + if (invalidSpeedValue.get() && entity.entityId in invalidSpeedList) + return true + if (pingValue.get()) { if (mc.netHandler.getPlayerInfo(entity.uniqueID)?.responseTime == 0) { return true @@ -332,9 +340,9 @@ object AntiBot : Module() { return true } - if (matrix7.get() && matrix.contains(entity.entityId)) { - return true - } +// if (matrix7.get() && matrix.contains(entity.entityId)) { +// return true +// } if (duplicateCompareModeValue.equals("WhenSpawn") && duplicate.contains(entity.gameProfile.id)) { return true @@ -429,7 +437,7 @@ object AntiBot : Module() { } } - @EventTarget + @EventTarget(ignoreCondition = true) fun onPacket(event: PacketEvent) { if (mc.thePlayer == null || mc.theWorld == null) return val packet = event.packet @@ -441,7 +449,20 @@ object AntiBot : Module() { ) is S14PacketEntity -> { + val entity = packet.getEntity(mc.theWorld) if (czechHekValue.get()) wasAdded = false + if (invalidSpeedValue.get() && entity is EntityPlayer) { + val deltaX = entity.posX - entity.prevPosX + val deltaZ = entity.posZ - entity.prevPosZ + val speed = sqrt(deltaX * deltaX + deltaZ * deltaZ) + + + if (speed in 0.45..0.46 && (!entity.isSprinting || !entity.isMoving || + entity.getActivePotionEffect(Potion.moveSpeed) == null)) + { + invalidSpeedList += entity.entityId + } + } processEntityMove(packet.getEntity(mc.theWorld) ?: return, packet.onGround) } @@ -513,6 +534,14 @@ object AntiBot : Module() { } if (matrix7.get() && modeValue.get() == "Custom") { + val world = mc.theWorld ?: return + val player = mc.thePlayer ?: return + world.playerEntities.forEach { entity -> + if (entity != player && entity.customNameTag == "") { + world.removeEntity(entity) + if (debugValue.get()) Chat.alert("AntiBot Remove ${entity.gameProfile.name}") + } + } // val player = mc.thePlayer ?: return // val world = mc.theWorld ?: return // for (entity in world.playerEntities) { @@ -522,42 +551,42 @@ object AntiBot : Module() { // continue // } // } - mc.theWorld.playerEntities.forEach { entity -> - if (entity.inventory.armorInventory.all { it != null } && entity.heldItem != null) { - - val player = mc.thePlayer ?: return@forEach - val world = mc.theWorld ?: return@forEach - val playerPosY = player.posY - 2..player.posY + 2 - - if (entity.posY in playerPosY) { - - val entityRot = entity.rotationYaw - val playerPreRot = player.prevRotationYaw - - val rotDiff = abs(entityRot - playerPreRot) - val utilDiff = abs(entityRot - RotationUtils.serverRotation?.yaw!!) - - if ((rotDiff <= 10 || utilDiff <= 10) && !matrix.contains(entity.entityId)) { -// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.") -// world.removeEntityFromWorld(entity.entityId) - matrix.add(entity.entityId) - if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}") - } - - if (entity.isSprinting && entity.moveForward == 0f && !matrix.contains(entity.entityId)) { -// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.") -// world.removeEntityFromWorld(entity.entityId) - matrix.add(entity.entityId) - if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}") - } - if (matrix.contains(entity.entityId)) { - if (packet is S38PacketPlayerListItem && packet.action == S38PacketPlayerListItem.Action.REMOVE_PLAYER) { - if (player.getDistanceToEntity(entity) < 10) matrix.remove(entity.entityId) - } - } - } - } - } +// mc.theWorld.playerEntities.forEach { entity -> +// if (entity.inventory.armorInventory.all { it != null } && entity.heldItem != null) { +// +// val player = mc.thePlayer ?: return@forEach +// val world = mc.theWorld ?: return@forEach +// val playerPosY = player.posY - 2..player.posY + 2 +// +// if (entity.posY in playerPosY) { +// +// val entityRot = entity.rotationYaw +// val playerPreRot = player.prevRotationYaw +// +// val rotDiff = abs(entityRot - playerPreRot) +// val utilDiff = abs(entityRot - RotationUtils.serverRotation?.yaw!!) +// +// if ((rotDiff <= 10 || utilDiff <= 10) && !matrix.contains(entity.entityId)) { +//// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.") +//// world.removeEntityFromWorld(entity.entityId) +// matrix.add(entity.entityId) +// if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}") +// } +// +// if (entity.isSprinting && entity.moveForward == 0f && !matrix.contains(entity.entityId)) { +//// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.") +//// world.removeEntityFromWorld(entity.entityId) +// matrix.add(entity.entityId) +// if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}") +// } +// if (matrix.contains(entity.entityId)) { +// if (packet is S38PacketPlayerListItem && packet.action == S38PacketPlayerListItem.Action.REMOVE_PLAYER) { +// if (player.getDistanceToEntity(entity) < 10) matrix.remove(entity.entityId) +// } +// } +// } +// } +// } } } @@ -577,6 +606,7 @@ object AntiBot : Module() { private fun clearAll() { hitted.clear() + invalidSpeedList.clear() swing.clear() ground.clear() invalidGround.clear() diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiSuffocate.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiSuffocate.kt index 3e79a8f..97b3405 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiSuffocate.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiSuffocate.kt @@ -18,11 +18,11 @@ object AntiSuffocate : Module(){ fun onPreMotion(){ - if (mc.thePlayer.isEntityInsideOpaqueBlock()){ + if (mc.thePlayer.isEntityInsideOpaqueBlock){ PacketUtils.sendPacketNoEvent(C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, BlockPos(mc.thePlayer).down(), EnumFacing.UP)) if (swing.get()){ - mc.thePlayer.swingItem(); + mc.thePlayer.swingItem() } } diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiVoid.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiVoid.kt index bdc5486..28aeb8c 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiVoid.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/AntiVoid.kt @@ -138,7 +138,7 @@ object AntiVoid : Module() { when (modeValue.get().lowercase()) { "groundspoof" -> { - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { canSpoof = mc.thePlayer.fallDistance > maxFallDistValue.get() } } @@ -152,7 +152,7 @@ object AntiVoid : Module() { val pearl = InventoryUtils.findItem(36, 45, Items.ender_pearl) if (mc.thePlayer.fallDistance > maxFallDistValue.get() && (pearl - 36) > -1) { - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { mc.thePlayer.inventory.currentItem = pearl - 36 } } @@ -171,7 +171,7 @@ object AntiVoid : Module() { posY = mc.thePlayer.prevPosY posZ = mc.thePlayer.prevPosZ } - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) { mc.thePlayer.setPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ) mc.netHandler.addToSendQueue( @@ -199,7 +199,7 @@ object AntiVoid : Module() { } "motionflag" -> { - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) { mc.thePlayer.motionY += motionflagValue.get() mc.thePlayer.fallDistance = 0.0F @@ -209,7 +209,7 @@ object AntiVoid : Module() { } "packetflag" -> { - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) { mc.netHandler.addToSendQueue( C03PacketPlayer.C04PacketPlayerPosition( @@ -237,7 +237,7 @@ object AntiVoid : Module() { posY = mc.thePlayer.prevPosY posZ = mc.thePlayer.prevPosZ } - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) { mc.thePlayer.setPositionAndUpdate(posX, posY, posZ) mc.thePlayer.fallDistance = 0F @@ -251,7 +251,7 @@ object AntiVoid : Module() { "jartex" -> { canSpoof = false - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (mc.thePlayer.fallDistance > maxFallDistValue.get() && mc.thePlayer.posY < lastRecY + 0.01 && mc.thePlayer.motionY <= 0 && !mc.thePlayer.onGround && !flagged) { mc.thePlayer.motionY = 0.0 mc.thePlayer.motionZ *= 0.838 @@ -264,7 +264,7 @@ object AntiVoid : Module() { "oldcubecraft" -> { canSpoof = false - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (mc.thePlayer.fallDistance > maxFallDistValue.get() && mc.thePlayer.posY < lastRecY + 0.01 && mc.thePlayer.motionY <= 0 && !mc.thePlayer.onGround && !flagged) { mc.thePlayer.motionY = 0.0 mc.thePlayer.motionZ = 0.0 @@ -288,7 +288,7 @@ object AntiVoid : Module() { } "packet" -> { - if (checkVoid()) { + if (checkVoid) { canCancel = true } @@ -355,8 +355,14 @@ object AntiVoid : Module() { } } - private fun checkVoid(): Boolean { - return (FallingPlayer(mc.thePlayer ?: return false).findCollision(60) == null) + val checkVoid: Boolean + get() { + for (i in 0..128) { + if (MovementUtils.isOnGround(i.toDouble())) { + return false + } + } + return true } @EventTarget @@ -366,7 +372,7 @@ object AntiVoid : Module() { if (mc.currentScreen != null || mc.playerController.currentGameType == WorldSettings.GameType.SPECTATOR || mc.playerController.currentGameType == WorldSettings.GameType.CREATIVE ) return - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (player.fallDistance > maxFallDistValue.get()) { if (player.heldItem?.item is ItemEnderPearl && player.heldItem.item != null) { if (freezeValue.equals("Cancel")) { @@ -404,7 +410,7 @@ object AntiVoid : Module() { val player = mc.thePlayer ?: return if (mc.currentScreen != null || mc.playerController.currentGameType == WorldSettings.GameType.SPECTATOR || mc.playerController.currentGameType == WorldSettings.GameType.CREATIVE) return - if (!voidOnlyValue.get() || checkVoid()) { + if (!voidOnlyValue.get() || checkVoid) { if (player.fallDistance > maxFallDistValue.get()) { if (freezeValue.equals("Cancel")) { if (player.heldItem?.item is ItemEnderPearl) { @@ -466,7 +472,7 @@ object AntiVoid : Module() { 3.125f if (packet is C03PacketPlayer) { - if (voidOnlyValue.get() && mc.thePlayer.fallDistance >= maxFallDistValue.get() && mc.thePlayer.motionY <= 0 && checkVoid()) { + if (voidOnlyValue.get() && mc.thePlayer.fallDistance >= maxFallDistValue.get() && mc.thePlayer.motionY <= 0 && checkVoid) { packet.y += 11.0 } if (!voidOnlyValue.get() && mc.thePlayer.fallDistance >= maxFallDistValue.get()) packet.y += 11.0 diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/InvManager.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/InvManager.kt index fc252b6..8ae287e 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/InvManager.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/InvManager.kt @@ -395,6 +395,7 @@ object InvManager : Module() { is ItemBlock -> return !InventoryUtils.isBlockListBlock(item) && amount[1] <= maxblock.get() is ItemPotion -> return isUsefulPotion(itemStack) is ItemBoat,is ItemMinecart -> return ignoreVehiclesValue.get() + is ItemFishingRod -> return amount[4] < 1 is ItemBed, is ItemEnderPearl,is ItemBucket -> return true } diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/Stealer.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Stealer.kt similarity index 89% rename from src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/Stealer.kt rename to src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Stealer.kt index 68035a4..934f3b1 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/Stealer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/player/Stealer.kt @@ -3,14 +3,13 @@ * 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.world +package net.ccbluex.liquidbounce.features.module.modules.player import net.ccbluex.liquidbounce.FDPClient import net.ccbluex.liquidbounce.event.* 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.features.module.modules.player.InvManager import net.ccbluex.liquidbounce.features.value.BoolValue import net.ccbluex.liquidbounce.features.value.IntegerValue import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification @@ -133,7 +132,10 @@ object Stealer : Module() { } // Chest title - if (chestTitleValue.get() && (screen.lowerChestInventory == null || !screen.lowerChestInventory.name.contains(ItemStack(Item.itemRegistry.getObject(ResourceLocation("minecraft:chest"))).displayName))) { + if (chestTitleValue.get() && (screen.lowerChestInventory == null || !screen.lowerChestInventory.name.contains( + ItemStack(Item.itemRegistry.getObject(ResourceLocation("minecraft:chest"))).displayName + )) + ) { return } @@ -154,7 +156,7 @@ object Stealer : Module() { if (slot.stack != null && (!onlyItemsValue.get() || slot.stack.item !is ItemBlock) && (!noDuplicateValue.get() || slot.stack.maxStackSize > 1 || !mc.thePlayer.inventory.mainInventory.filter { it != null && it.item != null } .map { it.item!! } - .contains(slot.stack.item)) && (!invManager.state || InvManager.isUseful( + .contains(slot.stack.item)) && (!invManager.state || invManager.isUseful( slot.stack, -1 )) @@ -175,16 +177,18 @@ object Stealer : Module() { val slot = screen.inventorySlots.inventorySlots[slotIndex] if (delayTimer.hasTimePassed(nextDelay.toLong()) && slot.stack != null && - (!onlyItemsValue.get() || slot.stack.item !is ItemBlock) && (!invManager.state || InvManager.isUseful( + (!onlyItemsValue.get() || slot.stack.item !is ItemBlock) && (!invManager.state || invManager.isUseful( slot.stack, -1 - ))) { + )) + ) { move(screen, slot) } } } else if (autoCloseValue.get() && screen.inventorySlots.windowId == contentReceived && autoCloseTimer.hasTimePassed( nextCloseDelay.toLong() - )) { + ) + ) { mc.thePlayer.closeScreen() nextCloseDelay = TimeUtils.randomDelay(autoCloseMinDelayValue.get(), autoCloseMaxDelayValue.get()) } @@ -192,29 +196,26 @@ object Stealer : Module() { @EventTarget fun onUpdate(event: UpdateEvent) { - if (chestTimer.hasTimePassed(chestValue.get().toLong())) { - if (instantValue.get()) { - if (mc.currentScreen is GuiChest) { - val chest = mc.currentScreen as GuiChest - val rows = chest.inventoryRows * 9 - for (i in 0 until rows) { - val slot = chest.inventorySlots.getSlot(i) - if (slot.hasStack) { - mc.thePlayer.sendQueue.addToSendQueue( - C0EPacketClickWindow( - chest.inventorySlots.windowId, - i, - 0, - 1, - slot.stack, - 1.toShort() - ) + if (instantValue.get()) { + if (mc.currentScreen is GuiChest) { + val chest = mc.currentScreen as GuiChest + val rows = chest.inventoryRows * 9 + for (i in 0 until rows) { + val slot = chest.inventorySlots.getSlot(i) + if (slot.hasStack) { + mc.thePlayer.sendQueue.addToSendQueue( + C0EPacketClickWindow( + chest.inventorySlots.windowId, + i, + 0, + 1, + slot.stack, + 1.toShort() ) - } - chestTimer.reset() + ) } - mc.thePlayer.closeScreen() } + mc.thePlayer.closeScreen() } } val screen = mc.currentScreen ?: return @@ -262,7 +263,7 @@ object Stealer : Module() { if (slot.stack != null && (!onlyItemsValue.get() || slot.stack.item !is ItemBlock) && (!noDuplicateValue.get() || slot.stack.maxStackSize > 1 || !mc.thePlayer.inventory.mainInventory.filter { it != null && it.item != null } .map { it.item!! } - .contains(slot.stack.item)) && (!inventoryCleaner.state || InvManager.isUseful( + .contains(slot.stack.item)) && (!inventoryCleaner.state || inventoryCleaner.isUseful( slot.stack, -1 )) @@ -287,7 +288,7 @@ object Stealer : Module() { if (delayTimer.hasTimePassed(nextDelay.toLong()) && slot.stack != null && (!onlyItemsValue.get() || slot.stack.item !is ItemBlock) && (!noDuplicateValue.get() || slot.stack.maxStackSize > 1 || !mc.thePlayer.inventory.mainInventory.filter { it != null && it.item != null } .map { it.item!! } - .contains(slot.stack.item)) && (!inventoryCleaner.state || InvManager.isUseful( + .contains(slot.stack.item)) && (!inventoryCleaner.state || inventoryCleaner.isUseful( slot.stack, -1 )) @@ -304,7 +305,7 @@ object Stealer : Module() { if (silenceValue.get() && !stillDisplayValue.get()) { FDPClient.hud.addNotification( Notification( - "Stealer","Closed chest.", + "Closed chest.", "!!!", NotifyType.INFO ) ) @@ -318,6 +319,7 @@ object Stealer : Module() { } } } + @EventTarget private fun onPacket(event: PacketEvent) { val packet = event.packet @@ -345,7 +347,7 @@ object Stealer : Module() { if (slot.stack != null && (!onlyItemsValue.get() || slot.stack.item !is ItemBlock) && (!noDuplicateValue.get() || slot.stack.maxStackSize > 1 || !mc.thePlayer.inventory.mainInventory.filter { it != null && it.item != null } .map { it.item!! } - .contains(slot.stack.item)) && (!inventoryCleaner.state || InvManager.isUseful( + .contains(slot.stack.item)) && (!inventoryCleaner.state || inventoryCleaner.isUseful( slot.stack, -1 )) @@ -358,4 +360,4 @@ object Stealer : Module() { private val fullInventory: Boolean get() = mc.thePlayer.inventory.mainInventory.none { it == null } -} \ No newline at end of file +} diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/SuperheroFX.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/SuperheroFX.kt new file mode 100644 index 0000000..391f791 --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/SuperheroFX.kt @@ -0,0 +1,110 @@ +/* + * LiquidBounce+ Hacked Client + * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge. + * https://github.com/WYSI-Foundation/LiquidBouncePlus/ + * + * This code was taken from UnlegitMC/FDPClient. Please credit them when using this code in your repository. + */ +package net.ccbluex.liquidbounce.features.module.modules.visual + +import net.ccbluex.liquidbounce.event.EntityDamageEvent +import net.ccbluex.liquidbounce.event.EventTarget +import net.ccbluex.liquidbounce.event.Render3DEvent +import net.ccbluex.liquidbounce.event.WorldEvent +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.ui.font.Fonts +import net.ccbluex.liquidbounce.utils.MinecraftInstance +import net.ccbluex.liquidbounce.utils.misc.RandomUtils +import net.ccbluex.liquidbounce.utils.render.ColorUtils +import net.ccbluex.liquidbounce.utils.timer.MSTimer +import net.minecraft.client.renderer.GlStateManager +import org.lwjgl.opengl.GL11 +import java.awt.Color +import kotlin.math.abs + +@ModuleInfo(name = "SuperheroFX", description = "Creates comic-like words as flying particles.", category = ModuleCategory.VISUAL) +class SuperheroFX : Module() { + + private val textParticles = mutableListOf() + private val generateTimer = MSTimer() + + @EventTarget + fun onWorld(event: WorldEvent) = textParticles.clear() + + @EventTarget + fun onEntityDamage(event: EntityDamageEvent) { + val entity = event.damagedEntity + if (mc.theWorld.loadedEntityList.contains(entity) && generateTimer.hasTimePassed(500L)) { + val dirX = RandomUtils.nextDouble(-0.5, 0.5) + val dirZ = RandomUtils.nextDouble(-0.5, 0.5) + generateTimer.reset() + textParticles.add( + FXParticle( + entity.posX + dirX, + entity.entityBoundingBox.minY + (entity.entityBoundingBox.maxY - entity.entityBoundingBox.minY) / 2.0, + entity.posZ + dirZ, + dirX, dirZ + ) + ) + } + } + + @EventTarget + fun onRender3D(event: Render3DEvent) { + val removeList = mutableListOf() + for (particle in textParticles) { + if (particle.canRemove) { + removeList.add(particle) + continue + } + particle.draw() + } + textParticles.removeAll(removeList) + } + +} +class FXParticle(val posX: Double, val posY: Double, val posZ: Double, val animHDir: Double, val animVDir: Double): MinecraftInstance() { + private val messageString: String = listOf("kaboom", "bam", "zap", "smash", "fatality", "kapow", "wham").random() + private val color: Color = listOf(Color.BLUE, Color.CYAN, Color.GREEN, Color.MAGENTA, Color.ORANGE, Color.PINK, Color.RED, Color.YELLOW).random() + + private val fadeTimer = MSTimer() + private val stringLength = Fonts.fontBangers.getStringWidth(messageString).toDouble() + private val fontHeight = Fonts.fontBangers.FONT_HEIGHT.toDouble() + + var canRemove = false + private var firstDraw = true + + fun draw() { + val renderManager = mc.renderManager ?: return + if (firstDraw) { + fadeTimer.reset() + firstDraw = false + } + val alpha = (if (fadeTimer.hasTimePassed(250L)) fadeTimer.hasTimeLeft(500L) else 250L - fadeTimer.hasTimeLeft(250L)).toFloat().coerceIn(0F, 250F) / 250F + val progress = (if (fadeTimer.hasTimePassed(250L)) abs(fadeTimer.hasTimeLeft(250L) - 250L) else 250L - fadeTimer.hasTimeLeft(250L)).toFloat().coerceIn(0F, 500F) / 250F + val textY = if (mc.gameSettings.thirdPersonView != 2) -1.0f else 1.0f + val offsetX = stringLength / 2.0 * 0.02 * progress.toDouble() + val offsetY = fontHeight / 2.0 * 0.02 * progress.toDouble() + if (progress >= 2F) { + canRemove = true + return + } + GlStateManager.pushMatrix() + GlStateManager.enablePolygonOffset() + GlStateManager.doPolygonOffset(1.0f, -1500000.0f) + GL11.glTranslated(posX + animHDir * progress - offsetX - renderManager.renderPosX, posY + animVDir * progress - offsetY - renderManager.renderPosY, posZ - renderManager.renderPosZ) + GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f) + GL11.glScalef(progress * -0.02F, progress * -0.02F, progress * 0.02F) + GlStateManager.rotate(textY * renderManager.playerViewX, 1.0f, 0.0f, 0.0f) + GL11.glDepthMask(false) + Fonts.fontBangers.drawString(messageString, 0.25F, 0.25F, Color(0F, 0F, 0F, alpha * 0.75F).rgb) + Fonts.fontBangers.drawString(messageString, 0F, 0F, ColorUtils.reAlpha(color, alpha).rgb) + GL11.glColor4f(187.0f, 255.0f, 255.0f, 1.0f) + GL11.glDepthMask(true) + GlStateManager.doPolygonOffset(1.0f, 1500000.0f) + GlStateManager.disablePolygonOffset() + GlStateManager.popMatrix() + } +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiContainer.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiContainer.java index ceacc78..870d0aa 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiContainer.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiContainer.java @@ -11,7 +11,7 @@ import net.ccbluex.liquidbounce.features.module.modules.client.Animations; import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura; import net.ccbluex.liquidbounce.features.module.modules.player.InvManager; -import net.ccbluex.liquidbounce.features.module.modules.world.Stealer; +import net.ccbluex.liquidbounce.features.module.modules.player.Stealer; import net.ccbluex.liquidbounce.utils.MinecraftInstance; import net.ccbluex.liquidbounce.utils.render.EaseUtils; import net.ccbluex.liquidbounce.utils.render.RenderUtils; diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt index e4bb41e..7f380fe 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/InventoryUtils.kt @@ -180,6 +180,7 @@ object InventoryUtils : MinecraftInstance(), Listenable { var blockAmount = 0 var arrowAmount = 0 var foodAmount = 0 + var rod = 0 mc.thePlayer.inventory.mainInventory.forEachIndexed { i, _ -> val itemStack = mc.thePlayer.inventoryContainer.getSlot(i).stack if (itemStack != null) { @@ -197,12 +198,14 @@ object InventoryUtils : MinecraftInstance(), Listenable { is ItemFood -> { foodAmount += itemStack.stackSize } + + is ItemFishingRod -> rod += itemStack.stackSize } if (itemStack.unlocalizedName == "item.arrow") { arrowAmount += itemStack.stackSize } } } - return intArrayOf(missileAmount, blockAmount, arrowAmount,foodAmount) + return intArrayOf(missileAmount, blockAmount, arrowAmount,foodAmount,rod) } } diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/PlayerUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/PlayerUtils.kt index f399d56..4af8a58 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/PlayerUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/PlayerUtils.kt @@ -20,6 +20,11 @@ import net.minecraft.util.AxisAlignedBB import net.minecraft.util.DamageSource import net.minecraft.util.MathHelper import net.minecraftforge.common.ForgeHooks +import kotlin.math.roundToInt + + +val EntityLivingBase.isMoving: Boolean + get() = this.run { moveForward != 0F || moveStrafing != 0F } object PlayerUtils { fun randomUnicode(str: String): String { @@ -39,7 +44,7 @@ object PlayerUtils { } fun getIncremental(`val`: Double, inc: Double): Double { val one = 1.0 / inc - return Math.round(`val` * one) / one + return (`val` * one).roundToInt() / one } fun getAr(player : EntityLivingBase):Double{ var arPercentage: Double = (player.totalArmorValue / player.maxHealth).toDouble() @@ -140,7 +145,7 @@ object PlayerUtils { f += f1 var flag1 = false val j = EnchantmentHelper.getFireAspectModifier(mc.thePlayer) - if (entity is EntityLivingBase && j > 0 && !entity.isBurning()) { + if (entity is EntityLivingBase && j > 0 && !entity.isBurning) { flag1 = true entity.setFire(1) } @@ -159,7 +164,7 @@ object PlayerUtils { ) mc.thePlayer.motionX *= 0.6 mc.thePlayer.motionZ *= 0.6 - mc.thePlayer.isSprinting = false + mc.thePlayer.serverSprintState = false } if (entity is EntityPlayerMP && entity.velocityChanged) { @@ -202,15 +207,14 @@ object PlayerUtils { } } - if (itemstack != null && entity is EntityLivingBase) { + if (entity is EntityLivingBase) { itemstack.hitEntity(entity, mc.thePlayer) if (itemstack.stackSize <= 0) { mc.thePlayer.destroyCurrentEquippedItem() } } - if (entity is EntityLivingBase) { - mc.thePlayer.addStat(StatList.damageDealtStat, Math.round(f * 10.0f)) + mc.thePlayer.addStat(StatList.damageDealtStat, (f * 10.0f).roundToInt()) if (j > 0) { entity.setFire(j * 4) }