use of binnie.core.api.gui.IArea 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);
}
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class ControlSlide method setSlide.
public void setSlide(final boolean b) {
this.slideActive = b;
final IArea area = this.isSlideActive() ? this.expanded : this.shrunk;
this.setSize(area.size());
this.setPosition(area.pos());
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class TextureRenderer method preRender.
public final void preRender(final IWidget widget, int guiWidth, int guiHeight) {
GlStateManager.pushMatrix();
GlStateManager.translate(widget.getPosition().xPos(), widget.getPosition().yPos(), 0.0f);
RenderUtil.setColour(widget.getColor());
if (widget.isCroppedWidet()) {
final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget;
final IPoint pos = cropRelative.getAbsolutePosition();
final IArea cropZone = widget.getCroppedZone();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
this.limitArea(new Area(pos.add(cropZone.pos()), cropZone.size()), guiWidth, guiHeight);
}
GlStateManager.disableDepth();
}
use of binnie.core.api.gui.IArea in project Binnie by ForestryMC.
the class TextureRenderer method texture.
public void texture(@Nullable final ITexture texture, final IPoint position) {
if (texture == null) {
return;
}
this.setTexture(texture);
final IPoint point = position.sub(texture.getBorder().getLeft(), texture.getBorder().getTop());
final IArea textureArea = texture.getArea().outset(texture.getBorder());
GuiUtils.drawTexturedModalRect(point.xPos(), point.yPos(), textureArea.pos().xPos(), textureArea.pos().yPos(), textureArea.size().xPos(), textureArea.size().yPos(), 0);
}
Aggregations