diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
4 files changed, 105 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index dbfd8e336..9c608e81a 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -30,10 +30,7 @@ import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; import at.hannibal2.skyhanni.features.slayer.HideMobNames; import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniboss; import at.hannibal2.skyhanni.features.slayer.SlayerQuestWarning; -import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper; -import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerFirePitsWarning; -import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerPillar; -import at.hannibal2.skyhanni.features.slayer.blaze.HellionShieldHelper; +import at.hannibal2.skyhanni.features.slayer.blaze.*; import at.hannibal2.skyhanni.features.summonings.SummoningMobManager; import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName; import at.hannibal2.skyhanni.test.LorenzTest; @@ -149,6 +146,7 @@ public class SkyHanniMod { registerEvent(new BlazeSlayerDaggerHelper()); registerEvent(new HellionShieldHelper()); registerEvent(new BlazeSlayerFirePitsWarning()); + registerEvent(new BlazeSlayerClearView()); registerEvent(new PlayerChatFilter()); registerEvent(new HideArmor()); registerEvent(new SlayerQuestWarning()); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java index 4c31648a3..544493750 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java @@ -101,6 +101,12 @@ public class Slayer { public boolean blazePhaseDisplay = false; @Expose + @ConfigOption(name = "Clear View", desc = "Hide particles and fireballs near blaze slayer bosses and demons.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean blazeClearView = false; + + @Expose @ConfigOption(name = "Miniboss Highlight", desc = "Highlight slayer miniboss in blue color") @ConfigEditorBoolean public boolean slayerMinibossHighlight = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index d8daab906..7b8809df1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -66,6 +66,10 @@ class DamageIndicatorManager { fun isBossSpawned(vararg types: BossType): Boolean { return types.any { isBossSpawned(it) } } + + fun getBosses(): Collection<EntityData> { + return data.values + } } @SubscribeEvent 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 new file mode 100644 index 000000000..c2036984b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -0,0 +1,93 @@ +package at.hannibal2.skyhanni.features.slayer.blaze + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.events.PlayParticleEvent +import at.hannibal2.skyhanni.features.damageindicator.BossType +import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.projectile.EntityFireball +import net.minecraft.util.EnumParticleTypes +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class BlazeSlayerClearView { + + private val hiddenFireBalls = mutableListOf<EntityFireball>() + + @SubscribeEvent + fun onChatPacket(event: PlayParticleEvent) { + if (!isEnabled()) return + + when (event.type) { + EnumParticleTypes.SPELL_MOB, + EnumParticleTypes.REDSTONE, + EnumParticleTypes.FLAME, + -> { + } + + else -> return + } + + val bossLocations = DamageIndicatorManager.getBosses() + .filter { isBlazeBoss(it.bossType) } + .map { it.entity.getLorenzVec() } + val location = event.location + if (bossLocations.any { it.distance(location) < 3 }) { + event.isCanceled = true + } + } + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!isEnabled()) return + + val entity = event.entity + if (entity !is EntityFireball) return + + if (entity in hiddenFireBalls) { + event.isCanceled = true + return + } + + val bossLocations = DamageIndicatorManager.getBosses() + .filter { isBlazeBoss(it.bossType) } + .map { it.entity.getLorenzVec() } + + val location = entity.getLorenzVec() + if (bossLocations.any { it.distance(location) < 5 }) { + hiddenFireBalls.add(entity) + event.isCanceled = true + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.blazeClearView + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + hiddenFireBalls.clear() + } + + private fun isBlazeBoss(type: BossType): Boolean { + return when (type) { + BossType.SLAYER_BLAZE_1, + BossType.SLAYER_BLAZE_2, + BossType.SLAYER_BLAZE_3, + BossType.SLAYER_BLAZE_4, + BossType.SLAYER_BLAZE_TYPHOEUS_1, + BossType.SLAYER_BLAZE_TYPHOEUS_2, + BossType.SLAYER_BLAZE_TYPHOEUS_3, + BossType.SLAYER_BLAZE_TYPHOEUS_4, + BossType.SLAYER_BLAZE_QUAZII_1, + BossType.SLAYER_BLAZE_QUAZII_2, + BossType.SLAYER_BLAZE_QUAZII_3, + BossType.SLAYER_BLAZE_QUAZII_4, + -> true + + else -> false + } + } +}
\ No newline at end of file |