Skip to content
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

Backend: SpecialColor translation #2854

Merged
merged 23 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
move old method calls
Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com>
  • Loading branch information
j10a1n15 committed Oct 28, 2024
commit 1c43eea4b803a46009a49092907f1da957074d62
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
Expand All @@ -15,12 +16,12 @@
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.SpecialColor

Check warning on line 19 in src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.init.Blocks
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color

Check warning on line 24 in src/main/java/at/hannibal2/skyhanni/features/fishing/ThunderSparksHighlight.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import

@SkyHanniModule
object ThunderSparksHighlight {
Expand All @@ -45,8 +46,7 @@
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!isEnabled()) return

val special = config.color
val color = Color(SpecialColor.specialToChromaRGB(special), true)
val color = config.color.toChromaColor()

for (spark in sparks) {
if (spark.isDead) continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayerIgnoreY
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBoxNea
import at.hannibal2.skyhanni.utils.SpecialColor

Check warning on line 17 in src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color

Check warning on line 22 in src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import

@SkyHanniModule
object GeyserFishing {
Expand Down Expand Up @@ -63,7 +64,7 @@
if (!IslandType.CRIMSON_ISLE.isInIsland()) return
if (config.onlyWithRod && !FishingAPI.holdingLavaRod) return

val color = Color(SpecialColor.specialToChromaRGB(config.boxColor), true)
val color = config.boxColor.toChromaColor()
event.drawFilledBoundingBoxNea(geyserBox, color)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
Expand Down Expand Up @@ -143,8 +144,7 @@ object MinionFeatures {
if (!enableWithHub()) return
if (!config.lastClickedMinion.display) return

val special = config.lastClickedMinion.color
val color = Color(SpecialColor.specialToChromaRGB(special), true)
val color = config.lastClickedMinion.color.toChromaColor()

val loc = lastMinion
if (loc != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.data.PartyAPI
import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SpecialColor
import net.minecraft.client.entity.EntityOtherPlayerMP
Expand All @@ -30,6 +31,6 @@ object PartyMemberOutlines {
private fun getEntityOutlineColor(entity: Entity): Int? {
if (entity !is EntityOtherPlayerMP || !PartyAPI.partyMembers.contains(entity.name)) return null

return SpecialColor.specialToChromaRGB(config.outlineColor)
return config.outlineColor.toChromaColor().rgb
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock
import at.hannibal2.skyhanni.utils.SpecialColor

Check warning on line 19 in src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.init.Blocks
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.BlockPos
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color

Check warning on line 25 in src/main/java/at/hannibal2/skyhanni/features/nether/SulphurSkitterBox.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import

@SkyHanniModule
object SulphurSkitterBox {
Expand Down Expand Up @@ -78,7 +79,7 @@
}

private fun drawBox(axis: AxisAlignedBB, partialTicks: Float) {
val color = Color(SpecialColor.specialToChromaRGB(config.boxColor), true)
val color = config.boxColor.toChromaColor()
when (config.boxType) {
SulphurSkitterBoxConfig.BoxType.FULL -> {
RenderUtils.drawFilledBoundingBoxNea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
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.EntityUtils.getEntities
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SpecialColor

Check warning on line 16 in src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import at.hannibal2.skyhanni.utils.TimeUtils.format
import net.minecraft.client.Minecraft
import net.minecraft.entity.Entity
Expand All @@ -20,7 +21,7 @@
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color

Check warning on line 24 in src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds

Expand Down Expand Up @@ -66,13 +67,13 @@
) { config.voltMoodMeter }
if (state == VoltState.DOING_LIGHTNING && config.voltRange) {
RenderUtils.drawCylinderInWorld(
Color(SpecialColor.specialToChromaRGB(config.voltColour), true),
config.voltColour.toChromaColor(),
entity.posX,
entity.posY - 4f,
entity.posZ,
radius = LIGHTNING_DISTANCE,
partialTicks = event.partialTicks,
height = 20F
height = 20F,
)
val dischargingSince = chargingSince.getOrDefault(entity, SimpleTimeMark.farPast())
val dischargeTimeLeft = CHARGE_TIME - dischargingSince.passedSince()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import at.hannibal2.skyhanni.features.skillprogress.SkillUtil.XP_NEEDED_FOR_60
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils.chat
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand All @@ -30,14 +31,14 @@
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.SpecialColor

Check warning on line 34 in src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import at.hannibal2.skyhanni.utils.TimeUnit
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.renderables.Renderable.Companion.horizontalContainer
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color

Check warning on line 41 in src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import kotlin.math.ceil
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
Expand Down Expand Up @@ -112,21 +113,21 @@
maxWidth = 182
Renderable.progressBar(
percent = factor.toDouble(),
startColor = Color(SpecialColor.specialToChromaRGB(barConfig.barStartColor)),
startColor = barConfig.barStartColor.toChromaColor(),
texture = barConfig.texturedBar.usedTexture.get(),
useChroma = barConfig.useChroma.get()
useChroma = barConfig.useChroma.get(),
)

} else {
maxWidth = barConfig.regularBar.width
val factor = skillExpPercentage.coerceAtMost(1.0)
Renderable.progressBar(
percent = factor,
startColor = Color(SpecialColor.specialToChromaRGB(barConfig.barStartColor)),
endColor = Color(SpecialColor.specialToChromaRGB(barConfig.barStartColor)),
startColor = barConfig.barStartColor.toChromaColor(),
endColor = barConfig.barStartColor.toChromaColor(),
width = maxWidth,
height = barConfig.regularBar.height,
useChroma = barConfig.useChroma.get()
useChroma = barConfig.useChroma.get(),
)
}

Expand Down
Loading