Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object ChatNotifications {

if(display == null) display = it.colorFormattedDisplay
SoundUtils.dingHighSound.play()
RenderUtils.drawTitle(display, NobaColor.WHITE, 2.75f, duration = 2.seconds, id = "chat_notification")
RenderUtils.drawTitle(display, color = NobaColor.WHITE, scale = 2.75f, duration = 2.seconds, id = "chat_notification")
return
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object ChocolateFactoryFeatures {
if(event.itemInHand.skyBlockId != HoppityAPI.LOCATOR) return
if(hasMythicRabbitSpawned) return

RenderUtils.drawTitle(tr("nobaaddons.chocolateFactory.spawnMythicRabbit", "Spawn Mythic Rabbit!"), NobaColor.RED)
RenderUtils.drawTitle(tr("nobaaddons.chocolateFactory.spawnMythicRabbit", "Spawn Mythic Rabbit!"), color = NobaColor.RED)
}

private fun onSendCommand(event: SendMessageEvents.SendCommand) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,62 @@ package me.nobaboy.nobaaddons.features.dungeons

import me.nobaboy.nobaaddons.api.skyblock.DungeonsAPI
import me.nobaboy.nobaaddons.config.NobaConfig
import me.nobaboy.nobaaddons.events.impl.client.TickEvents
import me.nobaboy.nobaaddons.events.impl.client.EntityEvents
import me.nobaboy.nobaaddons.events.impl.skyblock.SkyBlockEvents
import me.nobaboy.nobaaddons.utils.EntityUtils
import me.nobaboy.nobaaddons.utils.MCUtils
import me.nobaboy.nobaaddons.utils.StringUtils.cleanFormatting
import me.nobaboy.nobaaddons.utils.getNobaVec
import me.nobaboy.nobaaddons.utils.render.HighlightMode
import me.nobaboy.nobaaddons.utils.render.RenderUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderFilled
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderFullBox
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderOutline
import me.owdding.ktmodules.Module
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.decoration.ArmorStandEntity

// TODO Rework and implement Entity outlines
@Module
object HighlightStarredMobs {
private val config get() = NobaConfig.dungeons.highlightStarredMobs
private val enabled: Boolean get() = config.enabled && !DungeonsAPI.inBoss()

private val starredMobs = mutableListOf<ArmorStandEntity>()
private val starredMobs = mutableListOf<LivingEntity>()

init {
SkyBlockEvents.ISLAND_CHANGE.register { starredMobs.clear() }
TickEvents.TICK.register { getStarredMobs() }
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::renderHighlights)
EntityEvents.POST_RENDER.register(this::onEntityRender)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::onWorldRender)
}

private fun getStarredMobs() {
private fun onEntityRender(event: EntityEvents.Render) {
if(!enabled) return

EntityUtils.getEntities<ArmorStandEntity>().filter {
it !in starredMobs &&
it.hasCustomName() &&
it.shouldRenderName() &&
it.customName!!.string.cleanFormatting().startsWith("✯ ") &&
it.customName!!.string.cleanFormatting().endsWith("❤")
}.forEach { starredMobs.add(it) }
val entity = event.entity as? LivingEntity ?: return
if(entity in starredMobs) return

val armorStand = EntityUtils.getNextEntity(entity, 1) as? ArmorStandEntity ?: return
if(MCUtils.player?.canSee(armorStand) != true) return
if(!armorStand.shouldRenderName() || !armorStand.hasCustomName()) return

val armorStandName = armorStand.name.string
if(!armorStandName.startsWith("✯") || !armorStandName.endsWith("❤")) return

starredMobs.add(entity)
}

private fun renderHighlights(context: WorldRenderContext) {
private fun onWorldRender(context: WorldRenderContext) {
if(!enabled) return

val player = MCUtils.player ?: return
starredMobs.removeIf { !it.isAlive }

val color = config.highlightColor
val mode = config.highlightMode

starredMobs.removeIf { !it.isAlive }
for(starredMob in starredMobs) {
if(!player.canSee(starredMob)) continue

val name = starredMob.customName!!.string.cleanFormatting()
val extraHeight = if("Fels" in name) 2.0 else if("Spider" in name) -0.25 else 1.0

val vec = starredMob.getNobaVec()

starredMobs.forEach { mob ->
when(mode) {
HighlightMode.OUTLINE -> RenderUtils.renderOutline(context, vec.add(x = -0.5, y = -1.0, z = -0.5), color, extraSizeBottomY = extraHeight)
HighlightMode.FILLED -> RenderUtils.renderFilledBox(context, vec.add(x = -0.5, y = -1.0, z = -0.5), color, extraSizeBottomY = extraHeight)
HighlightMode.FILLED_OUTLINE -> RenderUtils.renderOutlinedFilledBox(context, vec.add(x = -0.5, y = -1.0, z = -0.5), color, extraSizeBottomY = extraHeight)
HighlightMode.OUTLINE -> context.renderOutline(mob.boundingBox, color)
HighlightMode.FILLED -> context.renderFilled(mob.boundingBox, color)
HighlightMode.FILLED_OUTLINE -> context.renderFullBox(mob.boundingBox, color)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import me.nobaboy.nobaaddons.utils.NumberUtils.addSeparators
import me.nobaboy.nobaaddons.utils.Timestamp
import me.nobaboy.nobaaddons.utils.items.ItemUtils.skyBlockId
import me.nobaboy.nobaaddons.utils.math.ParticlePathFitter
import me.nobaboy.nobaaddons.utils.render.RenderUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderText
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderWaypoint
import me.nobaboy.nobaaddons.utils.tr
import me.owdding.ktmodules.Module
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
Expand All @@ -38,7 +39,7 @@ object HoppityEggGuess {
ParticleEvents.PARTICLE.register(this::onParticle)
ItemUseEvent.EVENT.register(this::onItemUse)
ChatMessageEvents.CHAT.register(this::onChatMessage)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::renderWaypoints)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::onWorldRender)
}

private fun onParticle(event: ParticleEvents.Particle) {
Expand Down Expand Up @@ -69,24 +70,22 @@ object HoppityEggGuess {
if(event.cleaned.startsWith("HOPPITY'S HUNT You found a Chocolate")) guessLocation = null
}

private fun renderWaypoints(context: WorldRenderContext) {
private fun onWorldRender(context: WorldRenderContext) {
if(!enabled) return

guessLocation?.let {
val distance = it.distanceToPlayer()
val formattedDistance = distance.toInt().addSeparators()

RenderUtils.renderWaypoint(context, it, NobaColor.AQUA, throughBlocks = true)
RenderUtils.renderText(
context,
context.renderWaypoint(it, NobaColor.AQUA, throughBlocks = true)
context.renderText(
it.center().raise(),
tr("nobaaddons.events.hoppity.eggGuessWaypoint", "Egg Guess"),
color = NobaColor.AQUA,
yOffset = -10f,
throughBlocks = true
)
RenderUtils.renderText(
context,
context.renderText(
it.center().raise(),
"${formattedDistance}m",
color = NobaColor.GRAY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import me.nobaboy.nobaaddons.utils.TextUtils.toText
import me.nobaboy.nobaaddons.utils.Timestamp
import me.nobaboy.nobaaddons.utils.chat.ChatUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderText
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderWaypoint
import me.nobaboy.nobaaddons.utils.sound.SoundUtils
import me.nobaboy.nobaaddons.utils.tr
import me.owdding.ktmodules.Module
Expand Down Expand Up @@ -107,18 +109,16 @@ object BurrowWaypoints {

val distance = location.distance(LocationUtils.playerLocation, center = true)

RenderUtils.renderWaypoint(context, location, NobaColor.DARK_RED, throughBlocks = true)
RenderUtils.renderText(
context,
context.renderWaypoint(location, NobaColor.DARK_RED, throughBlocks = true)
context.renderText(
adjustedLocation,
tr("nobaaddons.events.mythological.inquisitor", "Inquisitor"),
color = NobaColor.DARK_RED,
yOffset = yOffset,
hideThreshold = 5.0,
throughBlocks = true,
)
RenderUtils.renderText(
context,
context.renderText(
adjustedLocation,
inquisitor.spawner,
color = NobaColor.GOLD,
Expand All @@ -128,8 +128,7 @@ object BurrowWaypoints {
)

if(config.showInquisitorDespawnTime) {
RenderUtils.renderText(
context,
context.renderText(
adjustedLocation,
tr("nobaaddons.events.mythological.inquisitorDespawnsIn", "Despawns in ${inquisitor.remainingTime}"),
color = NobaColor.GRAY,
Expand All @@ -150,9 +149,8 @@ object BurrowWaypoints {
type.displayName
}

RenderUtils.renderWaypoint(context, location, type.color, throughBlocks = true)
RenderUtils.renderText(
context,
context.renderWaypoint(location, type.color, throughBlocks = true)
context.renderText(
location.center().raise(),
text,
color = type.color,
Expand All @@ -171,18 +169,16 @@ object BurrowWaypoints {
val distance = it.distance(LocationUtils.playerLocation, center = true)
val formattedDistance = distance.toInt().addSeparators()

RenderUtils.renderWaypoint(context, it, NobaColor.AQUA, throughBlocks = distance > 10)
RenderUtils.renderText(
context,
context.renderWaypoint(it, NobaColor.AQUA, throughBlocks = distance > 10)
context.renderText(
adjustedLocation,
tr("nobaaddons.events.mythological.burrowGuessWaypoint", "Burrow Guess"),
color = NobaColor.AQUA,
yOffset = -10f,
hideThreshold = 5.0,
throughBlocks = true,
)
RenderUtils.renderText(
context,
context.renderText(
adjustedLocation,
"${formattedDistance}m",
color = NobaColor.GRAY,
Expand All @@ -200,7 +196,13 @@ object BurrowWaypoints {
nearestWarp = BurrowWarpLocations.getNearestWarp(targetLocation) ?: return
lastWarpSuggestTime = Timestamp.now()

RenderUtils.drawTitle(tr("nobaaddons.events.mythological.warpToPoint", "Warp to ${nearestWarp!!.warpPoint}"), NobaColor.GRAY, 2f, 30, 1.seconds)
RenderUtils.drawTitle(
tr("nobaaddons.events.mythological.warpToPoint", "Warp to ${nearestWarp!!.warpPoint}"),
color = NobaColor.GRAY,
scale = 2f,
offset = 30,
duration = 1.seconds
)
}

private fun getTargetLocation(): NobaVec? = InquisitorWaypoints.inquisitors.firstOrNull()?.location ?: guessLocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object InquisitorWaypoints {
val location = NobaVec(x, y, z)

inquisitors.add(Inquisitor(username, location))
RenderUtils.drawTitle("INQUISITOR!", NobaColor.DARK_RED, subtext = username.toText().gold())
RenderUtils.drawTitle("INQUISITOR!", subtext = username.toText().gold(), color = NobaColor.DARK_RED)
config.notificationSound.play()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import me.nobaboy.nobaaddons.utils.Timestamp.Companion.toShortString
import me.nobaboy.nobaaddons.utils.chat.ChatUtils
import me.nobaboy.nobaaddons.utils.chat.ChatUtils.clickAction
import me.nobaboy.nobaaddons.utils.chat.HypixelCommands
import me.nobaboy.nobaaddons.utils.render.RenderUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderBeacon
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderText
import me.nobaboy.nobaaddons.utils.toNobaVec
import me.owdding.ktmodules.Module
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
Expand All @@ -39,7 +40,7 @@ object HotspotWaypoints {
init {
SkyBlockEvents.ISLAND_CHANGE.register { hotspots.clear() }
EntityEvents.POST_RENDER.register(this::onEntityRender)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::renderWaypoints)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::onWorldRender)
}

private fun onEntityRender(event: EntityEvents.Render) {
Expand All @@ -63,15 +64,15 @@ object HotspotWaypoints {
hotspots.add(hotspot)
}

private fun renderWaypoints(context: WorldRenderContext) {
private fun onWorldRender(context: WorldRenderContext) {
if(!enabled) return

hotspots.removeIf { !it.armorStand.isAlive }
hotspots.forEach {
val time = it.remainingTime.ifEmpty { "Soon" }

RenderUtils.renderBeaconBeam(context, it.location, it.stat.color)
RenderUtils.renderText(context, it.location.center().raise(1.5), time, throughBlocks = true)
context.renderBeacon(it.location, it.stat.color)
context.renderText(it.location.center().raise(1.5), time, throughBlocks = true)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object SeaCreatureAlert {

val color = seaCreature.rarity.color ?: NobaColor.RED

RenderUtils.drawTitle(text, color, subtext = subtext, id = "sea_creature_alert")
RenderUtils.drawTitle(text, subtext = subtext, color = color, id = "sea_creature_alert")
config.notificationSound.play()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import me.nobaboy.nobaaddons.utils.BlockUtils.getBlockStateAt
import me.nobaboy.nobaaddons.utils.LocationUtils.distanceToPlayer
import me.nobaboy.nobaaddons.utils.getNobaVec
import me.nobaboy.nobaaddons.utils.items.ItemUtils.getSkullTexture
import me.nobaboy.nobaaddons.utils.render.RenderUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderFullBox
import me.nobaboy.nobaaddons.utils.render.RenderUtils.renderText
import me.nobaboy.nobaaddons.utils.tr
import me.owdding.ktmodules.Module
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents
Expand All @@ -28,7 +30,7 @@ object HighlightThunderSparks {
init {
SkyBlockEvents.ISLAND_CHANGE.register { thunderSparks.clear() }
EntityEvents.POST_RENDER.register(this::onEntityRender)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::renderHighlights)
WorldRenderEvents.AFTER_TRANSLUCENT.register(this::onWorldRender)
}

private fun onEntityRender(event: EntityEvents.Render) {
Expand All @@ -41,30 +43,32 @@ object HighlightThunderSparks {
thunderSparks.add(entity)
}

private fun renderHighlights(context: WorldRenderContext) {
private fun onWorldRender(context: WorldRenderContext) {
if(!enabled) return

thunderSparks.removeIf { !it.isAlive }

thunderSparks.forEach {
val vec = it.getNobaVec()
val distance = vec.distanceToPlayer()
val block = vec.roundToBlock().add(y = 1).getBlockStateAt()
val location = it.getNobaVec()
val distance = location.distanceToPlayer()
val block = location.roundToBlock().raise().getBlockStateAt()

val throughBlocks = distance < 6 && block.fluidState != null && block.fluidState.fluid is LavaFluid
val throughBlocks = distance < 6 && block.fluidState?.fluid is LavaFluid

RenderUtils.renderOutlinedFilledBox(
context,
vec.add(x = -0.5, z = -0.5),
context.renderFullBox(
location.add(x = -0.5, z = -0.5),
config.highlightColor,
extraSize = -0.25,
throughBlocks = throughBlocks
)
if(config.showText && distance < 10) RenderUtils.renderText(
context,
vec.raise(1.25),
"Thunder Spark",
throughBlocks = throughBlocks
)

if(config.showText && distance < 10) {
context.renderText(
location.raise(1.25),
tr("nobaaddons.fishing.thunderSpark", "Thunder Spark"),
throughBlocks = throughBlocks
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import me.nobaboy.nobaaddons.events.impl.render.ScreenRenderEvents
import me.nobaboy.nobaaddons.features.inventory.slotinfo.items.*
import me.nobaboy.nobaaddons.features.inventory.slotinfo.uielements.*
import me.nobaboy.nobaaddons.utils.NobaColor
import me.nobaboy.nobaaddons.utils.render.RenderUtils
import me.nobaboy.nobaaddons.utils.render.RenderUtils.drawText
import me.owdding.ktmodules.Module
import net.minecraft.client.font.TextRenderer
import net.minecraft.client.gui.DrawContext
Expand Down Expand Up @@ -86,7 +86,7 @@ interface ISlotInfo {
Position.BOTTOM_RIGHT -> context.matrices.translate(16f - width + 1f, textRenderer.fontHeight.toFloat(), 200f)
}

RenderUtils.drawText(context, text, x, y, scale)
context.drawText(text, x, y, scale)
context.matrices.pop()
}

Expand Down
Loading