diff options
author | ronald <inglettronald@gmail.com> | 2023-07-29 00:13:53 -0500 |
---|---|---|
committer | ronald <inglettronald@gmail.com> | 2023-07-29 00:13:53 -0500 |
commit | d3e13e38e22b8eecd5198c59cf6a132cc9425b33 (patch) | |
tree | e70a8fdc86d00cf22a281fcde09b856f09b45a11 /src/main/kotlin/com | |
parent | 71b8238eff91de0243e641c2eeadacd61b8f0f88 (diff) | |
download | DulkirMod-Fabric-d3e13e38e22b8eecd5198c59cf6a132cc9425b33.tar.gz DulkirMod-Fabric-d3e13e38e22b8eecd5198c59cf6a132cc9425b33.tar.bz2 DulkirMod-Fabric-d3e13e38e22b8eecd5198c59cf6a132cc9425b33.zip |
Lots of slayer backend and a smattering of random features (Lightning/fire culling, chat stacking improvements, aotv highlight stuff, etc)
Diffstat (limited to 'src/main/kotlin/com')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/Registrations.kt | 10 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt | 32 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt | 15 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt | 17 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/chat/ChatStacking.kt | 23 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/filters/CullExplosionParticles.kt (renamed from src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt) | 2 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt | 19 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt | 43 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/slayer/MiniBossHighlight.kt | 26 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt | 26 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/util/Utils.kt | 13 |
12 files changed, 208 insertions, 20 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt index 7db8905..0a87c0d 100644 --- a/src/main/kotlin/com/dulkirfabric/Registrations.kt +++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt @@ -10,18 +10,22 @@ import com.dulkirfabric.features.* import com.dulkirfabric.features.chat.AbiPhoneDND import com.dulkirfabric.features.chat.BridgeBotFormatter import com.dulkirfabric.features.chat.ChatStacking +import com.dulkirfabric.features.filters.CullExplosionParticles +import com.dulkirfabric.features.filters.Lightning +import com.dulkirfabric.features.slayer.Demonlord import com.dulkirfabric.features.slayer.MiniBossHighlight import com.dulkirfabric.hud.ActionBarHudReplacements import com.dulkirfabric.hud.SpeedOverlay import com.dulkirfabric.util.ActionBarUtil import com.dulkirfabric.util.ScoreBoardUtils import com.dulkirfabric.util.TablistUtils +import com.dulkirfabric.util.Utils +import com.dulkirfabric.util.render.HudRenderUtil import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents -import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents @@ -83,6 +87,10 @@ object Registrations { EVENT_BUS.subscribe(AotvHighlight) EVENT_BUS.subscribe(MiniBossHighlight) EVENT_BUS.subscribe(ScoreBoardUtils) + EVENT_BUS.subscribe(HudRenderUtil) + EVENT_BUS.subscribe(Demonlord) + EVENT_BUS.subscribe(Lightning) + EVENT_BUS.subscribe(Utils) if (FabricLoader.getInstance().isDevelopmentEnvironment) EVENT_BUS.subscribe(RenderTest) diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt index 3536890..246912a 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -113,6 +113,12 @@ class DulkirConfig { entryBuilder.mkToggle(Text.literal("Hide Hunger Overlay in Skyblock"), configOptions::hideHungerOverlay) ) general.addEntry( + entryBuilder.mkToggle(Text.literal("Hide Fire Overlay"), configOptions::hideFireOverlay) + ) + general.addEntry( + entryBuilder.mkToggle(Text.literal("Hide Lightning (SkyBlock only)"), configOptions::hideLightning) + ) + general.addEntry( entryBuilder.startIntSlider(Text.literal("Anti Downtime Alarm"), configOptions.alarmTimeout, 0, 1000) .setSaveConsumer { configOptions.alarmTimeout = it @@ -154,6 +160,10 @@ class DulkirConfig { entryBuilder.mkKeyField(Text.literal("Dynamic Key"), configOptions::dynamicKey) ) shortcuts.addEntry( + entryBuilder.mkToggle(Text.literal("Only Register Shortcuts in Skyblock"), configOptions::macrosSkyBlockOnly, + Text.literal("Useful if you want to use some of these binds elsewhere for non-skyblock specific stuff.")) + ) + shortcuts.addEntry( ConfigHelper.mkConfigList( Text.literal("Macros"), configOptions::macrosList, @@ -259,6 +269,18 @@ class DulkirConfig { .build() ) + val slayer = builder.getOrCreateCategory(Text.literal("Slayer")) + slayer.addEntry( + entryBuilder.mkToggle(Text.literal("MiniBoss Highlight Box"), configOptions::boxMinis) + ) + slayer.addEntry( + entryBuilder.mkToggle(Text.literal("MiniBoss Announcement Alert"), configOptions::announceMinis) + ) + slayer.addEntry( + entryBuilder.mkToggle(Text.literal("Blaze Slayer Attunement Display"), configOptions::attunementDisplay, + Text.literal("Shows a wireframe in the correct color for the slayer.")) + ) + builder.transparentBackground() screen = builder.build() } @@ -268,6 +290,7 @@ class DulkirConfig { var invScaleBool: Boolean = false, var inventoryScale: Float = 1f, var macrosList: List<Macro> = listOf(Macro(UNKNOWN_KEY, "")), + var macrosSkyBlockOnly: Boolean = false, var aliasList: List<Alias> = listOf(Alias("", "")), var ignoreReverseThirdPerson: Boolean = false, var dynamicKey: InputUtil.Key = UNKNOWN_KEY, @@ -284,7 +307,7 @@ class DulkirConfig { var hideHungerOverlay: Boolean = true, var animationPreset: AnimationPreset = AnimationPreset(), var duraCooldown: Boolean = false, - var alarmTimeout: Int = 300, + var alarmTimeout: Int = 0, var arachneKeeperWaypoints: Boolean = false, var arachneSpawnTimer: Boolean = false, var bridgeFormatter: Boolean = false, @@ -295,7 +318,12 @@ class DulkirConfig { var showEHP: Boolean = false, var hideHeldItemTooltip: Boolean = false, var showEtherwarpPreview: Boolean = true, - var etherwarpPreviewColor: Int = 0x99FFFFFF.toInt() + var etherwarpPreviewColor: Int = 0x99FFFFFF.toInt(), + var announceMinis: Boolean = false, + var boxMinis: Boolean = false, + var attunementDisplay: Boolean = false, + var hideFireOverlay: Boolean = false, + var hideLightning: Boolean = false ) @Serializable diff --git a/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt b/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt new file mode 100644 index 0000000..d16c854 --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/events/SlayerBossEvents.kt @@ -0,0 +1,15 @@ +package com.dulkirfabric.events + +import com.dulkirfabric.events.base.Event + +class SlayerBossEvents { + data class Spawn( + val type: String, + var timestamp: Long = System.currentTimeMillis() + ): Event() + + data class Kill( + val type: String, + var timestamp: Long = System.currentTimeMillis() + ): Event() +} diff --git a/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt b/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt index 283886f..9091351 100644 --- a/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt +++ b/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt @@ -5,6 +5,7 @@ import com.dulkirfabric.config.DulkirConfig import com.dulkirfabric.events.ClientTickEvent import com.dulkirfabric.events.LongUpdateEvent import com.dulkirfabric.events.WorldRenderLastEvent +import com.dulkirfabric.util.TextUtils import com.dulkirfabric.util.render.WorldRenderUtils import meteordevelopment.orbit.EventHandler import net.minecraft.client.MinecraftClient @@ -12,6 +13,7 @@ import net.minecraft.client.util.InputUtil import net.minecraft.entity.Entity import net.minecraft.util.hit.BlockHitResult import net.minecraft.util.hit.HitResult +import net.minecraft.util.math.BlockPos import net.minecraft.util.math.Vec3d import net.minecraft.world.RaycastContext import org.lwjgl.glfw.GLFW @@ -43,20 +45,26 @@ object AotvHighlight { // check that holding aotv if (heldItemID != "ASPECT_OF_THE_VOID") return val handle = MinecraftClient.getInstance().window.handle - if (!InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_LEFT_SHIFT)) return + if (!InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_LEFT_SHIFT) || mc.currentScreen != null) return // Find the targeted block with a range of 60.9 val entity = mc.cameraEntity if (mc.player == null) return val blockHit = raycast(entity!!, 60.9, mc.tickDelta) if (blockHit.type != HitResult.Type.BLOCK) return - val pos = (blockHit as BlockHitResult).blockPos + val pos: BlockPos = (blockHit as BlockHitResult).blockPos + if (!isValidTeleportLocation(pos)) return // if found display box WorldRenderUtils.drawBox(event.context, pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble(), 1.0, 1.0, 1.0, Color(DulkirConfig.configOptions.etherwarpPreviewColor, true), false) } + private fun isValidTeleportLocation(pos: BlockPos): Boolean { + // TODO: Implement this (LOTS OF CASES, seems annoying) + return true + } + private fun raycast(entity: Entity, maxDistance: Double, tickDelta: Float): HitResult { // 1.7 if not crouch, 1.54 if crouch val crouching = mc.player!!.isSneaking @@ -74,4 +82,9 @@ object AotvHighlight { ) ) } + + private fun err(): Boolean { + TextUtils.info("§6Error in getting block info for AOTV highlight, please report.") + return true + } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt b/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt index f0ca052..97ea6e4 100644 --- a/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt +++ b/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt @@ -4,6 +4,7 @@ import com.dulkirfabric.commands.DynamicKeyCommand import com.dulkirfabric.config.DulkirConfig import com.dulkirfabric.events.WorldKeyPressEvent import com.dulkirfabric.util.TextUtils +import com.dulkirfabric.util.Utils import meteordevelopment.orbit.EventHandler object KeyShortCutImpl { @@ -12,6 +13,7 @@ object KeyShortCutImpl { @EventHandler fun onKeyPress(event: WorldKeyPressEvent) { + if (DulkirConfig.configOptions.macrosSkyBlockOnly && !Utils.isInSkyblock()) return DulkirConfig.configOptions.macrosList.forEach { if (it.keyBinding.code == event.key) { // Spam Prevention diff --git a/src/main/kotlin/com/dulkirfabric/features/chat/ChatStacking.kt b/src/main/kotlin/com/dulkirfabric/features/chat/ChatStacking.kt index 02d1914..d222540 100644 --- a/src/main/kotlin/com/dulkirfabric/features/chat/ChatStacking.kt +++ b/src/main/kotlin/com/dulkirfabric/features/chat/ChatStacking.kt @@ -4,7 +4,9 @@ import com.dulkirfabric.DulkirModFabric.mc import com.dulkirfabric.events.LongUpdateEvent import com.dulkirfabric.events.chat.ChatEvents import com.dulkirfabric.util.ScoreBoardUtils.formattedString +import com.dulkirfabric.util.TextUtils import meteordevelopment.orbit.EventHandler +import net.minecraft.text.MutableText import net.minecraft.text.Text object ChatStacking { @@ -12,19 +14,32 @@ object ChatStacking { data class ChatLog(var timestamp: Long, val message: Text, var frequency: Int) private var chatLogs = mutableSetOf<ChatLog>() + private val stackRegex = """ §7\((\d+)\)$""".toRegex() + private val whiteListedMessages = listOf( + "".toRegex(), + "(-+)".toRegex() + ) @EventHandler - fun modifyChat(event: ChatEvents.ModifyChat) { + fun modifyChat(event: ChatEvents.AllowChat) { chatLogs.forEach { curMsg -> if (curMsg.message.string.equals(event.message.string)) { + // Probably don't stack empty lines and the long bars + if (whiteListedMessages.any { + it matches event.message.string + }) return + curMsg.timestamp = System.currentTimeMillis() curMsg.frequency++ mc.inGameHud.chatHud.messages.removeIf { msg -> - msg.content.string == curMsg.message.string - && mc.inGameHud.ticks - msg.creationTick >= 1200 + TextUtils.stripColorCodes(msg.content.string.replace(stackRegex, "")) == curMsg.message.string + && mc.inGameHud.ticks - msg.creationTick <= 1200 } + mc.inGameHud.chatHud.addMessage(Text.literal("${curMsg.message.formattedString()} §7(${curMsg.frequency})")) mc.inGameHud.chatHud.refresh() - event.setReturnValue(Text.literal("${curMsg.message.formattedString()} §7(${curMsg .frequency})")) + // TODO: implement something like this to avoid stripColorCodes call + // MutableText.of(event.message.content).append(Text.literal(" §7(${curMsg.frequency})")) + event.cancel() return } } diff --git a/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt b/src/main/kotlin/com/dulkirfabric/features/filters/CullExplosionParticles.kt index 302beb9..3ab193d 100644 --- a/src/main/kotlin/com/dulkirfabric/features/CullExplosionParticles.kt +++ b/src/main/kotlin/com/dulkirfabric/features/filters/CullExplosionParticles.kt @@ -1,4 +1,4 @@ -package com.dulkirfabric.features +package com.dulkirfabric.features.filters import com.dulkirfabric.config.DulkirConfig import com.dulkirfabric.events.AddParticleEvent diff --git a/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt b/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt new file mode 100644 index 0000000..3c3339a --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt @@ -0,0 +1,19 @@ +package com.dulkirfabric.features.filters + +import com.dulkirfabric.config.DulkirConfig +import com.dulkirfabric.events.AddParticleEvent +import com.dulkirfabric.events.EntityLoadEvent +import com.dulkirfabric.util.Utils +import meteordevelopment.orbit.EventHandler +import net.minecraft.entity.LightningEntity + +object Lightning { + @EventHandler + fun cull(event: EntityLoadEvent) { + if (!DulkirConfig.configOptions.hideLightning) return + if (!Utils.isInSkyblock()) return + if (event.entity is LightningEntity) { + event.entity.kill() + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt new file mode 100644 index 0000000..434c866 --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt @@ -0,0 +1,43 @@ +package com.dulkirfabric.features.slayer + +import com.dulkirfabric.DulkirModFabric.mc +import com.dulkirfabric.events.PlaySoundEvent +import com.dulkirfabric.events.WorldRenderLastEvent +import com.dulkirfabric.util.TablistUtils +import com.dulkirfabric.util.TextUtils +import com.dulkirfabric.util.Utils.debugSound +import com.dulkirfabric.util.Utils.getInterpolatedPos +import com.dulkirfabric.util.render.WorldRenderUtils +import meteordevelopment.orbit.EventHandler +import net.minecraft.entity.decoration.ArmorStandEntity +import net.minecraft.util.math.Box +import java.awt.Color + +object Demonlord { + private val phaseColors = listOf( + "CRYSTAL ♨" to Color(15, 247, 236, 255), + "ASHEN ♨" to Color(0, 0, 0, 255), + "AURIC ♨" to Color(206, 219, 57, 255), + "SPIRIT ♨" to Color(255, 255, 255, 255) + ) + private val box = Box(-.5, -.4, -.5, .5, -1.9, .5) + + @EventHandler + fun attunementHighlight(event: WorldRenderLastEvent) { + if (TablistUtils.persistentInfo.area != "Crimson Isle") return + val ents = mc.world?.entities ?: return + ents.forEach { ent -> + if (ent is ArmorStandEntity && ent.hasCustomName()) { + val name = TextUtils.stripColorCodes(ent.customName?.string ?: return@forEach) + val color = phaseColors.firstOrNull { name.contains(it.first) }?.second ?: return@forEach + val pos = ent.getInterpolatedPos(event.context.tickDelta()) + WorldRenderUtils.drawWireFrame( + event.context, + box.offset(pos.x, pos.y, pos.z), + color, + 8f + ) + } + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/MiniBossHighlight.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/MiniBossHighlight.kt index 4720890..61c712a 100644 --- a/src/main/kotlin/com/dulkirfabric/features/slayer/MiniBossHighlight.kt +++ b/src/main/kotlin/com/dulkirfabric/features/slayer/MiniBossHighlight.kt @@ -1,24 +1,30 @@ package com.dulkirfabric.features.slayer import com.dulkirfabric.DulkirModFabric.mc +import com.dulkirfabric.config.DulkirConfig +import com.dulkirfabric.events.PlaySoundEvent import com.dulkirfabric.events.WorldRenderLastEvent import com.dulkirfabric.util.ScoreBoardUtils -import com.dulkirfabric.util.TextUtils import com.dulkirfabric.util.Utils.getInterpolatedPos +import com.dulkirfabric.util.render.HudRenderUtil import com.dulkirfabric.util.render.WorldRenderUtils import meteordevelopment.orbit.EventHandler import net.minecraft.entity.decoration.ArmorStandEntity +import net.minecraft.text.Style +import net.minecraft.text.Text +import net.minecraft.util.Formatting import net.minecraft.util.math.Box import java.awt.Color +import java.time.Duration object MiniBossHighlight { data class MiniBoss(val name: String, val box: Box) - private val zombieBox = Box(-.3, .1, -.3, .3, -1.9, .3) + private val zombieBox = Box(-.4, .1, -.4, .4, -1.9, .4) private val spiderBox = Box(-.7, -.3, -.7, .7, -1.2, .7) - private val wolfBox = Box(-.3, -0.0, -.3, .3, -.85, .3) - private val emanBox = Box(-.3, 0.0, -.3, .3, -2.9, .3) + private val wolfBox = Box(-.4, -0.0, -.4, .4, -.85, .4) + private val emanBox = Box(-.4, 0.0, -.4, .4, -2.9, .4) private val blazeBox = Box(-.4, -.2, -.4, .4, -2.0, .4) private val miniBosses = listOf( @@ -43,8 +49,8 @@ object MiniBossHighlight { @EventHandler fun drawMiniBossBoxes(event: WorldRenderLastEvent) { - // TODO: check for a slayer quest being active if (!ScoreBoardUtils.hasActiveSlayerQuest) return + if (!DulkirConfig.configOptions.boxMinis) return val ents = mc.world?.entities ?: return @@ -57,4 +63,14 @@ object MiniBossHighlight { } } + // TODO: fix + @EventHandler + fun onSound(event: PlaySoundEvent) { + if (!DulkirConfig.configOptions.announceMinis) return + if (event.sound.id.path != "entity.generic.explode") return + if (event.sound.pitch != 1.2857143f) return + if (event.sound.volume != .6f) return + HudRenderUtil.drawTitle(Text.literal("MiniBoss Spawned").setStyle(Style.EMPTY.withColor(Formatting.RED)), + Duration.ofMillis(1000)) + } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt b/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt index fb2f967..c62cbab 100644 --- a/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt @@ -2,6 +2,8 @@ package com.dulkirfabric.util import com.dulkirfabric.DulkirModFabric import com.dulkirfabric.events.LongUpdateEvent +import com.dulkirfabric.events.PlaySoundEvent +import com.dulkirfabric.events.SlayerBossEvents import meteordevelopment.orbit.EventHandler import net.minecraft.scoreboard.Team import net.minecraft.text.StringVisitable @@ -13,6 +15,7 @@ import java.util.* object ScoreBoardUtils { var hasActiveSlayerQuest = false + var slayerType: String? = "" /** * Gets Scoreboard lines, will return null if not in Skyblock. @@ -77,8 +80,27 @@ object ScoreBoardUtils { @EventHandler fun updateUtility(event: LongUpdateEvent) { val lines = getLines() ?: return - hasActiveSlayerQuest = lines.any { - it.contains("Slayer Quest") + lines.forEach { + when { + it.contains("Slayer Quest") -> { + hasActiveSlayerQuest = true + val i = lines.indexOf(it) + 1 + if (i == 0) return err() + slayerType = lines[i] + } + } } } + + @EventHandler + fun onSound(event: PlaySoundEvent) { + if (event.sound.id.path != "entity.wither.shoot") return + if (event.sound.pitch != 0.6984127f) return + if (event.sound.volume != .5f) return + SlayerBossEvents.Spawn(slayerType?: return err()).post() + } + + fun err() { + TextUtils.info("§6Error Determining active slayer type, please report.") + } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/util/Utils.kt b/src/main/kotlin/com/dulkirfabric/util/Utils.kt index 93597d2..1f781d3 100644 --- a/src/main/kotlin/com/dulkirfabric/util/Utils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/Utils.kt @@ -1,6 +1,9 @@ package com.dulkirfabric.util import com.dulkirfabric.events.PlaySoundEvent +import com.dulkirfabric.events.SlayerBossEvents +import com.dulkirfabric.events.chat.ChatEvents +import meteordevelopment.orbit.EventHandler import net.minecraft.entity.Entity import net.minecraft.util.math.Vec3d @@ -13,9 +16,7 @@ object Utils { * Prints relevant information about a sound that is being displayed */ fun debugSound(event: PlaySoundEvent) { - if (event.sound.id.path == "entity.player.hurt" - && event.sound.pitch == 0f - && event.sound.volume == 0f) return + if (event.sound.id.path == "entity.player.hurt") return println("Path: ${event.sound.id.path}") println("Pitch: ${event.sound.pitch}") println("Volume: ${event.sound.volume}") @@ -32,4 +33,10 @@ object Utils { val prevPos = Vec3d(this.prevX, this.prevY, this.prevZ) return lerp(prevPos, this.pos, tickDelta) } + + @EventHandler + fun detectSlayerKill(event: ChatEvents.AllowChat) { + if (event.message.string.trim() != "SLAYER QUEST COMPLETE!") return + SlayerBossEvents.Kill(ScoreBoardUtils.slayerType?: return ScoreBoardUtils.err()).post() + } }
\ No newline at end of file |