From c5a7fc3d516c24c0c219515897cfd3e54e3e533d Mon Sep 17 00:00:00 2001 From: bdew Date: Tue, 16 Sep 2014 14:51:33 +0300 Subject: [PATCH] Fixed WidgetFluidGauge not respecting fluid color --- src/net/bdew/lib/gui/widgets/WidgetFluidGauge.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/net/bdew/lib/gui/widgets/WidgetFluidGauge.scala b/src/net/bdew/lib/gui/widgets/WidgetFluidGauge.scala index c25c992..9cd07b6 100644 --- a/src/net/bdew/lib/gui/widgets/WidgetFluidGauge.scala +++ b/src/net/bdew/lib/gui/widgets/WidgetFluidGauge.scala @@ -13,7 +13,7 @@ import java.text.DecimalFormat import net.bdew.lib.Misc import net.bdew.lib.data.DataSlotTankBase -import net.bdew.lib.gui.{Point, Rect, Texture} +import net.bdew.lib.gui.{Color, Point, Rect, Texture} import org.lwjgl.opengl.GL11 import scala.collection.mutable @@ -39,19 +39,21 @@ class WidgetFluidGauge(val rect: Rect, overlay: Texture, dslot: DataSlotTankBase val icon = Texture(Texture.BLOCKS, fstack.getFluid.getStillIcon) var fillHeight = if (dslot.getCapacity > 0) rect.h * fstack.amount / dslot.getCapacity else 0 var yStart: Int = 0 + val color = Color.fromInt(fstack.getFluid.getColor(fstack)) while (fillHeight > 0) { if (fillHeight > 16) { - parent.drawTexture(new Rect(rect.x, rect.y2 - 16 - yStart, rect.w, 16), icon) + parent.drawTexture(new Rect(rect.x, rect.y2 - 16 - yStart, rect.w, 16), icon, color) fillHeight -= 16 } else { - parent.drawTextureInterpolate(new Rect(rect.x, rect.y2 - 16 - yStart, rect.w, 16), icon, 0, 1 - fillHeight / 16, 1, 1) + parent.drawTextureInterpolate(new Rect(rect.x, rect.y2 - 16 - yStart, rect.w, 16), icon, 0, 1 - fillHeight / 16, 1, 1, color) fillHeight = 0 } yStart = yStart + 16 } } + GL11.glColor3d(1, 1, 1) GL11.glDisable(GL11.GL_BLEND) parent.drawTexture(rect, overlay)