aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-04 22:21:53 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-04 22:21:53 +0200
commit22f7ac624784bc70721022699bc430bcca2f6357 (patch)
tree37ea1a2044c6bfe14a5c441af4ca5de4a33fbfe3 /src
parentf49841740f624b2c50b47f61026d50df8644689e (diff)
downloadskyhanni-22f7ac624784bc70721022699bc430bcca2f6357.tar.gz
skyhanni-22f7ac624784bc70721022699bc430bcca2f6357.tar.bz2
skyhanni-22f7ac624784bc70721022699bc430bcca2f6357.zip
added option to hide all the particles around the ashfang boss & Added option to hide the name of full health blazes around ashfang
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt126
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlightBlazes.kt84
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt5
10 files changed, 185 insertions, 91 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 4407eb7f8..fdcefcea9 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -88,7 +88,8 @@ public class SkyHanniMod {
registerEvent(new SummoningSoulsName());
registerEvent(new AshfangGravityOrbs());
registerEvent(new AshfangBlazingSouls());
- registerEvent(new AshfangHighlightBlazes());
+ registerEvent(new AshfangBlazes());
+ registerEvent(new AshfangHideParticles());
registerEvent(new ItemStars());
registerEvent(new MinionFeatures());
registerEvent(new RealTime());
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java b/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java
index cbed42513..92d3b3bf4 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java
@@ -59,4 +59,14 @@ public class Ashfang {
@ConfigOption(name = "Ashfang Highlight Blazes", desc = "Highlight the different blazes in their respected color")
@ConfigEditorBoolean
public boolean highlightBlazes = false;
+
+ @Expose
+ @ConfigOption(name = "Ashfang Hide Particles", desc = "Hide all the particles around the ashfang boss")
+ @ConfigEditorBoolean
+ public boolean hideParticles = false;
+
+ @Expose
+ @ConfigOption(name = "Ashfang Hide Names", desc = "Hide the name of full health blazes around ashfang (only useful when highlight blazes is enabled)")
+ @ConfigEditorBoolean
+ public boolean hideNames = 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 e1a12c7af..de53ecfb2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -34,13 +34,17 @@ import kotlin.math.max
class DamageIndicatorManager {
- var data = mutableMapOf<UUID, EntityData>()
private var mobFinder: MobFinder? = null
private val decimalFormat = DecimalFormat("0.0")
private val maxHealth = mutableMapOf<UUID, Int>()
companion object {
+ private var data = mutableMapOf<UUID, EntityData>()
val damagePattern: Pattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)")
+
+ fun isBossSpawned(type: BossType): Boolean {
+ return data.entries.find { it.value.bossType == type } != null
+ }
}
@SubscribeEvent
@@ -476,7 +480,6 @@ class DamageIndicatorManager {
270_000 / 2, 270_000 -> 1
0 -> 0
else -> {
- LorenzTest.enabled = true
LorenzTest.text = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
LorenzUtils.error("Unexpected health of thorn in m4! (${
LorenzUtils.formatDouble(LorenzUtils.formatDouble(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt
new file mode 100644
index 000000000..bd0a72e7e
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt
@@ -0,0 +1,126 @@
+package at.hannibal2.skyhanni.features.nether.ashfang
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.RenderMobColoredEvent
+import at.hannibal2.skyhanni.events.ResetEntityHurtTimeEvent
+import at.hannibal2.skyhanni.events.withAlpha
+import at.hannibal2.skyhanni.features.damageindicator.BossType
+import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
+import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsWith
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.entity.EntityLivingBase
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.entity.monster.EntityBlaze
+import net.minecraft.network.play.server.S1CPacketEntityMetadata
+import net.minecraftforge.client.event.RenderLivingEvent
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class AshfangBlazes {
+
+ private val blazeColor = mutableMapOf<EntityBlaze, LorenzColor>()
+ private val blazeArmorStand = mutableMapOf<EntityBlaze, EntityArmorStand>()
+
+ var nearAshfang = false
+ var tick = 0
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!isEnabled()) return
+
+ if (tick++ % 20 == 0) {
+ checkNearAshfang()
+ }
+
+ if (nearAshfang) {
+ for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityBlaze>()
+ .filter { it !in blazeColor.keys }) {
+ val list = entity.getAllNameTagsWith(2, "Ashfang")
+ if (list.size == 1) {
+ val armorStand = list[0]
+ blazeArmorStand[entity] = armorStand
+ if (armorStand.name.contains("Ashfang Follower")) {
+ blazeColor[entity] = LorenzColor.DARK_GRAY
+ } else if (armorStand.name.contains("Ashfang Underling")) {
+ blazeColor[entity] = LorenzColor.RED
+ } else if (armorStand.name.contains("Ashfang Acolyte")) {
+ blazeColor[entity] = LorenzColor.BLUE
+ } else {
+ blazeArmorStand.remove(entity)
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onHealthUpdatePacket(event: PacketEvent.ReceiveEvent) {
+ if (!isEnabled()) return
+
+ val packet = event.packet
+ if (packet !is S1CPacketEntityMetadata) return
+ if (packet.entityId !in blazeArmorStand.keys.map { it.entityId }) return
+
+ for (watchableObject in packet.func_149376_c()) {
+ if (watchableObject.dataValueId == 6) {
+ val health = watchableObject.`object` as Float
+ if (health % 10_000_000 != 0F) {
+ blazeArmorStand.keys.removeIf { it.entityId == packet.entityId }
+ }
+ }
+ }
+ }
+
+ private fun checkNearAshfang() {
+ nearAshfang = Minecraft.getMinecraft().theWorld.loadedEntityList
+ .any { it is EntityArmorStand && it.name.contains("Ashfang") }
+ }
+
+ @SubscribeEvent
+ fun onRenderMobColored(event: RenderMobColoredEvent) {
+ if (!isEnabled()) return
+ if (!SkyHanniMod.feature.ashfang.highlightBlazes) return
+ val entity = event.entity
+ event.color = blazeColor[entity]?.toColor()?.withAlpha(40) ?: 0
+ }
+
+ @SubscribeEvent
+ fun onResetEntityHurtTime(event: ResetEntityHurtTimeEvent) {
+ if (!isEnabled()) return
+ if (!SkyHanniMod.feature.ashfang.highlightBlazes) return
+ val entity = event.entity
+ if (entity in blazeColor) {
+ event.shouldReset = true
+ }
+
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
+ if (!isEnabled()) return
+ if (!SkyHanniMod.feature.ashfang.hideNames) return
+
+ val entity = event.entity
+ if (entity !is EntityArmorStand) return
+ if (!entity.hasCustomName()) return
+ if (entity.isDead) return
+ if (entity in blazeArmorStand.values) {
+ event.isCanceled = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: WorldEvent.Load) {
+ blazeColor.clear()
+ blazeArmorStand.clear()
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt
index 1ca713afe..c31733715 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazingSouls.kt
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.features.damageindicator.BossType
+import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.LocationUtils
@@ -58,6 +60,7 @@ class AshfangBlazingSouls {
}
private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.blazingSouls
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.blazingSouls &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt
index 20a6c7bd5..8d12b4668 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt
@@ -2,6 +2,8 @@ package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
+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.LorenzUtils.matchRegex
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
@@ -38,6 +40,7 @@ class AshfangFreezeCooldown {
}
private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.freezeCooldown
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.freezeCooldown &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt
index 635d5fe88..f9ca75f59 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangGravityOrbs.kt
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.features.damageindicator.BossType
+import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.LocationUtils
@@ -59,6 +61,7 @@ class AshfangGravityOrbs {
}
private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.gravityOrbs
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.gravityOrbs &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
new file mode 100644
index 000000000..07dc6d305
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
@@ -0,0 +1,26 @@
+package at.hannibal2.skyhanni.features.nether.ashfang
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.features.damageindicator.BossType
+import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.network.play.server.S2APacketParticles
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class AshfangHideParticles {
+
+ @SubscribeEvent
+ fun onReceivePacket(event: PacketEvent.ReceiveEvent) {
+ if (event.packet !is S2APacketParticles) return
+
+ if (isEnabled()) {
+ event.isCanceled = true
+ }
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlightBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlightBlazes.kt
deleted file mode 100644
index eaac1a5e1..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHighlightBlazes.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-package at.hannibal2.skyhanni.features.nether.ashfang
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.RenderMobColoredEvent
-import at.hannibal2.skyhanni.events.ResetEntityHurtTimeEvent
-import at.hannibal2.skyhanni.events.withAlpha
-import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsWith
-import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.item.EntityArmorStand
-import net.minecraft.entity.monster.EntityBlaze
-import net.minecraftforge.event.world.WorldEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-
-class AshfangHighlightBlazes {
-
- private val blazes = mutableMapOf<EntityBlaze, LorenzColor>()
-
- var nearAshfang = false
- var tick = 0
-
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (!isEnabled()) return
-
- if (tick++ % 20 == 0) {
- checkNearAshfang()
- } else {
- return
- }
-
- if (nearAshfang) {
- for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityBlaze>()
- .filter { it !in blazes.keys }) {
- val list = entity.getAllNameTagsWith(2, "Ashfang")
- if (list.size == 1) {
- val armorStand = list[0]
- if (armorStand.name.contains("Ashfang Follower")) {
- blazes[entity] = LorenzColor.DARK_GRAY
- } else if (armorStand.name.contains("Ashfang Underling")) {
- blazes[entity] = LorenzColor.RED
- } else if (armorStand.name.contains("Ashfang Acolyte")) {
- blazes[entity] = LorenzColor.BLUE
- }
- } else if (list.size > 1) {
- println("found " + list.size + " name tags")
- }
- }
- }
-
- }
-
- private fun checkNearAshfang() {
- nearAshfang = Minecraft.getMinecraft().theWorld.loadedEntityList
- .any { it is EntityArmorStand && it.name.contains("Ashfang") }
- }
-
- @SubscribeEvent
- fun onRenderMobColored(event: RenderMobColoredEvent) {
- if (!isEnabled()) return
- val entity = event.entity
- event.color = blazes[entity]?.toColor()?.withAlpha(40) ?: 0
- }
-
- @SubscribeEvent
- fun onResetEntityHurtTime(event: ResetEntityHurtTimeEvent) {
- if (!isEnabled()) return
- val entity = event.entity
- if (entity in blazes) {
- event.shouldReset = true
- }
- }
-
- @SubscribeEvent
- fun onWorldChange(event: WorldEvent.Load) {
- blazes.clear()
- }
-
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.highlightBlazes
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
index 0e10334b8..69aac5777 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
+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.RenderUtils.renderString
import net.minecraft.client.Minecraft
@@ -48,6 +50,7 @@ class AshfangNextResetCooldown {
}
private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.nextResetCooldown
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.nextResetCooldown &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
}
} \ No newline at end of file