Search in sources :

Example 1 with WidgetManager

use of forestry.core.gui.widgets.WidgetManager 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 WidgetManager

use of forestry.core.gui.widgets.WidgetManager 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)

Aggregations

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