Search in sources :

Example 1 with IGuiElementLayout

use of forestry.api.core.IGuiElementLayout in project ForestryMC by ForestryMC.

the class GuiElementFactory method createToleranceInfo.

private IGuiElementLayout createToleranceInfo(IAlleleTolerance toleranceAllele, int x) {
    int textColor = getColorCoding(toleranceAllele.isDominant());
    EnumTolerance tolerance = toleranceAllele.getValue();
    String text = "(" + toleranceAllele.getAlleleName() + ")";
    IGuiElementLayout layout = createHorizontal(x, 0, 0).setDistance(2);
    switch(tolerance) {
        case BOTH_1:
        case BOTH_2:
        case BOTH_3:
        case BOTH_4:
        case BOTH_5:
            layout.addElement(createBothSymbol(0, -1));
            layout.addElement(new GuiElementText(0, 0, 12, text, textColor));
            break;
        case DOWN_1:
        case DOWN_2:
        case DOWN_3:
        case DOWN_4:
        case DOWN_5:
            layout.addElement(createDownSymbol(0, -1));
            layout.addElement(new GuiElementText(0, 0, 12, text, textColor));
            break;
        case UP_1:
        case UP_2:
        case UP_3:
        case UP_4:
        case UP_5:
            layout.addElement(createUpSymbol(0, -1));
            layout.addElement(new GuiElementText(0, 0, 12, text, textColor));
            break;
        default:
            layout.addElement(createNoneSymbol(0, -1));
            layout.addElement(new GuiElementText(0, 0, 12, "(0)", textColor));
            break;
    }
    return layout;
}
Also used : EnumTolerance(forestry.api.genetics.EnumTolerance) IGuiElementLayout(forestry.api.core.IGuiElementLayout)

Example 2 with IGuiElementLayout

use of forestry.api.core.IGuiElementLayout in project ForestryMC by ForestryMC.

the class GuiElementFactory method createToleranceInfo.

public IGuiElement createToleranceInfo(IAlleleTolerance toleranceAllele, IAlleleSpecies species, String text) {
    IGuiElementLayout layout = createHorizontal(0, 0, 0).setDistance(0);
    layout.addElement(new GuiElementText(0, 0, 12, text, getColorCoding(species.isDominant())));
    layout.addElement(createToleranceInfo(toleranceAllele, 0));
    return layout;
}
Also used : IGuiElementLayout(forestry.api.core.IGuiElementLayout)

Example 3 with IGuiElementLayout

use of forestry.api.core.IGuiElementLayout 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 IGuiElementLayout

use of forestry.api.core.IGuiElementLayout in project ForestryMC by ForestryMC.

the class GuiElementFactory method createMutationResultant.

public IGuiElementLayout createMutationResultant(int x, int y, int width, int height, IMutation mutation, IBreedingTracker breedingTracker) {
    if (breedingTracker.isDiscovered(mutation)) {
        IGuiElementLayout element = new GuiElementPanel(x, y, width, height);
        IAlyzerPlugin plugin = mutation.getRoot().getAlyzerPlugin();
        Map<String, ItemStack> iconStacks = plugin.getIconStacks();
        ItemStack firstPartner = iconStacks.get(mutation.getAllele0().getUID());
        ItemStack secondPartner = iconStacks.get(mutation.getAllele1().getUID());
        element.addElements(new GuiElementItemStack(0, 0, firstPartner), createProbabilityAdd(mutation, 21, 4), new GuiElementItemStack(33, 0, secondPartner));
        return element;
    }
    // Do not display secret undiscovered mutations.
    if (mutation.isSecret()) {
        return null;
    }
    return createUnknownMutationGroup(x, y, width, height, mutation);
}
Also used : IAlyzerPlugin(forestry.api.genetics.IAlyzerPlugin) ItemStack(net.minecraft.item.ItemStack) IGuiElementLayout(forestry.api.core.IGuiElementLayout)

Aggregations

IGuiElementLayout (forestry.api.core.IGuiElementLayout)4 EnumTolerance (forestry.api.genetics.EnumTolerance)1 IAlyzerPlugin (forestry.api.genetics.IAlyzerPlugin)1 Drawable (forestry.core.gui.Drawable)1 ItemStack (net.minecraft.item.ItemStack)1