diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-18 20:02:45 -0400 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-18 20:05:28 -0400 |
commit | 393b0ba720de298f8b048804c0253b16941e8a60 (patch) | |
tree | 75f3f51764292984e17ce9437e904d0e386fa72f /src/main | |
parent | 1446376ef424b6d195cae05cfb4e0bdc3b2e0131 (diff) | |
download | SkytilsMod-393b0ba720de298f8b048804c0253b16941e8a60.tar.gz SkytilsMod-393b0ba720de298f8b048804c0253b16941e8a60.tar.bz2 SkytilsMod-393b0ba720de298f8b048804c0253b16941e8a60.zip |
fix arrow never disappear, fix experimental running 100% of the time
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt index ca4e2bfa..58e498f1 100644 --- a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt +++ b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt @@ -95,7 +95,7 @@ class SlayerFeatures { expectedMaxHp = BossHealths["Voidgloom"]?.get(currentTier)?.asInt } if (lastYangGlyphSwitchTicks >= 0) lastYangGlyphSwitchTicks++ - if (Skytils.config.experimentalYangGlyphDetection && yangGlyphEntity == null && yangGlyph == null && slayerEntity != null) { + if (Skytils.config.experimentalYangGlyphDetection && lastYangGlyphSwitchTicks >= 0 && yangGlyphEntity == null && yangGlyph == null && slayerEntity != null) { val suspect = mc.theWorld.getEntitiesWithinAABB( EntityArmorStand::class.java, slayerEntity!!.entityBoundingBox.expand(20.69, 20.69, 20.69) @@ -107,7 +107,7 @@ class SlayerFeatures { }.minByOrNull { abs(lastYangGlyphSwitchTicks - it.ticksExisted) + slayerEntity!!.getDistanceSqToEntity(it) } if (suspect != null) { printDevMessage( - "Found suspect glyph, ${lastYangGlyphSwitchTicks} switched, ${suspect.ticksExisted} existed, ${ + "Found suspect glyph, $lastYangGlyphSwitchTicks switched, ${suspect.ticksExisted} existed, ${ slayerEntity!!.getDistanceSqToEntity( suspect ) @@ -314,6 +314,7 @@ class SlayerFeatures { fun onBlockChange(event: BlockChangeEvent) { if (yangGlyph != null && event.pos == yangGlyph && event.old.block is BlockBeacon && event.update.block is BlockAir) { yangGlyph = null + yangGlyphEntity = null return } if (slayerEntity == null) return @@ -327,11 +328,12 @@ class SlayerFeatures { } } if (Skytils.config.experimentalYangGlyphDetection && yangGlyph == null && slayerEntity != null) { - if (lastYangGlyphSwitchTicks <= 5 && slayerEntity!!.getDistanceSq(event.pos) <= 5 * 5) { + if (lastYangGlyphSwitchTicks in 0..5 && slayerEntity!!.getDistanceSq(event.pos) <= 5 * 5) { printDevMessage( "Beacon was close to slayer, $lastYangGlyphSwitchTicks", "slayer", "seraph", "seraphGlyph" ) yangGlyph = event.pos + lastYangGlyphSwitchTicks = -1 } } } @@ -465,6 +467,10 @@ class SlayerFeatures { slayerNameEntity = null slayerTimerEntity = null hitMap.clear() + yangGlyph = null + yangGlyphEntity = null + lastYangGlyphSwitch = -1 + lastYangGlyphSwitchTicks = -1 } @SubscribeEvent @@ -489,7 +495,8 @@ class SlayerFeatures { fun onRenderHud(event: RenderHUDEvent) { if (!Utils.inSkyblock) return if (Skytils.config.highlightYangGlyph) { - val pos = yangGlyph.toVec3()?.addVector(0.5, 0.5, 0.5) ?: yangGlyphEntity?.positionVector ?: return + val pos = yangGlyph.toVec3()?.addVector(0.5, 0.5, 0.5) + ?: yangGlyphEntity?.run { if (this.isEntityAlive) this else null }?.positionVector ?: return val x = UResolution.scaledWidth / 2.0 val y = UResolution.scaledHeight / 2.0 val angle: Double = -(MathHelper.atan2( |