From b220e76e12724a91507e894ac018e1ad6b695c9a Mon Sep 17 00:00:00 2001 From: inglettronald Date: Mon, 5 Jun 2023 13:54:08 -0500 Subject: archer highlight impl --- src/main/kotlin/dulkirmod/DulkirMod.kt | 2 +- src/main/kotlin/dulkirmod/config/DulkirConfig.kt | 51 ++++++++++++++++++---- .../dulkirmod/features/dungeons/ArcherHighlight.kt | 40 +++++++++++++++++ src/main/kotlin/dulkirmod/utils/TablistUtils.kt | 9 ++++ 4 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 76b2ce1..382c936 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -87,7 +87,7 @@ class DulkirMod { mcBus.register(WorldRenderUtils) mcBus.register(IchorHighlight) mcBus.register(SteakDisplay) - mcBus.register(StarredMobBoxes) + mcBus.register(ArcherHighlight) keyBinds.forEach(ClientRegistry::registerKeyBinding) } diff --git a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt index 2a4bb1c..858d11f 100644 --- a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt +++ b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt @@ -2,6 +2,7 @@ package dulkirmod.config import cc.polyfrost.oneconfig.config.Config import cc.polyfrost.oneconfig.config.annotations.* +import cc.polyfrost.oneconfig.config.core.OneColor import cc.polyfrost.oneconfig.config.data.Mod import cc.polyfrost.oneconfig.config.data.ModType import dulkirmod.DulkirMod @@ -16,27 +17,58 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf @Switch( name = "Patch Crimson Isle memory leak", - description = "This is a temporary fix for the memory leak on crimson isles. It will be removed when Hypixel fixes the issue.", + description = "This was a temporary fix for the memory leak on crimson isles. It is now deprecated.", category = "General", subcategory = "General" ) - var crimsonIslesMemoryLeakPatch = true + var crimsonIslesMemoryLeakPatch = false @Switch( name = "Remove Useless Armor Stands", - description = "Another hypixel issue, should be a significant fps boost in relevant scenarios.", + description = "Another hypixel issue, should be useful for eman/arachne still.", category = "General", subcategory = "General" ) - var blankStandRemoval = true + var blankStandRemoval = false @Switch( - name = "Debug Armor stands", - description = "Another hypixel issue, should be a significant fps boost in relevant scenarios.", - category = "General", - subcategory = "General" + name = "Double Hook Ding", + description = "blame deathstreeks", + category = "Random Beta Features", + subcategory = "Fishing" + ) + var doubleHookDing = false + + @Switch( + name = "Remove Double Hook Message", + description = "i wonder what this does", + category = "Random Beta Features", + subcategory = "Fishing" + ) + var removeHookMessage = false + + @Switch( + name = "Box Archer in P5", + description = "blame noth", + category = "Random Beta Features", + subcategory = "Dungeons" + ) + var archerBox = false + + @Switch( + name = "Box Archer Anywhere in Dungeons", + description = "This will bypass the m7 check and p5 check", + category = "Random Beta Features", + subcategory = "Dungeons" + ) + var archerBoxEverywhere = false + + @Color( + name = "Archer Box color", + category = "Random Beta Features", + subcategory = "Dungeons" ) - var debugStandRemoval = false + var archBoxColor = OneColor(0, 255, 255, 255) @Switch( name = "Hide Enchant Rune Particles", @@ -802,5 +834,6 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf addDependency("persistentAlert", "notifyMaxVisitors") addDependency("secretSoundVolume", "secretClickSounds") addDependency("demoSecretVolume", "secretClickSounds") + addDependency("boxArcherEverywhere", "boxArcher") } } diff --git a/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt b/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt new file mode 100644 index 0000000..9da6d4a --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt @@ -0,0 +1,40 @@ +package dulkirmod.features.dungeons + +import com.google.common.eventbus.Subscribe +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.DulkirConfig +import dulkirmod.utils.ScoreBoardUtils +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.WorldRenderUtils +import ibxm.Player +import net.minecraft.entity.player.EntityPlayer +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color + +object ArcherHighlight { + + @SubscribeEvent + fun onRenderLiving(event: RenderLivingEvent.Post<*>) { + if (!DulkirConfig.archerBox) return + if (TabListUtils.area != "Dungeon") return + if (!ScoreBoardUtils.isInM7 && !DulkirConfig.archerBoxEverywhere) return + if (event.entity !is EntityPlayer) return + val name = event.entity.name ?: return + if (name != TabListUtils.archerName) return + if (mc.thePlayer.positionVector.yCoord > 45 && !DulkirConfig.archerBoxEverywhere) return + if (mc.thePlayer.name == name) return + val (x, y, z) = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z) + WorldRenderUtils.drawCustomBox( + x - .5, + 1.0, + y, + event.entity.height.toDouble(), + z - .5, + 1.0, + DulkirConfig.archBoxColor.toJavaColor(), + 3f, + phase = false + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt index 8bad6be..8ecc771 100644 --- a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt @@ -3,6 +3,7 @@ package dulkirmod.utils import com.google.common.collect.ComparisonChain import com.google.common.collect.Ordering import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.DulkirConfig import net.minecraft.client.network.NetworkPlayerInfo import net.minecraft.world.WorldSettings @@ -18,6 +19,7 @@ object TabListUtils { var gardenMilestone: String = "" var timeTillNextVisitor: String = "" var numVisitors: Int = 0 + var archerName: String = "" private val playerInfoOrdering = object : Ordering() { override fun compare(p_compare_1_: NetworkPlayerInfo?, p_compare_2_: NetworkPlayerInfo?): Int { @@ -84,9 +86,16 @@ object TabListUtils { numVisitors = line.substring(11, 12).toInt() // TODO: FIX WHEN THEY ADD THE TENTH VISITOR numVisitorsFlag = true } + line.contains("(Archer") -> { + val strArr = line.split(" ") + archerName = strArr[1] + } } } + if (area != "Dungeon") { + archerName = "" + } if (area != "Crimson Isle") { explosivity = false } -- cgit