diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-01 19:12:48 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-01 19:12:48 +0200 |
commit | 7f68a52e3dcd71edbca363e01618a694839efa4e (patch) | |
tree | dcb326b8698073ae8cbd6b1b4d6a15e407a23208 /src/main/java/at | |
parent | 6294c1e84663a92964326105c4e25bc970a29394 (diff) | |
download | skyhanni-7f68a52e3dcd71edbca363e01618a694839efa4e.tar.gz skyhanni-7f68a52e3dcd71edbca363e01618a694839efa4e.tar.bz2 skyhanni-7f68a52e3dcd71edbca363e01618a694839efa4e.zip |
fixed blaze slayer pillar hider
Diffstat (limited to 'src/main/java/at')
4 files changed, 24 insertions, 18 deletions
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 def86bc74..d33e70b69 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java @@ -83,16 +83,11 @@ public class Slayer { public Position firePillarPos = new Position(10, 10, false, true); @Expose - @ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer for the Blaze Slayer.") + @ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer and hide pillar build sound for the Blaze Slayer.") @ConfigEditorBoolean @ConfigAccordionId(id = 3) public boolean firePillarSound = false; - @Expose - @ConfigOption(name = "Hide Pillar", desc = "Hide sound and entities when building the Fire Pillar for the Blaze Slayer.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean firePillarBuildHider = false; @Expose @ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the Blaze Slayer tier 3 and 4.") 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 5455d3067..757f401a2 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 @@ -6,15 +6,17 @@ import at.hannibal2.skyhanni.events.PlayParticleEvent import at.hannibal2.skyhanni.events.SpawnParticleEvent 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 class BlazeSlayerClearView { - var tick = 0 - var hideParticles = false + private var tick = 0 + private var hideParticles = false @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { @@ -62,9 +64,16 @@ class BlazeSlayerClearView { @SubscribeEvent fun onCheckRender(event: CheckRenderEntityEvent<*>) { if (isEnabled()) { - if (event.entity is EntityFireball) { + val entity = event.entity + 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 index c5a42c15e..014cd11c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt @@ -27,8 +27,10 @@ class BlazeSlayerPillar { private var patternPillarExploded = Pattern.compile("§cYou took §r§f(.+) §r§ctrue damage from an exploding fire pillar!") private val pillarEntities = mutableListOf<EntityArmorStand>() - private val pillarWarningTexture = - "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWMyZTlkODM5NWNhY2Q5OTIyODY5YzE1MzczY2Y3Y2IxNmRhMGE1Y2U1ZjNjNjMyYjE5Y2ViMzkyOWM5YTExIn19fQ==" + companion object { + const val pillarWarningTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWMyZTlkODM5NWNhY2Q5OTIyODY5YzE1MzczY2Y3Y2IxNmRhMGE1Y2U1ZjNjNjMyYjE5Y2ViMzkyOWM5YTExIn19fQ==" + } private var lastPillarSpawnTime = -1L private var lastSoundMoment = 0.0 @@ -57,12 +59,6 @@ class BlazeSlayerPillar { if (armorStand in pillarBuildEntityList || armorStand.inventory.any { it != null && it.getSkullTexture() == pillarWarningTexture }) { if (armorStand !in pillarBuildEntityList) { pillarBuildEntityList.add(armorStand) - if (SkyHanniMod.feature.slayer.firePillarBuildHider) { - armorStand.inventory[0] = null - armorStand.inventory[1] = null - armorStand.inventory[2] = null - armorStand.inventory[3] = null - } } if (armorStand.getLorenzVec().distance(playerLocation) < 15) { list.add(armorStand) @@ -167,7 +163,7 @@ class BlazeSlayerPillar { @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { if (!isEnabled()) return - if (!SkyHanniMod.feature.slayer.firePillarBuildHider) return + if (!SkyHanniMod.feature.slayer.firePillarSound) return when (event.soundName) { "mob.chicken.plop", diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index ad96a9510..c91865dce 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import net.minecraft.client.multiplayer.WorldClient import net.minecraft.entity.EntityLiving @@ -111,4 +112,9 @@ object EntityUtils { ): MutableList<EntityBlaze> = getEntities(clazz) { entity -> entity?.getLorenzVec()?.let { it.distance(location) < radius } ?: false } + + fun EntityArmorStand.hasSkullTexture(skin: String): Boolean { + if (inventory == null) return false + return inventory.any { it != null && it.getSkullTexture() == skin } + } }
\ No newline at end of file |