aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAppability <appable@icloud.com>2022-10-30 20:42:56 -0700
committerAppability <appable@icloud.com>2022-11-01 10:37:47 -0700
commit38e6266d2e608f376833dc9bc0c1074bed24535b (patch)
treeecf6e02eca2263b0bf4f5b8791143153dd826470
parenta0c2f3baf572c747321812241ad941f79218c875 (diff)
downloadAmbientAddons-38e6266d2e608f376833dc9bc0c1074bed24535b.tar.gz
AmbientAddons-38e6266d2e608f376833dc9bc0c1074bed24535b.tar.bz2
AmbientAddons-38e6266d2e608f376833dc9bc0c1074bed24535b.zip
kuudra HP display features
-rw-r--r--src/main/java/com/ambientaddons/mixin/MixinBossStatus.java21
-rw-r--r--src/main/kotlin/com/ambientaddons/AmbientAddons.kt8
-rw-r--r--src/main/kotlin/com/ambientaddons/config/Config.kt6
-rw-r--r--src/main/kotlin/com/ambientaddons/events/BossStatusEvent.kt8
-rw-r--r--src/main/kotlin/com/ambientaddons/features/kuudra/KuudraHp.kt25
-rw-r--r--src/main/kotlin/com/ambientaddons/features/kuudra/KuudraReady.kt (renamed from src/main/kotlin/com/ambientaddons/features/misc/KuudraReady.kt)2
-rw-r--r--src/main/kotlin/com/ambientaddons/features/misc/BonzoMask.kt2
-rw-r--r--src/main/kotlin/com/ambientaddons/utils/Timer.kt30
8 files changed, 98 insertions, 4 deletions
diff --git a/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java b/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java
new file mode 100644
index 0000000..9cf0a52
--- /dev/null
+++ b/src/main/java/com/ambientaddons/mixin/MixinBossStatus.java
@@ -0,0 +1,21 @@
+package com.ambientaddons.mixin;
+
+import com.ambientaddons.events.BossStatusEvent;
+import net.minecraft.entity.boss.BossStatus;
+import net.minecraft.entity.boss.IBossDisplayData;
+import net.minecraftforge.common.MinecraftForge;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(BossStatus.class)
+public abstract class MixinBossStatus {
+
+ @Inject(method = "setBossStatus", at = @At("HEAD"), cancellable = true)
+ private static void onSetBossStatus(IBossDisplayData displayData, boolean hasColorModifierIn, CallbackInfo ci) {
+ if (MinecraftForge.EVENT_BUS.post(new BossStatusEvent(displayData, hasColorModifierIn))) {
+ ci.cancel();
+ }
+ }
+}
diff --git a/src/main/kotlin/com/ambientaddons/AmbientAddons.kt b/src/main/kotlin/com/ambientaddons/AmbientAddons.kt
index 57ded8a..406cc41 100644
--- a/src/main/kotlin/com/ambientaddons/AmbientAddons.kt
+++ b/src/main/kotlin/com/ambientaddons/AmbientAddons.kt
@@ -10,6 +10,8 @@ import com.ambientaddons.features.dungeon.*
import com.ambientaddons.features.dungeon.terminals.MelodyHelper
import com.ambientaddons.features.keybinds.PerspectiveKeybind
import com.ambientaddons.features.keybinds.SendLastMessageKeybind
+import com.ambientaddons.features.kuudra.KuudraReady
+import com.ambientaddons.features.kuudra.KuudraHp
import com.ambientaddons.features.misc.*
import com.ambientaddons.gui.GuiElement
import com.ambientaddons.utils.SBLocation
@@ -74,13 +76,15 @@ class AmbientAddons {
CrimsonFishing,
CatOverlay,
PingOverlay,
- ThornOverlay
+ ThornOverlay,
+ KuudraHp
).forEach(MinecraftForge.EVENT_BUS::register)
keyBinds.values.forEach(ClientRegistry::registerKeyBinding)
guiElements = listOf(
CatOverlay.element,
PingOverlay.element,
- ThornOverlay.element
+ ThornOverlay.element,
+ KuudraHp.element
)
}
diff --git a/src/main/kotlin/com/ambientaddons/config/Config.kt b/src/main/kotlin/com/ambientaddons/config/Config.kt
index 753d401..8c20b46 100644
--- a/src/main/kotlin/com/ambientaddons/config/Config.kt
+++ b/src/main/kotlin/com/ambientaddons/config/Config.kt
@@ -13,6 +13,7 @@ object Config : Vigilant(
var kuudraReady = false
+ var kuudraHp = false
var autoTrapper = false
var trapperEsp = false
@@ -58,6 +59,11 @@ object Config : Vigilant(
name = "Automatically ready in Kuudra",
description = "Automatically clicks the ready pane when the ready GUI is opened."
)
+ switch(
+ ::kuudraHp,
+ name = "Show Kuudra health",
+ description = "Shows Kuudra health percentage in boss bar.",
+ )
}
subcategory("Trevor the Trapper") {
switch(
diff --git a/src/main/kotlin/com/ambientaddons/events/BossStatusEvent.kt b/src/main/kotlin/com/ambientaddons/events/BossStatusEvent.kt
new file mode 100644
index 0000000..cefd993
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/events/BossStatusEvent.kt
@@ -0,0 +1,8 @@
+package com.ambientaddons.events
+
+import net.minecraft.entity.boss.IBossDisplayData
+import net.minecraftforge.fml.common.eventhandler.Cancelable
+import net.minecraftforge.fml.common.eventhandler.Event
+
+@Cancelable
+class BossStatusEvent(val displayData: IBossDisplayData, val hasColorModifierIn: Boolean) : Event() \ No newline at end of file
diff --git a/src/main/kotlin/com/ambientaddons/features/kuudra/KuudraHp.kt b/src/main/kotlin/com/ambientaddons/features/kuudra/KuudraHp.kt
new file mode 100644
index 0000000..79f6428
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/kuudra/KuudraHp.kt
@@ -0,0 +1,25 @@
+package com.ambientaddons.features.kuudra
+
+import AmbientAddons.Companion.config
+import com.ambientaddons.events.BossStatusEvent
+import com.ambientaddons.gui.GuiElement
+import com.ambientaddons.utils.Area
+import com.ambientaddons.utils.Extensions.stripControlCodes
+import com.ambientaddons.utils.SBLocation
+import net.minecraft.entity.boss.BossStatus
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object KuudraHp {
+
+ fun onBossBarSet(event: BossStatusEvent) {
+ if (!config.kuudraHp || SBLocation.area != Area.Kuudra) return
+ val bossData = event.displayData
+ if (bossData.displayName.unformattedText.stripControlCodes().contains("Kuudra")) {
+ BossStatus.healthScale = bossData.health / bossData.maxHealth
+ BossStatus.statusBarTime = 100
+ BossStatus.bossName = "${bossData.displayName.formattedText} §r§8 - §r§d ${S}"
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/ambientaddons/features/misc/KuudraReady.kt b/src/main/kotlin/com/ambientaddons/features/kuudra/KuudraReady.kt
index d9be1dd..8133182 100644
--- a/src/main/kotlin/com/ambientaddons/features/misc/KuudraReady.kt
+++ b/src/main/kotlin/com/ambientaddons/features/kuudra/KuudraReady.kt
@@ -1,4 +1,4 @@
-package com.ambientaddons.features.misc
+package com.ambientaddons.features.kuudra
import AmbientAddons.Companion.config
import AmbientAddons.Companion.mc
diff --git a/src/main/kotlin/com/ambientaddons/features/misc/BonzoMask.kt b/src/main/kotlin/com/ambientaddons/features/misc/BonzoMask.kt
index 2e8be9e..022a435 100644
--- a/src/main/kotlin/com/ambientaddons/features/misc/BonzoMask.kt
+++ b/src/main/kotlin/com/ambientaddons/features/misc/BonzoMask.kt
@@ -38,7 +38,7 @@ object BonzoMask {
else -> false
}
if (config.maskWarning && didMaskProc) {
- mc.ingameGUI.displayTitle("§cMask!", null, 5, 20, 5)
+ mc.ingameGUI.displayTitle("§cMask!", null, 5, 40, 5)
}
}
diff --git a/src/main/kotlin/com/ambientaddons/utils/Timer.kt b/src/main/kotlin/com/ambientaddons/utils/Timer.kt
new file mode 100644
index 0000000..dab30b2
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/utils/Timer.kt
@@ -0,0 +1,30 @@
+package com.ambientaddons.utils
+
+class Timer {
+ private var previousTime: Long = 0
+ private var startTime: Long? = null
+
+ var isRunning: Boolean = false
+ private set
+
+ private val sessionTime: Long
+ get() {
+ return startTime?.let { System.currentTimeMillis() - it } ?: 0
+ }
+
+ private val time: Long
+ get() {
+ return sessionTime?.let { it + previousTime } ?: 0
+ }
+
+ fun start() {
+ isRunning = true
+ startTime = System.currentTimeMillis()
+ }
+
+ fun stop() {
+ isRunning = false
+ previousTime = sessionTime
+ startTime = null
+ }
+} \ No newline at end of file