From 15b61517c59f8aa8135af82d6814739ad5da76b3 Mon Sep 17 00:00:00 2001 From: ingle Date: Mon, 28 Nov 2022 10:14:44 -0600 Subject: - 1.1.3 --- src/main/kotlin/dulkirmod/DulkirMod.kt | 6 ++- src/main/kotlin/dulkirmod/command/HelpCommand.kt | 5 +++ .../kotlin/dulkirmod/command/HurtCamCommand.kt | 17 ++++++++ src/main/kotlin/dulkirmod/config/Config.kt | 39 +++++++++++++++++ .../kotlin/dulkirmod/features/HurtCamSlider.kt | 31 +++++++++++++ .../kotlin/dulkirmod/features/KeeperWaypoints.kt | 51 ++++++++++++++++++++++ .../kotlin/dulkirmod/features/NametagCleaner.kt | 7 +++ .../kotlin/dulkirmod/features/chat/AbiphoneDND.kt | 2 +- src/main/kotlin/dulkirmod/utils/Utils.kt | 12 +++++ .../kotlin/dulkirmod/utils/WorldRenderUtils.kt | 40 +++++++++++++++++ 10 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 src/main/kotlin/dulkirmod/command/HurtCamCommand.kt create mode 100644 src/main/kotlin/dulkirmod/features/HurtCamSlider.kt create mode 100644 src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt (limited to 'src/main/kotlin/dulkirmod') diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 4a29113..69ac692 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -7,6 +7,7 @@ import dulkirmod.features.* import dulkirmod.features.chat.AbiphoneDND import dulkirmod.utils.ContainerNameUtil import dulkirmod.utils.TitleUtils +import dulkirmod.utils.Utils.getArea import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -53,6 +54,7 @@ class DulkirMod { ClientCommandHandler.instance.registerCommand(SettingsCommand()) ClientCommandHandler.instance.registerCommand(JoinDungeonCommand()) ClientCommandHandler.instance.registerCommand(LeapNameCommand()) + ClientCommandHandler.instance.registerCommand(HurtCamCommand()) } @Mod.EventHandler @@ -69,6 +71,7 @@ class DulkirMod { MinecraftForge.EVENT_BUS.register(ContainerNameUtil()) MinecraftForge.EVENT_BUS.register(DungeonLeap()) MinecraftForge.EVENT_BUS.register(AbiphoneDND()) + MinecraftForge.EVENT_BUS.register(KeeperWaypoints()) keyBinds.forEach(ClientRegistry::registerKeyBinding) } @@ -98,6 +101,7 @@ class DulkirMod { alarmClock() brokenHypeNotif() matchoAlert.alert() + getArea() longupdate = false } } @@ -114,7 +118,7 @@ class DulkirMod { companion object { const val MOD_ID = "dulkirmod" const val MOD_NAME = "Dulkir Mod" - const val MOD_VERSION = "1.1.2" + const val MOD_VERSION = "1.1.3" const val CHAT_PREFIX = "§f<§3DulkirMod§f>" val mc: Minecraft = Minecraft.getMinecraft() diff --git a/src/main/kotlin/dulkirmod/command/HelpCommand.kt b/src/main/kotlin/dulkirmod/command/HelpCommand.kt index 804cb5c..0180fac 100644 --- a/src/main/kotlin/dulkirmod/command/HelpCommand.kt +++ b/src/main/kotlin/dulkirmod/command/HelpCommand.kt @@ -24,5 +24,10 @@ class HelpCommand : ClientCommandBase("dulkirhelp") { EnumChatFormatting.GRAY.toString() + "/fairy - toggles healer fairy visibility." ) ) + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GRAY.toString() + "/hl - helps change highlighted leap player on the fly" + ) + ) } } \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/HurtCamCommand.kt b/src/main/kotlin/dulkirmod/command/HurtCamCommand.kt new file mode 100644 index 0000000..3dce80e --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/HurtCamCommand.kt @@ -0,0 +1,17 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod +import dulkirmod.config.Config +import net.minecraft.command.CommandException +import net.minecraft.command.ICommandSender +import net.minecraft.util.ChatComponentText + +class HurtCamCommand : ClientCommandBase("ouch") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array) { + Config.hurtCamIntensity = 7f + DulkirMod.mc.thePlayer.addChatMessage( + ChatComponentText("${DulkirMod.CHAT_PREFIX} §6§lOUCH! THAT HURT!") + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt index 09de6cb..83ffe07 100644 --- a/src/main/kotlin/dulkirmod/config/Config.kt +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -35,6 +35,25 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so ) var abiCallerID = false + @Property( + type = PropertyType.SWITCH, + name = "Hurt Cam Slider", + description = "more or less ouchie", + category = "General" + ) + var hurtCamSlider = false + + @Property( + type = PropertyType.DECIMAL_SLIDER, + name = "Hurt Cam Intensity", + description = "1 is default, make sure other mods noHurtCam stuff is off", + category = "General", + minF = 0f, + maxF = 2f, + decimalPlaces = 1 + ) + var hurtCamIntensity = 1f + @Property( type = PropertyType.SWITCH, name = "Hide Healer fairy", @@ -478,6 +497,25 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so subcategory = "Arachne" ) var arachneSpawnTimer = false + + @Property( + type = PropertyType.SWITCH, + name = "Show Arachne Keeper Spawn Locations", + description = "simple text waypoints", + category = "Bestiary", + subcategory = "Arachne" + ) + var keeperWaypoints = false + + @Property( + type = PropertyType.SWITCH, + name = "Focus Mode", + description = "only show the nametags of keepers. make sure to turn off when you're done", + category = "Bestiary", + subcategory = "Arachne" + ) + var keeperFocus = false + fun init() { initialize() addDependency("customMessage", "throttleNotifier") @@ -486,6 +524,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so addDependency("demoVolume", "bestiaryAlertSounds") addDependency("highlightLeapName", "highlightLeap") addDependency("abiCallerID", "abiDND") + addDependency("hurtCamIntensity", "hurtCamSlider") setCategoryDescription( "Custom Animations", diff --git a/src/main/kotlin/dulkirmod/features/HurtCamSlider.kt b/src/main/kotlin/dulkirmod/features/HurtCamSlider.kt new file mode 100644 index 0000000..7237d95 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/HurtCamSlider.kt @@ -0,0 +1,31 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.Config +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.entity.EntityLivingBase +import net.minecraft.util.MathHelper + +object HurtCamSlider { + fun renderHurt(partialTicks: Float): Boolean { + if (!Config.hurtCamSlider) return false + if (mc.renderViewEntity is EntityLivingBase) { + val entitylivingbase = mc.renderViewEntity as EntityLivingBase + var f: Float = (entitylivingbase.hurtTime.toFloat() - partialTicks) + if (entitylivingbase.health <= 0.0f) { + val f1: Float = entitylivingbase.deathTime.toFloat() + partialTicks + GlStateManager.rotate(40.0f - 8000.0f / (f1 + 200.0f), 0.0f, 0.0f, 1.0f) + } + if (f < 0.0f) { + return true + } + f /= entitylivingbase.maxHurtTime.toFloat() + f = MathHelper.sin(f * f * f * f * Math.PI.toFloat()) + val f2 = entitylivingbase.attackedAtYaw + GlStateManager.rotate(-f2, 0.0f, 1.0f, 0.0f) + GlStateManager.rotate(-f * 14.0f * Config.hurtCamIntensity, 0.0f, 0.0f, 1.0f) + GlStateManager.rotate(f2, 0.0f, 1.0f, 0.0f) + } + return true + } +} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt b/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt new file mode 100644 index 0000000..7b82fa2 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/KeeperWaypoints.kt @@ -0,0 +1,51 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.Config +import dulkirmod.utils.Utils +import dulkirmod.utils.WorldRenderUtils +import net.minecraft.util.Vec3 +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.math.max + +class KeeperWaypoints { + @SubscribeEvent + fun onWorldRenderLast(event: RenderWorldLastEvent) { + if (!Config.keeperWaypoints) return + if (Utils.area != "Spider's Den") return + + val vec1 = Vec3(-208.5, 44.5, -259.5) + val vec2 = Vec3(-311.5, 43.5, -232.5) + val vec3 = Vec3(-230.5, 57.5, -307.5) + val vec4 = Vec3(-269.5, 47.5, -166.5) + val vec5 = Vec3(-292.5, 47.5, -167.5) + val vec6 = Vec3(-291.5, 47.5, -183.5) + val vec7 = Vec3(-282.5, 47.5, -195.5) + val vec8 = Vec3(-262.5, 49.5, -191.5) + val vec9 = Vec3(-269.5, 61.5, -159.5) + val playerVec = mc.thePlayer.positionVector + + val scale1 = max(1f, playerVec.distanceTo(vec1).toFloat()/10f) + val scale2 = max(1f,playerVec.distanceTo(vec2).toFloat()/10f) + val scale3 = max(1f, playerVec.distanceTo(vec3).toFloat()/10f) + val scale4 = max(1f, playerVec.distanceTo(vec4).toFloat()/10f) + val scale5 = max(1f, playerVec.distanceTo(vec5).toFloat()/10f) + val scale6 = max(1f, playerVec.distanceTo(vec6).toFloat()/10f) + val scale7 = max(1f, playerVec.distanceTo(vec7).toFloat()/10f) + val scale8 = max(1f, playerVec.distanceTo(vec8).toFloat()/10f) + val scale9 = max(1f, playerVec.distanceTo(vec9).toFloat()/10f) + + val color = Utils.getColorString(Config.bestiaryNotifColor) + WorldRenderUtils.render(vec1, "${color}1", false, scale1, true) + WorldRenderUtils.render(vec2, "${color}2", false, scale2, true) + WorldRenderUtils.render(vec3, "${color}3", false, scale3, true) + WorldRenderUtils.render(vec4, "${color}4", false, scale4, true) + WorldRenderUtils.render(vec5, "${color}5", false, scale5, true) + WorldRenderUtils.render(vec6, "${color}6", false, scale6, true) + WorldRenderUtils.render(vec7, "${color}7", false, scale7, true) + WorldRenderUtils.render(vec8, "${color}8", false, scale8, true) + WorldRenderUtils.render(vec9, "${color}9", false, scale9, true) + } +} + diff --git a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt index e2e4a04..5dd190a 100644 --- a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt +++ b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt @@ -2,6 +2,7 @@ package dulkirmod.features import dulkirmod.DulkirMod.Companion.config import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.utils.Utils import dulkirmod.utils.Utils.stripColorCodes import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.client.event.RenderLivingEvent @@ -30,6 +31,12 @@ object NametagCleaner { mc.theWorld.removeEntity(event.entity) } } + + if (config.keeperFocus && Utils.area == "Spider's Den") { + val name = stripColorCodes(event.entity.customNameTag) + if (!name.contains("Keeper")) + mc.theWorld.removeEntity(event.entity) + } } } } diff --git a/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt b/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt index d2e0a69..f0a5cb0 100644 --- a/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt +++ b/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt @@ -18,6 +18,7 @@ class AbiphoneDND { if (!Config.abiDND) return if (System.currentTimeMillis() - lastRing < 5000) { if (event.name == "note.pling" && event.sound.volume == 0.69f && event.sound.pitch == 1.6666666f) { + // This throws an error but still blocks the sound. Not a great solution, but it works for now event.isCanceled = true } } @@ -47,6 +48,5 @@ class AbiphoneDND { event.isCanceled = true; } } - } } \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt index fcc8de0..81646cb 100644 --- a/src/main/kotlin/dulkirmod/utils/Utils.kt +++ b/src/main/kotlin/dulkirmod/utils/Utils.kt @@ -12,6 +12,8 @@ import java.awt.datatransfer.StringSelection import java.util.* object Utils { + + var area = "" fun stripColorCodes(string: String): String { return string.replace("§.".toRegex(), "") } @@ -82,4 +84,14 @@ object Utils { fun getColorString(int: Int): String { return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString() } + + fun getArea() { + val scoreboardList: List = TabListUtils.fetchTabEntires().map { + it.displayName?.unformattedText + } + for (l in scoreboardList) { + if (l != null && l.startsWith("Area: ")) + area = l.substring(6) + } + } } \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt index d3c2761..e0febdd 100644 --- a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt @@ -18,6 +18,7 @@ class WorldRenderUtils { text: String, depthTest: Boolean = true, scale: Float = 1f, + showDistance: Boolean = false, shadow: Boolean = false, renderBlackBox: Boolean = true, ) { @@ -66,6 +67,45 @@ class WorldRenderUtils { 0 ) } + + // for waypoints + if (showDistance) { + val distance = "§e${mc.thePlayer.positionVector.distanceTo(location).toInt()}m" + GlStateManager.translate(0.0, 8.66, 0.0) + GlStateManager.scale(.66, .66, .66) + + if (renderBlackBox) { + val j = mc.fontRendererObj.getStringWidth(distance) / 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( + distance, + -mc.fontRendererObj.getStringWidth(distance) / 2f, + 0f, + 0 + ) + } else { + mc.fontRendererObj.drawString( + distance, + -mc.fontRendererObj.getStringWidth(distance) / 2, + 0, + 0 + ) + } + } + GlStateManager.color(1f, 1f, 1f) GlStateManager.disableBlend() GlStateManager.popMatrix() -- cgit