Search in sources :

Example 1 with Drawable

use of forestry.core.gui.Drawable in project ForestryMC by ForestryMC.

the class WidgetDatabaseSlot method draw.

@Override
public void draw(int startX, int startY) {
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    manager.minecraft.renderEngine.bindTexture(TEXTURE_LOCATION);
    Drawable texture = SLOT;
    if (isSelected()) {
        texture = SLOT_SELECTED;
    }
    texture.draw(startX + xPos - 3, startY + yPos - 3);
    ItemStack itemStack = getItemStack();
    if (!itemStack.isEmpty()) {
        Minecraft minecraft = Minecraft.getMinecraft();
        TextureManager textureManager = minecraft.getTextureManager();
        textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.enableGUIStandardItemLighting();
        GuiUtil.drawItemStack(manager.gui, itemStack, startX + xPos, startY + yPos);
        RenderHelper.disableStandardItemLighting();
    }
    if (mouseOver) {
        drawMouseOver();
    }
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) Drawable(forestry.core.gui.Drawable) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft)

Example 2 with Drawable

use of forestry.core.gui.Drawable in project ForestryMC by ForestryMC.

the class WidgetDatabaseTabs method drawTabs.

public void drawTabs(int startX, int startY) {
    for (int tabIndex = 0; tabIndex < TABS.length; tabIndex++) {
        if (tabIndex == selectedTab) {
            continue;
        }
        EnumDatabaseTab tab = TABS[tabIndex];
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        Drawable tabTexture = GUI_TAB;
        int xPos = this.xPos + tabIndex * (GUI_TAB.width + spacing);
        tabTexture.draw(xPos, yPos - 4);
        GuiUtil.drawItemStack(manager.gui, parent.getItemStack(tab), startX + xPos + 6, startY + yPos + 2);
    }
}
Also used : EnumDatabaseTab(forestry.api.genetics.EnumDatabaseTab) Drawable(forestry.core.gui.Drawable)

Example 3 with Drawable

use of forestry.core.gui.Drawable in project ForestryMC by ForestryMC.

the class GuiElementFactory method createFertilityInfo.

public IGuiElement createFertilityInfo(IAlleleInteger fertilityAllele, int x, int texOffset) {
    String fertilityString = Integer.toString(fertilityAllele.getValue()) + " x";
    IGuiElementLayout layout = createHorizontal(x, 0, 0).setDistance(2);
    layout.addElement(new GuiElementText(0, 0, 12, fertilityString, getColorCoding(fertilityAllele.isDominant())));
    layout.addElement(new GuiElementDrawable(0, -1, new Drawable(TEXTURE, 60, 240 + texOffset, 12, 8)));
    return layout;
}
Also used : Drawable(forestry.core.gui.Drawable) IGuiElementLayout(forestry.api.core.IGuiElementLayout)

Example 4 with Drawable

use of forestry.core.gui.Drawable in project ForestryMC by ForestryMC.

the class GuiElementFactory method createProbabilityAdd.

private static GuiElementDrawable createProbabilityAdd(IMutation mutation, int x, int y) {
    float chance = mutation.getBaseChance();
    int line = 247;
    int column = 190;
    switch(EnumMutateChance.rateChance(chance)) {
        case HIGHEST:
            column = 190;
            break;
        case HIGHER:
            column = 190 + 9;
            break;
        case HIGH:
            column = 190 + 9 * 2;
            break;
        case NORMAL:
            column = 190 + 9 * 3;
            break;
        case LOW:
            column = 190 + 9 * 4;
            break;
        case LOWEST:
            column = 190 + 9 * 5;
        default:
            break;
    }
    // Probability add
    return new GuiElementDrawable(x, y, new Drawable(TEXTURE, column, line, 9, 9));
}
Also used : Drawable(forestry.core.gui.Drawable)

Example 5 with Drawable

use of forestry.core.gui.Drawable in project ForestryMC by ForestryMC.

the class WidgetDatabaseTabs method drawSelectedTab.

public void drawSelectedTab(int startX, int startY) {
    // Check if a tab is selected
    if (selectedTab < 0) {
        return;
    }
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    EnumDatabaseTab tab = TABS[selectedTab];
    int textureIndex = selectedTab == 0 ? 0 : selectedTab == TABS.length - 1 ? 2 : 1;
    Drawable tabTexture;
    if (textureIndex == 0) {
        tabTexture = GUI_TAB_ACTIVE_LEFT;
    } else if (textureIndex == 2) {
        tabTexture = GUI_TAB_ACTIVE_RIGHT;
    } else {
        tabTexture = GUI_TAB_ACTIVE_CENTER;
    }
    int xPos = this.xPos + selectedTab * (GUI_TAB.width + spacing);
    tabTexture.draw(xPos, yPos - 4);
    GuiUtil.drawItemStack(manager.gui, parent.getItemStack(tab), startX + xPos + 6, startY + yPos + 2);
}
Also used : EnumDatabaseTab(forestry.api.genetics.EnumDatabaseTab) Drawable(forestry.core.gui.Drawable)

Aggregations

Drawable (forestry.core.gui.Drawable)5 EnumDatabaseTab (forestry.api.genetics.EnumDatabaseTab)2 IGuiElementLayout (forestry.api.core.IGuiElementLayout)1 Minecraft (net.minecraft.client.Minecraft)1 TextureManager (net.minecraft.client.renderer.texture.TextureManager)1 ItemStack (net.minecraft.item.ItemStack)1