Skip to content

Commit

Permalink
Much more Modules and dupebook command
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard127 committed Dec 5, 2021
1 parent d7d1168 commit 9c6a55a
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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.")
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
}
}
Expand Down
69 changes: 69 additions & 0 deletions src/main/kotlin/com/lambda/client/module/modules/combat/AntiBot.kt
Original file line number Diff line number Diff line change
@@ -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<EntityPlayer>()

init {
listener<ConnectionEvent.Disconnect> {
botSet.clear()
}

listener<PlayerAttackEvent> {
if (isEnabled && botSet.contains(it.entity)) it.cancel()
}

safeListener<TickEvent.ClientTickEvent> {
val cacheSet = HashSet<EntityPlayer>()
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
}
}
Original file line number Diff line number Diff line change
@@ -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<TickEvent.ClientTickEvent> {
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
}
}
Original file line number Diff line number Diff line change
@@ -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<PlayerTravelEvent> {
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<OnUpdateWalkingPlayerEvent> {
if (mode == Mode.OLD && it.phase == Phase.PRE) {
return@listener
}
}

listener<PacketEvent.Receive> {
if (mode == Mode.OLD && it.packet is SPacketCloseWindow) {
it.cancel()
}
}
}

enum class Mode {
OLD,
FAST,
VANILLA // todo: vanilla mode (for phasing)
}
}
Original file line number Diff line number Diff line change
@@ -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<PacketEvent.Receive> {
if (it.packet !is SPacketRespawn) return@safeListener
if (it.packet.dimensionID == 1 && confirmed) {
connection.handleDisconnect(SPacketDisconnect(TextComponentString("Attempting teleportation exploit")))
disable()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading

0 comments on commit 9c6a55a

Please sign in to comment.