Java Code Examples for net.minecraft.client.gui.Gui#drawModalRectWithCustomSizedTexture()

The following examples show how to use net.minecraft.client.gui.Gui#drawModalRectWithCustomSizedTexture() . 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: GuiServices.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, height / 2 - 110, 0, 0, 222, 55, 222, 55);
    GlStateManager.popMatrix();

    if (!SpotifyHandler.logged) {
        drawCenteredString(fontRendererObj, I18n.format("menu.guiservices.text.spotifyNotLogged.name"), width / 2, height / 2 - 53, Color.red.getRGB());
    } else {
        drawCenteredString(fontRendererObj, I18n.format("menu.guiservices.text.spotifyLogged.name"), width / 2, height / 2 - 53, Color.green.getRGB());
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example 2
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 3
Source File: GuiButtonUpdates.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int x, int y, float partialTicks)
{
    visible = UpdateHandler.getListSize() != 0;

    this.displayString = String.valueOf(UpdateHandler.getListSize());
    if (this.visible)
    {
        Minecraft.getMinecraft().getTextureManager().bindTexture(Resources.GUI_BUTTON_UPDATE);
        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;
        if (flag)
        {
            k += this.height;
        }
        Gui.drawModalRectWithCustomSizedTexture(this.x, this.y, 0, k, this.width, this.height, 20, 40);
        this.drawCenteredString(Minecraft.getMinecraft().fontRenderer, this.displayString, this.x + this.width / 2 + 8, this.y + this.height / 2 + 3, 0xFFFFFF);
    }
}
 
Example 4
Source File: TacoCmd.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onRenderGUI(RenderGameOverlayEvent.Post event)
{
	if(event.getType() != ElementType.ALL || mc.gameSettings.showDebugInfo)
		return;
	
	if(wurst.getHax().rainbowUiHack.isEnabled())
	{
		float[] acColor = wurst.getGui().getAcColor();
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 1);
	}else
		GL11.glColor4f(1, 1, 1, 1);
	
	int tacoId = WMinecraft.getPlayer().ticksExisted % 32 / 8;
	ResourceLocation tacoLocation = tacos[tacoId];
	mc.getTextureManager().bindTexture(tacoLocation);
	
	ScaledResolution sr = new ScaledResolution(mc);
	int x = sr.getScaledWidth() / 2 + 44;
	int y = sr.getScaledHeight() - 51;
	int w = 64;
	int h = 32;
	Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h);
}
 
Example 5
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 6
Source File: GuiButtonCurse.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_CURSE);
        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 7
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 8
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 9
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public static void drawImage(ResourceLocation image, int x, int y, int width, int height) {
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glDepthMask(false);
    OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
    glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.getTextureManager().bindTexture(image);
    Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, width, height, width, height);
    glDepthMask(true);
    glDisable(GL_BLEND);
    glEnable(GL_DEPTH_TEST);
}
 
Example 10
Source File: GuiChangeLogList.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void overlayBackground()
{
    this.client.renderEngine.bindTexture(Resources.GUI_WINDOW);
    GL11.glColor4f(0.6F, 0.6F, 0.6F, 1.0F);
    Gui.drawModalRectWithCustomSizedTexture(left - 10, top - slotHeight, 0, 30, listWidth + 20, slotHeight, 220, 160);
    Gui.drawModalRectWithCustomSizedTexture(left - 10, top + listHeight, 0, listHeight + slotHeight, listWidth + 20, slotHeight, 220, 160);
}
 
Example 11
Source File: IMediaGui.java    From MediaMod with GNU General Public License v3.0 5 votes vote down vote up
default void drawHeader(int width, int height) {
    GlStateManager.pushMatrix();
    GlStateManager.color(1, 1, 1, 1);

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

    // Render the album art as 35x35
    Gui.drawModalRectWithCustomSizedTexture(width / 2 - 111, height / 2 - 110, 0, 0, 222, 55, 222, 55);
    GlStateManager.popMatrix();
}
 
Example 12
Source File: GuiUpdates.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float par3)
{
    updateList.drawScreen(mouseX, mouseY, par3);

    if (openUpdate != null)
    {
        changeLogList.drawScreen(mouseX, mouseY, par3);
    }

    this.fontRenderer.drawSplitString(I18n.translateToLocal(Strings.INFO).replace(";", "\n"), 10, height / 2 - 60, width / 2 - 150 + listShift - 20, 0xCCCCCC);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().renderEngine.bindTexture(Resources.GUI_LOGO);

    int i = width / 2 - 150 + listShift - 10;
    Gui.drawModalRectWithCustomSizedTexture(5, 5, 0, 0, i, (int) (i * 0.4), i, (int) (i * 0.4));

    if (openUpdate != null)
    {
        drawCenteredString(fontRenderer, openUpdate.displayName, width / 2 + listShift, height / 2 - 80, 0xFFFFFF);
        if (openUpdate.changeLog == null)
        {
            drawCenteredString(fontRenderer, I18n.translateToLocal(Strings.NO_CHANGE_LOG), width / 2 + listShift, height / 2 - 60, 0xCCCCCC);
        }
    }
    if (DownloadThread.isUpdating())
    {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        Minecraft.getMinecraft().renderEngine.bindTexture(Resources.GUI_ICONS);
        Gui.drawModalRectWithCustomSizedTexture(width - 20, 4, 0, 0, 16, 16, 64, 32);
    }

    super.drawScreen(mouseX, mouseY, par3);

    drawToolTip(mouseX, mouseY);
    if (tempDisableButtonPress > 0)
        tempDisableButtonPress--;
}
 
Example 13
Source File: GuiScroll.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void overlayBackground()
{
    this.client.renderEngine.bindTexture(Resources.GUI_WINDOW);
    GL11.glColor4f(0.6F, 0.6F, 0.6F, 1.0F);
    Gui.drawModalRectWithCustomSizedTexture(left - 10, top - slotHeight, 0, 0, listWidth + 20, slotHeight, 220, 160);
    Gui.drawModalRectWithCustomSizedTexture(left - 10, top + listHeight, 0, listHeight + slotHeight, listWidth + 20, slotHeight, 220, 160);
}
 
Example 14
Source File: PotionExp.java    From Sakura_mod with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha)
{
  mc.getTextureManager().bindTexture(PotionLoader.res);
  Gui.drawModalRectWithCustomSizedTexture(x + 3, y + 3, 0, 0, 18, 18, 256.0F, 256.0F);
}
 
Example 15
Source File: WrapperGui.java    From ClientBase with MIT License 4 votes vote down vote up
public static void drawModalRectWithCustomSizedTexture(int var0, int var1, float var2, float var3, int var4, int var5, float var6, float var7) {
    Gui.drawModalRectWithCustomSizedTexture(var0, var1, var2, var3, var4, var5, var6, var7);
}
 
Example 16
Source File: MixinLoadingScreenRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @author ConorTheDev
 * @reason Custom screen when loading to a new world
 */
@Inject(method = "setLoadingProgress", at = @At("HEAD"), cancellable = true)
private void setLoadingProgress(CallbackInfo ci) {
    if (Settings.HYPERIUM_LOADING_SCREEN) {
        long nanoTime = Minecraft.getSystemTime();

        if (nanoTime - systemTime >= 100L) {
            systemTime = nanoTime;
            ScaledResolution scaledresolution = new ScaledResolution(mc);
            int scaleFactor = scaledresolution.getScaleFactor();
            int scaledWidth = scaledresolution.getScaledWidth();
            int scaledHeight = scaledresolution.getScaledHeight();

            if (OpenGlHelper.isFramebufferEnabled()) {
                framebuffer.framebufferClear();
            } else {
                GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT);
            }

            framebuffer.bindFramebuffer(false);
            GlStateManager.matrixMode(GL11.GL_PROJECTION);
            GlStateManager.loadIdentity();
            GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D);
            GlStateManager.matrixMode(GL11.GL_MODELVIEW);
            GlStateManager.loadIdentity();
            GlStateManager.translate(0.0F, 0.0F, -200.0F);

            if (!OpenGlHelper.isFramebufferEnabled()) GlStateManager.clear(16640);

            Tessellator tessellator = Tessellator.getInstance();
            WorldRenderer worldrenderer = tessellator.getWorldRenderer();
            mc.getTextureManager().bindTexture(new ResourceLocation("textures/world-loading.png"));

            Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0f, 0.0f, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight());

            int progress;
            if ("Loading world".equals(currentlyDisplayedText)) {
                if (message.isEmpty()) {
                    progress = 33;
                } else if (message.equals("Converting world")) {
                    progress = 66;
                } else if (message.equals("Building terrain")) {
                    progress = 90;
                } else {
                    progress = 100;
                }
            } else {
                progress = -1;
            }

            if (progress >= 0) {
                int maxProgress = 100;
                int barTop = 2;
                int barHeight = scaledResolution.getScaledHeight() - 15;
                GlStateManager.disableTexture2D();
                worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
                worldrenderer.pos(maxProgress, barHeight, 0.0D).color(128, 128, 128, 255).endVertex();
                worldrenderer.pos(maxProgress, barHeight + barTop, 0.0D).color(128, 128, 128, 255).endVertex();
                worldrenderer.pos(maxProgress + maxProgress, barHeight + barTop, 0.0D).color(128, 128, 128, 255).endVertex();
                worldrenderer.pos(maxProgress + maxProgress, barHeight, 0.0D).color(128, 128, 128, 255).endVertex();
                worldrenderer.pos(maxProgress, barHeight, 0.0D).color(128, 255, 128, 255).endVertex();
                worldrenderer.pos(maxProgress, barHeight + barTop, 0.0D).color(128, 255, 128, 255).endVertex();
                worldrenderer.pos(maxProgress + progress, barHeight + barTop, 0.0D).color(128, 255, 128, 255).endVertex();
                worldrenderer.pos(maxProgress + progress, barHeight, 0.0D).color(128, 255, 128, 255).endVertex();
                tessellator.draw();
                GlStateManager.enableAlpha();
                GlStateManager.enableBlend();
                Gui.drawRect(0, scaledResolution.getScaledHeight() - 35, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
                    new Color(0, 0, 0, 50).getRGB());
                GlStateManager.disableAlpha();
                GlStateManager.disableBlend();
                GlStateManager.enableTexture2D();
            }

            GlStateManager.enableBlend();
            GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
            mc.fontRendererObj.drawString(currentlyDisplayedText, 5, scaledResolution.getScaledHeight() - 30, -1);
            mc.fontRendererObj.drawString(message, 5, scaledResolution.getScaledHeight() - 15, -1);
            framebuffer.unbindFramebuffer();

            if (OpenGlHelper.isFramebufferEnabled()) {
                framebuffer.framebufferRender(scaledWidth * scaleFactor, scaledHeight * scaleFactor);
            }

            mc.updateDisplay();

            try {
                Thread.yield();
            } catch (Exception ignored) {
            }
        }

        ci.cancel();
    }
}
 
Example 17
Source File: PotionAttackPotion.java    From Sakura_mod with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderHUDEffect(int ix, int iy, PotionEffect effect, Minecraft mc, float alpha)
{
  mc.getTextureManager().bindTexture(PotionLoader.res);
  Gui.drawModalRectWithCustomSizedTexture(ix + 3, iy + 3, x, y, w, h, 256.0F, 256.0F);
}
 
Example 18
Source File: PotionFire.java    From Sakura_mod with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderHUDEffect(int ix, int iy, PotionEffect effect, Minecraft mc, float alpha)
{
  mc.getTextureManager().bindTexture(PotionLoader.res);
  Gui.drawModalRectWithCustomSizedTexture(ix + 3, iy + 3, 36, 18, 18, 18, 256.0F, 256.0F);
}
 
Example 19
Source File: GuiUpdates.java    From VersionChecker with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void drawWindow()
{
    GL11.glColor4f(0.6F, 0.6F, 0.6F, 1.0F);
    Minecraft.getMinecraft().renderEngine.bindTexture(Resources.GUI_WINDOW);
    Gui.drawModalRectWithCustomSizedTexture(windowStartX, windowStartY, 0, 0, 220, 160, 220, 160);
}
 
Example 20
Source File: GuiUpdateList.java    From VersionChecker with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void drawSlot(int slotIndex, int minX, int maxX, int minY, int maxY, Tessellator tesselator)
{
    Update update = updateList.get(slotIndex);
    if (update != null && !update.oldVersion.matches(update.newVersion))
    {
        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(update.displayName, listWidth - 10), minX + 5, minY + 4, 0xFFFFFF);
        if (this.parent.getFontRenderer().getStringWidth(update.newVersion) >= (listWidth - 125)){
        	this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(update.oldVersion + " -> ", listWidth - 10), minX + 5, minY + 15, 0xCCCCCC);
        	this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("  " + update.newVersion, listWidth - 10), minX + 5, minY + 25, 0xCCCCCC);
        }
        else
        {
        	this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(update.oldVersion + " -> " + update.newVersion, listWidth - 10), minX + 5, minY + 15, 0xCCCCCC);
        }
        
        String info;

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        Minecraft.getMinecraft().renderEngine.bindTexture(Resources.GUI_ICONS);

        if (DownloadThread.isUpdating(update))
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 0, 0, 16, 16, 64, 32);

            info = I18n.translateToLocal(Strings.UPDATING);
        }
        else if (update.isDownloaded())
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 16, 0, 16, 16, 64, 32);

            if (!update.MOD_ID.equalsIgnoreCase(Reference.MOD_ID))
            {
                info = I18n.translateToLocal(Strings.IS_DOWNLOADED);
            }
            else
            {
                info = I18n.translateToLocal(Strings.UNABLE_TO_REMOVE_SELF);
            }
        }
        else if (update.isErrored())
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 32, 0, 16, 16, 64, 32);

            info = I18n.translateToLocal(Strings.ERRORED);
        }
        else if (update.isDirectLink)
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 16, 16, 16, 16, 64, 32);

            info = I18n.translateToLocal(Strings.DL_AVAILABLE);
        }
        else if (update.updateURL != null)
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 0, 16, 16, 16, 64, 32);

            info = I18n.translateToLocal(Strings.LINK_TO_DL);
        }
        else
        {
            info = I18n.translateToLocal(Strings.CANNOT_UPDATE);
        }

        if (update.updateType == Update.UpdateType.NOT_ENOUGH_MODS)
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 32, 16, 16, 16, 64, 32);
        }
        else if (update.updateType == Update.UpdateType.CURSE)
        {
            Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 48, 0, 16, 16, 64, 32);
        }

        this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(info, listWidth - 10), minX + 5, minY + 35, 0xCCCCCC);
    }
}