diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt | 10 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt | 12 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 24 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SpecialColor.java (renamed from src/main/java/at/hannibal2/skyhanni/utils/SpecialColour.java) | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 4 |
6 files changed, 27 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt index 6a0af6cba..b2057d339 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ColorUtils.kt @@ -6,17 +6,17 @@ object ColorUtils { /** Transfer string colors from the config to [Color] */ fun String.toChromaColor() = Color(toChromaColorInt(), true) - fun String.toChromaColorInt() = SpecialColour.specialToChromaRGB(this) + fun String.toChromaColorInt() = SpecialColor.specialToChromaRGB(this) fun String.getFirstColorCode() = this.takeIf { it.firstOrNull() == '§' }?.getOrNull(1) - fun getRed(colour: Int) = colour shr 16 and 0xFF + fun getRed(color: Int) = color shr 16 and 0xFF - fun getGreen(colour: Int) = colour shr 8 and 0xFF + fun getGreen(color: Int) = color shr 8 and 0xFF - fun getBlue(colour: Int) = colour and 0xFF + fun getBlue(color: Int) = color and 0xFF - fun getAlpha(colour: Int) = colour shr 24 and 0xFF + fun getAlpha(color: Int) = color shr 24 and 0xFF fun blendRGB(start: Color, end: Color, percent: Double) = Color( (start.red * (1 - percent) + end.red * percent).toInt(), diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt index 403484fcd..75eb5087e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -28,12 +28,12 @@ import kotlin.math.min // TODO cleanup of redundant functions object GuiRenderUtils { - fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, colour: Int) { + fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, color: Int) { val strLen = fr.getStringWidth(str) val x2 = x - strLen / 2f val y2 = y - fr.FONT_HEIGHT / 2f GL11.glTranslatef(x2, y2, 0f) - fr.drawString(str, 0f, 0f, colour, shadow) + fr.drawString(str, 0f, 0f, color, shadow) GL11.glTranslatef(-x2, -y2, 0f) } @@ -222,19 +222,19 @@ object GuiRenderUtils { return Color(color.red / 5, color.green / 5, color.blue / 5).rgb } - fun drawScaledRec(left: Int, top: Int, right: Int, bottom: Int, colour: Int, inverseScale: Float) { + fun drawScaledRec(left: Int, top: Int, right: Int, bottom: Int, color: Int, inverseScale: Float) { GuiScreen.drawRect( (left * inverseScale).toInt(), (top * inverseScale).toInt(), (right * inverseScale).toInt(), (bottom * inverseScale).toInt(), - colour + color, ) } - fun renderItemAndBackground(item: ItemStack, x: Int, y: Int, colour: Int) { + fun renderItemAndBackground(item: ItemStack, x: Int, y: Int, color: Int) { renderItemStack(item, x, y) - GuiScreen.drawRect(x, y, x + 16, y + 16, colour) + GuiScreen.drawRect(x, y, x + 16, y + 16, color) } // Taken and edited from NEU <- it's broken diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index 9bb2cccd8..9947dd715 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -50,7 +50,7 @@ enum class LorenzColor(val chatColorCode: Char, private val color: Color, privat override fun toString(): String = coloredLabel - fun toConfigColour(): String = "0:255:${color.red}:${color.green}:${color.blue}" + fun toConfigColor(): String = "0:255:${color.red}:${color.green}:${color.blue}" fun toDyeColor(): EnumDyeColor = when (this) { WHITE -> EnumDyeColor.WHITE diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 102013758..d32ff9ea9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -75,7 +75,7 @@ object RenderUtils { private val beaconBeam = ResourceLocation("textures/entity/beacon_beam.png") private val matrixBuffer: FloatBuffer = GLAllocation.createDirectFloatBuffer(16) - private val colourBuffer: FloatBuffer = GLAllocation.createDirectFloatBuffer(16) + private val colorBuffer: FloatBuffer = GLAllocation.createDirectFloatBuffer(16) private val bezier2Buffer: FloatBuffer = GLAllocation.createDirectFloatBuffer(9) infix fun Slot.highlight(color: LorenzColor) { @@ -1009,12 +1009,12 @@ object RenderUtils { y: Float, shadow: Boolean, len: Int, - colour: Int, + color: Int, ) { val strLen = fr.getStringWidth(str) var factor = len / strLen.toFloat() factor = 1f.coerceAtMost(factor) - TextRenderUtils.drawStringScaled(str, fr, x, y, shadow, colour, factor) + TextRenderUtils.drawStringScaled(str, fr, x, y, shadow, color, factor) } fun LorenzRenderWorldEvent.drawDynamicText( @@ -1608,14 +1608,14 @@ object RenderUtils { fun LorenzRenderWorldEvent.outlineTopFace( boundingBox: AxisAlignedBB, lineWidth: Int, - colour: Color, + color: Color, depth: Boolean, ) { val (cornerOne, cornerTwo, cornerThree, cornerFour) = boundingBox.getCorners(boundingBox.maxY) - this.draw3DLine(cornerOne, cornerTwo, colour, lineWidth, depth) - this.draw3DLine(cornerTwo, cornerThree, colour, lineWidth, depth) - this.draw3DLine(cornerThree, cornerFour, colour, lineWidth, depth) - this.draw3DLine(cornerFour, cornerOne, colour, lineWidth, depth) + this.draw3DLine(cornerOne, cornerTwo, color, lineWidth, depth) + this.draw3DLine(cornerTwo, cornerThree, color, lineWidth, depth) + this.draw3DLine(cornerThree, cornerFour, color, lineWidth, depth) + this.draw3DLine(cornerFour, cornerOne, color, lineWidth, depth) } // TODO nea please merge with 'draw3DLine' @@ -1861,9 +1861,9 @@ object RenderUtils { } fun getAlpha(): Float { - colourBuffer.clear() - GlStateManager.getFloat(GL11.GL_CURRENT_COLOR, colourBuffer) - if (colourBuffer.limit() < 4) return 1f - return colourBuffer.get(3) + colorBuffer.clear() + GlStateManager.getFloat(GL11.GL_CURRENT_COLOR, colorBuffer) + if (colorBuffer.limit() < 4) return 1f + return colorBuffer.get(3) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SpecialColour.java b/src/main/java/at/hannibal2/skyhanni/utils/SpecialColor.java index 010e67e4d..7fc733c2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SpecialColour.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/SpecialColor.java @@ -5,7 +5,7 @@ import java.awt.Color; /** * Taken from NotEnoughUpdates */ -public class SpecialColour { +public class SpecialColor { private static final int RADIX = 10; diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index f180e6bf7..180959658 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -25,7 +25,7 @@ object StringUtils { private val whiteSpacePattern = "^\\s*|\\s*$".toPattern() private val resetPattern = "(?i)§R".toPattern() private val sFormattingPattern = "(?i)§S".toPattern() - private val stringColourPattern = "§[0123456789abcdef].*".toPattern() + private val stringColorPattern = "§[0123456789abcdef].*".toPattern() private val asciiPattern = "[^\\x00-\\x7F]".toPattern() fun String.trimWhiteSpaceAndResets(): String = whiteSpaceResetPattern.matcher(this).replaceAll("") @@ -194,7 +194,7 @@ object StringUtils { } fun getColor(string: String, default: Int, darker: Boolean = true): Int { - val matcher = stringColourPattern.matcher(string) + val matcher = stringColorPattern.matcher(string) if (matcher.matches()) { val colorInt = Minecraft.getMinecraft().fontRendererObj.getColorCode(string[1]) return if (darker) { |