Search in sources :

Example 1 with EscritoireGameToken

use of forestry.core.tiles.EscritoireGameToken in project ForestryMC by ForestryMC.

the class GameTokenWidget method draw.

@Override
@SideOnly(Side.CLIENT)
public void draw(int startX, int startY) {
    EscritoireGameToken token = getToken();
    if (token == null) {
        return;
    }
    int tokenColour = token.getTokenColour();
    float colorR = (tokenColour >> 16 & 255) / 255.0F;
    float colorG = (tokenColour >> 8 & 255) / 255.0F;
    float colorB = (tokenColour & 255) / 255.0F;
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    textureManager.bindTexture(manager.gui.textureFile);
    GlStateManager.enableDepth();
    GlStateManager.color(colorR, colorG, colorB);
    manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 228, 0, 22, 22);
    GlStateManager.color(1.0f, 1.0f, 1.0f);
    ItemStack tokenStack = HIDDEN_TOKEN;
    if (token.isVisible()) {
        tokenStack = token.getTokenStack();
    }
    GuiUtil.drawItemStack(manager.gui, tokenStack, startX + xPos + 3, startY + yPos + 3);
    GlStateManager.disableDepth();
    TextureManagerForestry.getInstance().bindGuiTextureMap();
    for (String ident : getToken().getOverlayIcons()) {
        TextureAtlasSprite icon = TextureManagerForestry.getInstance().getDefault(ident);
        manager.gui.drawTexturedModalRect(startX + xPos + 3, startY + yPos + 3, icon, 16, 16);
    }
    GlStateManager.enableDepth();
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) EscritoireGameToken(forestry.core.tiles.EscritoireGameToken) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with EscritoireGameToken

use of forestry.core.tiles.EscritoireGameToken in project ForestryMC by ForestryMC.

the class GameTokenWidget method getToolTip.

@Override
public ToolTip getToolTip(int mouseX, int mouseY) {
    EscritoireGameToken token = getToken();
    if (token == null || !token.isVisible()) {
        return null;
    }
    ToolTip tooltip = new ToolTip();
    tooltip.add(token.getTooltip());
    return tooltip;
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip) EscritoireGameToken(forestry.core.tiles.EscritoireGameToken)

Aggregations

EscritoireGameToken (forestry.core.tiles.EscritoireGameToken)2 ToolTip (forestry.core.gui.tooltips.ToolTip)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 TextureManager (net.minecraft.client.renderer.texture.TextureManager)1 ItemStack (net.minecraft.item.ItemStack)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1