aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt182
2 files changed, 0 insertions, 190 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
index 9c220bea9..289377c83 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
@@ -5,9 +5,7 @@ import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
-import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.projectile.EntityFireball
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -52,12 +50,6 @@ class BlazeSlayerClearView {
if (entity is EntityFireball) {
event.isCanceled = true
}
-
- if (entity is EntityArmorStand) {
- if (entity.hasSkullTexture(BlazeSlayerPillar.pillarWarningTexture)) {
- event.isCanceled = true
- }
- }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt
deleted file mode 100644
index bb01e6ddc..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt
+++ /dev/null
@@ -1,182 +0,0 @@
-package at.hannibal2.skyhanni.features.slayer.blaze
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.data.SendTitleHelper
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.PlaySoundEvent
-import at.hannibal2.skyhanni.features.damageindicator.BossType
-import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
-import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
-import at.hannibal2.skyhanni.utils.LocationUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.SoundUtils
-import at.hannibal2.skyhanni.utils.SoundUtils.playSound
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
-import at.hannibal2.skyhanni.utils.getLorenzVec
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.item.EntityArmorStand
-import net.minecraftforge.client.event.RenderGameOverlayEvent
-import net.minecraftforge.event.world.WorldEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.text.DecimalFormat
-import java.util.regex.Pattern
-import kotlin.math.roundToInt
-
-class BlazeSlayerPillar {
- private var patternPillarExploded =
- Pattern.compile("§cYou took §r§f(.+) §r§ctrue damage from an exploding fire pillar!")
- private val pillarEntities = mutableListOf<EntityArmorStand>()
-
- companion object {
- const val pillarWarningTexture =
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWMyZTlkODM5NWNhY2Q5OTIyODY5YzE1MzczY2Y3Y2IxNmRhMGE1Y2U1ZjNjNjMyYjE5Y2ViMzkyOWM5YTExIn19fQ=="
- }
-
- private var lastPillarSpawnTime = -1L
- private var lastSoundMoment = 0.0
- private var lastPillarBuildEntitiesFound = 0L
- private var pillarBuildEntityList = mutableListOf<EntityArmorStand>()
-
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (!isEnabled()) return
-
- val list = mutableListOf<EntityArmorStand>()
- val playerLocation = LocationUtils.playerLocation()
- for (armorStand in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>()) {
- val name = armorStand.name
- if (name.matchRegex("§6§l.s §c§l8 hits")) {
- if (armorStand !in pillarEntities) {
- pillarEntities.add(armorStand)
-
- val lastPillarEntities = System.currentTimeMillis() - lastPillarBuildEntitiesFound
- if (lastPillarEntities in 2500..4500) {
- lastPillarSpawnTime = System.currentTimeMillis()
- }
- }
- }
-
- if (armorStand in pillarBuildEntityList || armorStand.hasSkullTexture(pillarWarningTexture)) {
- if (armorStand !in pillarBuildEntityList) {
- pillarBuildEntityList.add(armorStand)
- }
- if (armorStand.getLorenzVec().distance(playerLocation) < 15) {
- list.add(armorStand)
- }
- }
- }
- val size = list.size
- if (size == 0) return
- if (size % 12 == 0) {
- if (System.currentTimeMillis() > lastPillarBuildEntitiesFound + 10_000) {
- lastPillarBuildEntitiesFound = System.currentTimeMillis()
- }
- }
- }
-
- @SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- if (!isEnabled()) return
-
- val message = event.message
- val matcher = patternPillarExploded.matcher(message)
- if (matcher.matches()) {
- lastPillarSpawnTime = -1L
- SoundUtils.createSound("note.pling", 0.7f).playSound()
- SendTitleHelper.sendTitle("§cBlaze Pillar: §aExploded!", 500)
- }
-
- when (message) {
- " §r§a§lSLAYER QUEST COMPLETE!",
- " §r§c§lSLAYER QUEST FAILED!",
- "§eYour Slayer boss was despawned, but you have kept your quest progress!",
- -> lastPillarSpawnTime = -1L
- }
- }
-
- @SubscribeEvent
- fun onRenderOverlay(event: RenderGameOverlayEvent.Post) {
- if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
- if (!isEnabled()) return
- if (lastPillarSpawnTime == -1L) return
-
- val duration = System.currentTimeMillis() - lastPillarSpawnTime
- val maxDuration = 7_000
- val remainingLong = maxDuration - duration
- val remaining = (remainingLong.toFloat() / 1000)
- if (SkyHanniMod.feature.slayer.firePillarSound) {
- playSound(remaining)
- }
-
- if (SkyHanniMod.feature.slayer.firePillarDisplay) {
- if (remaining > -0.5) {
- val format = DecimalFormat("0.0").format(remaining + 0.1)
- SendTitleHelper.sendTitle("§cBlaze Pillar: §a${format}s", 200)
- }
- }
- }
-
- private fun playSound(remaining: Float) {
- val time = (remaining * 10).roundToInt().toDouble() / 10
- if (time == lastSoundMoment) return
- lastSoundMoment = time
-
- val playSound = if (time < 0) {
- false
- } else if (time <= 0.7) {
- true
- } else if (time <= 2.1) {
- when (time) {
- 0.9,
- 1.2,
- 1.5,
- 1.8,
- 2.1,
- -> true
-
- else -> false
- }
- } else if (time <= 4 && time % 0.5 == 0.0) {
- true
- } else time % 1.0 == 0.0
-
- if (playSound) {
- SoundUtils.createSound("random.click", 1.3f).playSound()
- }
- }
-
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyBlock && DamageIndicatorManager.isBossSpawned(
- BossType.SLAYER_BLAZE_2,
- BossType.SLAYER_BLAZE_3,
- BossType.SLAYER_BLAZE_4,
- BossType.SLAYER_BLAZE_QUAZII_2,
- BossType.SLAYER_BLAZE_QUAZII_3,
- BossType.SLAYER_BLAZE_QUAZII_4,
- BossType.SLAYER_BLAZE_TYPHOEUS_2,
- BossType.SLAYER_BLAZE_TYPHOEUS_3,
- BossType.SLAYER_BLAZE_TYPHOEUS_4,
- )
- }
-
- @SubscribeEvent
- fun onWorldChange(event: WorldEvent.Load) {
- pillarEntities.clear()
- lastPillarSpawnTime = -1
- }
-
- @SubscribeEvent
- fun onPlaySound(event: PlaySoundEvent) {
- if (!isEnabled()) return
- if (!SkyHanniMod.feature.slayer.firePillarSound) return
-
- when (event.soundName) {
- "mob.chicken.plop",
- "mob.bat.takeoff",
- -> {
- event.isCanceled = true
- }
- }
- }
-} \ No newline at end of file