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

Commit

Permalink
no mroe fps drosp
Browse files Browse the repository at this point in the history
Signed-off-by: TomJuri <[email protected]>
  • Loading branch information
TomJuri committed Sep 17, 2023
1 parent 6e5bef6 commit 37524c1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SwiftSlayerConfig : Config(Mod("SwiftSlayer", ModType.SKYBLOCK), "swiftsla
name = "MobKiller Weapon",
category = "General",
subcategory = "Slayer",
options = ["Spirit Sceptre", "Aspect of the Dragons", "Frozen Scythe", "Fire Veil Wand"]
options = ["Spirit Sceptre", "Melee", "Frozen Scythe", "Fire Veil Wand"]
)
var mobKillerWeapon = 0

Expand Down
8 changes: 6 additions & 2 deletions src/main/kotlin/dev/macrohq/swiftslayer/feature/Tracker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ class Tracker {
fun getLevelUpIn(): String {
val xpPerHour = getXPPerHour()
if (xpPerHour.toInt() == 0 || xpNeededForNextLevel.toFloat() == 0f) return "00:00:00"
val millis = (xpNeededForNextLevel / xpPerHour) * 60 * 60 * 1000
return String.format("%02d:%02d:%02d", millis / 3600000, millis % 3600000 / 60000, millis % 60000 / 1000)
val decimalHours = (xpNeededForNextLevel / xpPerHour.toFloat())
val hours = decimalHours.toInt()
val timeleft = decimalHours - hours
val minutes = (timeleft * 60).toInt()
val seconds = ((timeleft * 60 - minutes) * 60).toInt()
return String.format("%02d:%02d:%02d", hours, minutes, seconds)
}
fun getTimeRunning(): String {
val millis = System.currentTimeMillis() - startTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import dev.macrohq.swiftslayer.util.PathingUtil
import dev.macrohq.swiftslayer.util.RotationUtil
import dev.macrohq.swiftslayer.util.SlayerUtil
import dev.macrohq.swiftslayer.util.config
import dev.macrohq.swiftslayer.util.gameSettings
import dev.macrohq.swiftslayer.util.getStandingOnCeil
import dev.macrohq.swiftslayer.util.macroManager
import dev.macrohq.swiftslayer.util.player
import dev.macrohq.swiftslayer.util.setPressed
import net.minecraft.entity.EntityLiving
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
Expand All @@ -25,17 +27,15 @@ class GenericBossKiller {
@SubscribeEvent
fun onTick(event: ClientTickEvent) {
if (!enabled) return
if (target == null) {
val t = SlayerUtil.getBoss()
if (t != null) target = t.first
else return
}
target = SlayerUtil.getBoss()?.first
if (target == null) return
if (SlayerUtil.getState() == SlayerUtil.SlayerState.BOSS_DEAD) {
Logger.info("Boss killed.")
gameSettings.keyBindSneak.setPressed(false)
disable()
return
}

gameSettings.keyBindSneak.setPressed(true)
if (AngleUtil.getAngles(target!!).pitch < 70) {
RotationUtil.lock(target!!, 350, true, true)
} else {
Expand Down Expand Up @@ -75,6 +75,7 @@ class GenericBossKiller {
if (enabled) return
Logger.info("Enabling GenericBossKiller")
RotationUtil.stop()
PathingUtil.stop()
target = null
enabled = true
hasRotated = false
Expand All @@ -85,6 +86,7 @@ class GenericBossKiller {
Logger.info("Disabling GenericBossKiller")
enabled = false
RotationUtil.stop()
PathingUtil.stop()
KeyBindUtil.stopClicking()
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/macrohq/swiftslayer/macro/MobKiller.kt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class MobKiller {
private fun holdWeapon() {
when (config.mobKillerWeapon) {
0 -> InventoryUtil.holdItem("Spirit Sceptre")
1 -> InventoryUtil.holdItem("Aspect of the Dragons")
1 -> player.inventory.currentItem = config.meleeWeaponSlot - 1
2 -> InventoryUtil.holdItem("Frozen Scythe")
3 -> InventoryUtil.holdItem("Fire Veil Wand")
}
Expand Down
25 changes: 0 additions & 25 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/EntityUtil.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package dev.macrohq.swiftslayer.util

import net.minecraft.entity.EntityLiving
import net.minecraft.entity.monster.EntitySpider
import net.minecraft.entity.passive.EntityWolf
import net.minecraft.init.Blocks
import net.minecraft.util.BlockPos
import kotlin.math.abs
import kotlin.math.atan2
import kotlin.math.sqrt

object EntityUtil {
fun getMobs(entityClass: Class<out EntityLiving>): List<EntityLiving> {
Expand All @@ -18,23 +12,4 @@ object EntityUtil {
newEntities.addAll(entities.sortedBy { it.getDistanceToEntity(player) })
return newEntities
}

private fun inRange(entity: EntityLiving): Boolean {
if (entity is EntityWolf) {
return sqrt(entity.position.distanceSq(BlockPos(-382, 51, -7))) > 20
} else if (entity is EntitySpider) {
return (sqrt(entity.position.distanceSq(BlockPos(-294, 43, -243))) < 60 &&
sqrt(entity.position.distanceSq(BlockPos(-284, 48, 151))) > 20)
}
return true
}

private fun isInFov(entity: EntityLiving): Boolean {
val deltaX = entity.posX - player.posX
val deltaZ = entity.posZ - player.posZ
val angle = atan2(deltaZ, deltaX) - atan2(player.lookVec.zCoord, player.lookVec.xCoord)
val fov = Math.toRadians(110.0)
if (abs(angle) < fov / 2.0) return true
return false
}
}
8 changes: 5 additions & 3 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/SlayerUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ object SlayerUtil {
fun isBoss(entity: EntityArmorStand) = bosses.any { StringUtils.stripControlCodes(entity.name).contains(it) }
fun isBoss(entity: EntityLiving): Boolean {
val bossArmorStands = player.worldObj.loadedEntityList.filterIsInstance<EntityArmorStand>().filter { isBoss(it) }
if (bossArmorStands.isEmpty()) return false
val closestBossArmorStand = bossArmorStands.minByOrNull { it.getDistanceToEntity(entity) }
return closestBossArmorStand != null
bossArmorStands.forEach { bossArmorStand ->
val closest = player.worldObj.loadedEntityList.minByOrNull { it.getDistanceToEntity(bossArmorStand) }
if (closest == entity) return true
}
return false
}
fun isMiniBoss(entity: EntityArmorStand) = miniBosses.any { StringUtils.stripControlCodes(entity.name).contains(it) }

Expand Down

0 comments on commit 37524c1

Please sign in to comment.