Skip to content

Commit

Permalink
LEGACY: Added more AutoPlay modes (CCBlueX#2980)
Browse files Browse the repository at this point in the history
- Removed Minemen Mode
- Improved Code
- Added more modes

---------

Co-authored-by: Eclipses <[email protected]>
  • Loading branch information
Coccocoahelper and EclipsesDev authored May 16, 2024
1 parent cbd1f4d commit f425062
Showing 1 changed file with 44 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ import net.minecraft.item.ItemStack

object AutoPlay : Module("AutoPlay", ModuleCategory.PLAYER, gameDetecting = false, hideModule = false) {

private val mode by ListValue("Mode", arrayOf("BlocksMC", "HypixelSkywars"), "BlocksMC")
private val mode by ListValue("Mode", arrayOf("Paper", "Hypixel"), "Paper")

// Hypixel Skywars AutoPlay Settings
private val skywarsMode by ListValue("SkywarsMode", arrayOf("Normal", "Insane"), "Normal") {
mode == "HypixelSkywars"
// Hypixel Settings
private val hypixelMode by ListValue("HypixelMode", arrayOf("Skywars", "Bedwars"), "Skywars") {
mode == "Hypixel"
}
private val skywarsMode by ListValue("SkywarsMode", arrayOf("SoloNormal", "SoloInsane"), "SoloNormal") {
hypixelMode == "Skywars"
}
private val bedwarsMode by ListValue("BedwarsMode", arrayOf("Solo", "Double", "Trio", "Quad"), "Solo") {
hypixelMode == "Bedwars"
}

private val delay by IntegerValue("Delay", 50, 0..200)
Expand All @@ -34,15 +40,18 @@ object AutoPlay : Module("AutoPlay", ModuleCategory.PLAYER, gameDetecting = fals
fun onUpdate(event: UpdateEvent) {
val player = mc.thePlayer ?: return

if (!player.isAirBorne || !player.inventory.hasItemStack(ItemStack(Items.paper))) {
if (!playerInGame() || !player.inventory.hasItemStack(ItemStack(Items.paper))) {
if (delayTick > 0)
delayTick = 0

return
} else {
delayTick++
}

when (mode) {
"BlocksMC" -> {
val paper = findPaper(36, 45)
"Paper" -> {
val paper = findPaper()

if (paper == -1) {
return
Expand All @@ -57,37 +66,32 @@ object AutoPlay : Module("AutoPlay", ModuleCategory.PLAYER, gameDetecting = fals
}
}

"HypixelSkywars" -> {
"Hypixel" -> {
if (delayTick >= delay) {
when (skywarsMode) {
"Normal" -> player.sendChatMessage("/play solo_normal")
"Insane" -> player.sendChatMessage("/play solo_insane")
if (hypixelMode == "Skywars") {
when (skywarsMode) {
"SoloNormal" -> player.sendChatMessage("/play solo_normal")
"SoloInsane" -> player.sendChatMessage("/play solo_insane")
}
} else {
when (bedwarsMode) {
"Solo" -> player.sendChatMessage("/play bedwars_eight_one")
"Double" -> player.sendChatMessage("/play bedwars_eight_two")
"Trio" -> player.sendChatMessage("/play bedwars_four_three")
"Quad" -> player.sendChatMessage("/play bedwars_four_four")
}
}
delayTick = 0
}
}

"MinemenClub" -> {
if (player.ticksExisted % 15 == 1) {
val paper = findPaper(36, 45)
if (paper == -1) return

mc.thePlayer.rotationPitch = -90f
mc.thePlayer.inventory.currentItem = (paper - 36)
mc.playerController.updateController()
if (delayTick >= delay) {
mc.rightClickMouse()
}
}
}
}
}

/**
* Find paper in inventory
*/
private fun findPaper(startSlot: Int, endSlot: Int): Int {
for (i in startSlot until endSlot) {
private fun findPaper(): Int {
for (i in 36 until 45) {
val stack = mc.thePlayer?.inventoryContainer?.getSlot(i)?.stack
if (stack != null) {
if (stack.item == Items.paper) {
Expand All @@ -98,9 +102,21 @@ object AutoPlay : Module("AutoPlay", ModuleCategory.PLAYER, gameDetecting = fals
return -1
}

/**
* Check whether player is in game or not
*/
private fun playerInGame(): Boolean {
val player = mc.thePlayer ?: return false

return player.ticksExisted > 10
&& (player.capabilities.isFlying
|| player.capabilities.allowFlying
|| player.capabilities.disableDamage)
}

/**
* HUD Tag
*/
override val tag
get() = mode
}
}

0 comments on commit f425062

Please sign in to comment.