Remove redundant kotlinx.coroutines usage in ClickBox.kt
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
312b875267
commit
76b28db14b
|
@ -15,9 +15,6 @@ import fr.username404.snowygui.utils.RenderingUtil.endDraw
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.prepareDraw
|
import fr.username404.snowygui.utils.RenderingUtil.prepareDraw
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.tessellator
|
import fr.username404.snowygui.utils.RenderingUtil.tessellator
|
||||||
import io.github.config4k.extract
|
import io.github.config4k.extract
|
||||||
import kotlinx.coroutines.CoroutineStart
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import org.jetbrains.annotations.ApiStatus
|
import org.jetbrains.annotations.ApiStatus
|
||||||
|
@ -80,7 +77,7 @@ class ClickBox(
|
||||||
private const val inclination: Double = 2.5
|
private const val inclination: Double = 2.5
|
||||||
}
|
}
|
||||||
override fun render(poseStack: PoseStack?) {
|
override fun render(poseStack: PoseStack?) {
|
||||||
runBlocking {
|
val currentHeight = y + (height + clickboxHeightOffset)
|
||||||
prepareDraw()
|
prepareDraw()
|
||||||
with(buffer) {
|
with(buffer) {
|
||||||
begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR)
|
begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR)
|
||||||
|
@ -91,7 +88,6 @@ class ClickBox(
|
||||||
vertex(x + inclination, y, 0.0).colorEnd()
|
vertex(x + inclination, y, 0.0).colorEnd()
|
||||||
|
|
||||||
// Render the box:
|
// Render the box:
|
||||||
val currentHeight = y + (height + clickboxHeightOffset)
|
|
||||||
vertex(x, currentHeight, 0.0).colorEnd()
|
vertex(x, currentHeight, 0.0).colorEnd()
|
||||||
vertex(x + width + inclination, currentHeight, 0.0).colorEnd()
|
vertex(x + width + inclination, currentHeight, 0.0).colorEnd()
|
||||||
vertex(x + width + inclination, y + height, 0.0).colorEnd()
|
vertex(x + width + inclination, y + height, 0.0).colorEnd()
|
||||||
|
@ -105,7 +101,7 @@ class ClickBox(
|
||||||
}
|
}
|
||||||
endDraw()
|
endDraw()
|
||||||
|
|
||||||
val renderButtons = if (buttons.isNotEmpty()) launch(start = CoroutineStart.UNDISPATCHED) {
|
if (buttons.isNotEmpty()) {
|
||||||
buttonsProgressBar.apply {
|
buttonsProgressBar.apply {
|
||||||
x = this@ClickBox.x + this@ClickBox.width - 3
|
x = this@ClickBox.x + this@ClickBox.width - 3
|
||||||
y = this@ClickBox.y + this@ClickBox.height + 3
|
y = this@ClickBox.y + this@ClickBox.height + 3
|
||||||
|
@ -118,11 +114,9 @@ class ClickBox(
|
||||||
it.hidden = if ((num + 1) <= 8) ((it.y) !in fullHeight) else ((it.y + it.height) !in fullHeight)
|
it.hidden = if ((num + 1) <= 8) ((it.y) !in fullHeight) else ((it.y + it.height) !in fullHeight)
|
||||||
}.display(poseStack)
|
}.display(poseStack)
|
||||||
}
|
}
|
||||||
} else null
|
}
|
||||||
if (poseStack != null) {
|
if (poseStack != null) {
|
||||||
Minecraft.getInstance().font.draw(poseStack, name.string, x.toFloat() + 5, y.toFloat() + 1.5F, Colors.TRANSPARENT.hexValue)
|
Minecraft.getInstance().font.draw(poseStack, name.string, x.toFloat() + 5, y.toFloat() + 1.5F, Colors.TRANSPARENT.hexValue)
|
||||||
renderButtons?.join()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init {
|
init {
|
||||||
|
|
Loading…
Reference in New Issue