diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-09-14 09:30:30 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-09-14 09:30:30 +0200 |
commit | 1e059c76d85cbe045dcd44b95f32bd3f61d83f2b (patch) | |
tree | 46da5c788a11c0e420721095aed1203c608ad71b /src/main/java | |
parent | 9617551b8a25c007a259ef342552ef5fa9f3aafc (diff) | |
download | skyhanni-1e059c76d85cbe045dcd44b95f32bd3f61d83f2b.tar.gz skyhanni-1e059c76d85cbe045dcd44b95f32bd3f61d83f2b.tar.bz2 skyhanni-1e059c76d85cbe045dcd44b95f32bd3f61d83f2b.zip |
add Hide Mob Names and Hide Damage Splash
Diffstat (limited to 'src/main/java')
6 files changed, 124 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 538da3c55..8128dfb66 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -27,6 +27,7 @@ import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityC import at.hannibal2.skyhanni.features.minion.MinionFeatures; import at.hannibal2.skyhanni.features.nether.ashfang.*; 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.summonings.SummoningMobManager; import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName; @@ -119,6 +120,8 @@ public class SkyHanniMod { registerEvent(new DungeonCopilot()); registerEvent(new EndermanSlayerBeacon()); registerEvent(new FireVeilWandParticles()); + registerEvent(new HideMobNames()); + registerEvent(new HideDamageSplash()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 6fa5b8b2d..d8b08a0ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -52,4 +52,9 @@ public class Misc { @ConfigOption(name = "Corrupted Mob Highlight", desc = "Highlight corrupted mobs in purple color") @ConfigEditorBoolean public boolean corruptedMobHighlight = false; + + @Expose + @ConfigOption(name = "Hide Damage Splash", desc = "Hide all damage splashes, from anywhere in Skyblock.") + @ConfigEditorBoolean + public boolean hideDamageSplash = false; }
\ No newline at end of file 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 cac13b109..e401b463f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java @@ -15,4 +15,9 @@ public class Slayer { @ConfigOption(name = "Slayer Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)") @ConfigEditorBoolean public boolean slayerEndermanBeacon = false; + + @Expose + @ConfigOption(name = "Hide Mob Names", desc = "Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.") + @ConfigEditorBoolean + public boolean hideMobNames = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt new file mode 100644 index 000000000..23146f5f6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/HideDamageSplash.kt @@ -0,0 +1,22 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.EntityLivingBase +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class HideDamageSplash { + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderDamage(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.misc.hideDamageSplash) return + + if (DamageIndicatorManager.isDamageSplash(event.entity)) { + event.isCanceled = true + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt index 62d28d3cb..101e2dd08 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.entity.EntityLivingBase import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -11,6 +12,7 @@ class DungeonBossHideDamageSplash { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { + if (!LorenzUtils.inDungeons) return if (!SkyHanniMod.feature.dungeon.damageSplashBoss) return if (!DungeonData.inBossRoom) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt new file mode 100644 index 000000000..383419cda --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt @@ -0,0 +1,87 @@ +package at.hannibal2.skyhanni.features.slayer + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.EntityLivingBase +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class HideMobNames { + + private val lastMobName = mutableMapOf<EntityArmorStand, String>() + private val mobNamesHidden = mutableListOf<EntityArmorStand>() + private val patterns = mutableListOf<Pattern>() + + init { + addMobToHide("Zombie") + addMobToHide("Zombie") + addMobToHide("Zombie Villager") + addMobToHide("Crypt Ghoul") + + addMobToHide("Dasher Spider") + addMobToHide("Weaver Spider") + addMobToHide("Splitter Spider") + addMobToHide("Voracious Spider") + addMobToHide("Silverfish") + + addMobToHide("Wolf") + addMobToHide("§bHowling Spirit") + addMobToHide("§bPack Spirit") + + addMobToHide("Enderman") + addMobToHide("Voidling Fanatic") + + addMobToHide("Blaze") // 1.2m + addMobToHide("Mutated Blaze") // 1.5m + addMobToHide("Bezal") // 2m + addMobToHide("Smoldering Blaze") // 5.5m + } + + private fun addMobToHide(bossName: String) { + patterns.add(Pattern.compile("§8\\[§7Lv(\\d+)§8] §c$bossName§r §[ae](.+)§f/§a(.+)§c❤")) + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.slayer.hideMobNames) return + + val entity = event.entity + if (entity !is EntityArmorStand) return + if (!entity.hasCustomName()) return + + val name = entity.name + if (lastMobName.getOrDefault(entity, "abc") == name) { + if (entity in mobNamesHidden) { + event.isCanceled = true + } + return + } + + lastMobName[entity] = name + mobNamesHidden.remove(entity) + + if (shouldNameBeHidden(name)) { + event.isCanceled = true + mobNamesHidden.add(entity) + } + } + + private fun shouldNameBeHidden(name: String): Boolean { + for (pattern in patterns) { + val matcher = pattern.matcher(name) + if (matcher.matches()) { + val min = matcher.group(2) + val max = matcher.group(3) + if (min == max || min == "0") { + return true + } + } + } + + return false + } +}
\ No newline at end of file |