aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-24 14:52:34 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-24 14:52:34 +0200
commit34d966db485edd217fab9902995868eb4cf9d30b (patch)
tree4d93ad43076d6d989f755543d3af1df8eb07e313 /src/main/java
parentc98df746b791a34630ae48460be3af19ec5a4ba3 (diff)
downloadskyhanni-34d966db485edd217fab9902995868eb4cf9d30b.tar.gz
skyhanni-34d966db485edd217fab9902995868eb4cf9d30b.tar.bz2
skyhanni-34d966db485edd217fab9902995868eb4cf9d30b.zip
fire pit warning
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt107
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt6
5 files changed, 117 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index da0e6ca78..7bd6cd965 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -33,6 +33,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.blaze.BlazeSlayerDaggerHelper;
+import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerFirePitsWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerPillar;
import at.hannibal2.skyhanni.features.summonings.SummoningMobManager;
import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName;
@@ -135,6 +136,7 @@ public class SkyHanniMod {
registerEvent(new ThunderSparksHighlight());
registerEvent(new BlazeSlayerPillar());
registerEvent(new BlazeSlayerDaggerHelper());
+ registerEvent(new BlazeSlayerFirePitsWarning());
registerEvent(new PlayerChatFilter());
registerEvent(new HideArmor());
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 eadb19cbb..3f270b6b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
@@ -55,4 +55,11 @@ public class Slayer {
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean blazeDaggers = false;
+
+ @Expose
+ //TODO blaze slayer tier 4
+ @ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the blaze slayer tier 3")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean firePitsWarning = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt b/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt
index a95aa02b7..e691f4812 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/HideArmor.kt
@@ -131,7 +131,7 @@ class HideArmor {
val equipmentSlot = packet.equipmentSlot - 1
if (equipmentSlot == -1) return
- val entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityID)
+ val entity = Minecraft.getMinecraft().theWorld?.getEntityByID(entityID)
if (entity == null) {
laterCheck.add(entityID)
return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
new file mode 100644
index 000000000..a5b7ae229
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
@@ -0,0 +1,107 @@
+package at.hannibal2.skyhanni.features.slayer.blaze
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils
+import at.hannibal2.skyhanni.events.BossHealthChangeEvent
+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.SoundUtils
+import at.hannibal2.skyhanni.utils.SoundUtils.playSound
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.ScaledResolution
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class BlazeSlayerFirePitsWarning {
+
+ companion object {
+ private var textToRender = ""
+ private var lastFirePitsWarning = 0L
+ private var nextTickIn = 0
+
+ fun fireFirePits() {
+ lastFirePitsWarning = System.currentTimeMillis()
+ textToRender = "§cFire Pits!"
+ nextTickIn = 0
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!isEnabled()) return
+
+ val difference = System.currentTimeMillis() - lastFirePitsWarning
+
+ if (difference > 0) {
+ if (difference > 2_000) {
+ textToRender = ""
+ } else {
+ if (nextTickIn++ % 10 == 0) {
+ if (SkyHanniMod.feature.slayer.firePitsWarning) {
+ SoundUtils.createSound("random.orb", 0.8f).playSound()
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onBossHealthChange(event: BossHealthChangeEvent) {
+ if (!isEnabled()) return
+ val entityData = event.entityData
+
+ val health = event.health
+ val maxHealth = event.maxHealth
+ val lastHealth = event.lastHealth
+
+ val percentHealth = maxHealth * 0.33
+ if (health < percentHealth) {
+ if (lastHealth > percentHealth) {
+ when (entityData.bossType) {
+ BossType.SLAYER_BLAZE_3,
+ //TODO blaze slayer tier 4
+ //BossType.SLAYER_BLAZE_4,
+ -> {
+ fireFirePits()
+ }
+
+ else -> {}
+ }
+ }
+ }
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && DamageIndicatorManager.isBossSpawned(
+ BossType.SLAYER_BLAZE_3,
+ //TODO blaze slayer tier 4
+// BossType.SLAYER_BLAZE_4,
+ BossType.SLAYER_BLAZE_QUAZII_34,
+ BossType.SLAYER_BLAZE_TYPHOEUS_34,
+ )
+ }
+
+ @SubscribeEvent
+ fun renderOverlay(event: RenderGameOverlayEvent.Post) {
+ if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
+ if (!isEnabled()) return
+ if (!SkyHanniMod.feature.slayer.firePitsWarning) return
+
+ val scaledResolution = ScaledResolution(Minecraft.getMinecraft())
+ val width = scaledResolution.scaledWidth
+ val height = scaledResolution.scaledHeight
+
+ GlStateManager.enableBlend()
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
+ val renderer = Minecraft.getMinecraft().fontRendererObj
+
+ GlStateManager.pushMatrix()
+ GlStateManager.translate((width / 2).toFloat(), (height / 1.8).toFloat(), 0.0f)
+ GlStateManager.scale(4.0f, 4.0f, 4.0f)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(textToRender, renderer, 0f, 0f, false, 75, 0)
+ GlStateManager.popMatrix()
+ }
+} \ No newline at end of file
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 457a4c6af..da812bcb9 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
@@ -139,7 +139,6 @@ class BlazeSlayerPillar {
} else time % 1.0 == 0.0
if (playSound) {
-// SoundUtils.createSound("random.orb", 11.2f).playSound()
SoundUtils.createSound("random.click", 1.3f).playSound()
}
}
@@ -165,7 +164,6 @@ class BlazeSlayerPillar {
@SubscribeEvent
fun onSoundEvent(event: PlaySoundEvent) {
if (!isEnabled()) return
-
if (!SkyHanniMod.feature.slayer.firePillarBuildHider) return
when (event.soundName) {
@@ -176,8 +174,4 @@ class BlazeSlayerPillar {
}
}
}
-
- private fun isPillarWarningEntity(armorStand: EntityArmorStand) =
- armorStand.inventory.any { it != null && it.getSkullTexture() == pillarWarningTexture }
-
} \ No newline at end of file