Search in sources :

Example 1 with GuiAlyzer

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

the class TreeAlyzerPlugin method drawAnalyticsPage1.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        ITree tree = TreeManager.treeRoot.getMember(itemStack);
        if (tree == null) {
            return;
        }
        EnumGermlingType type = TreeManager.treeRoot.getType(itemStack);
        if (type == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
        textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
        textLayout.newLine();
        textLayout.newLine();
        {
            String customPrimaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.", "");
            String customSecondaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getSecondary().getUnlocalizedName().replace("trees.species.", "");
            guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), tree, EnumTreeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryTreeKey), GuiAlyzer.checkCustomName(customSecondaryTreeKey));
            textLayout.newLine();
        }
        guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.saplings"), tree, EnumTreeChromosome.FERTILITY);
        textLayout.newLineCompressed();
        guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.maturity"), tree, EnumTreeChromosome.MATURATION);
        textLayout.newLineCompressed();
        guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.height"), tree, EnumTreeChromosome.HEIGHT);
        textLayout.newLineCompressed();
        IAlleleInteger activeGirth = (IAlleleInteger) tree.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH);
        IAlleleInteger inactiveGirth = (IAlleleInteger) tree.getGenome().getInactiveAllele(EnumTreeChromosome.GIRTH);
        textLayout.drawLine(Translator.translateToLocal("for.gui.girth"), GuiAlyzer.COLUMN_0);
        guiAlyzer.drawLine(String.format("%sx%s", activeGirth.getValue(), activeGirth.getValue()), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.GIRTH, false);
        guiAlyzer.drawLine(String.format("%sx%s", inactiveGirth.getValue(), inactiveGirth.getValue()), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.GIRTH, true);
        textLayout.newLineCompressed();
        guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.yield"), tree, EnumTreeChromosome.YIELD);
        textLayout.newLineCompressed();
        guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.sappiness"), tree, EnumTreeChromosome.SAPPINESS);
        textLayout.newLineCompressed();
        guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), tree, EnumTreeChromosome.EFFECT);
        textLayout.endPage();
    }
}
Also used : TextLayoutHelper(forestry.core.gui.TextLayoutHelper) IAlleleInteger(forestry.api.genetics.IAlleleInteger) EnumGermlingType(forestry.api.arboriculture.EnumGermlingType) ITree(forestry.api.arboriculture.ITree) GuiAlyzer(forestry.core.gui.GuiAlyzer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with GuiAlyzer

use of forestry.core.gui.GuiAlyzer 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 3 with GuiAlyzer

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

the class FlutterlyzerPlugin method drawAnalyticsPage2.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
        if (butterfly == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
        textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
        textLayout.newLine();
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()), butterfly, EnumButterflyChromosome.SPECIES);
        textLayout.newLine();
        IAlleleTolerance tempToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
        IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
        textLayout.drawLine("  " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
        guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
        guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()), butterfly, EnumButterflyChromosome.SPECIES);
        textLayout.newLine();
        IAlleleTolerance humidToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
        IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
        textLayout.drawLine("  " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
        guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
        guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
        textLayout.newLine();
        textLayout.newLine();
        String yes = Translator.translateToLocal("for.yes");
        String no = Translator.translateToLocal("for.no");
        String diurnal0, diurnal1, nocturnal0, nocturnal1;
        if (butterfly.getGenome().getNocturnal()) {
            nocturnal0 = diurnal0 = yes;
        } else {
            nocturnal0 = butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
            diurnal0 = !butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
        }
        if (((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.NOCTURNAL)).getValue()) {
            nocturnal1 = diurnal1 = yes;
        } else {
            nocturnal1 = butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
            diurnal1 = !butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
        }
        textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
        textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
        textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
        textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
        textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
        textLayout.newLine();
        String primary = StringUtil.readableBoolean(butterfly.getGenome().getTolerantFlyer(), yes, no);
        String secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TOLERANT_FLYER)).getValue(), yes, no);
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, butterfly, EnumButterflyChromosome.TOLERANT_FLYER);
        textLayout.newLine();
        primary = StringUtil.readableBoolean(butterfly.getGenome().getFireResist(), yes, no);
        secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FIRE_RESIST)).getValue(), yes, no);
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.fireresist"), primary, secondary, butterfly, EnumButterflyChromosome.FIRE_RESIST);
        textLayout.endPage();
    }
}
Also used : TextLayoutHelper(forestry.core.gui.TextLayoutHelper) IAlleleTolerance(forestry.api.genetics.IAlleleTolerance) IButterfly(forestry.api.lepidopterology.IButterfly) GuiAlyzer(forestry.core.gui.GuiAlyzer) AlleleBoolean(forestry.core.genetics.alleles.AlleleBoolean) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with GuiAlyzer

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

the class FlutterlyzerPlugin method drawAnalyticsPage1.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
        if (butterfly == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
        textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
        textLayout.newLine();
        textLayout.newLine();
        guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), butterfly, EnumButterflyChromosome.SPECIES, null, null);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.size"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SIZE).getAlleleName(), butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.SIZE).getAlleleName(), butterfly, EnumButterflyChromosome.SPEED);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.lifespan"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.LIFESPAN).getAlleleName(), butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.LIFESPAN).getAlleleName(), butterfly, EnumButterflyChromosome.LIFESPAN);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.speed"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SPEED).getAlleleName(), butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.SPEED).getAlleleName(), butterfly, EnumButterflyChromosome.SPEED);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.metabolism"), GenericRatings.rateMetabolism(butterfly.getGenome().getMetabolism()), GenericRatings.rateMetabolism(((IAlleleInteger) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.METABOLISM)).getValue()), butterfly, EnumButterflyChromosome.METABOLISM);
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
        guiAlyzer.drawFertilityInfo(butterfly.getGenome().getFertility(), GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.FERTILITY).isDominant()), 8);
        guiAlyzer.drawFertilityInfo(((IAlleleInteger) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY)).getValue(), GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY).isDominant()), 8);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flowers"), butterfly.getGenome().getFlowerProvider().getDescription(), ((IAlleleFlowers) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FLOWER_PROVIDER)).getProvider().getDescription(), butterfly, EnumButterflyChromosome.FLOWER_PROVIDER);
        textLayout.newLine();
        guiAlyzer.drawRow(Translator.translateToLocal("for.gui.effect"), butterfly.getGenome().getEffect().getAlleleName(), butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.EFFECT).getAlleleName(), butterfly, EnumButterflyChromosome.EFFECT);
        textLayout.newLine();
        textLayout.endPage();
    }
}
Also used : TextLayoutHelper(forestry.core.gui.TextLayoutHelper) IAlleleFlowers(forestry.api.genetics.IAlleleFlowers) IButterfly(forestry.api.lepidopterology.IButterfly) IAlleleInteger(forestry.api.genetics.IAlleleInteger) GuiAlyzer(forestry.core.gui.GuiAlyzer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with GuiAlyzer

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

the class FlutterlyzerPlugin method drawAnalyticsPage3.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
        if (butterfly == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.loot.butterfly") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        int x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : butterfly.getGenome().getPrimary().getButterflyLoot().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.newLine();
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.loot.caterpillar") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : butterfly.getGenome().getPrimary().getCaterpillarLoot().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.newLine();
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.loot.cocoon") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : butterfly.getGenome().getCocoon().getCocoonLoot().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) IButterfly(forestry.api.lepidopterology.IButterfly) GuiAlyzer(forestry.core.gui.GuiAlyzer) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

GuiAlyzer (forestry.core.gui.GuiAlyzer)9 TextLayoutHelper (forestry.core.gui.TextLayoutHelper)9 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)9 IBee (forestry.api.apiculture.IBee)3 ITree (forestry.api.arboriculture.ITree)3 IAlleleInteger (forestry.api.genetics.IAlleleInteger)3 IButterfly (forestry.api.lepidopterology.IButterfly)3 ItemStack (net.minecraft.item.ItemStack)3 EnumBeeType (forestry.api.apiculture.EnumBeeType)2 IAlleleTolerance (forestry.api.genetics.IAlleleTolerance)2 AlleleBoolean (forestry.core.genetics.alleles.AlleleBoolean)2 ItemStackWidget (forestry.core.gui.widgets.ItemStackWidget)2 WidgetManager (forestry.core.gui.widgets.WidgetManager)2 EnumGermlingType (forestry.api.arboriculture.EnumGermlingType)1 IAlleleFruit (forestry.api.arboriculture.IAlleleFruit)1 IAllele (forestry.api.genetics.IAllele)1 IAlleleFlowers (forestry.api.genetics.IAlleleFlowers)1 IFruitFamily (forestry.api.genetics.IFruitFamily)1 ArrayList (java.util.ArrayList)1