Skip to content

Commit

Permalink
fix: expand Use Hits to Detect Slayer to work on EntityLivingBase
Browse files Browse the repository at this point in the history
Player is not a subtype of EntityLiving
  • Loading branch information
My-Name-Is-Jeff committed Jun 23, 2023
1 parent ee94530 commit 5e4d8e9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ object SlayerFeatures : CoroutineScope {
var hasSlayerText = false
private var lastTickHasSlayerText = false
var expectedMaxHp: Int? = null
private val hitMap = HashMap<EntityLiving, Int>()
private val hitMap = HashMap<EntityLivingBase, Int>()
var BossHealths = HashMap<String, HashMap<String, Int>>()
var maddoxCommand = ""

Expand Down Expand Up @@ -491,8 +491,9 @@ object SlayerFeatures : CoroutineScope {

@SubscribeEvent
fun onAttack(event: AttackEntityEvent) {
if (!hasSlayerText || !Utils.inSkyblock || event.entity != mc.thePlayer || event.target !is EntityLiving || !Skytils.config.useSlayerHitMethod) return
val entity = event.target as EntityLiving
val entity = event.target as? EntityLivingBase ?: return

if (!hasSlayerText || !Utils.inSkyblock || event.entity != mc.thePlayer || !Skytils.config.useSlayerHitMethod) return
if ((if (MayorInfo.mayorPerks.contains("DOUBLE MOBS HP!!!")) 2 else 1) * floor(entity.baseMaxHealth).toInt() == expectedMaxHp) {
printDevMessage("A valid entity was attacked", "slayer", "seraph", "seraphHit")
hitMap.compute(entity) { _, int ->
Expand Down

0 comments on commit 5e4d8e9

Please sign in to comment.