Java Code Examples for codechicken.lib.texture.TextureUtils#changeTexture()

The following examples show how to use codechicken.lib.texture.TextureUtils#changeTexture() . 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: GuiEnderItemStorage.java    From EnderStorage with MIT License 6 votes vote down vote up
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    TextureUtils.changeTexture(container.chestInv.getSize() == 0 ? "textures/gui/container/dispenser.png" : "textures/gui/container/generic_54.png");
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;

    switch (container.chestInv.getSize()) {
        case 0:
        case 2:
            blit(x, y, 0, 0, xSize, ySize);
            break;
        case 1:
            blit(x, y, 0, 0, xSize, 71);
            blit(x, y + 71, 0, 126, xSize, 96);
            break;

    }
}
 
Example 2
Source File: GuiRecipe.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
    GlStateManager.color(1, 1, 1, 1);
    TextureUtils.changeTexture("nei:textures/gui/recipebg.png");
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

    GlStateManager.pushMatrix();
    GlStateManager.translate(j + 5, k + 16, 0);
    IRecipeHandler recipehandler = currenthandlers.get(recipetype);
    for (int i = page * recipehandler.recipiesPerPage(); i < recipehandler.numRecipes() && i < (page + 1) * recipehandler.recipiesPerPage(); i++) {
        recipehandler.drawBackground(i);
        GlStateManager.translate(0, 65, 0);
    }
    GlStateManager.popMatrix();
}
 
Example 3
Source File: PatreonButton.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void drawButtonTex(int mousex, int mousey) {
    super.drawButtonTex(mousex, mousey);

    GlStateManager.color(1, 1, 1, 1);
    TextureUtils.changeTexture("nei:textures/patreon_neon.png");
    int texh = height - 4;
    int texw = texh * 4;
    drawModalRectWithCustomSizedTexture(x + width / 2 - texw / 2, y + height / 2 - texh / 2, 0, 0, texw, texh, texw, texh);
}
 
Example 4
Source File: ContainerEnchantmentModifier.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void drawSlots(GuiEnchantmentModifier gui) {
    for (int slot = 0; slot < 3; slot++) {
        int shade = 0;
        String text = "";

        int containerslot = slot + getScrolledSlots();
        if (containerslot + 1 > slotEnchantment.size()) {
            shade = 1;
        } else {
            EnchantmentHash e = slotEnchantment.get(containerslot);
            shade = e.state;
            text = e.enchantment.getTranslatedName(e.level == -1 ? level : e.level);
            if (gui.mc.fontRenderer.getStringWidth(text) > 95 && text.contains("Projectile")) {
                text = text.replace("Projectile", "Proj");
            }
            if (gui.mc.fontRenderer.getStringWidth(text) > 95 && text.contains("Protection")) {
                text = text.replace("Protection", "Protect");
            }
            if (gui.mc.fontRenderer.getStringWidth(text) > 95 && text.contains("Bane of")) {
                text = text.replace("Bane of ", "");
            }
        }

        TextureUtils.changeTexture("textures/gui/container/enchanting_table.png");
        GlStateManager.color(1, 1, 1);
        if (hasScrollBar()) {
            gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.getYSize() + slotheight * shade, cwidth - 30, slotheight);
            gui.drawTexturedModalRect(relx + cwidth - 30, rely + slot * slotheight, cwidth - 23, gui.getYSize() + slotheight * shade, 30, slotheight);
        } else {
            gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.getYSize() + slotheight * shade, cwidth + 7, slotheight);
        }

        gui.getFontRenderer().drawString(text, relx + 4, rely + slot * slotheight + 5, textColourFromState(shade));
    }
}
 
Example 5
Source File: GuiPotionCreator.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void drawBackground() {
    TextureUtils.changeTexture("nei:textures/gui/potion.png");
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);

    FontUtils.drawCenteredString("Favourite Potions", xSize / 2, 4, 0x404040);
    fontRenderer.drawString("Duration", 12, 40, 0x404040);
    fontRenderer.drawString("Level", 19, 73, 0x404040);
    FontUtils.drawCenteredString(translateAmplifier(amplifier), 33, 86, 0xFF606060);
}
 
Example 6
Source File: GuiExtendedCreativeInv.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {

    GlStateManager.color(1, 1, 1, 1);
    TextureUtils.changeTexture(INV_TEX);

    int x = guiLeft;
    int y = guiTop - 4;

    drawTexturedModalRect(x - 23, y, 0, 0, 199, 204);
}
 
Example 7
Source File: GuiEnchantmentModifier.java    From NotEnoughItems with MIT License 5 votes vote down vote up
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GlStateManager.color(1, 1, 1, 1);
    TextureUtils.changeTexture("textures/gui/container/enchanting_table.png");
    GlStateManager.translate(guiLeft, guiTop, 0);
    drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);

    container.onUpdate(i, j);
    container.drawSlots(this);
    container.drawScrollBar(this);

    String levelstring = "" + container.level;
    fontRenderer.drawString(levelstring, 33 - fontRenderer.getStringWidth(levelstring) / 2, 34, 0xFF606060);

    GlStateManager.translate(-guiLeft, -guiTop, 0);
}
 
Example 8
Source File: GuiNEIButton.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks) {

    if (!visible) {
        return;
    }

    FontRenderer fontrenderer = minecraft.fontRenderer;
    TextureUtils.changeTexture(GUI_TEX);
    GlStateManager.color(1, 1, 1, 1);

    boolean flag = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
    int k = getHoverState(flag);

    drawTexturedModalRect(x, y, 0, 46 + k * 20, width / 2, height / 2);//top left
    drawTexturedModalRect(x + width / 2, y, 200 - width / 2, 46 + k * 20, width / 2, height / 2);//top right
    drawTexturedModalRect(x, y + height / 2, 0, 46 + k * 20 + 20 - height / 2, width / 2, height / 2);//bottom left
    drawTexturedModalRect(x + width / 2, y + height / 2, 200 - width / 2, 46 + k * 20 + 20 - height / 2, width / 2, height / 2);//bottom right

    mouseDragged(minecraft, mouseX, mouseY);

    if (!enabled) {
        drawCenteredString(fontrenderer, displayString, x + width / 2, y + (height - 8) / 2, 0xffa0a0a0);
    } else if (flag) {
        drawCenteredString(fontrenderer, displayString, x + width / 2, y + (height - 8) / 2, 0xffffa0);
    } else {
        drawCenteredString(fontrenderer, displayString, x + width / 2, y + (height - 8) / 2, 0xe0e0e0);
    }
}