net.minecraft.client.gui.Gui Java Examples

The following examples show how to use net.minecraft.client.gui.Gui. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiNBTButton.java    From NBTEdit with GNU General Public License v3.0 6 votes vote down vote up
public void draw(int mx, int my){
	mc.renderEngine.bindTexture(GuiNBTNode.WIDGET_TEXTURE);
	
	if(inBounds(mx,my)){
		Gui.drawRect(x, y, x+WIDTH, y+HEIGHT, 0x80ffffff);
		if (hoverTime == -1)
			hoverTime = System.currentTimeMillis();
	}
	else
		hoverTime = -1;
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	drawTexturedModalRect(x, y, (id-1) * 9, 18, WIDTH, HEIGHT);
	if (!enabled){
		drawRect(x, y, x+WIDTH, y+HEIGHT, 0xc0222222);
	}
	else if (hoverTime != -1 && System.currentTimeMillis() - hoverTime > 300){
		drawToolTip(mx,my);
	}
}
 
Example #2
Source File: LabelComponent.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void render(int x, int y, int width, int mouseX, int mouseY) {
    HyperiumFontRenderer font = tab.gui.getFont();
    lines.clear();
    lines = font.splitString(label, (width + 25) / 2); //16 for icon, 3 for render offset and then some more

    GlStateManager.pushMatrix();
    if (hover) Gui.drawRect(x, y, x + width, y + 18 * lines.size(), 0xa0000000);
    GlStateManager.popMatrix();

    int line1 = 0;
    for (String line : lines) {
        font.drawString(line.toUpperCase(), x + 3, y + 5 + 17 * line1, 0xffffff);
        line1++;
    }
}
 
Example #3
Source File: CustomButton.java    From MediaMod with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
    if (this.visible) {
        FontRenderer fontrenderer = mc.fontRendererObj;
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        this.hovered =
                mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
                        && mouseY < this.yPosition + this.height;

        Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, new Color(0, 0, 0, 175).getRGB());

        this.mouseDragged(mc, mouseX, mouseY);
        int j = 14737632;

        if (!this.enabled) {
            j = 10526880;
        } else if (this.hovered) {
            j = new Color(180, 180, 180).getRGB();
        }

        drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
    }
}
 
Example #4
Source File: GuiPlayerSettings.java    From MediaMod with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawDefaultBackground();

    GlStateManager.pushMatrix();
    GlStateManager.color(1, 1, 1, 1);

    // Bind the texture for rendering
    mc.getTextureManager().bindTexture(this.headerResource);

    // Render the header
    Gui.drawModalRectWithCustomSizedTexture(width / 2 - 111, 2, 0, 0, 222, 55, 222, 55);
    GlStateManager.popMatrix();

    boolean testing;
    if (ServiceHandler.INSTANCE.getCurrentMediaHandler() == null) {
        testing = true;
    } else {
        testing = !ServiceHandler.INSTANCE.getCurrentMediaHandler().handlerReady();
    }

    PlayerOverlay.INSTANCE.drawPlayer(width / 2 - 80, height / 2 + 10, Settings.MODERN_PLAYER_STYLE, testing, 1.0);

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example #5
Source File: RenderListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
private void drawMiddleThreeRows(Gui gui, float x, float y, int barHeight, int textureX, int baseTextureY, int width, int fillWidth, int rowHeight) {
    if (fillWidth > width || baseTextureY >= 8) fillWidth = width;
    for (int i = 0; i < barHeight; i++) {
        if (rowHeight == 2) { //this means its drawing bar separators, and its a little different
            gui.drawTexturedModalRect(x, y - 1 - i, textureX, baseTextureY, fillWidth, rowHeight);
        } else {
            gui.drawTexturedModalRect(x, y - i, textureX, baseTextureY + 1, fillWidth, rowHeight);
        }
    }

    gui.drawTexturedModalRect(x, y + 1, textureX, baseTextureY + 2, fillWidth, 1);

    for (int i = 0; i < barHeight; i++) {
        gui.drawTexturedModalRect(x, y + 2 + i, textureX, baseTextureY + 3, fillWidth, rowHeight);
    }
}
 
Example #6
Source File: GuiNBTButton.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public void draw(int mx, int my) {
    GL11.glScalef(.5f, .5f, .5f);
    if (this.inBounds(mx, my)) {
        Gui.drawRect(this.x * 2, this.y * 2, (this.x * 2 + 19), (this.y * 2 + 19), -2130706433);
        if (this.hoverTime == -1L) {
            this.hoverTime = System.currentTimeMillis();
        }
    } else {
        this.hoverTime = -1L;
    }
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    GuiIconUtils.drawButtonBack(this.x * 2, this.y * 2);
    GuiIconUtils.drawButtonIcon(this.x * 2, this.y * 2, id - 1);

    if (!this.enabled) {
        GuiNBTButton.drawRect(this.x * 2, this.y * 2, (this.x * 2 + 19), (this.y * 2 + 19), -1071504862);
    }
    GL11.glScalef(2f, 2f, 2f);
    if (this.enabled && this.hoverTime != -1L && System.currentTimeMillis() - this.hoverTime > 300L) {
        this.drawToolTip(mx, my);
    }
}
 
Example #7
Source File: RenderListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
private void drawBarStart(Gui gui, float x, float y, boolean filled, int barWidth, int barHeight, int fillWidth, Color color, int maxWidth) {
        int baseTextureY = filled ? 0 : 6;

//        drawMiddleThreeRows(gui,x+10,y,barHeight,22,baseTextureY,2, fillWidth, 2); // these two lines just fill some gaps in the bar
//        drawMiddleThreeRows(gui,x+11+(barWidth*9),y,barHeight,22,baseTextureY,2, fillWidth, 2);

        drawAllFiveRows(gui, x, y, barHeight, 0, baseTextureY, 11, fillWidth); // This draws the first segment- including the first separator.

        drawBarSeparators(gui, x + 11, y, baseTextureY, barWidth, barHeight, fillWidth); // This draws the rest of the bar, not sure why it's named this...

        if (fillWidth < maxWidth-1 && fillWidth > 0 && // This just draws a dark line to easily distinguish where the bar's progress is.
                main.getUtils().isUsingDefaultBarTextures()) { // It doesn't always work out nicely when using like custom textures though.
            GlStateManager.color(((float) color.getRed() / 255) * 0.8F, ((float) color.getGreen() / 255) * 0.8F, ((float) color.getBlue() / 255) * 0.8F);
            drawMiddleThreeRows(gui, x + fillWidth, y, barHeight, 11, 6, 2, fillWidth, 2);
        }
    }
 
Example #8
Source File: GuiButtonDownloaded.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft minecraft, int x, int y, float partialTicks)
{
    if (this.visible)
    {
        Minecraft.getMinecraft().getTextureManager().bindTexture(Resources.GUI_BUTTON_TICK);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        boolean flag = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
        int k = 0;
        int j = 0;
        if (flag)
        {
            k += this.height;
        }
        if (ticked)
        {
            j += this.width;
        }
        Gui.drawModalRectWithCustomSizedTexture(this.x, this.y, j, k, this.width, this.height, 40, 40);
        this.drawString(Minecraft.getMinecraft().fontRenderer, I18n.translateToLocal(Strings.MARK_DL), this.x + this.width + 5, this.y + this.height / 2 - 4, 0xFFFFFF);
    }
}
 
Example #9
Source File: LinkComponent.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void render(int x, int y, int width, int mouseX, int mouseY) {
    HyperiumFontRenderer font = tab.gui.getFont();
    lines.clear();
    lines = font.splitString(label,
        (width + 25) / 2); //16 for icon, 3 for render offset and then some more

    GlStateManager.pushMatrix();
    if (hover) Gui.drawRect(x, y, x + width, y + 18 * lines.size(), 0xa0000000);
    GlStateManager.popMatrix();

    int line1 = 0;

    for (String line : lines) {
        font.drawString(line.replaceAll("_", " ").toUpperCase(), x + 3, y + 5 + 17 * line1,
            0xffffff);
        line1++;
    }

    GlStateModifier.INSTANCE.reset();
}
 
Example #10
Source File: SelectorComponent.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void render(int x, int y, int width, int mouseX, int mouseY) {
    HyperiumFontRenderer font = tab.gui.getFont();
    lines.clear();
    lines = font.splitString(label, (int) (width - font.getWidth(getCurrentValue()))); //16 for icon, 3 for render offset and then some more

    GlStateManager.pushMatrix();
    if (hover) Gui.drawRect(x, y, x + width, y + 18 * lines.size(), 0xa0000000);
    GlStateManager.popMatrix();

    int line1 = 0;
    for (String line : lines) {
        font.drawString(line.replaceAll("_", " ").toUpperCase(), x + 3, y + 5 + 17 * line1, 0xffffff);
        line1++;
    }

    int farSide = x + width;
    String val = getCurrentValue();
    float statX = farSide - 5 - font.getWidth(val);
    font.drawString(val, statX, y + 5, Color.WHITE.getRGB());

}
 
Example #11
Source File: ButtonComponent.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void render(int x, int y, int width, int mouseX, int mouseY) {
    HyperiumFontRenderer font = tab.gui.getFont();
    lines.clear();
    lines = font.splitString(label, (width + 25) / 2); //16 for icon, 3 for render offset and then some more

    GlStateManager.pushMatrix();
    if (hover) Gui.drawRect(x, y, x + width, y + 18 * lines.size(), 0xa0000000);
    GlStateManager.popMatrix();

    int line1 = 0;
    for (String line : lines) {
        font.drawString(line.toUpperCase(), x + 3, y + 5 + 17 * line1, 0xffffff);
        line1++;
    }
}
 
Example #12
Source File: MixinGuiChat.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    Gui.drawRect(2, this.height - (int) fade, this.width - 2, this.height, Integer.MIN_VALUE);
    this.inputField.drawTextBox();

    if (LiquidBounce.commandManager.getLatestAutoComplete().length > 0 && !inputField.getText().isEmpty() && inputField.getText().startsWith(String.valueOf(LiquidBounce.commandManager.getPrefix()))) {
        String[] latestAutoComplete = LiquidBounce.commandManager.getLatestAutoComplete();
        String[] textArray = inputField.getText().split(" ");
        String trimmedString = latestAutoComplete[0].replaceFirst("(?i)" + textArray[textArray.length - 1], "");

        mc.fontRendererObj.drawStringWithShadow(trimmedString, inputField.xPosition + mc.fontRendererObj.getStringWidth(inputField.getText()), inputField.yPosition, new Color(165, 165, 165).getRGB());
    }

    IChatComponent ichatcomponent =
            this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());

    if (ichatcomponent != null)
        this.handleComponentHover(ichatcomponent, mouseX, mouseY);
}
 
Example #13
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
public static void renderNameTag(final String string, final double x, final double y, final double z) {
    final RenderManager renderManager = mc.getRenderManager();

    glPushMatrix();
    glTranslated(x - renderManager.renderPosX, y - renderManager.renderPosY, z - renderManager.renderPosZ);
    glNormal3f(0F, 1F, 0F);
    glRotatef(-mc.getRenderManager().playerViewY, 0F, 1F, 0F);
    glRotatef(mc.getRenderManager().playerViewX, 1F, 0F, 0F);
    glScalef(-0.05F, -0.05F, 0.05F);
    setGlCap(GL_LIGHTING, false);
    setGlCap(GL_DEPTH_TEST, false);
    setGlCap(GL_BLEND, true);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    final int width = Fonts.font35.getStringWidth(string) / 2;

    Gui.drawRect(-width - 1, -1, width + 1, Fonts.font35.FONT_HEIGHT, Integer.MIN_VALUE);
    Fonts.font35.drawString(string, -width, 1.5F, Color.WHITE.getRGB(), true);

    resetCaps();
    glColor4f(1F, 1F, 1F, 1F);
    glPopMatrix();
}
 
Example #14
Source File: GuiButtonSpecial.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int x, int y){
    if(thisVisible) super.drawButton(mc, x, y);

    if(visible) {
        if(renderedStacks != null) {
            int middleX = xPosition + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for(int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(FMLClientHandler.instance().getClient().fontRenderer, FMLClientHandler.instance().getClient().renderEngine, renderedStacks[i], startX + i * 18, yPosition + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if(resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            func_146110_a(xPosition + width / 2 - 8, yPosition + 2, 0, 0, 16, 16, 16, 16);
        }
        if(enabled && !thisVisible && x >= xPosition && y >= yPosition && x < xPosition + width && y < yPosition + height) {
            Gui.drawRect(xPosition, yPosition, xPosition + width, yPosition + height, invisibleHoverColor);
        }
    }
}
 
Example #15
Source File: CPSKey.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderKey(int x, int y) {
    int yOffset = this.yOffset;

    if (!mod.getSettings().isShowingMouseButtons()) yOffset -= 24;
    if (!mod.getSettings().isShowingSpacebar()) yOffset -= 18;
    if (!mod.getSettings().isShowingSneak()) yOffset -= 18;
    if (!mod.getSettings().isShowingWASD()) yOffset -= 48;

    Mouse.poll();

    int textColor = getColor();

    if (mod.getSettings().isKeyBackgroundEnabled()) {
        Gui.drawRect(x + xOffset, y + yOffset, x + xOffset + 70, y + yOffset + 16,
            new Color(mod.getSettings().getKeyBackgroundRed(), mod.getSettings().getKeyBackgroundGreen(), mod.getSettings().getKeyBackgroundBlue(),
                mod.getSettings().getKeyBackgroundOpacity()).getRGB());
    }

    String name = (mod.getSettings().isLeftClick() ? getLeftCPS() : getRightCPS()) + " CPS";
    if (mod.getSettings().isChroma()) {
        drawChromaString(name, ((x + (xOffset + 70) / 2) - mc.fontRendererObj.getStringWidth(name) / 2), y + (yOffset + 4), 1.0F);
    } else {
        drawCenteredString(name, x + (xOffset + 70) / 2, y + (yOffset + 4), textColor);
    }
}
 
Example #16
Source File: GuiButtonNEM.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft minecraft, int x, int y, float partialTicks)
{
    if (this.visible)
    {
        Minecraft.getMinecraft().getTextureManager().bindTexture(Resources.GUI_BUTTON_NEM);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        boolean flag = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
        int k = 0;
        int j = 0;
        if (flag)
        {
            k += this.height;
        }
        if (ticked)
        {
            j += this.width;
        }
        Gui.drawModalRectWithCustomSizedTexture(this.x, this.y, j, k, this.width, this.height, 40, 40);
    }
}
 
Example #17
Source File: GuiContainerHook.java    From SkyblockAddons with MIT License 6 votes vote down vote up
private static void setZLevel(Gui gui, int zLevelToSet) {
    if (SkyblockAddonsTransformer.isLabymodClient()) { // There are no access transformers in labymod.
        try {
            if (zLevel == null) {
                zLevel = gui.getClass().getDeclaredField("e");
                zLevel.setAccessible(true);
            }
            if (zLevel != null) {
                zLevel.set(gui, zLevelToSet);
            }
        } catch (IllegalAccessException | NoSuchFieldException e) {
            e.printStackTrace();
        }
    } else {
        gui.zLevel = zLevelToSet;
    }
}
 
Example #18
Source File: GuiExtendedButton.java    From GokiStats with MIT License 6 votes vote down vote up
private void drawHover(Minecraft mc, int mouseX, int mouseY) {
    GL11.glPushMatrix();
    GL11.glTranslatef(this.x, this.y, 0.0F);
    Gui.drawRect(0,
            0,
            this.width,
            this.height,
            this.backgroundColor + -16777216);
    drawCenteredString(mc.fontRenderer,
            this.displayString,
            this.width / 2,
            this.height / 2 - mc.fontRenderer.FONT_HEIGHT / 2 + 1,
            16763904);
    drawBorder();
    GL11.glPopMatrix();
}
 
Example #19
Source File: GuiHyperiumScreen.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void renderBackgroundImage() {
    if (Settings.BACKGROUND.equalsIgnoreCase("CUSTOM")) {
        boolean success = getCustomBackground();

        if (success) {
            Minecraft.getMinecraft().getTextureManager().bindTexture(dynamicBackgroundTexture);
            Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0,
                ResolutionUtil.current().getScaledWidth(),
                ResolutionUtil.current().getScaledHeight(),
                ResolutionUtil.current().getScaledWidth(),
                ResolutionUtil.current().getScaledHeight());

            return;
        } else {
            Settings.BACKGROUND = "1";
        }
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/material/backgrounds/" + Settings.BACKGROUND + ".png"));
    Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0,
        ResolutionUtil.current().getScaledWidth(),
        ResolutionUtil.current().getScaledHeight(),
        ResolutionUtil.current().getScaledWidth(),
        ResolutionUtil.current().getScaledHeight());
}
 
Example #20
Source File: ClickGUI.java    From Happy_MinecraftClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    for(final Panel panel : panels) {
        // Draw panel
        Gui.drawRect(panel.getX(), panel.getY(), panel.getX() + panel.getWidth(), panel.getY() + 20, new Color(66, 134, 244).hashCode());
        fontRendererObj.drawString(panel.getPanelName(), panel.getX() + 5, panel.getY() + 5, 0xffffff);

        for(int i = 0; i < panel.getButtons().size(); i++) {
            final Button button = panel.getButtons().get(i);

            Gui.drawRect(panel.getX(), panel.getY() + 20 + (20 * i), panel.getX() + panel.getWidth(), panel.getY() + (20 * i) + 40, Integer.MIN_VALUE);
            fontRendererObj.drawString((button.getModule().getState() ? "§a" : "§c") + button.getModule().getModuleName(), panel.getX() + 2, panel.getY() + 20 + (20 * i) + 7, 0xffffff);
        }

        // Drag panel
        if(panel.isDrag()) {
            panel.setX(mouseX + panel.getDragX());
            panel.setY(mouseY + panel.getDragY());
        }
    }
    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example #21
Source File: GuiNBTNode.java    From NBTEdit with GNU General Public License v3.0 6 votes vote down vote up
public void draw(int mx, int my)
{
	boolean selected = tree.getFocused() == node;
	boolean hover = inBounds(mx,my);
	boolean chHover = inHideShowBounds(mx,my);
	int color = selected ? 0xff : hover ? 16777120 : (node.hasParent()) ? 14737632 : -6250336;

	mc.renderEngine.bindTexture(WIDGET_TEXTURE);
	
	if (selected){
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		Gui.drawRect(x+11, y, x+width, y+height, Integer.MIN_VALUE);
	}
	if (node.hasChildren()){
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		this.drawTexturedModalRect(x-9, y, (node.shouldDrawChildren()) ? 9 : 0 ,(chHover)?height : 0,9,height);
	}
	
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	drawTexturedModalRect(x+1, y, (node.getObject().getNBT().getId() -1)*9, 18, 9, 9);
	drawString(mc.fontRenderer, displayString, x+11, y + (this.height - 8) / 2, color);
}
 
Example #22
Source File: GuiHelper.java    From LunatriusCore with MIT License 5 votes vote down vote up
public static void drawItemStackSlot(final TextureManager textureManager, final int x, final int y) {
    textureManager.bindTexture(Gui.STAT_ICONS);

    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder buffer = tessellator.getBuffer();
    final double uScale = 1.0 / 128.0;
    final double vScale = 1.0 / 128.0;

    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    drawTexturedRectangle(buffer, x + 1, y + 1, x + 1 + 18, y + 1 + 18, 0, uScale * 0, vScale * 0, uScale * 18, vScale * 18);
    tessellator.draw();
}
 
Example #23
Source File: GuiScrollable.java    From WearableBackpacks with MIT License 5 votes vote down vote up
public void drawBackground(int x, int y, int mouseX, int mouseY, float partialTicks) {
	float scale = 1 / 32.0F;
	float u1 = x * scale;
	float v1 = y * scale;
	float u2 = (x + getWidth()) * scale;
	float v2 = (y + getHeight()) * scale;
	
	bindTexture(Gui.OPTIONS_BACKGROUND);
	setRenderColorRGB(0x202020);
	drawRect(0, 0, getWidth(), getHeight(), u1, v1, u2, v2);
}
 
Example #24
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public static void drawButton(int x, int y, int x2, int y2, int borderC, int topgradient, int bottomgradient) {

        GLUtils.drawBorderedRect(x, y, x2, y2, borderC, 16777215);
        Gui.drawRect((x2 - 2), y, (x2 - 1), y2, -16172197);
        Gui.drawRect((x + 1), (y + 1), (x2 - 1), (y + 2), -15050626);
        Gui.drawRect((x + 1), (y + 1), (x + 2), (y2 - 1), -15050626);
        Gui.drawRect(x, (y2 - 2), x2, (y2 - 1), -16172197);
        GLUtils.drawGradientRect(x + 2, y + 2, x2 - 2, y2 - 2, topgradient, bottomgradient);
    }
 
Example #25
Source File: SplashProgress.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Render the progress bar and text
 */
private static void drawProgress() {
    if (Minecraft.getMinecraft().gameSettings == null || Minecraft.getMinecraft().getTextureManager() == null)
        return;

    // Declare the font to be used
    if (raleway == null) raleway = new HyperiumFontRenderer("Raleway", 20);
    if (roboto == null) roboto = new HyperiumFontRenderer("Roboto", 20);

    // Get the users screen width and height to apply
    ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());

    // Calculate the progress bar
    double nProgress = PROGRESS;
    double calc = (nProgress / DEFAULT_MAX) * sr.getScaledWidth();

    // Draw the transparent bar before the green bar
    Gui.drawRect(0, sr.getScaledHeight() - 35, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 50).getRGB());

    // Draw the current splash text
    raleway.drawString(CURRENT, 20, sr.getScaledHeight() - 25, 0xffffffff);

    // Draw the current amount of progress / max amount of progress
    String s = PROGRESS + "/" + DEFAULT_MAX;
    roboto.drawString(s, sr.getScaledWidth() - 20 - roboto.getWidth(s), sr.getScaledHeight() - 25, 0xe1e1e1ff);

    // Render the blue progress bar
    Gui.drawRect(0, sr.getScaledHeight() - 2, (int) calc, sr.getScaledHeight(), new Color(3, 169, 244).getRGB());

    // Render the bar base
    Gui.drawRect(0, sr.getScaledHeight() - 2, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 10).getRGB());
}
 
Example #26
Source File: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawSmoothRect(int left, int top, int right, int bottom, int circleSize, int color) {
    left += circleSize;
    right -= circleSize;
    Gui.drawRect(left, top, right, bottom, color);
    int i = circleSize - 1;
    Gui.drawRect(left - circleSize, top + i, left, bottom - i, color);
    Gui.drawRect(right, top + i, right + circleSize, bottom - i, color);

    drawFilledCircle(left, top + circleSize, circleSize, color);
    drawFilledCircle(left, bottom - circleSize, circleSize, color);

    drawFilledCircle(right, top + circleSize, circleSize, color);
    drawFilledCircle(right, bottom - circleSize, circleSize, color);

}
 
Example #27
Source File: GuiNBTNode.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void draw(int mx, int my) {
    boolean selected = this.tree.getFocused() == this.node;
    boolean hover = this.inBounds(mx, my);
    boolean chHover = this.inHideShowBounds(mx, my);
    int color = selected ? 255 : (hover ? 16777120 : (this.node.hasParent() ? 14737632 : -6250336));
    if (selected) {
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        Gui.drawRect((this.x + 11), this.y, (this.x + this.width), (this.y + this.height), Integer.MIN_VALUE);
    }
    GL11.glScalef(.5f, .5f, .5f);
    if (this.node.hasChildren()) {
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        GuiIconUtils.drawButtonBack((this.x - 9) * 2, this.y * 2 - 3);
        if (chHover) {
            GLUtils.drawRect((this.x - 9) * 2 + 4, this.y * 2 + 4 - 3, (this.x - 9) * 2 + 15, this.y * 2 + 15 - 3, GLUtils.getColor(255, 255, 255));
        }
        GLUtils.drawRect((this.x - 9) * 2 + 6, this.y * 2 + 9 - 3, (this.x - 9) * 2 + 13, this.y * 2 + 10 - 3, GLUtils.getColor(0, 0, 0));
        if (!this.node.shouldDrawChildren()) {
            GLUtils.drawRect((this.x - 9) * 2 + 9, this.y * 2 + 6 - 3, (this.x - 9) * 2 + 10, this.y * 2 + 13 - 3, GLUtils.getColor(0, 0, 0));
        }
    }
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    GuiIconUtils.drawButtonBack((this.x + 1) * 2, this.y * 2 - 3);
    GuiIconUtils.drawButtonIcon((this.x + 1) * 2, this.y * 2 - 3, NBT_ICON_MAPPING[this.node.getObject().getNBT().getId() - 1]);
    GL11.glScalef(2f, 2f, 2f);
    this.drawString(Wrapper.INSTANCE.fontRenderer(), this.displayString, this.x + 11, this.y + (this.height - 8) / 2, color);
}
 
Example #28
Source File: GuiCharacterButton.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void draw(int mx, int my) {
    if (this.inBounds(mx, my)) {
        Gui.drawRect(this.x, this.y, (this.x + 14), (this.y + 14), -2130706433);
    }
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    //this.drawTexturedModalRect(this.x, this.y, this.id * 14, 27, 14, 14);
    if (!this.enabled) {
        GuiCharacterButton.drawRect(this.x, this.y, (this.x + 14), (this.y + 14), -1071504862);
    }
}
 
Example #29
Source File: GuiFilter.java    From BetterChests with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GuiFilter(ContainerFilter container) {
	super(container);

	GuiElementToggle isBlacklist = new GuiElementToggle(this, 96, 16, "isBlacklist");
	isBlacklist.setTexture(new IRenderable() {
		IRenderable blacklist = IRenderable.getRenderable(BlocksItemsBetterChests.filter.getBlacklistItemStack());
		IRenderable whitelist = IRenderable.getRenderable(BlocksItemsBetterChests.filter.getWhitelistItemStack());

		@Override
		public void render(int x, int y, Gui gui, TextureManager textureManager) {
			if (isBlacklist.getState()) {
				blacklist.render(x, y, gui, textureManager);
			} else {
				whitelist.render(x, y, gui, textureManager);
			}
		}
	}.offset(6, 2));
	addGuiElement(isBlacklist);

	GuiElementToggle checkDamage = new GuiElementToggle(this, 96, 38, "checkdamage");
	checkDamage.setTexture(checkDamage.getRenderable());
	addGuiElement(checkDamage);

	GuiElementToggle checkNbt = new GuiElementToggle(this, 96, 60, "checknbt");
	checkNbt.setTexture(checkNbt.getRenderable());
	addGuiElement(checkNbt);

	GuiElementExpandableColor upgradeInfo = addGuiElement(new GuiElementExpandableColor(this, right(22, 22), 125, 70));
	upgradeInfo.setColor(0xFF808000);
	upgradeInfo.setTexture(IRenderable.getRenderable(new ItemStack(BlocksItemsBetterChests.crafting)));
	upgradeInfo.setActualContent(IRenderable.getRenderable(() -> LocalizationHelper.localize("betterchests:gui.filter.info.restrictupgrade"), upgradeInfo.getLocation()));
}
 
Example #30
Source File: OptionScrollPane.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void drawOverlayTex(int x, int y, int w, int h, float zLevel) {
    GlStateManager.color(1, 1, 1, 1);
    Minecraft.getMinecraft().renderEngine.bindTexture(Gui.optionsBackground);
    WorldRenderer r = CCRenderState.startDrawing();
    r.addVertexWithUV(x, y, zLevel, 0, 0);
    r.addVertexWithUV(x, y + h, zLevel, 0, h / 16D);
    r.addVertexWithUV(x + w, y + h, zLevel, w / 16D, h / 16D);
    r.addVertexWithUV(x + w, y, zLevel, w / 16D, 0);
    CCRenderState.draw();
}