This repository has been archived by the owner on May 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
src/main/kotlin/dev/luna5ama/trollhack/module/modules/exploit/SandPop.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} | ||
} |