This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
generated from TomJuri/ExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connectiing the differnet modules is almost done
also added generic boss killer and changed enderman boss killer Signed-off-by: TomJuri <[email protected]>
- Loading branch information
Showing
12 changed files
with
180 additions
and
75 deletions.
There are no files selected for viewing
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
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
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
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
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
55 changes: 55 additions & 0 deletions
55
src/main/kotlin/dev/macrohq/swiftslayer/macro/GenericBossKiller.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,55 @@ | ||
package dev.macrohq.swiftslayer.macro | ||
|
||
import dev.macrohq.swiftslayer.util.* | ||
import net.minecraft.entity.EntityLiving | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent | ||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent | ||
|
||
class GenericBossKiller { | ||
|
||
var enabled = false | ||
private set | ||
private lateinit var target: EntityLiving | ||
private var hasRotated = false | ||
|
||
@SubscribeEvent | ||
fun onTick(event: ClientTickEvent) { | ||
if (!enabled) return | ||
if (target.isDead) { | ||
Logger.info("Boss killed.") | ||
disable() | ||
return | ||
} | ||
if (!hasRotated) { | ||
if (config.bossKillerWeapon == 1) { | ||
RotationUtil.easeToEntity(target, 500, aimLock = true, true) | ||
} else { | ||
RotationUtil.ease(RotationUtil.Rotation(player.rotationYaw, 90f), 500) | ||
} | ||
hasRotated = true | ||
} | ||
if (player.getDistanceToEntity(target) <= 5) { | ||
if (config.bossKillerWeapon == 1) | ||
KeyBindUtil.leftClick(10) | ||
else | ||
KeyBindUtil.rightClick(10) | ||
} else { | ||
KeyBindUtil.stopClicking() | ||
} | ||
} | ||
|
||
fun enable(target: EntityLiving) { | ||
if (enabled) return | ||
Logger.info("Enabling GenericBossKiller") | ||
enabled = true | ||
} | ||
|
||
fun disable() { | ||
if (!enabled) return | ||
Logger.info("Disabling GenericBossKiller") | ||
enabled = false | ||
RotationUtil.stop() | ||
KeyBindUtil.stopClicking() | ||
hasRotated = false | ||
} | ||
} |
41 changes: 34 additions & 7 deletions
41
src/main/kotlin/dev/macrohq/swiftslayer/macro/MacroManager.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 |
---|---|---|
@@ -1,30 +1,57 @@ | ||
package dev.macrohq.swiftslayer.macro | ||
|
||
import dev.macrohq.swiftslayer.util.Logger | ||
import dev.macrohq.swiftslayer.util.config | ||
import dev.macrohq.swiftslayer.util.* | ||
import net.minecraft.entity.EntityLiving | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent | ||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent | ||
|
||
class MacroManager { | ||
|
||
private var enabled = false | ||
private var state = State.ACTIVATE_QUEST | ||
|
||
fun toggle() { | ||
if (!enabled) { | ||
enabled = true | ||
} else { | ||
enabled = false | ||
@SubscribeEvent | ||
fun onTick(event: ClientTickEvent) { | ||
if (!enabled || autoBatphone.enabled || mobKiller.enabled || genericBossKiller.enabled || endermanBossKiller.enabled) return | ||
when (state) { | ||
State.ACTIVATE_QUEST -> autoBatphone.enable(true) | ||
State.KILL_MOBS -> mobKiller.enable() | ||
State.KILL_BOSS -> { | ||
val boss = | ||
player.worldObj.loadedEntityList.filterIsInstance<EntityLiving>().maxByOrNull { it.maxHealth }!! | ||
if (config.slayer == 3) endermanBossKiller.enable(boss) | ||
else genericBossKiller.enable(boss) | ||
} | ||
} | ||
} | ||
|
||
fun toggle() { | ||
if (!enabled) enable() else disable() | ||
} | ||
|
||
private fun enable() { | ||
if (enabled) return | ||
if (config.slayer != 0 && config.slayerTier == 4) { | ||
Logger.error("There's no tier 5 boss for this slayer.") | ||
return | ||
} | ||
Logger.info("Enabling macro.") | ||
enabled = true | ||
} | ||
|
||
private fun disable() { | ||
if (!enabled) return | ||
Logger.info("Disabling macro.") | ||
enabled = false | ||
autoBatphone.disable() | ||
mobKiller.disable() | ||
genericBossKiller.disable() | ||
endermanBossKiller.disable() | ||
} | ||
|
||
enum class State { | ||
ACTIVATE_QUEST, | ||
KILL_MOBS, | ||
KILL_BOSS | ||
} | ||
} |
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
Oops, something went wrong.