Skip to content

Backend: Remove usages of deprecated color functions #2972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 22, 2024
Merged
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 @@ -9,8 +9,6 @@ import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColorInt
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
Expand All @@ -23,6 +21,8 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawSphereWireframeInWorld
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.SkullTextureHolder
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColorInt
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.TimeUtils.ticks
import at.hannibal2.skyhanni.utils.getLorenzVec
Expand Down Expand Up @@ -170,7 +170,7 @@ object FlareDisplay {
FlareType.WARNING -> config.warningColor
FlareType.ALERT -> config.alertColor
FlareType.SOS -> config.sosColor
}.toChromaColor()
}.toSpecialColor()

when (config.outlineType) {
FlareConfig.OutlineType.FILLED -> {
Expand Down Expand Up @@ -200,7 +200,7 @@ object FlareDisplay {
0,
minecraft.displayWidth,
minecraft.displayHeight,
(alpha shl 24) or (config.flashColor.toChromaColorInt() and 0xFFFFFF),
(alpha shl 24) or (config.flashColor.toSpecialColorInt() and 0xFFFFFF),
)
GlStateManager.color(1F, 1F, 1F, 1F)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.getLorenzVec
import at.hannibal2.skyhanni.utils.getPrevLorenzVec
import net.minecraft.client.Minecraft
Expand Down Expand Up @@ -55,12 +55,12 @@ object ArrowTrail {
fun onWorldRender(event: LorenzRenderWorldEvent) {
if (!isEnabled()) return
val color = if (config.handlePlayerArrowsDifferently) config.playerArrowColor else config.arrowColor
val playerArrowColor = color.toChromaColor()
val playerArrowColor = color.toSpecialColor()
listYourArrow.forEach {
event.draw3DLine(it.start, it.end, playerArrowColor, config.lineWidth, true)
}
if (!config.hideOtherArrows) {
val arrowColor = config.arrowColor.toChromaColor()
val arrowColor = config.arrowColor.toSpecialColor()
listAllArrow.forEach {
event.draw3DLine(it.start, it.end, arrowColor, config.lineWidth, true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color
Expand Down Expand Up @@ -43,7 +43,7 @@ object CosmeticFollowingLine {
updateClose(event)

val firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0
val color = config.lineColor.toChromaColor()
val color = config.lineColor.toSpecialColor()

renderClose(event, firstPerson, color)
renderFar(event, firstPerson, color)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import at.hannibal2.skyhanni.events.DungeonBlockClickEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ExtendedChatColor
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.TimeLimitedCache
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
Expand Down Expand Up @@ -63,7 +63,7 @@ object DungeonHighlightClickedBlocks {
}

if (lockedPattern.matches(event.message)) {
blocks.lastOrNull { it.value.displayText.contains("Chest") }?.value?.color = config.lockedChestColor.toChromaColor()
blocks.lastOrNull { it.value.displayText.contains("Chest") }?.value?.color = config.lockedChestColor.toSpecialColor()
}
}

Expand All @@ -74,7 +74,7 @@ object DungeonHighlightClickedBlocks {

val type = event.blockType

val color = if (config.randomColor) getRandomColor().toColor() else getBlockProperties(type).color.toChromaColor()
val color = if (config.randomColor) getRandomColor().toColor() else getBlockProperties(type).color.toSpecialColor()
val displayText = ExtendedChatColor(color.rgb, false).toString() + "Clicked " + getBlockProperties(type).name
blocks[event.position] = ClickedBlock(displayText, color)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.MobEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color
Expand Down Expand Up @@ -87,7 +87,7 @@ object DungeonMobManager {
event.draw3DLine(
it.baseEntity.getLorenzVec().add(y = 0.15),
event.exactPlayerEyeLocation(),
fel.colour.get().toChromaColor(),
fel.colour.get().toSpecialColor(),
3,
true,
)
Expand All @@ -97,7 +97,7 @@ object DungeonMobManager {
felOnTheGround.removeIf { mob ->
event.drawWaypointFilled(
mob.baseEntity.getLorenzVec().add(-0.5, -0.23, -0.5),
fel.colour.get().toChromaColor(),
fel.colour.get().toSpecialColor(),
seeThroughBlocks = false,
beacon = false,
extraSize = -0.2,
Expand Down Expand Up @@ -125,7 +125,7 @@ object DungeonMobManager {
}
}

private fun getStarColor(): Color = starredConfig.colour.get().toChromaColor()
private fun getStarColor(): Color = starredConfig.colour.get().toSpecialColor()

private fun handleStar0(mob: Mob, colour: Color?) {
if (mob.isInvisible()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.ParkourHelper
import at.hannibal2.skyhanni.utils.RegexUtils.findMatcher
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

Expand Down Expand Up @@ -78,7 +78,7 @@ object DungeonsRaceGuide {
private fun updateConfig() {
parkourHelpers.values.forEach {
it.rainbowColor = config.rainbowColor.get()
it.monochromeColor = config.monochromeColor.get().toChromaColor()
it.monochromeColor = config.monochromeColor.get().toSpecialColor()
it.lookAhead = config.lookAhead.get() + 1
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.diana.InquisitorFoundEvent
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColorInt
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColorInt

@SkyHanniModule
object HighlightInquisitors {
Expand All @@ -18,7 +18,7 @@ object HighlightInquisitors {

val inquisitor = event.inquisitorEntity

val color = config.color.toChromaColorInt()
val color = config.color.toSpecialColorInt()
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(inquisitor, color) { config.highlightInquisitors }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColorInt
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColorInt
import at.hannibal2.skyhanni.utils.StringUtils.isValidUuid
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.Gui
Expand Down Expand Up @@ -136,7 +136,7 @@ object HoppityCallWarning {
minecraft.displayWidth,
minecraft.displayHeight,
// Apply the shifted alpha and combine it with the RGB components of flashColor.
shiftedRandomAlpha or (config.flashColor.toChromaColorInt() and 0xFFFFFF),
shiftedRandomAlpha or (config.flashColor.toSpecialColorInt() and 0xFFFFFF),
)
GlStateManager.color(1F, 1F, 1F, 1F)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import at.hannibal2.skyhanni.events.hoppity.EggFoundEvent
import at.hannibal2.skyhanni.features.fame.ReminderUtils
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
Expand All @@ -30,6 +29,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import net.minecraft.item.ItemStack
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
Expand Down Expand Up @@ -147,7 +147,7 @@ object HoppityEggLocator {
if (eyeLocation.distance(it) > 2) {
drawWaypointFilled(
it,
config.waypointColor.toChromaColor(),
config.waypointColor.toSpecialColor(),
seeThroughBlocks = true,
)
drawDynamicText(it.up(), "§aGuess", 1.5)
Expand All @@ -164,7 +164,7 @@ object HoppityEggLocator {
val shouldMarkDuplicate = config.highlightDuplicateEggLocations && HoppityEggLocations.hasCollectedEgg(location)
val possibleDuplicateLabel = if (shouldMarkDuplicate) "$label §c(Duplicate Location)" else label
if (!shouldMarkDuplicate) {
drawWaypointFilled(location, config.waypointColor.toChromaColor(), seeThroughBlocks = true)
drawWaypointFilled(location, config.waypointColor.toSpecialColor(), seeThroughBlocks = true)
} else {
drawColor(location, LorenzColor.RED.toColor(), false, 0.5f)
}
Expand Down Expand Up @@ -276,7 +276,7 @@ object HoppityEggLocator {
if (!config.showPathFinder) return
val location = possibleEggLocations.firstOrNull() ?: return

val color = config.waypointColor.toChromaColor()
val color = config.waypointColor.toSpecialColor()

IslandGraphs.pathFind(location, "Hoppity Egg", color, condition = { config.showPathFinder })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
Expand All @@ -22,6 +21,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawSphereInWorld
import at.hannibal2.skyhanni.utils.RenderUtils.drawSphereWireframeInWorld
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.SoundUtils.playPlingSound
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.TimeLimitedSet
import at.hannibal2.skyhanni.utils.TimeUnit
import at.hannibal2.skyhanni.utils.TimeUtils.format
Expand Down Expand Up @@ -91,7 +91,7 @@ object TotemOfCorruption {
if (!isEffectiveAreaEnabled()) return
if (totems.isEmpty()) return

val color = config.color.toChromaColor()
val color = config.color.toSpecialColor()
for (totem in totems) {
// The center of the totem is the upper part of the armor stand
when (config.outlineType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.data.GuiEditManager.getAbsX
import at.hannibal2.skyhanni.data.GuiEditManager.getAbsY
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.backgroundConfig
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.compat.GuiScreenUtils
import at.hannibal2.skyhanni.utils.renderables.Renderable
import net.minecraft.util.ResourceLocation
Expand All @@ -28,8 +28,8 @@ object RenderBackground {
0,
backgroundConfig.roundedCornerSmoothness,
1,
outline.colorTop.toChromaColor().rgb,
outline.colorBottom.toChromaColor().rgb,
outline.colorTop.toSpecialColor().rgb,
outline.colorBottom.toSpecialColor().rgb,
outline.thickness,
outline.blur,
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
Expand All @@ -52,7 +52,7 @@ object RenderBackground {
} else {
Renderable.drawInsideRoundedRect(
renderable,
backgroundConfig.color.toChromaColor(),
backgroundConfig.color.toSpecialColor(),
borderSize,
backgroundConfig.roundedCornerSmoothness,
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.inventory.patternGroup
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.ConfigUtils.jumpToEditor
import at.hannibal2.skyhanni.utils.HypixelCommands
Expand All @@ -36,6 +35,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SkyBlockTime
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.TimeLimitedCache
import at.hannibal2.skyhanni.utils.renderables.Renderable
import net.minecraft.inventory.ContainerChest
Expand Down Expand Up @@ -66,8 +66,8 @@ object CakeTracker {
private var cakeRenderables = listOf<Renderable>()
private var lastKnownCakeDataHash = 0

private val unobtainedHighlightColor: Color get() = config.unobtainedAuctionHighlightColor.toChromaColor()
private val obtainedHighlightColor: Color get() = config.obtainedAuctionHighlightColor.toChromaColor()
private val unobtainedHighlightColor: Color get() = config.unobtainedAuctionHighlightColor.toSpecialColor()
private val obtainedHighlightColor: Color get() = config.obtainedAuctionHighlightColor.toSpecialColor()

/**
* REGEX-TEST: §cNew Year Cake (Year 360)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactor
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryDataLoader.clickMeGoldenRabbitPattern
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryDataLoader.clickMeRabbitPattern
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColorInt
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColorInt
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.Gui
import net.minecraft.client.renderer.GlStateManager
Expand Down Expand Up @@ -64,7 +64,7 @@ object ChocolateFactoryScreenFlash {
0,
minecraft.displayWidth,
minecraft.displayHeight,
(alpha shl 24) or (config.rabbitWarning.flashColor.toChromaColorInt() and 0xFFFFFF),
(alpha shl 24) or (config.rabbitWarning.flashColor.toSpecialColorInt() and 0xFFFFFF),
)
GlStateManager.color(1F, 1F, 1F, 1F)
}
Expand Down
Loading
Loading