diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt | 25 |
1 files changed, 15 insertions, 10 deletions
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 index 28ff6f7df..b5aff0bf4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsWith import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityBlaze @@ -25,9 +26,9 @@ class AshfangBlazes { private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang private val blazeColor = mutableMapOf<EntityBlaze, LorenzColor>() - private val blazeArmorStand = mutableMapOf<EntityBlaze, EntityArmorStand>() + private var blazeArmorStand = mapOf<EntityBlaze, EntityArmorStand>() - var nearAshfang = false + private var nearAshfang = false @SubscribeEvent fun onTick(event: LorenzTickEvent) { @@ -43,19 +44,21 @@ class AshfangBlazes { val list = entity.getAllNameTagsWith(2, "Ashfang") if (list.size == 1) { val armorStand = list[0] - blazeArmorStand[entity] = armorStand val color = when { armorStand.name.contains("Ashfang Follower") -> LorenzColor.DARK_GRAY armorStand.name.contains("Ashfang Underling") -> LorenzColor.RED armorStand.name.contains("Ashfang Acolyte") -> LorenzColor.BLUE else -> { - blazeArmorStand.remove(entity) - null + blazeArmorStand = blazeArmorStand.editCopy { + remove(entity) + } + continue } } - color?.let { - blazeColor[entity] = it + blazeArmorStand = blazeArmorStand.editCopy { + this[entity] = armorStand } + blazeColor[entity] = color } } } @@ -69,7 +72,9 @@ class AshfangBlazes { if (entityId !in blazeArmorStand.keys.map { it.entityId }) return if (event.health % 10_000_000 != 0) { - blazeArmorStand.keys.removeIf { it.entityId == entityId } + blazeArmorStand = blazeArmorStand.editCopy { + keys.removeIf { it.entityId == entityId } + } } } @@ -112,7 +117,7 @@ class AshfangBlazes { @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { blazeColor.clear() - blazeArmorStand.clear() + blazeArmorStand = emptyMap() } @SubscribeEvent @@ -125,4 +130,4 @@ class AshfangBlazes { private fun isEnabled(): Boolean { return LorenzUtils.inSkyBlock && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } -}
\ No newline at end of file +} |