diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-23 17:31:10 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-23 17:31:10 +0200 |
commit | 3736fb833f7609b833d960d50f037208b2dcee6e (patch) | |
tree | 5a0febc0b8b03bbed28a170d5381e055571e7840 /src | |
parent | e49183a248f1a007b924d76909274081f2d0fce2 (diff) | |
download | skyhanni-3736fb833f7609b833d960d50f037208b2dcee6e.tar.gz skyhanni-3736fb833f7609b833d960d50f037208b2dcee6e.tar.bz2 skyhanni-3736fb833f7609b833d960d50f037208b2dcee6e.zip |
blaze slayer features
Diffstat (limited to 'src')
14 files changed, 380 insertions, 28 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index fdd3ca81f..05dc52499 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -32,6 +32,8 @@ 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.slayer.blaze.BlazeSlayerPillarTimer; +import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerWeaponHelper; import at.hannibal2.skyhanni.features.summonings.SummoningMobManager; import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName; import at.hannibal2.skyhanni.test.LorenzTest; @@ -131,6 +133,8 @@ public class SkyHanniMod { registerEvent(new HideMobNames()); registerEvent(new HideDamageSplash()); registerEvent(new ThunderSparksHighlight()); + registerEvent(new BlazeSlayerPillarTimer()); + registerEvent(new BlazeSlayerWeaponHelper()); registerEvent(new PlayerChatFilter()); registerEvent(new HideArmor()); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 9fad399ec..85c01417f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -63,6 +63,11 @@ public class Features extends Config { return; } + if (runnableId.equals("firePillars")) { + editOverlay(activeConfigCategory, 200, 16, slayer.firePillarsPos); + return; + } + if (runnableId.equals("ashfangResetCooldown")) { editOverlay(activeConfigCategory, 200, 16, ashfang.nextResetCooldownPos); return; 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 e401b463f..9ad0a8047 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.config.features; -import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorBoolean; -import at.hannibal2.skyhanni.config.core.config.annotations.ConfigOption; +import at.hannibal2.skyhanni.config.core.config.Position; +import at.hannibal2.skyhanni.config.core.config.annotations.*; import com.google.gson.annotations.Expose; public class Slayer { @@ -20,4 +20,27 @@ public class Slayer { @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; + + @Expose + @ConfigOption(name = "Blaze", desc = "") + @ConfigEditorAccordion(id = 0) + public boolean damageSplash = false; + + @Expose + @ConfigOption(name = "Fire Pillars", desc = "Cooldown when the Fire Pillars from the blaze slayer will kill you.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean firePillars = false; + + @Expose + @ConfigOption(name = "Fire Pillars Position", desc = "") + @ConfigEditorButton(runnableId = "firePillars", buttonText = "Edit") + @ConfigAccordionId(id = 0) + public Position firePillarsPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the blaze slayer daggers") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean blazeDaggers = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index 1e07a6eaa..26e08356b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -35,7 +35,7 @@ class EntityMovementData { val distance = newLocation.distance(oldLocation) if (distance > 0.01) { entityLocation[entity] = newLocation - EntityMoveEvent(entity).postAndCatch() + EntityMoveEvent(entity, oldLocation, newLocation).postAndCatch() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/BossHealthChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/BossHealthChangeEvent.kt new file mode 100644 index 000000000..71cce7c7a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/BossHealthChangeEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events + +import at.hannibal2.skyhanni.features.damageindicator.EntityData + +class BossHealthChangeEvent(val entityData: EntityData, val lastHealth: Long, val health: Long, val maxHealth: Long): LorenzEvent()
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt index fdb50bfb0..405938195 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.entity.Entity -class EntityMoveEvent(val entity: Entity) : LorenzEvent()
\ No newline at end of file +class EntityMoveEvent(val entity: Entity, val oldLocation: LorenzVec, val newLocation: LorenzVec) : LorenzEvent()
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 3d9835910..111f34b71 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -172,6 +172,10 @@ class ChatFilter { if (message.matchRegex("§d§lCRAZY RARE DROP! §r§7\\(§r§f§r§fPocket Espresso Machine§r§7\\) (.*)")) return true if (message.matchRegex("§5§lVERY RARE DROP! §r§7\\(§r§f§r§5◆ End Rune I§r§7\\) (.*)")) return true + //Blaze + if (message.matchRegex("§9§lVERY RARE DROP! §r§7\\(§r§f§r§fWisp's Ice-Flavored Water I Splash Potion§r§7\\) (.*)")) return true + if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§5Bundle of Magma Arrows§r§7\\) (.*)")) return true + return false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt index a013bcc63..2a9088068 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt @@ -37,6 +37,20 @@ enum class BossType(val fullName: String, val bossTypeToggle: Int, val shortName SLAYER_ENDERMAN_4("§4Voidgloom Seraph 4", 8, "§4Void 4"), SLAYER_BLAZE_1("§aInferno Demonlord 1", 9, "§aInferno 1"), + SLAYER_BLAZE_2("§aInferno Demonlord 2", 9, "§aInferno 2"), + SLAYER_BLAZE_3("§aInferno Demonlord 3", 9, "§aInferno 3"), + SLAYER_BLAZE_4("§aInferno Demonlord 4", 9, "§aInferno 4"), + + SLAYER_BLAZE_TYPHOEUS_1("§aInferno Typhoeus 1", 9, "§aTyphoeus 1"), + SLAYER_BLAZE_TYPHOEUS_2("§eInferno Typhoeus 2", 9, "§eTyphoeus 2"), + SLAYER_BLAZE_TYPHOEUS_3("§cInferno Typhoeus 3", 9, "§cTyphoeus 3"), + SLAYER_BLAZE_TYPHOEUS_4("§4Inferno Typhoeus 4", 9, "§4Typhoeus 4"), + + SLAYER_BLAZE_QUAZII_1("§aInferno Quazii 1", 9, "§aQuazii 1"), + SLAYER_BLAZE_QUAZII_2("§eInferno Quazii 2", 9, "§eQuazii 2"), + SLAYER_BLAZE_QUAZII_3("§cInferno Quazii 3", 9, "§cQuazii 3"), + SLAYER_BLAZE_QUAZII_4("§4Inferno Quazii 4", 9, "§4Quazii 4"), + HUB_HEADLESS_HORSEMAN("§6Headless Horseman", 10), 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 328ab2bbe..4a93f2647 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -2,9 +2,11 @@ package at.hannibal2.skyhanni.features.damageindicator import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.events.BossHealthChangeEvent import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.dungeon.DungeonData +import at.hannibal2.skyhanni.features.slayer.blaze.SwordMode import at.hannibal2.skyhanni.test.LorenzTest import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith @@ -14,6 +16,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager +import net.minecraft.entity.EntityLiving import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityEnderman @@ -58,6 +61,10 @@ class DamageIndicatorManager { fun isBossSpawned(type: BossType): Boolean { return data.entries.find { it.value.bossType == type } != null } + + fun isBossSpawned(vararg types: BossType): Boolean { + return types.any { isBossSpawned(it) } + } } @SubscribeEvent @@ -253,6 +260,7 @@ class DamageIndicatorManager { val bossType = entityData.bossType checkDamage(entityData, health, lastHealth, bossType) tickDamage(entityData.damageCounter) + BossHealthChangeEvent(entityData, lastHealth, health, maxHealth).postAndCatch() } entityData.lastHealth = health @@ -287,6 +295,19 @@ class DamageIndicatorManager { return checkEnderSlayer(entity as EntityEnderman, entityData, health.toInt(), maxHealth.toInt()) } + BossType.SLAYER_BLAZE_2, + BossType.SLAYER_BLAZE_3, + BossType.SLAYER_BLAZE_4, + BossType.SLAYER_BLAZE_QUAZII_2, + BossType.SLAYER_BLAZE_QUAZII_3, + BossType.SLAYER_BLAZE_QUAZII_4, + BossType.SLAYER_BLAZE_TYPHOEUS_2, + BossType.SLAYER_BLAZE_TYPHOEUS_3, + BossType.SLAYER_BLAZE_TYPHOEUS_4, + -> { + return checkBlazeSlayer(entity as EntityLiving, entityData) + } + BossType.NETHER_MAGMA_BOSS -> { return checkMagmaCube(entity as EntityMagmaCube, entityData, health.toInt(), maxHealth.toInt()) } @@ -321,6 +342,17 @@ class DamageIndicatorManager { return "" } + private fun checkBlazeSlayer(entity: EntityLiving, entityData: EntityData): String { + for (swordMode in SwordMode.values()) { + if (entity.hasNameTagWith(3, swordMode.name)) { + entityData.namePrefix = swordMode.formattedName + " " + return "" + } + } + + return "" + } + private fun checkMagmaCube( entity: EntityMagmaCube, entityData: EntityData, diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index 43c0e4552..f5cceab8e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.damageindicator import at.hannibal2.skyhanni.features.dungeon.DungeonData +1import at.hannibal2.skyhanni.utils.EntityUtils.hasBossHealth import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith import at.hannibal2.skyhanni.utils.LorenzUtils @@ -267,23 +268,37 @@ class MobFinder { } } } - if (entity is EntityBlaze) { - if (entity.hasNameTagWith(2, "§c☠ §bInferno Demonlord ")) { - when { - entity.hasMaxHealth(2_500_000) -> { - return EntityResult(bossType = BossType.SLAYER_BLAZE_1) - } - } + if (entity is EntityBlaze && entity.hasNameTagWith(2, "§c☠ §bInferno Demonlord ")) { + when { + entity.hasBossHealth(2_500_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_1) + entity.hasBossHealth(10_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_2) + entity.hasBossHealth(45_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_3) + entity.hasBossHealth(150_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_4) } } - if (entity is EntitySpider) { - if (entity.hasNameTagWith(1, "§5☠ §4Tarantula Broodfather ")) { - when { - entity.hasMaxHealth(740) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_1) - entity.hasMaxHealth(30_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_2) - entity.hasMaxHealth(900_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_3) - entity.hasMaxHealth(2_400_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_4) - } + if (entity is EntityPigZombie && entity.hasNameTagWith(2, "§c☠ §6ⓉⓎⓅⒽⓄⒺⓊⓈ ")) { + when { + entity.hasBossHealth(500_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_TYPHOEUS_1) + entity.hasBossHealth(1_750_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_TYPHOEUS_2) + entity.hasBossHealth(5_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_TYPHOEUS_3) + entity.hasBossHealth(10_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_TYPHOEUS_4) + } + } + if (entity is EntitySkeleton && entity.hasNameTagWith(2, "§c☠ §3ⓆⓊⒶⓏⒾⒾ ")) { + when { + entity.hasBossHealth(500_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_QUAZII_1) + entity.hasBossHealth(1_750_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_QUAZII_2) + entity.hasBossHealth(5_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_QUAZII_3) + entity.hasBossHealth(10_000_000) -> return EntityResult(bossType = BossType.SLAYER_BLAZE_QUAZII_4) + } + } + + if (entity is EntitySpider && entity.hasNameTagWith(1, "§5☠ §4Tarantula Broodfather ")) { + when { + entity.hasMaxHealth(740) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_1) + entity.hasMaxHealth(30_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_2) + entity.hasMaxHealth(900_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_3) + entity.hasMaxHealth(2_400_000) -> return EntityResult(bossType = BossType.SLAYER_SPIDER_4) } } if (entity is EntityWolf) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillarTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillarTimer.kt new file mode 100644 index 000000000..b75da2cc5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillarTimer.kt @@ -0,0 +1,85 @@ +package at.hannibal2.skyhanni.features.slayer.blaze + +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 +import net.minecraft.client.Minecraft +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import java.text.DecimalFormat +import java.util.regex.Pattern + +class BlazeSlayerPillarTimer { + + private var pattern = Pattern.compile("§cYou took §r§f(.+) §r§ctrue damage from an exploding fire pillar!") + + private var lastFound = -1L + + private val pillarTimerEntities = mutableListOf<EntityArmorStand>() + + var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + for (armorStand in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>()) { + val name = armorStand.name + if (name.matchRegex("§6§l.s §c§l8 hits")) { + if (armorStand !in pillarTimerEntities) { + pillarTimerEntities.add(armorStand) + lastFound = System.currentTimeMillis() + } + } + } + } + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + + val message = event.message + val matcher = pattern.matcher(message) + if (matcher.matches()) { + lastFound = -1L + } + if (message == " §r§a§lSLAYER QUEST COMPLETE!") { + lastFound = -1L + } + + if (message == "§eYour Slayer boss was despawned, but you have kept your quest progress!") { + lastFound = -1L + } + } + + @SubscribeEvent + fun renderOverlay(event: RenderGameOverlayEvent.Post) { + if (!isEnabled()) return + if (lastFound == -1L) return + + val duration = System.currentTimeMillis() - lastFound + val maxDuration = 7_000 + + val remainingLong = maxDuration - duration + val remaining = (remainingLong.toFloat() / 1000) + val format = DecimalFormat("0.0").format(remaining + 0.1) + SkyHanniMod.feature.slayer.firePillarsPos.renderString("§cBlaze Pillar: §a${format}s") + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.firePillars && DamageIndicatorManager.isBossSpawned( + BossType.SLAYER_BLAZE_2, BossType.SLAYER_BLAZE_3, BossType.SLAYER_BLAZE_4 + ) + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + pillarTimerEntities.clear() + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerWeaponHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerWeaponHelper.kt new file mode 100644 index 000000000..475df5ce9 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerWeaponHelper.kt @@ -0,0 +1,153 @@ +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.PacketEvent +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP +import net.minecraft.client.gui.ScaledResolution +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.network.play.client.C07PacketPlayerDigging +import net.minecraft.network.play.server.S45PacketTitle +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class BlazeSlayerWeaponHelper { + + var textToRenderA = "" + var textToRenderB = "" + var clientSideClicked = false + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + val sword = getSwordInHand() + if (sword != null) { + textToRenderA = getSwordText(sword) + textToRenderB = getSwordText(sword.other()) + return + } + + textToRenderA = "" + textToRenderB = "" + } + + private fun getSwordInHand(): Sword? { + val player = Minecraft.getMinecraft().thePlayer + val itemName = getName(player) + for (sword in Sword.values()) { + if (itemName.contains(sword.swordName)) { + return sword + } + } + + return null + } + + private fun getSwordText(sword: Sword): String { + var activeAbility = "" + var inactiveAbility = "" + for (mode in sword.modes) { + if (mode.active) { + activeAbility = mode.color + "§l" + mode + } else { + inactiveAbility = " §7/ " + mode.color + mode.toString().lowercase() + } + } + if (activeAbility == "") return "" + return "$activeAbility$inactiveAbility" + + } + + private fun getName(player: EntityPlayerSP): String { + val itemStack = player.inventory.mainInventory[player.inventory.currentItem] ?: return "" + return itemStack.name ?: "" + } + + @SubscribeEvent + fun onReceiveCurrentMode(event: PacketEvent.ReceiveEvent) { + if (!isEnabled()) return + + val packet = event.packet + + if (packet !is S45PacketTitle) return + val message = packet.message ?: return + val formattedText = message.formattedText + + for (swordMode in SwordMode.values()) { + if (swordMode.formattedName + "§r" == formattedText) { + Sword.values().filter { swordMode in it.modes }.forEach { + it.modes.forEach { mode -> mode.active = false } + } + swordMode.active = true + event.isCanceled = true + clientSideClicked = false + return + } + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.blazeDaggers + } + + @SubscribeEvent + fun onRightClick(event: PacketEvent.SendEvent) { + if (!isEnabled()) return + + if (clientSideClicked) return + + val packet = event.packet + + if (packet is C07PacketPlayerDigging) { + val status = packet.status + if (status == C07PacketPlayerDigging.Action.RELEASE_USE_ITEM) { + val sword = getSwordInHand() + sword?.modes?.forEach { mode -> mode.active = !mode.active } + clientSideClicked = true + } + } + } + + enum class Sword(val swordName: String, vararg val modes: SwordMode) { + TWILIGHT("Twilight Dagger", SwordMode.SPIRIT, SwordMode.CRYSTAL), + FIREDUST("Firedust Dagger", SwordMode.ASHEN, SwordMode.AURIC), + ; + + fun other(): Sword = if (this == TWILIGHT) { + FIREDUST + } else { + TWILIGHT + } + } + + @SubscribeEvent + fun renderOverlay(event: RenderGameOverlayEvent.Post) { + if (!isEnabled()) return + if (event.type != RenderGameOverlayEvent.ElementType.ALL) 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.85).toFloat(), 0.0f) + GlStateManager.scale(4.0f, 4.0f, 4.0f) + TextRenderUtils.drawStringCenteredScaledMaxWidth(textToRenderA, renderer, 0f, 0f, false, 55, 0) + GlStateManager.popMatrix() + + GlStateManager.pushMatrix() + GlStateManager.translate((width / 2).toFloat(), (height / 1.65).toFloat(), 0.0f) + GlStateManager.scale(4.0f, 4.0f, 4.0f) + TextRenderUtils.drawStringCenteredScaledMaxWidth(textToRenderB, renderer, 0f, 0f, false, 40, 0) + GlStateManager.popMatrix() + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/SwordMode.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/SwordMode.kt new file mode 100644 index 000000000..deeb24244 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/SwordMode.kt @@ -0,0 +1,9 @@ +package at.hannibal2.skyhanni.features.slayer.blaze + +enum class SwordMode(val formattedName: String, val color: String, var active: Boolean = false) { + AURIC("§e§lAURIC", "§e"), + ASHEN("§8§lASHEN", "§8"), + SPIRIT("§f§lSPIRIT", "§f"), + CRYSTAL("§b§lCRYSTAL", "§b"), + ; +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index e9621b319..47575c3f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -73,21 +73,23 @@ object EntityUtils { } } - fun EntityLivingBase.hasMaxHealth(health: Int): Boolean { - return when (this.baseMaxHealth) { - health.toDouble() -> true + fun EntityLivingBase.hasBossHealth(health: Int): Boolean = this.hasMaxHealth(health, true) - //Derpy - health.toDouble() * 2 -> true + fun EntityLivingBase.hasMaxHealth(health: Int, boss: Boolean = false): Boolean { + if (this.baseMaxHealth == health.toDouble()) return true + //Derpy + if (this.baseMaxHealth == health.toDouble() * 2) return true + + if (!boss) { //Corrupted - health.toDouble() * 3 -> true + if (this.baseMaxHealth == health.toDouble() * 3) return true //Derpy + Corrupted - health.toDouble() * 2 * 3 -> true - - else -> false + if (this.baseMaxHealth == health.toDouble() * 2 * 3) return true } + + return false } fun EntityPlayer.getSkinTexture(): String? { |