diff options
author | ronald <inglettronald@gmail.com> | 2023-07-30 17:41:02 -0500 |
---|---|---|
committer | ronald <inglettronald@gmail.com> | 2023-07-30 17:41:02 -0500 |
commit | cb1c7a0db3ba8990c65dce812a435bc1abadd369 (patch) | |
tree | c4ff025989ed50d40d9a7f9861961104667ba397 /src/main/kotlin/com | |
parent | d6faaa1f987b8766637fbc1e20a97112dfce164a (diff) | |
download | DulkirMod-Fabric-cb1c7a0db3ba8990c65dce812a435bc1abadd369.tar.gz DulkirMod-Fabric-cb1c7a0db3ba8990c65dce812a435bc1abadd369.tar.bz2 DulkirMod-Fabric-cb1c7a0db3ba8990c65dce812a435bc1abadd369.zip |
Added Rift Stuff and some cooldowns
Diffstat (limited to 'src/main/kotlin/com')
6 files changed, 147 insertions, 1 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt index 650fe87..355abb8 100644 --- a/src/main/kotlin/com/dulkirfabric/Registrations.kt +++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt @@ -15,6 +15,7 @@ import com.dulkirfabric.features.filters.Lightning import com.dulkirfabric.features.slayer.BossTimer import com.dulkirfabric.features.slayer.Demonlord import com.dulkirfabric.features.slayer.MiniBossHighlight +import com.dulkirfabric.features.slayer.Vampire import com.dulkirfabric.hud.ActionBarHudReplacements import com.dulkirfabric.hud.Garden import com.dulkirfabric.hud.SpeedOverlay @@ -97,6 +98,7 @@ object Registrations { EVENT_BUS.subscribe(Garden) EVENT_BUS.subscribe(VisitorAlert) EVENT_BUS.subscribe(BrokenHyp) + EVENT_BUS.subscribe(Vampire) 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 3118275..1457a85 100644 --- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt +++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt @@ -298,6 +298,14 @@ class DulkirConfig { slayer.addEntry( entryBuilder.mkToggle(Text.literal("Disable ALL particles during Blaze slayer boss"), configOptions::cleanBlaze) ) + slayer.addEntry( + entryBuilder.mkToggle(Text.literal("Vampire Steak Display"), configOptions::steakDisplay, + Text.literal("Shows a wireframe on vampire boss when you can 1 tap it")) + ) + slayer.addEntry( + entryBuilder.mkToggle(Text.literal("Blood Ichor Highlight"), configOptions::ichorHighlight, + Text.literal("Highlights the T5 mechanic that you line up with the boss.")) + ) val garden = builder.getOrCreateCategory(Text.literal("Garden")) garden.addEntry( @@ -367,6 +375,8 @@ class DulkirConfig { var visitorAlert: Boolean = false, var persistentVisitorAlert: Boolean = false, var brokenHypNotif: Boolean = false, + var steakDisplay: Boolean = false, + var ichorHighlight: Boolean = false, ) @Serializable diff --git a/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt b/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt index dfae99b..85c1f7b 100644 --- a/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt +++ b/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt @@ -31,6 +31,7 @@ object BrokenHyp { // get info about held item val tag = stack.nbt ?: return id = tag.getCompound("ExtraAttributes")?.getString("id") ?: "" + kill = tag.getCompound("ExtraAttributes")?.getInt("stats_book") ?: -1 championXp = tag.getCompound("ExtraAttributes")?.getDouble("champion_combat_xp") ?: -1.0 diff --git a/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt b/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt index 9bdfa13..0476d51 100644 --- a/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt +++ b/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt @@ -7,6 +7,7 @@ import com.dulkirfabric.util.SoundInfo import com.dulkirfabric.util.TrackedCooldown import com.dulkirfabric.util.Utils import meteordevelopment.orbit.EventHandler +import net.minecraft.client.sound.Sound import net.minecraft.item.ItemStack import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable import kotlin.math.round @@ -24,9 +25,31 @@ object CooldownDisplays { Pair( SoundInfo("entity.firework_rocket.launch", 1f, 3f), TrackedCooldown("SOS_FLARE".toRegex(), 20000, 0) + ), + Pair( + SoundInfo("block.lever.click", 2f, .55f), + TrackedCooldown("RAGNAROCK_AXE".toRegex(), 20000, 0) + ), + Pair( + SoundInfo("entity.generic.drink", 1.7936507f, 1f), + TrackedCooldown("HOLY_ICE".toRegex(), 4000, 0) + ), + Pair( + SoundInfo("entity.wolf.howl", 1.5238096f, .5f), + TrackedCooldown("WEIRDER_TUBA".toRegex(), 20000, 0) + ), + Pair( + SoundInfo("block.lava.pop", 2f, .4f), + TrackedCooldown("ROGUE_SWORD".toRegex(), 30000, 0) + ), + Pair( + SoundInfo("block.anvil.land", 0.4920635f, 1f), + TrackedCooldown("GIANTS_SWORD".toRegex(), 30000, 0) ) ) + private var lastRagTick: Long = 0 + fun shouldDisplay(stack: ItemStack, cir: CallbackInfoReturnable<Boolean>) { val cooldown = fetchCooldownItem(stack) ?: return cir.returnValue = System.currentTimeMillis() - cooldown.lastUsage < cooldown.cooldownDuration @@ -39,13 +62,21 @@ object CooldownDisplays { @EventHandler fun onSound(event: PlaySoundEvent) { if (!DulkirConfig.configOptions.duraCooldown) return - // Utils.debugSound(event) val path = event.sound.id.path val pitch = event.sound.pitch val volume = event.sound.volume // Figure out if we have a match in trackedCooldowns val matchResult = trackedCooldowns[SoundInfo(path, pitch, volume)] ?: return + + if (matchResult.itemID matches "RAGNAROCK_AXE") { + if (System.currentTimeMillis() - lastRagTick < 5000) { + lastRagTick = System.currentTimeMillis() + return + } else { + lastRagTick = System.currentTimeMillis() + } + } matchResult.lastUsage = System.currentTimeMillis() } diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/Vampire.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/Vampire.kt new file mode 100644 index 0000000..322d58a --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/features/slayer/Vampire.kt @@ -0,0 +1,93 @@ +package com.dulkirfabric.features.slayer + +import com.dulkirfabric.DulkirModFabric.mc +import com.dulkirfabric.config.DulkirConfig +import com.dulkirfabric.events.SlayerBossEvents +import com.dulkirfabric.events.WorldRenderLastEvent +import com.dulkirfabric.util.ScoreBoardUtils +import com.dulkirfabric.util.TablistUtils +import com.dulkirfabric.util.Utils.getInterpolatedPos +import com.dulkirfabric.util.Utils.getSkullTexture +import com.dulkirfabric.util.render.WorldRenderUtils +import meteordevelopment.orbit.EventHandler +import net.minecraft.block.entity.SkullBlockEntity +import net.minecraft.client.texture.PlayerSkinProvider +import net.minecraft.entity.EquipmentSlot +import net.minecraft.entity.decoration.ArmorStandEntity +import net.minecraft.item.Items +import net.minecraft.nbt.NbtHelper +import net.minecraft.util.math.Box +import java.awt.Color + +object Vampire { + + private const val char = "҉" + private const val ichorTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzAzNDA5MjNhNmRlNDgyNWExNzY4MTNkMTMzNTAzZWZmMTg2ZGIwODk2ZTMyYjY3MDQ5MjhjMmEyYmY2ODQyMiJ9fX0=" + private val box = Box(-.4, .1, -.4, .4, -1.9, .4) + private var inT5 = false + private val ichorBox = Box(- .5, 1.0, -.5, .5, 2.0, .5,) + + @EventHandler + fun steakDisplay(event: WorldRenderLastEvent) { + if (!DulkirConfig.configOptions.steakDisplay) return + if (TablistUtils.persistentInfo.area != "The Rift") return + + val ents = mc.world?.entities ?: return + ents.forEach { + if (it !is ArmorStandEntity || !it.hasCustomName()) return@forEach + if (!it.isMarker) return@forEach + if (!it.isCustomNameVisible) return@forEach + val name = it.customName?.string ?: return@forEach + if (name.contains(char) && name.contains("Bloodfiend")) { + val pos = it.getInterpolatedPos(mc.tickDelta) + WorldRenderUtils.drawWireFrame( + event.context, + box.offset(pos.x, pos.y, pos.z), + Color(0, 255, 255), + 8f + ) + } + } + } + + @EventHandler + fun ichorHighlight(event: WorldRenderLastEvent) { + if (!inT5) return + if (!DulkirConfig.configOptions.ichorHighlight) return + if (TablistUtils.persistentInfo.area != "The Rift") return + + val ents = mc.world?.entities ?: return + ents.forEach { + if (it !is ArmorStandEntity) return@forEach + val itemStack = it.getEquippedStack(EquipmentSlot.HEAD) ?: return@forEach + val item = itemStack.item ?: return@forEach + if (item !== Items.PLAYER_HEAD) return@forEach + val textureId = getSkullTexture(itemStack) ?: return@forEach + if (textureId != ichorTexture) return@forEach + val pos = it.getInterpolatedPos(mc.tickDelta) + WorldRenderUtils.drawWireFrame( + event.context, + ichorBox.offset(pos.x, pos.y, pos.z), + Color(0, 255, 255), + 8f, + ) + } + } + + @EventHandler + fun onSlayerStart(event: SlayerBossEvents.Spawn) { + if (ScoreBoardUtils.slayerType == "Riftstalker Bloodfiend V") + inT5 = true + } + + @EventHandler + fun onSlayerKill(event: SlayerBossEvents.Kill) { + inT5 = false + } + + @EventHandler + fun onSlayerFail(event: SlayerBossEvents.Fail) { + inT5 = false + } +}
\ 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 c2d65c3..18a442e 100644 --- a/src/main/kotlin/com/dulkirfabric/util/Utils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/Utils.kt @@ -4,7 +4,11 @@ import com.dulkirfabric.events.PlaySoundEvent import com.dulkirfabric.events.SlayerBossEvents import com.dulkirfabric.events.chat.ChatEvents import meteordevelopment.orbit.EventHandler +import net.minecraft.block.entity.SkullBlockEntity +import net.minecraft.client.texture.PlayerSkinProvider import net.minecraft.entity.Entity +import net.minecraft.item.ItemStack +import net.minecraft.nbt.NbtHelper import net.minecraft.util.math.Vec3d object Utils { @@ -42,4 +46,9 @@ object Utils { SlayerBossEvents.Fail(ScoreBoardUtils.slayerType ?: return ScoreBoardUtils.err()).post() } } + + fun getSkullTexture(itemStack: ItemStack): String? { + return itemStack.getSubNbt(SkullBlockEntity.SKULL_OWNER_KEY)?.let(NbtHelper::toGameProfile)?.properties?.get( + PlayerSkinProvider.TEXTURES)?.first()?.value + } }
\ No newline at end of file |