use of binnie.core.gui.minecraft.GuiCraftGUI in project Binnie by ForestryMC.
the class ControlLiquidTank method onRenderForeground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
CraftGUI.RENDER.texture(this.horizontal ? CraftGUITexture.HORIZONTAL_LIQUID_TANK_OVERLAY : CraftGUITexture.LIQUID_TANK_OVERLAY, Point.ZERO);
GuiCraftGUI gui = Window.get(this).getGui();
if (this.isMouseOver() && gui.isHelpMode()) {
final IArea area = this.getArea();
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.HELP));
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
}
if (ControlLiquidTank.tankError.contains(this.tankID)) {
final IArea area = this.getArea();
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR));
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
}
}
use of binnie.core.gui.minecraft.GuiCraftGUI in project Binnie by ForestryMC.
the class ControlSlot method onRenderForeground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
boolean highlighted = false;
for (final Map.Entry<EnumHighlighting, List<Integer>> highlight : ControlSlot.highlighting.entrySet()) {
if (highlight.getKey() == EnumHighlighting.SHIFT_CLICK && !ControlSlot.shiftClickActive) {
continue;
}
if (highlighted || !highlight.getValue().contains(this.slot.slotNumber)) {
continue;
}
highlighted = true;
final int c = -1442840576 + Math.min(highlight.getKey().getColour(), 16777215);
GlStateManager.disableBlend();
GlStateManager.disableDepth();
RenderUtil.drawGradientRect(new Area(1, 1, 16, 16), c, c);
GlStateManager.enableBlend();
GlStateManager.enableDepth();
}
if (!highlighted && this.getTopParent().getMousedOverWidget() == this) {
GuiCraftGUI gui = Window.get(this).getGui();
GlStateManager.disableBlend();
GlStateManager.disableDepth();
if (!gui.getDraggedItem().isEmpty() && !this.slot.isItemValid(gui.getDraggedItem())) {
RenderUtil.drawGradientRect(new Area(1, 1, 16, 16), -1426089575, -1426089575);
} else {
RenderUtil.drawGradientRect(new Area(1, 1, 16, 16), -2130706433, -2130706433);
}
GlStateManager.enableBlend();
GlStateManager.enableDepth();
}
}
use of binnie.core.gui.minecraft.GuiCraftGUI in project Binnie by ForestryMC.
the class ControlLiquidTank method onRenderBackground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.RENDER.texture(this.horizontal ? CraftGUITexture.HORIZONTAL_LIQUID_TANK : CraftGUITexture.LIQUID_TANK, Point.ZERO);
GuiCraftGUI gui = Window.get(this).getGui();
if (this.isMouseOver() && gui.isHelpMode()) {
final int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.HELP);
RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
} else if (ControlLiquidTank.tankError.contains(this.tankID)) {
final int c = -1442840576 + MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR);
RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
} else if (this.getTopParent().getMousedOverWidget() == this) {
if (!gui.getDraggedItem().isEmpty()) {
RenderUtil.drawGradientRect(this.getArea().inset(1), -1426089575, -1426089575);
} else {
RenderUtil.drawGradientRect(this.getArea().inset(1), -2130706433, -2130706433);
}
}
if (this.isTankValid()) {
final int height = this.horizontal ? 16 : 58;
final int squaled = Math.round(height * (this.getTank().getAmount() / this.getTank().getCapacity()));
final int yPos = height + 1;
final Fluid fluid = this.getTank().getLiquid().getFluid();
final int hex = fluid.getColor(this.getTank().getLiquid());
final int r = (hex & 0xFF0000) >> 16;
final int g = (hex & 0xFF00) >> 8;
final int b = hex & 0xFF;
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
GlStateManager.enableBlend();
{
GlStateManager.blendFunc(770, 771);
final IPoint pos = this.getAbsolutePosition();
final IPoint offset = new Point(0, height - squaled);
final IArea limited = this.getArea().inset(1);
if (this.horizontal) {
limited.setSize(new Point(limited.width() - 1, limited.height()));
}
CraftGUI.RENDER.limitArea(new Area(limited.pos().add(pos).add(offset), limited.size().sub(offset)), guiWidth, guiHeight);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
{
BinnieCore.getBinnieProxy().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
for (int y = 0; y < height; y += 16) {
for (int x = 0; x < (this.horizontal ? 58 : 16); x += 16) {
final TextureAtlasSprite icon = BinnieCore.getBinnieProxy().getTextureAtlasSprite(fluid.getStill());
RenderUtil.drawSprite(new Point(1 + x, 1 + y), icon);
}
}
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
}
GlStateManager.disableBlend();
GlStateManager.color(1, 1, 1, 1);
}
}
Aggregations