Bring back progress bar red flash

This commit is contained in:
DBotThePony 2022-01-04 19:33:40 +07:00
parent 51f7e506f6
commit 605ab992f5
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 13 additions and 0 deletions

View File

@ -908,7 +908,11 @@ open class EditablePanel @JvmOverloads constructor(
return mouse_x >= pos.x && mouse_x <= pos.x + width && mouse_y >= pos.y && mouse_y + height <= pos.y
}
protected var tick = 0
open fun tick() {
tick++
for (child in children) {
child.tick()
}

View File

@ -1,5 +1,6 @@
package ru.dbotthepony.mc.otm.client.screen.widget
import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component
@ -166,6 +167,10 @@ open class ProgressGaugePanel @JvmOverloads constructor(
}
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
if (widget.isStuck() && tick % 40 <= 20) {
RenderSystem.setShaderColor(0.75f, 0.4f, 0.4f, 1f)
}
if (flop) {
GAUGE_BACKGROUND.render(stack, winding = UVWindingOrder.U1_V0_U0_V1)
val width = this.width * widget.percentage()
@ -175,6 +180,10 @@ open class ProgressGaugePanel @JvmOverloads constructor(
val width = this.width * widget.percentage()
GAUGE_FOREGROUND.renderPartial(stack, width = width)
}
if (widget.isStuck() && tick % 40 <= 20) {
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
}
}
override fun innerRenderTooltips(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float): Boolean {