Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Sand Pop for hole lover Ab_noCPU
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna5ama committed Sep 12, 2023
1 parent a92a0c2 commit 8a70a0a
Showing 1 changed file with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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()
}
}
}

0 comments on commit 8a70a0a

Please sign in to comment.