From 9c6a55a0c95f96b9a44f873a145527ae012c61f8 Mon Sep 17 00:00:00 2001 From: Edouard127 <46357922+Edouard127@users.noreply.github.com> Date: Sun, 5 Dec 2021 14:26:31 -0500 Subject: [PATCH] Much more Modules and dupebook command --- .../command/commands/DupeBookCommand.kt | 79 ++++++++++++++++ .../client/command/commands/HelpCommand.kt | 3 +- .../client/module/modules/combat/AntiBot.kt | 69 ++++++++++++++ .../module/modules/combat/InfiniteAura.kt | 80 ++++++++++++++++ .../modules/movement/PacketFileExploit.kt | 94 +++++++++++++++++++ .../module/modules/player/EndTeleport.kt | 37 ++++++++ .../client/module/modules/render/NoRender.kt | 2 +- .../com/lambda/client/util/PacketEvent.kt | 8 +- 8 files changed, 367 insertions(+), 5 deletions(-) create mode 100644 src/main/kotlin/com/lambda/client/command/commands/DupeBookCommand.kt create mode 100644 src/main/kotlin/com/lambda/client/module/modules/combat/AntiBot.kt create mode 100644 src/main/kotlin/com/lambda/client/module/modules/combat/InfiniteAura.kt create mode 100644 src/main/kotlin/com/lambda/client/module/modules/movement/PacketFileExploit.kt create mode 100644 src/main/kotlin/com/lambda/client/module/modules/player/EndTeleport.kt diff --git a/src/main/kotlin/com/lambda/client/command/commands/DupeBookCommand.kt b/src/main/kotlin/com/lambda/client/command/commands/DupeBookCommand.kt new file mode 100644 index 0000000..8707d2b --- /dev/null +++ b/src/main/kotlin/com/lambda/client/command/commands/DupeBookCommand.kt @@ -0,0 +1,79 @@ +package com.lambda.client.command.commands + +import com.lambda.client.command.ClientCommand +import com.lambda.client.event.SafeExecuteEvent +import com.lambda.client.util.items.itemPayload +import com.lambda.client.util.text.MessageSendHelper +import net.minecraft.item.ItemWritableBook +import net.minecraft.nbt.NBTTagList +import net.minecraft.nbt.NBTTagString +import java.util.* +import java.util.stream.Collectors + +/** + * @author 0x2E | PretendingToCode + * @author EarthComputer + * + * The characterGenerator is from here: https://github.com/ImpactDevelopment/ImpactIssues/issues/1123#issuecomment-482721273 + * Which was written by EarthComputer for both EvilSourcerer and 0x2E + */ +object DupeBookCommand : ClientCommand( + name = "dupebook", + alias = arrayOf("bookbot"), + description = "Generates books used for chunk save state dupe." +) { + init { + boolean("sign book") { signBookArg -> + executeSafe { + createBook(signBookArg.value) + } + } + + executeSafe { + createBook(false) + } + } + + private fun SafeExecuteEvent.createBook(sign: Boolean) { + val heldItem = player.inventory.getCurrentItem() + + if (heldItem.item is ItemWritableBook) { + val characterGenerator = Random() + .ints(0x80, 0x10ffff - 0x800) + .map { if (it < 0xd800) it else it + 0x800 } + + val joinedPages = characterGenerator + .limit(50 * 210L) + .mapToObj { it.toChar().toString() } // this has to be turned into a Char first, otherwise you will get the raw Int value + .collect(Collectors.joining()) + + val pages = NBTTagList() + val title = if (sign) UUID.randomUUID().toString().substring(0, 5) else "" + + for (page in 0..49) { + pages.appendTag(NBTTagString(joinedPages.substring(page * 210, (page + 1) * 210))) + } + + if (heldItem.hasTagCompound()) { + heldItem.tagCompound!!.setTag("pages", pages) + heldItem.tagCompound!!.setTag("title", NBTTagString(title)) + heldItem.tagCompound!!.setTag("author", NBTTagString(player.name)) + } else { + heldItem.setTagInfo("pages", pages) + heldItem.setTagInfo("title", NBTTagString(title)) + heldItem.setTagInfo("author", NBTTagString(player.name)) + } + + itemPayload(heldItem, "MC|BEdit") + + if (sign) { + itemPayload(heldItem, "MC|BSign") + } + + MessageSendHelper.sendChatMessage("Dupe book generated.") + } else { + MessageSendHelper.sendErrorMessage("You must be holding a writable book.") + } + } + +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/command/commands/HelpCommand.kt b/src/main/kotlin/com/lambda/client/command/commands/HelpCommand.kt index b3841a2..67b3104 100644 --- a/src/main/kotlin/com/lambda/client/command/commands/HelpCommand.kt +++ b/src/main/kotlin/com/lambda/client/command/commands/HelpCommand.kt @@ -45,8 +45,7 @@ object HelpCommand : ClientCommand( "How do I see all commands? - ${formatValue("$prefix${name} commands")}\n" + "How do I use Baritone? - ${formatValue("${prefix}b")}\n" + "How do I change ${TextFormatting.GRAY};${TextFormatting.RESET} to something else? - ${formatValue("${prefix}prefix")}\n" + - "How do I get a Cape? - Contribute to the project.\n" + - "Other questions? - Get support at ${TextFormatting.BLUE}${LambdaMod.DISCORD_INVITE}" + "How do I get a Cape? - Contribute to the project.\n" ) } } diff --git a/src/main/kotlin/com/lambda/client/module/modules/combat/AntiBot.kt b/src/main/kotlin/com/lambda/client/module/modules/combat/AntiBot.kt new file mode 100644 index 0000000..e4bd9d1 --- /dev/null +++ b/src/main/kotlin/com/lambda/client/module/modules/combat/AntiBot.kt @@ -0,0 +1,69 @@ +package com.lambda.client.module.modules.combat + +import com.lambda.client.event.SafeClientEvent +import com.lambda.client.event.events.PlayerAttackEvent +import com.lambda.client.event.events.ConnectionEvent +import com.lambda.client.module.Category +import com.lambda.client.module.Module +import com.lambda.client.module.modules.misc.FakePlayer +import com.lambda.client.util.math.Vec2d +import com.lambda.client.util.threads.safeListener +import com.lambda.event.listener.listener +import net.minecraft.entity.Entity +import net.minecraft.entity.player.EntityPlayer +import net.minecraftforge.fml.common.gameevent.TickEvent +import kotlin.math.abs + +object AntiBot : Module( + name = "AntiBot", + description = "Avoid attacking fake players", + category = Category.COMBAT, + alwaysListening = true +) { + private val tabList by setting("Tab List", true) + private val ping by setting("Ping", true) + private val hp by setting("HP", true) + private val sleeping by setting("Sleeping", false) + private val hoverOnTop by setting("Hover On Top", true) + private val ticksExists by setting("Ticks Exists", 200, 0..500, 10) + + private val botSet = HashSet() + + init { + listener { + botSet.clear() + } + + listener { + if (isEnabled && botSet.contains(it.entity)) it.cancel() + } + + safeListener { + val cacheSet = HashSet() + for (entity in world.loadedEntityList) { + if (entity !is EntityPlayer) continue + if (entity == player) continue + if (!isBot(entity)) continue + cacheSet.add(entity) + } + botSet.removeIf { !cacheSet.contains(it) } + botSet.addAll(cacheSet) + } + } + + fun isBot(entity: Entity) = isEnabled && entity is EntityPlayer && botSet.contains(entity) + + private fun SafeClientEvent.isBot(entity: EntityPlayer) = entity.name == player.name + || entity.name == FakePlayer.playerName + || tabList && connection.getPlayerInfo(entity.name) == null + || ping && connection.getPlayerInfo(entity.name)?.responseTime ?: -1 <= 0 + || hp && entity.health !in 0f..20f + || sleeping && entity.isPlayerSleeping && !entity.onGround + || hoverOnTop && hoverCheck(entity) + || entity.ticksExisted < ticksExists + + private fun SafeClientEvent.hoverCheck(entity: EntityPlayer): Boolean { + val distXZ = Vec2d(entity.posX, entity.posZ).minus(player.posX, player.posZ).lengthSquared() + return distXZ < 16 && entity.posY - player.posY > 2.0 && abs(entity.posY - entity.prevPosY) < 0.1 + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/combat/InfiniteAura.kt b/src/main/kotlin/com/lambda/client/module/modules/combat/InfiniteAura.kt new file mode 100644 index 0000000..0f3df73 --- /dev/null +++ b/src/main/kotlin/com/lambda/client/module/modules/combat/InfiniteAura.kt @@ -0,0 +1,80 @@ +package com.lambda.client.module.modules.combat + +import com.lambda.client.manager.managers.CombatManager +import com.lambda.client.module.Category +import com.lambda.client.module.Module +import com.lambda.client.util.text.MessageSendHelper +import com.lambda.client.util.threads.safeListener +import net.minecraft.entity.EntityLivingBase +import net.minecraft.network.play.client.CPacketPlayer +import net.minecraftforge.fml.common.gameevent.TickEvent + +object TpAura : Module( + name = "TpAura", + description = "KillAura with infinite reach (Infinite as in to the edge of the render distance if good config)", + category = Category.COMBAT, + modulePriority = 120 +) { + val mode by setting("Mode", Mode.FAST) + + val delay by setting("Tick Delay", 2, 1..200, 1) + val disableOnDeath by setting("Death Disable", true) + + + val range by setting("Range", 50, 5..500, 1) + + var timer = 0 + + init { + onEnable { + timer = 0 + } + onDisable { + timer = 0 + } + + safeListener { + if (it.phase != TickEvent.Phase.START) { + return@safeListener + } + + timer++ + if (timer <= delay) { + MessageSendHelper.sendChatMessage("timer'd @ $timer") + return@safeListener + } + timer = 0 + + if (!player.isEntityAlive) { + if (disableOnDeath) { + disable() + } + return@safeListener + } + val target = CombatManager.target ?: return@safeListener + + MessageSendHelper.sendChatMessage("e") + + if (!CombatManager.isOnTopPriority(TpAura) || CombatSetting.pause) return@safeListener + if (player.getDistance(target) >= range) return@safeListener + + doTpHit(target) + } + } + + private fun doTpHit(target: EntityLivingBase) { + + if (mode == Mode.FAST) { + MessageSendHelper.sendChatMessage("Attacked ${target.name}") + + mc.player.connection.sendPacket(CPacketPlayer.Position(target.posX, target.posY, target.posZ, false)) + mc.playerController.attackEntity(mc.player, target) + mc.player.connection.sendPacket(CPacketPlayer.Position(mc.player.posX, mc.player.posY, mc.player.posZ, mc.player.onGround)) + } + } + + enum class Mode { + FAST, + GOOD + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFileExploit.kt b/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFileExploit.kt new file mode 100644 index 0000000..00160bf --- /dev/null +++ b/src/main/kotlin/com/lambda/client/module/modules/movement/PacketFileExploit.kt @@ -0,0 +1,94 @@ +package com.lambda.client.module.modules.movement + +import com.lambda.client.event.Phase +import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent +import com.lambda.client.event.events.PlayerTravelEvent +import com.lambda.client.module.Category +import com.lambda.client.module.Module +import com.lambda.client.util.MovementUtils +import com.lambda.client.util.MovementUtils.calcMoveYaw +import com.lambda.client.util.PacketEvent +import com.lambda.client.util.threads.safeListener +import com.lambda.event.listener.listener +import net.minecraft.network.play.client.CPacketPlayer +import net.minecraft.network.play.server.SPacketCloseWindow +import net.minecraftforge.fml.common.gameevent.TickEvent +import kotlin.math.cos +import kotlin.math.sin + +object PacketFlyExploit : Module( + name = "PacketFly", + description = "Allows you to fly by exploiting NoCheatPlus", + category = Category.MOVEMENT +) { + + val mode by setting("Mode", Mode.FAST) + val ySpeed by setting("YSpeed", 0.05, 0.01..1.0, 0.01) + val delay by setting("Delay", 1, 0..20, 1) + + var timer = 0 + + + init { + safeListener { + if (mode == Mode.FAST) { + + timer++ + if (timer < delay) { + return@safeListener + } + timer = 0 + + + if (mc.gameSettings.keyBindJump.isKeyDown) { + mc.player.connection.sendPacket(CPacketPlayer.PositionRotation(mc.player.posX, mc.player.posY - ySpeed, mc.player.posZ, 0f, 0f, mc.player.onGround)) + } else if (mc.gameSettings.keyBindSneak.isKeyDown) { + mc.player.connection.sendPacket(CPacketPlayer.PositionRotation(mc.player.posX, mc.player.posY + ySpeed, mc.player.posZ, 0f, 0f, mc.player.onGround)) + } + + mc.player.connection.sendPacket(CPacketPlayer.PositionRotation(mc.player.posX, -1337.0, mc.player.posZ, 0f, 0f, true)) + } else if (mode == Mode.OLD) { + it.cancel() + + player.motionY = if (mc.gameSettings.keyBindJump.isKeyDown xor mc.gameSettings.keyBindSneak.isKeyDown) { + if (mc.gameSettings.keyBindJump.isKeyDown) { + 0.0622 + } + else -0.0622 + } else { + if (MovementUtils.isInputting) { + val yaw = calcMoveYaw() + player.motionX = -sin(yaw) * 0.2f + player.motionZ = cos(yaw) * 0.2f + } + -ySpeed + } + + val posX = player.posX + player.motionX + val posY = player.posY + player.motionY + val posZ = player.posZ + player.motionZ + + connection.sendPacket(CPacketPlayer.PositionRotation(posX, posY, posZ, player.rotationYaw, player.rotationPitch, false)) + connection.sendPacket(CPacketPlayer.Position(posX, player.posY - 42069, posZ, true)) + } + } + + listener { + if (mode == Mode.OLD && it.phase == Phase.PRE) { + return@listener + } + } + + listener { + if (mode == Mode.OLD && it.packet is SPacketCloseWindow) { + it.cancel() + } + } + } + + enum class Mode { + OLD, + FAST, + VANILLA // todo: vanilla mode (for phasing) + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/player/EndTeleport.kt b/src/main/kotlin/com/lambda/client/module/modules/player/EndTeleport.kt new file mode 100644 index 0000000..439dc7d --- /dev/null +++ b/src/main/kotlin/com/lambda/client/module/modules/player/EndTeleport.kt @@ -0,0 +1,37 @@ +package com.lambda.client.module.modules.player + +import com.lambda.client.module.Category +import com.lambda.client.module.Module +import com.lambda.client.util.PacketEvent +import com.lambda.client.util.text.MessageSendHelper +import com.lambda.client.util.threads.safeListener +import net.minecraft.network.play.server.SPacketDisconnect +import net.minecraft.network.play.server.SPacketRespawn +import net.minecraft.util.text.TextComponentString + +object EndTeleport : Module( + name = "EndTeleport", + category = Category.PLAYER, + description = "Allows for teleportation when going through end portals" +) { + private val confirmed by setting("Confirm", false) + + init { + onEnable { + if (mc.currentServerData == null) { + MessageSendHelper.sendWarningMessage("$chatName This module does not work in singleplayer") + disable() + } else if (!confirmed) { + MessageSendHelper.sendWarningMessage("$chatName This module will kick you from the server! It is part of the exploit and cannot be avoided") + } + } + + safeListener { + if (it.packet !is SPacketRespawn) return@safeListener + if (it.packet.dimensionID == 1 && confirmed) { + connection.handleDisconnect(SPacketDisconnect(TextComponentString("Attempting teleportation exploit"))) + disable() + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/render/NoRender.kt b/src/main/kotlin/com/lambda/client/module/modules/render/NoRender.kt index 173d7c8..8c9663e 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/render/NoRender.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/render/NoRender.kt @@ -166,7 +166,7 @@ object NoRender : Module( if (!enchantingTableSnow || tileEntity !is TileEntityEnchantmentTable) return false runSafe { - val blockState = Blocks.SNOW_LAYER.defaultState.withProperty(BlockSnow.LAYERS, 7) + val blockState = Blocks.BOOKSHELF.defaultState world.setBlockState(tileEntity.pos, blockState) world.markTileEntityForRemoval(tileEntity) } diff --git a/src/main/kotlin/com/lambda/client/util/PacketEvent.kt b/src/main/kotlin/com/lambda/client/util/PacketEvent.kt index 1f85e28..0ef144d 100644 --- a/src/main/kotlin/com/lambda/client/util/PacketEvent.kt +++ b/src/main/kotlin/com/lambda/client/util/PacketEvent.kt @@ -3,7 +3,7 @@ import com.lambda.client.module.modules.EventStage import net.minecraft.network.Packet import net.minecraftforge.fml.common.eventhandler.Cancelable -open class PacketEvent(stage: Int, private val packet: Packet<*>) : EventStage(stage) { +open class PacketEvent(stage: Int, internal val packet: Packet<*>) : EventStage(stage) { fun getPacket(): Packet<*> { return packet } @@ -12,5 +12,9 @@ open class PacketEvent(stage: Int, private val packet: Packet<*>) : EventStage(s class Send(stage: Int, packet: Packet<*>) : PacketEvent(stage, packet) @Cancelable - class Receive(stage: Int, packet: Packet<*>) : PacketEvent(stage, packet) + class Receive(stage: Int, packet: Packet<*>) : PacketEvent(stage, packet) { + fun cancel() { + return cancel() + } + } }