Skip to content

Commit 8ac8700

Browse files
committed
Fixes space issue.
1 parent 47ce7b9 commit 8ac8700

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

dist/src/main/kotlin/kr/toxicity/hud/util/Adventures.kt

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,17 @@ fun Int.parseChar(): String {
4949
}
5050

5151
fun Int.toSpaceComponent() = toSpaceComponent(this)
52-
fun Int.toSpaceComponent(width: Int): WidthComponent {
53-
val builder = Component.text()
54-
return if (VERSION.version <= 18) {
55-
val abs = abs(this)
56-
if (abs > 256) {
57-
val i = (if (this > 0) 1 else -1)
58-
WidthComponent(
59-
builder.font(LEGACY_SPACE_KEY)
60-
.append(Component.text(((abs / 256 + 255) * i + 0xFFC00).parseChar()))
61-
.append(Component.text(((abs % 256) * i + 0xFFC00).parseChar())),
62-
width
63-
)
64-
} else WidthComponent(builder.font(LEGACY_SPACE_KEY).content((this + 0xFFC00).parseChar()), width)
65-
} else {
66-
WidthComponent(builder.font(SPACE_KEY).content((this + 0xD0000).parseChar()), width)
67-
}
52+
fun Int.toSpaceComponent(width: Int) = if (VERSION.version <= 18) {
53+
val abs = abs(this)
54+
if (abs > 256) {
55+
val i = if (this > 0) 1 else -1
56+
WidthComponent(
57+
Component.text().font(LEGACY_SPACE_KEY)
58+
.append(Component.text(((abs / 256 + 255) * i + 0xFFC00).parseChar()))
59+
.append(Component.text(((abs % 256) * i + 0xFFC00).parseChar())),
60+
width
61+
)
62+
} else WidthComponent(Component.text().font(LEGACY_SPACE_KEY).content((this + 0xFFC00).parseChar()), width)
63+
} else {
64+
WidthComponent(Component.text().font(SPACE_KEY).content((this + 0xD0000).parseChar()), width)
6865
}

0 commit comments

Comments
 (0)