From 41b0af964703aeb0d85117d71a8fb677d9b0f8b8 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 8 Feb 2023 10:43:18 +0100 Subject: Removed blaze pillar features. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 - .../features/slayer/blaze/BlazeSlayerClearView.kt | 8 - .../features/slayer/blaze/BlazeSlayerPillar.kt | 182 --------------------- 3 files changed, 191 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 1b93a00ad..714e5b5de 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -155,7 +155,6 @@ public class SkyHanniMod { loadModule(new HideMobNames()); loadModule(new HideDamageSplash()); loadModule(new ThunderSparksHighlight()); - loadModule(new BlazeSlayerPillar()); loadModule(new BlazeSlayerDaggerHelper()); loadModule(new HellionShieldHelper()); loadModule(new BlazeSlayerFirePitsWarning()); 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() - - companion object { - const val pillarWarningTexture = - "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWMyZTlkODM5NWNhY2Q5OTIyODY5YzE1MzczY2Y3Y2IxNmRhMGE1Y2U1ZjNjNjMyYjE5Y2ViMzkyOWM5YTExIn19fQ==" - } - - private var lastPillarSpawnTime = -1L - private var lastSoundMoment = 0.0 - private var lastPillarBuildEntitiesFound = 0L - private var pillarBuildEntityList = mutableListOf() - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return - - val list = mutableListOf() - val playerLocation = LocationUtils.playerLocation() - for (armorStand in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance()) { - 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 -- cgit