@@ -37,12 +37,8 @@ object LambdaMoji : Module(
3737 defaultTags = setOf(ModuleTag .CLIENT , ModuleTag .RENDER ),
3838 enabledByDefault = true ,
3939) {
40- val scale by setting(" Emoji Scale" , 1.0 , 0.5 .. 1.5 , 0.1 )
4140 val suggestions by setting(" Chat Suggestions" , true )
4241
43- private val emojiWhitespace: String
44- get() = " " .repeat(((mc.textRenderer.fontHeight / 2 / mc.textRenderer.getWidth(" " )) * scale).toInt())
45-
4642 private val renderQueue = mutableListOf<Triple <GlyphInfo , Vec2d , Color >>()
4743
4844 init {
@@ -73,7 +69,6 @@ object LambdaMoji : Module(
7369 val index = raw.indexOf(emoji)
7470 if (index == - 1 ) return @forEach
7571
76- val height = mc.textRenderer.fontHeight
7772 val width = mc.textRenderer.getWidth(raw.substring(0 , index))
7873
7974 // Dude I'm sick of working with the shitcode that is minecraft's codebase :sob:
@@ -82,19 +77,19 @@ object LambdaMoji : Module(
8277 else -> Color (255 , 255 , 255 , (color shr 24 and 0xFF ))
8378 }
8479
85- val glyph = RenderSettings .emojiFont[emoji]!!
86- renderQueue.add(Triple (glyph, Vec2d (x + width, y + height / 2 ), trueColor))
80+ val glyph = RenderSettings .emojiFont[emoji] ? : return @forEach
81+ renderQueue.add(Triple (glyph, Vec2d (x + width, y), trueColor))
8782
8883 // Replace the emoji with whitespaces depending on the player's settings
89- raw = raw.replaceFirst(emoji, emojiWhitespace )
84+ raw = raw.replaceFirst(emoji, " " )
9085 }
9186
9287 val constructed = mutableListOf<OrderedText >()
9388
9489 // Will not work properly if the emoji is part of the style
95- saved.forEach { (charIndex : Int , style: Style ) ->
96- if (charIndex >= raw.length) return @forEach
97- constructed.add(OrderedText .styledForwardsVisitedString(raw.substring(charIndex, charIndex + 1 ), style))
90+ saved.forEach { (index , style) ->
91+ if (index >= raw.length) return @forEach
92+ constructed.add(OrderedText .styledForwardsVisitedString(raw.substring(index, index + 1 ), style))
9893 }
9994
10095 return OrderedText .concat(constructed)
0 commit comments