From 8a70a0a1d932f21c085ddfe3b15b5ad6c3414896 Mon Sep 17 00:00:00 2001 From: Luna <62033805+Luna5ama@users.noreply.github.com> Date: Mon, 11 Sep 2023 22:49:58 -0400 Subject: [PATCH] Sand Pop for hole lover Ab_noCPU --- .../module/modules/exploit/SandPop.kt | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/main/kotlin/dev/luna5ama/trollhack/module/modules/exploit/SandPop.kt diff --git a/src/main/kotlin/dev/luna5ama/trollhack/module/modules/exploit/SandPop.kt b/src/main/kotlin/dev/luna5ama/trollhack/module/modules/exploit/SandPop.kt new file mode 100644 index 0000000..794c1e4 --- /dev/null +++ b/src/main/kotlin/dev/luna5ama/trollhack/module/modules/exploit/SandPop.kt @@ -0,0 +1,71 @@ +package dev.luna5ama.trollhack.module.modules.exploit + +import dev.luna5ama.trollhack.gui.hudgui.elements.client.Notification +import dev.luna5ama.trollhack.manager.managers.CombatManager +import dev.luna5ama.trollhack.manager.managers.HotbarSwitchManager.ghostSwitch +import dev.luna5ama.trollhack.module.Category +import dev.luna5ama.trollhack.module.Module +import dev.luna5ama.trollhack.util.inventory.block +import dev.luna5ama.trollhack.util.inventory.slot.allSlotsPrioritized +import dev.luna5ama.trollhack.util.inventory.slot.firstBlock +import dev.luna5ama.trollhack.util.inventory.slot.firstByStack +import dev.luna5ama.trollhack.util.threads.runSafe +import dev.luna5ama.trollhack.util.world.PlacementSearchOption +import dev.luna5ama.trollhack.util.world.getPlacementSequence +import dev.luna5ama.trollhack.util.world.placeBlock +import net.minecraft.block.BlockConcretePowder +import net.minecraft.block.BlockSand +import net.minecraft.init.Blocks +import net.minecraft.util.math.BlockPos + +internal object SandPop : Module( + name = "Sand Pop", + category = Category.EXPLOIT, + description = "Pop people out of hole using sand" +) { + init { + onEnable { + runSafe { + val target = CombatManager.target ?: run { + Notification.send(SandPop, "No target found") + return@runSafe + } + + val obsidianSlot = player.allSlotsPrioritized.firstBlock(Blocks.OBSIDIAN) ?: run { + Notification.send(SandPop, "No obsidian found") + return@runSafe + } + + val sandSlot = player.allSlotsPrioritized.firstByStack { + val block = it.item.block + block is BlockSand || block is BlockConcretePowder + } ?: run { + Notification.send(SandPop, "No sand or concrete powder found") + return@runSafe + } + + + val abovePos = BlockPos(target.posX, target.entityBoundingBox.maxY + 1.0, target.posZ) + + val sequence = getPlacementSequence( + abovePos, + 5, + PlacementSearchOption.range(5.0), + PlacementSearchOption.ENTITY_COLLISION + ) ?: run { + Notification.send(SandPop, "No valid placement found") + return@runSafe + } + + for (placeInfo in sequence) { + val slot = if (placeInfo.placedPos == abovePos) sandSlot else obsidianSlot + ghostSwitch(slot) { + placeBlock(placeInfo) + } + } + } + + disable() + } + } +} \ No newline at end of file