diff options
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt | 1 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt | 17 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt | 12 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/hud/Garden.kt | 31 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/hud/SpeedOverlay.kt | 35 |
7 files changed, 91 insertions, 23 deletions
@@ -76,11 +76,23 @@ DulkirMod 1.8.9 Can be found [here](https://github.com/inglettronald/DulkirMod). </details> ## For Users -Opening the settings menu can be achieved through the escape menu or through the `/dulkir` command. +Opening the settings menu can be achieved through the escape menu or through the `/dulkir` command. Almost all features +are off by default, so you **will** want to look into this upon first launch. Editing HUD positioning makes use of the [JARVIS API](https://github.com/romangraef/jarvis). This library is still in development, but is a fantastic library for a common HUD element editor. This allows multiple mods to handle the rendering on their own, but have the positioning logic be handled in one place. Use the command `/jarvis gui` to access the main editor. -Use the command `/animations` to share animation profiles.
\ No newline at end of file +Use the command `/animations` to share animation profiles. + +## For Developers +This is intended to be run with Jetbrains Runtime to enable hot-swap to work properly. +To get hot swapping with DCEVM working in this version, I found the most convenient way of achieving this is manually installing +the hotswap jar here and changing your VM args in `build.gradle` to link your java agent properly. I'm not an insane wizard with +this stuff, so my terminology might be kinda poor here. If any developer is interested in helping me refine instructions to +be better to understand, feel free to hit me up. + +In the meantime, if you're struggling, I would suggest not worrying about DCEVM. You can (probably?) achieve this by just removing the +last 2 VMargs inside your `build.gradle` and regenerating your run configuration. My DMs are always open to try to offer support +on this stuff, as it will help me learn a thing or two as well.
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 69aa3eb..f898821 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ dependencies { include "com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9" implementation "com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9" annotationProcessor "com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9" - modImplementation("moe.nea.jarvis:jarvis-fabric:1.1.1") + modImplementation("moe.nea.jarvis:jarvis-api:1.1.1") include("moe.nea.jarvis:jarvis-fabric:1.1.1") modLocalRuntime("moe.nea.jarvis:jarvis-fabric:1.1.1") } diff --git a/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt b/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt index 0c8c314..80f4dc2 100644 --- a/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt +++ b/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt @@ -46,7 +46,6 @@ object DulkirModFabric : ModInitializer { Registrations.registerEvents() DulkirConfig.loadConfig() - System.setProperty("java.awt.headless", "false"); } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt b/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt index 39a9f11..6a8829d 100644 --- a/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt +++ b/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt @@ -1,17 +1,14 @@ package com.dulkirfabric.commands +import com.dulkirfabric.DulkirModFabric.mc import com.dulkirfabric.config.DulkirConfig -import com.dulkirfabric.util.render.AnimationPreset import com.dulkirfabric.util.TextUtils +import com.dulkirfabric.util.render.AnimationPreset import com.google.gson.Gson import com.mojang.brigadier.CommandDispatcher import com.mojang.brigadier.builder.LiteralArgumentBuilder import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource import net.minecraft.command.CommandRegistryAccess -import java.awt.Toolkit -import java.awt.datatransfer.Clipboard -import java.awt.datatransfer.DataFlavor -import java.awt.datatransfer.StringSelection import java.util.* object AnimationCommand { @@ -51,8 +48,7 @@ object AnimationCommand { private fun applyPresetFromClipboard() { val gson = Gson() - val clipboard = Toolkit.getDefaultToolkit().systemClipboard - val base64 = clipboard.getData(DataFlavor.stringFlavor) as String + val base64 = mc.keyboard.clipboard try { val jsonString = String(Base64.getDecoder().decode(base64)) val import = gson.fromJson(jsonString, AnimationPreset::class.java) @@ -74,14 +70,11 @@ object AnimationCommand { } private fun applyPresetToClipboard() { - var s = "" val gson = Gson() val jsonString = gson.toJson(DulkirConfig.configOptions.animationPreset) - s = Base64.getEncoder().encodeToString(jsonString.toByteArray()) + val s = Base64.getEncoder().encodeToString(jsonString.toByteArray()) // set clipboard - val selection = StringSelection(s) - val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard - clipboard.setContents(selection, selection) + mc.keyboard.clipboard = s TextUtils.info("ยง6Animation config has been copied to clipboard") } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt index 1457a85..c6ed544 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -145,6 +145,9 @@ class DulkirConfig { tooltip = Text.literal("This converts Mana/Health/Def/Stacks as HUD elements")) ) general.addEntry( + entryBuilder.mkToggle(Text.literal("Show Speed in HUD"), configOptions::speedHud) + ) + general.addEntry( entryBuilder.mkToggle(Text.literal("Include EHP in def HUD element"), configOptions::showEHP, tooltip = Text.literal("Must have Action Bar HUD elements Enabled")) ) @@ -320,6 +323,12 @@ class DulkirConfig { garden.addEntry( entryBuilder.mkToggle(Text.literal("Persistent Visitor alert (dependent on previous)"), configOptions::persistentVisitorAlert) ) + garden.addEntry( + entryBuilder.mkToggle(Text.literal("Show Blocks per second (SPEED)"), configOptions::speedBpsHud) + ) + garden.addEntry( + entryBuilder.mkToggle(Text.literal("Show Pitch/Yaw in HUD"), configOptions::pitchYawDisplay) + ) builder.transparentBackground() screen = builder.build() @@ -377,6 +386,9 @@ class DulkirConfig { var brokenHypNotif: Boolean = false, var steakDisplay: Boolean = false, var ichorHighlight: Boolean = false, + var speedHud: Boolean = false, + var speedBpsHud: Boolean = false, + var pitchYawDisplay: Boolean = false, ) @Serializable diff --git a/src/main/kotlin/com/dulkirfabric/hud/Garden.kt b/src/main/kotlin/com/dulkirfabric/hud/Garden.kt index 673b630..1c77c77 100644 --- a/src/main/kotlin/com/dulkirfabric/hud/Garden.kt +++ b/src/main/kotlin/com/dulkirfabric/hud/Garden.kt @@ -12,9 +12,11 @@ import net.minecraft.util.Formatting object Garden { private val visitorHud = DulkirConfig.hudElement("visitors", Text.literal("Visitors"), 100, 21, - Point(0.4056462738575835, 0.4479382203757649),1.2286775f) + Point(0.4056462738575835, 0.055456899963360104),1.101687f) private val composterHud = DulkirConfig.hudElement("composter", Text.literal("Composter"), 100, 21, - Point(0.4056462738575835, 0.4479382203757649),1.2286775f) + Point(0.027783937063393563, 0.10514400299398007),0.9619154f) + private val pitchYawHud = DulkirConfig.hudElement("pitch/yaw", Text.literal("Pitch/Yaw"), 100, 21, + Point(0.027783937063393563, 0.15514400299398007),0.9619154f) @EventHandler fun onHudRender(event: HudRenderEvent) { @@ -48,5 +50,30 @@ object Garden { context.drawText(mc.textRenderer, composterText,0, 1, -1, true) matrices.pop() } + var yaw = mc.player?.yaw ?: return + val pitch = mc.player?.pitch ?: return + yaw %= 360f + if (yaw < -180.0f) { + yaw += 360.0f; + } else if (yaw > 180.0f) { + yaw -= 360.0f; + } + + if (DulkirConfig.configOptions.pitchYawDisplay) { + matrices.push() + pitchYawHud.applyTransformations(matrices) + + val yawText = Text.literal("Yaw: ") + .setStyle(Style.EMPTY.withColor(Formatting.GOLD)) + .append(Text.literal("%.2f".format(yaw)) + .setStyle(Style.EMPTY.withColor(Formatting.GRAY))) + context.drawText(mc.textRenderer, yawText,0, 1, -1, true) + val pitchText = Text.literal("Pitch: ") + .setStyle(Style.EMPTY.withColor(Formatting.GOLD)) + .append(Text.literal("%.2f".format(pitch)) + .setStyle(Style.EMPTY.withColor(Formatting.GRAY))) + context.drawText(mc.textRenderer, pitchText,0, 13, -1, true) + matrices.pop() + } } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/hud/SpeedOverlay.kt b/src/main/kotlin/com/dulkirfabric/hud/SpeedOverlay.kt index 53aca50..85756ee 100644 --- a/src/main/kotlin/com/dulkirfabric/hud/SpeedOverlay.kt +++ b/src/main/kotlin/com/dulkirfabric/hud/SpeedOverlay.kt @@ -2,23 +2,48 @@ package com.dulkirfabric.hud import com.dulkirfabric.DulkirModFabric.mc import com.dulkirfabric.config.DulkirConfig +import com.dulkirfabric.events.ClientTickEvent import com.dulkirfabric.events.HudRenderEvent import com.dulkirfabric.util.TablistUtils import meteordevelopment.orbit.EventHandler import moe.nea.jarvis.api.Point +import net.fabricmc.loader.impl.lib.sat4j.core.Vec +import net.minecraft.text.Style import net.minecraft.text.Text +import net.minecraft.util.math.Vec3d object SpeedOverlay { private val speedHud = DulkirConfig.hudElement("SpeedHud", Text.literal("Speed"), 24 + 4, 11, - Point(0.3669986675110943, 0.9857798862704453), 1.6367052f) + Point(0.028240898890913812, 0.9857798862704453), 1.6367052f) + private val bpsOverlay = DulkirConfig.hudElement("MovementHud", Text.literal("Speed (BPS)"), 69, 11, + Point(0.020240898890, 0.9857798862704453), 1.5052f) + + + private var tickMomentum = 0.0 @EventHandler fun onHudRender(event: HudRenderEvent) { val context = event.context val matrices = context.matrices - matrices.push() - speedHud.applyTransformations(matrices) - context.drawText(mc.textRenderer, Text.literal(TablistUtils.persistentInfo.speed),0, 1, -1, true) - matrices.pop() + if (DulkirConfig.configOptions.speedHud) { + matrices.push() + speedHud.applyTransformations(matrices) + context.drawText(mc.textRenderer, Text.literal(TablistUtils.persistentInfo.speed),0, 1, -1, true) + matrices.pop() + } + if (DulkirConfig.configOptions.speedBpsHud) { + matrices.push() + bpsOverlay.applyTransformations(matrices) + context.drawText(mc.textRenderer, Text.literal("${"%.2f".format(tickMomentum)} BPS (speed)"),0, 1, -1, true) + matrices.pop() + } + } + + @EventHandler + fun onTick(event: ClientTickEvent) { + val player = mc.player ?: return + val last = Vec3d(player.prevX, player.prevY, player.prevZ) + val now = player.pos ?: return + tickMomentum = last.distanceTo(now) * 20 } }
\ No newline at end of file |