diff options
author | ingle <inglettronald@gmail.com> | 2022-10-15 11:18:19 -0500 |
---|---|---|
committer | ingle <inglettronald@gmail.com> | 2022-10-15 11:18:19 -0500 |
commit | d2eb0ada9182f9cd507cd32b74cb72f62355acaa (patch) | |
tree | 5f9378e9f066f62b777bc7e8c308f7c9ac1f9b7c /src | |
parent | bb0a6799a67e3bed3f78948b2dc5711c668e1c4f (diff) | |
download | DulkirMod-d2eb0ada9182f9cd507cd32b74cb72f62355acaa.tar.gz DulkirMod-d2eb0ada9182f9cd507cd32b74cb72f62355acaa.tar.bz2 DulkirMod-d2eb0ada9182f9cd507cd32b74cb72f62355acaa.zip |
+ moar bestiary stuff and added WorldRenderUtils
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 16 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/Config.kt | 78 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/ArachneTimer.kt | 22 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt | 8 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/MatchoAlert.kt | 43 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/TablistUtils.kt | 38 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt | 71 |
8 files changed, 244 insertions, 38 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 350c4ae..9eb1464 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -3,10 +3,7 @@ package dulkirmod import dulkirmod.command.* import dulkirmod.config.Config import dulkirmod.events.ChatEvent -import dulkirmod.features.ArachneTimer -import dulkirmod.features.NametagCleaner -import dulkirmod.features.alarmClock -import dulkirmod.features.brokenHypeNotif +import dulkirmod.features.* import dulkirmod.utils.TitleUtils import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -14,6 +11,7 @@ import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen import net.minecraft.client.settings.KeyBinding +import net.minecraft.util.ChatComponentText import net.minecraftforge.client.ClientCommandHandler import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.client.registry.ClientRegistry @@ -62,6 +60,7 @@ class DulkirMod { MinecraftForge.EVENT_BUS.register(NametagCleaner) MinecraftForge.EVENT_BUS.register(DulkirMod.titleUtils) MinecraftForge.EVENT_BUS.register(ArachneTimer()) + MinecraftForge.EVENT_BUS.register(MatchoAlert()) keyBinds.forEach(ClientRegistry::registerKeyBinding) } @@ -91,6 +90,7 @@ class DulkirMod { // EXECUTE STUFF HERE THAT DOESN'T REALLY NEED TO BE RUN EVERY TICK alarmClock() brokenHypeNotif() + matchoAlert.alert() longupdate = false } } @@ -98,13 +98,16 @@ class DulkirMod { @SubscribeEvent fun onKey(event: KeyInputEvent) { if (keyBinds[0].isPressed) display = config.gui() - if (keyBinds[1].isPressed) Config.noReverse3rdPerson = !Config.noReverse3rdPerson + if (keyBinds[1].isPressed) { + Config.noReverse3rdPerson = !Config.noReverse3rdPerson + mc.thePlayer.addChatMessage(ChatComponentText("§7Toggling No Selfie Camera Setting... now: §6${Config.noReverse3rdPerson}")) + } } companion object { const val MOD_ID = "dulkirmod" const val MOD_NAME = "Dulkir Mod" - const val MOD_VERSION = "1.0.7" + const val MOD_VERSION = "1.0.8" const val CHAT_PREFIX = "§f<§3DulkirMod§f>" val mc: Minecraft = Minecraft.getMinecraft() @@ -112,6 +115,7 @@ class DulkirMod { var display: GuiScreen? = null val scope = CoroutineScope(EmptyCoroutineContext) val titleUtils = TitleUtils() + val matchoAlert = MatchoAlert() val keyBinds = arrayOf( KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"), diff --git a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt index 46506a2..9765a47 100644 --- a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt +++ b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt @@ -1,11 +1,11 @@ package dulkirmod.command +import dulkirmod.DulkirMod import dulkirmod.DulkirMod.Companion.mc import dulkirmod.config.Config import net.minecraft.command.CommandException import net.minecraft.command.ICommandSender import net.minecraft.util.ChatComponentText -import net.minecraft.util.EnumChatFormatting class JoinDungeonCommand : ClientCommandBase("joindungeon") { @Throws(CommandException::class) @@ -29,9 +29,7 @@ class JoinDungeonCommand : ClientCommandBase("joindungeon") { if(Config.dungeonCommandConfirm) { mc.thePlayer.addChatMessage( - ChatComponentText( - EnumChatFormatting.GOLD.toString() + "" + EnumChatFormatting.BOLD + "Running command: $type$num" - ) + ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Running command: $type$num") ) } mc.thePlayer.sendChatMessage("/joindungeon $arguments") diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt index 1a88d1a..ebda0c5 100644 --- a/src/main/kotlin/dulkirmod/config/Config.kt +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -23,31 +23,31 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Hide Healer fairy", description = "Probably disable when not in dungeons for now. Will fix later.", - category = "General" + category = "Dungeons" ) - var hideHealerFairy = false + var hideHealerFairy = true @Property( type = PropertyType.SWITCH, name = "Hide Heart Particles", description = "Useful for hyperion and healer bullshit", - category = "General" + category = "Dungeons" ) - var hideHeartParticles = false + var hideHeartParticles = true @Property( type = PropertyType.SWITCH, name = "Throttle Notifier", description = "Making features out of bugs wow", - category = "General" + category = "Dungeons" ) - var throttleNotifier = false + var throttleNotifier = true @Property( type = PropertyType.TEXT, name = "Throttle Notifier String", description = "How do you want to tell people you are throttled?", - category = "General", + category = "Dungeons", placeholder = "i am being throttled zzz", protectedText = false ) @@ -59,12 +59,12 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so description = "Prevents some nametags not covered by skytils \"Hide non-starred nametags\" from rendering.", category = "General" ) - var hideTags = false + var hideTags = true // CUSTOM ANIMATIONS @Property( type = PropertyType.SWITCH, - name = "Custom Animations", + name = "Global Toggle", description = "Change the look of your held item", category = "Animations" ) @@ -207,7 +207,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.BUTTON, name = "Export Preset as String", description = "Base64 representation of your current config - will copy to clipboard when pressed.", - category = "Animations" + category = "Animations", + subcategory = "Presets" ) fun presetString() { Utils.animationConfigToString() @@ -217,7 +218,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.BUTTON, name = "Import Preset from Clipboard", description = "Base64 representation of your config accepted from clipboard. Closes gui.", - category = "Animations" + category = "Animations", + subcategory = "Presets" ) fun stringToConfig() { Utils.animationStringtoConfig() @@ -227,9 +229,9 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "JoinDungeon Command Confirmation", description = "Chat notification when you push the button. Useful if you suck at navigating a numpad.", - category = "General" + category = "Dungeon" ) - var dungeonCommandConfirm = false + var dungeonCommandConfirm = true @Property( type = PropertyType.SWITCH, @@ -287,7 +289,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Ghast Notification", description = "Shows a title at 9:00pm for bestiary", - category = "Bestiary" + category = "Bestiary", + subcategory = "Notifications" ) var notifyGhast = false @@ -295,7 +298,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Zombie Villager Notification", description = "Shows a title at 8:00pm for bestiary", - category = "Bestiary" + category = "Bestiary", + subcategory = "Notifications" ) var notifyZombieVillager = false @@ -303,15 +307,26 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Broken Hype Notification", description = "Tells you if you are no longer getting bestiary! Requires champion and book of stats on your item. LEAVE OFF IF FISHING.", - category = "Bestiary" + category = "Bestiary", + subcategory = "Notifications" ) var notifyHype = false @Property( + type = PropertyType.SWITCH, + name = "Matcho Spawn Alert!", + description = "Alerts you if your lobby becomes EXPLOSIVE!", + category = "Bestiary", + subcategory = "Notifications" + ) + var notifyMatcho = false + + @Property( type = PropertyType.SELECTOR, name = "Bestiary Notification Color", - description = "Changes color of title notification", + description = "Changes color some bestiary features.", category = "Bestiary", + subcategory = "Notifications", options = ["§0Black", "§1Dark Blue", "§2Dark Green", @@ -337,7 +352,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Text Shadow", description = "Shows text shadow for notification", - category = "Bestiary" + category = "Bestiary", + subcategory = "Notifications" ) var bestiaryTextShadow = false @@ -346,17 +362,20 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so name = "Scale", description = "Size of notification!", category = "Bestiary", + subcategory = "Notifications", minF = 0f, maxF = 1f, decimalPlaces = 1 ) var bestiaryNotifSize = .7f + @Property( type = PropertyType.SWITCH, name = "Alert Noises", description = "Uses relevant mob sounds, doesn't override audio/patcher settings", - category = "Bestiary" + category = "Bestiary", + subcategory = "Audio" ) var bestiaryAlertSounds = false @@ -365,6 +384,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so name = "Alert Volume", description = "Volume of notification!", category = "Bestiary", + subcategory = "Audio", minF = 0f, maxF = 1f, decimalPlaces = 1 @@ -375,7 +395,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.BUTTON, name = "Demo Volume Selection", description = "Plays the Ghast Noise as Reference, Might add individual sliders later but this seems like enough", - category = "Bestiary" + category = "Bestiary", + subcategory = "Audio" ) fun demoVolume() { DulkirMod.mc.thePlayer.playSound("mob.ghast.scream", 1f * Config.bestiaryNotifVol, 1f) @@ -385,7 +406,8 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Hide Arachne Loot Nametags", description = "Useful when killing a lot of them", - category = "Bestiary" + category = "Bestiary", + subcategory = "Arachne" ) var hideArachneTags = false @@ -393,12 +415,24 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so type = PropertyType.SWITCH, name = "Arachne kill timer", description = "Shows in chat.", - category = "Bestiary" + category = "Bestiary", + subcategory = "Arachne" ) var arachneKillTimer = false + + @Property( + type = PropertyType.SWITCH, + name = "Arachne spawn countdown", + description = "Shows how long it takes for the arachne to spawn (in world).", + category = "Bestiary", + subcategory = "Arachne" + ) + var arachneSpawnTimer = false fun init() { initialize() addDependency("customMessage", "throttleNotifier") + addDependency("bestiaryNotifVol", "bestiaryAlertSounds") + addDependency("demoVolume", "bestiaryAlertSounds") setCategoryDescription( "Custom Animations", diff --git a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt index 7e0f144..d5334ba 100644 --- a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt +++ b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt @@ -4,14 +4,18 @@ import dulkirmod.DulkirMod import dulkirmod.DulkirMod.Companion.mc import dulkirmod.config.Config import dulkirmod.utils.Utils +import dulkirmod.utils.WorldRenderUtils import net.minecraft.util.ChatComponentText +import net.minecraft.util.Vec3 import net.minecraftforge.client.event.ClientChatReceivedEvent +import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ArachneTimer { - private var startmillis : Long = -1; - private var endmillis : Long = -1; + private var startmillis : Long = -1 + private var endmillis : Long = -1 + private var spawnmillis : Long = -1 @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW) fun onChat(event: ClientChatReceivedEvent) { @@ -27,6 +31,9 @@ class ArachneTimer { if (unformatted == "[BOSS] Arachne: You dare to call me, the queen of the dark, to you. I'll accept no excuses, you shall die!") { startmillis = System.currentTimeMillis() } + else if (unformatted.startsWith('☄') && unformatted.contains("Something is awakening!")) { + spawnmillis = System.currentTimeMillis() + } if (unformatted == "[BOSS] Arachne: You are lucky this time that you only called out a portion of my power. If you dared to face me at my peak, you would not survive!") { endmillis = System.currentTimeMillis() @@ -39,4 +46,15 @@ class ArachneTimer { } } } + @SubscribeEvent + fun onWorldRenderLast(event: RenderWorldLastEvent) { + if (!Config.arachneSpawnTimer) return + + if (spawnmillis > startmillis) { + val color = Utils.getColorString(Config.bestiaryNotifColor) + var time = 18 - (System.currentTimeMillis() - spawnmillis)/1000 + if (time < 0) time = 0 + WorldRenderUtils.render(Vec3(-282.5, 50.8, -178.5), "${color}${time}") + } + } }
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt index b748f8b..d516fcf 100644 --- a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt +++ b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt @@ -8,14 +8,14 @@ import net.minecraft.item.ItemStack import net.minecraft.nbt.NBTTagCompound var oldKill = -1 -var oldChampionXp = -1 +var oldChampionXp = -1.0 var oldID = "" fun brokenHypeNotif() { if (!Config.notifyHype) return; var kill = -1 - var championXp = -1 + var championXp = -1.0 var id = "" if (mc.thePlayer == null) return @@ -34,7 +34,7 @@ fun brokenHypeNotif() { kill = ea.getInteger("stats_book") } if (ea.hasKey("champion_combat_xp", 99)) { - championXp = ea.getDouble("champion_combat_xp").toInt() + championXp = ea.getDouble("champion_combat_xp") } } } @@ -46,7 +46,7 @@ fun brokenHypeNotif() { // Check if this is a valid item for testing whether bestiary is broken. // That is, to be specific, check that it has champion and book of stats. // If it doesn't, don't reset because it can't be used anyway. - if (kill == -1 || championXp == -1) { + if (kill == -1 || championXp == -1.0) { return; } // If we get here this is a new item that is legitimate for testing bugged xp, in theory. diff --git a/src/main/kotlin/dulkirmod/features/MatchoAlert.kt b/src/main/kotlin/dulkirmod/features/MatchoAlert.kt new file mode 100644 index 0000000..f713372 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/MatchoAlert.kt @@ -0,0 +1,43 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod +import dulkirmod.config.Config +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.Utils + +class MatchoAlert() { + + var hasSentAlert = false + + fun alert() { + if (!Config.notifyMatcho) return + if (!Utils.isInSkyblock()) return + + val scoreboardList: List<String?> = TabListUtils.fetchTabEntires().map { + it.displayName?.unformattedText + } + + var explo = false + for (s in scoreboardList) { + if (explo) { + // This line is status of Volcano + if (s != " INACTIVE" && !hasSentAlert) { + val color = Utils.getColorString(Config.bestiaryNotifColor) + DulkirMod.titleUtils.drawStringForTime("${color}Matcho", 5000) + if (Config.bestiaryAlertSounds) + DulkirMod.mc.thePlayer.playSound("mob.villager.yes", 1f * Config.bestiaryNotifVol, 0f) + hasSentAlert = true; + } else if (s == " INACTIVE") hasSentAlert = false + break; + } + if (s == "Volcano Explosivity:") + explo = true + if (s != null) { + if (s.contains("Area:") && !s.contains("Crimson Isle")) { + hasSentAlert = false + break; + } + } + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt new file mode 100644 index 0000000..57cb289 --- /dev/null +++ b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt @@ -0,0 +1,38 @@ +package dulkirmod.utils + +import com.google.common.collect.ComparisonChain +import com.google.common.collect.Ordering +import dulkirmod.DulkirMod.Companion.mc +import net.minecraft.client.network.NetworkPlayerInfo +import net.minecraft.world.WorldSettings + +val NetworkPlayerInfo.text: String + get() = mc.ingameGUI.tabList.getPlayerName(this) + +// STOLEN FROM SKYTILS mmm yes +object TabListUtils { + private val playerInfoOrdering = object : Ordering<NetworkPlayerInfo>() { + override fun compare(p_compare_1_: NetworkPlayerInfo?, p_compare_2_: NetworkPlayerInfo?): Int { + val scorePlayerTeam = p_compare_1_?.playerTeam + val scorePlayerTeam1 = p_compare_2_?.playerTeam + if (p_compare_1_ != null) { + if (p_compare_2_ != null) { + return ComparisonChain.start().compareTrueFirst( + p_compare_1_.gameType != WorldSettings.GameType.SPECTATOR, + p_compare_2_.gameType != WorldSettings.GameType.SPECTATOR + ).compare( + if (scorePlayerTeam != null) scorePlayerTeam.registeredName else "", + if (scorePlayerTeam1 != null) scorePlayerTeam1.registeredName else "" + ).compare(p_compare_1_.gameProfile.name, p_compare_2_.gameProfile.name).result() + } + return 0 + } + return -1 + } + } + var tabEntries: List<Pair<NetworkPlayerInfo, String>> = emptyList() + fun fetchTabEntires(): List<NetworkPlayerInfo> = + if (mc.thePlayer == null) emptyList() else playerInfoOrdering.sortedCopy( + mc.thePlayer.sendQueue.playerInfoMap + ) +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt new file mode 100644 index 0000000..b214555 --- /dev/null +++ b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt @@ -0,0 +1,71 @@ +package dulkirmod.utils + +import dulkirmod.DulkirMod.Companion.mc +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.client.renderer.GlStateManager.disableTexture2D +import net.minecraft.client.renderer.GlStateManager.enableTexture2D +import net.minecraft.client.renderer.Tessellator +import net.minecraft.client.renderer.vertex.DefaultVertexFormats +import net.minecraft.util.Vec3 +import org.lwjgl.opengl.GL11 + + +class WorldRenderUtils { + + companion object { + fun render(location: Vec3, text: String, depthTest: Boolean = true, scale: Float = 1f, shadow: Boolean = false, renderBlackBox: Boolean = true) { + if (!depthTest) { + GL11.glDisable(GL11.GL_DEPTH_TEST) + GL11.glDepthMask(false) + } + GlStateManager.pushMatrix() + GlStateManager.enableBlend() + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.translate( + location.xCoord - mc.renderManager.viewerPosX, + location.yCoord - mc.renderManager.viewerPosY, + location.zCoord - mc.renderManager.viewerPosZ + ) + GlStateManager.color(1f, 1f, 1f, 0.5f) + GlStateManager.rotate(-mc.renderManager.playerViewY, 0.0f, 1.0f, 0.0f) + GlStateManager.rotate(mc.renderManager.playerViewX, 1.0f, 0.0f, 0.0f) + GlStateManager.scale(-scale / 25, -scale / 25, scale / 25) + + if (renderBlackBox) { + val j = mc.fontRendererObj.getStringWidth(text) / 2 + disableTexture2D() + val worldRenderer = Tessellator.getInstance().worldRenderer + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR) + worldRenderer.pos((-j - 1).toDouble(), (-1).toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() + worldRenderer.pos((-j - 1).toDouble(), 8.toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() + worldRenderer.pos((j + 1).toDouble(), 8.toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() + worldRenderer.pos((j + 1).toDouble(), (-1).toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() + Tessellator.getInstance().draw() + enableTexture2D() + } + + if (shadow) { + mc.fontRendererObj.drawStringWithShadow( + text, + -mc.fontRendererObj.getStringWidth(text) / 2f, + 0f, + 0 + ) + } else { + mc.fontRendererObj.drawString( + text, + -mc.fontRendererObj.getStringWidth(text) / 2, + 0, + 0 + ) + } + GlStateManager.color(1f, 1f, 1f) + GlStateManager.disableBlend() + GlStateManager.popMatrix() + if (!depthTest) { + GL11.glEnable(GL11.GL_DEPTH_TEST) + GL11.glDepthMask(true) + } + } + } +}
\ No newline at end of file |