Search in sources :

Example 1 with ItemStackWidget

use of forestry.core.gui.widgets.ItemStackWidget in project ForestryMC by ForestryMC.

the class TreeAlyzerPlugin method drawAnalyticsPage3.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        ITree tree = TreeManager.treeRoot.getMember(itemStack);
        if (tree == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        WidgetManager widgetManager = guiAlyzer.getWidgetManager();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        int x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : tree.getProducts().keySet()) {
            widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
            x += 18;
            if (x > 148) {
                x = GuiAlyzer.COLUMN_0;
                textLayout.newLine();
            }
        }
        textLayout.newLine();
        textLayout.newLine();
        textLayout.newLine();
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : tree.getSpecialties().keySet()) {
            Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(stack, guiAlyzer.getGuiLeft() + x, guiAlyzer.getGuiTop() + textLayout.getLineY());
            x += 18;
            if (x > 148) {
                x = GuiAlyzer.COLUMN_0;
                textLayout.newLine();
            }
        }
        textLayout.endPage();
    }
}
Also used : TextLayoutHelper(forestry.core.gui.TextLayoutHelper) ItemStackWidget(forestry.core.gui.widgets.ItemStackWidget) WidgetManager(forestry.core.gui.widgets.WidgetManager) ITree(forestry.api.arboriculture.ITree) GuiAlyzer(forestry.core.gui.GuiAlyzer) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with ItemStackWidget

use of forestry.core.gui.widgets.ItemStackWidget in project ForestryMC by ForestryMC.

the class GuiAlyzer method drawMutationInfo.

public void drawMutationInfo(IMutation combination, IAllele species, int x, IBreedingTracker breedingTracker) {
    Map<String, ItemStack> iconStacks = combination.getRoot().getAlyzerPlugin().getIconStacks();
    ItemStack partnerBee = iconStacks.get(combination.getPartner(species).getUID());
    widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), partnerBee));
    drawProbabilityArrow(combination, guiLeft + x + 18, guiTop + textLayout.getLineY() + 4, breedingTracker);
    IAllele result = combination.getTemplate()[EnumBeeChromosome.SPECIES.ordinal()];
    ItemStack resultBee = iconStacks.get(result.getUID());
    widgetManager.add(new ItemStackWidget(widgetManager, x + 33, textLayout.getLineY(), resultBee));
}
Also used : IAllele(forestry.api.genetics.IAllele) ItemStackWidget(forestry.core.gui.widgets.ItemStackWidget) ItemStack(net.minecraft.item.ItemStack)

Example 3 with ItemStackWidget

use of forestry.core.gui.widgets.ItemStackWidget in project ForestryMC by ForestryMC.

the class BeeAlyzerPlugin method drawAnalyticsPage3.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        IBee bee = BeeManager.beeRoot.getMember(itemStack);
        if (bee == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        WidgetManager widgetManager = guiAlyzer.getWidgetManager();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        int x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : bee.getProduceList()) {
            widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
            x += 18;
            if (x > 148) {
                x = GuiAlyzer.COLUMN_0;
                textLayout.newLine();
            }
        }
        textLayout.newLine();
        textLayout.newLine();
        textLayout.newLine();
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : bee.getSpecialtyList()) {
            widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
            x += 18;
            if (x > 148) {
                x = GuiAlyzer.COLUMN_0;
                textLayout.newLine();
            }
        }
        textLayout.endPage();
    }
}
Also used : TextLayoutHelper(forestry.core.gui.TextLayoutHelper) ItemStackWidget(forestry.core.gui.widgets.ItemStackWidget) WidgetManager(forestry.core.gui.widgets.WidgetManager) IBee(forestry.api.apiculture.IBee) GuiAlyzer(forestry.core.gui.GuiAlyzer) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with ItemStackWidget

use of forestry.core.gui.widgets.ItemStackWidget in project ForestryMC by ForestryMC.

the class GuiCatalogue method drawTradePreview.

private void drawTradePreview(ITradeStationInfo tradeInfo, int x, int y) {
    fontRenderer.drawString(boldUnderline + tradeInfo.getAddress().getName(), x, y, ColourProperties.INSTANCE.get("gui.book"));
    fontRenderer.drawString(String.format(Translator.translateToLocal("for.gui.mail.willtrade"), tradeInfo.getOwner().getName()), x, y + 18, ColourProperties.INSTANCE.get("gui.book"));
    addTradeInfoWidget(new ItemStackWidget(widgetManager, x - guiLeft, y - guiTop + 28, tradeInfo.getTradegood()));
    fontRenderer.drawString(Translator.translateToLocal("for.gui.mail.tradefor"), x, y + 46, ColourProperties.INSTANCE.get("gui.book"));
    for (int i = 0; i < tradeInfo.getRequired().size(); i++) {
        ItemStack itemStack = tradeInfo.getRequired().get(i);
        addTradeInfoWidget(new ItemStackWidget(widgetManager, x - guiLeft + i * 18, y - guiTop + 56, itemStack));
    }
    if (tradeInfo.getState().isOk()) {
        fontRenderer.drawSplitString(TextFormatting.DARK_GREEN + tradeInfo.getState().getDescription(), x, y + 82, 119, ColourProperties.INSTANCE.get("gui.book"));
    } else {
        fontRenderer.drawSplitString(TextFormatting.DARK_RED + tradeInfo.getState().getDescription(), x, y + 82, 119, ColourProperties.INSTANCE.get("gui.book"));
    }
}
Also used : ItemStackWidget(forestry.core.gui.widgets.ItemStackWidget) ItemStack(net.minecraft.item.ItemStack)

Example 5 with ItemStackWidget

use of forestry.core.gui.widgets.ItemStackWidget in project ForestryMC by ForestryMC.

the class GuiLetter method drawTradePreview.

private void drawTradePreview(int x, int y) {
    String infoString = null;
    if (container.getTradeInfo() == null) {
        infoString = Translator.translateToLocal("for.gui.mail.no.trader");
    } else if (container.getTradeInfo().getTradegood().isEmpty()) {
        infoString = Translator.translateToLocal("for.gui.mail.nothing.to.trade");
    } else if (!container.getTradeInfo().getState().isOk()) {
        infoString = container.getTradeInfo().getState().getDescription();
    }
    if (infoString != null) {
        fontRenderer.drawSplitString(infoString, guiLeft + x, guiTop + y, 119, ColourProperties.INSTANCE.get("gui.mail.lettertext"));
        return;
    }
    fontRenderer.drawString(Translator.translateToLocal("for.gui.mail.pleasesend"), guiLeft + x, guiTop + y, ColourProperties.INSTANCE.get("gui.mail.lettertext"));
    addTradeInfoWidget(new ItemStackWidget(widgetManager, x, y + 10, container.getTradeInfo().getTradegood()));
    fontRenderer.drawString(Translator.translateToLocal("for.gui.mail.foreveryattached"), guiLeft + x, guiTop + y + 28, ColourProperties.INSTANCE.get("gui.mail.lettertext"));
    for (int i = 0; i < container.getTradeInfo().getRequired().size(); i++) {
        addTradeInfoWidget(new ItemStackWidget(widgetManager, x + i * 18, y + 38, container.getTradeInfo().getRequired().get(i)));
    }
}
Also used : ItemStackWidget(forestry.core.gui.widgets.ItemStackWidget)

Aggregations

ItemStackWidget (forestry.core.gui.widgets.ItemStackWidget)5 ItemStack (net.minecraft.item.ItemStack)4 GuiAlyzer (forestry.core.gui.GuiAlyzer)2 TextLayoutHelper (forestry.core.gui.TextLayoutHelper)2 WidgetManager (forestry.core.gui.widgets.WidgetManager)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 IBee (forestry.api.apiculture.IBee)1 ITree (forestry.api.arboriculture.ITree)1 IAllele (forestry.api.genetics.IAllele)1