Search in sources :

Example 6 with EnumTolerance

use of forestry.api.genetics.EnumTolerance in project Binnie by ForestryMC.

the class ControlClimateBar method setSpecies.

public void setSpecies(IAlleleBeeSpecies species) {
    tolerated.clear();
    int main;
    EnumTolerance tolerance;
    IAllele[] template = BeeManager.beeRoot.getTemplate(species);
    IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(template);
    if (!isHumidity) {
        main = species.getTemperature().ordinal() - 1;
        tolerance = genome.getToleranceTemp();
    } else {
        main = species.getHumidity().ordinal();
        tolerance = genome.getToleranceHumid();
    }
    tolerated.add(main);
    switch(tolerance) {
        case BOTH_5:
        case UP_5:
            {
                tolerated.add(main + 5);
            }
        case BOTH_4:
        case UP_4:
            {
                tolerated.add(main + 4);
            }
        case BOTH_3:
        case UP_3:
            {
                tolerated.add(main + 3);
            }
        case BOTH_2:
        case UP_2:
            {
                tolerated.add(main + 2);
            }
        case BOTH_1:
        case UP_1:
            {
                tolerated.add(main + 1);
                break;
            }
    }
    switch(tolerance) {
        case BOTH_5:
        case DOWN_5:
            {
                tolerated.add(main - 5);
            }
        case BOTH_4:
        case DOWN_4:
            {
                tolerated.add(main - 4);
            }
        case BOTH_3:
        case DOWN_3:
            {
                tolerated.add(main - 3);
            }
        case BOTH_2:
        case DOWN_2:
            {
                tolerated.add(main - 2);
            }
        case BOTH_1:
        case DOWN_1:
            {
                tolerated.add(main - 1);
                break;
            }
    }
}
Also used : IAllele(forestry.api.genetics.IAllele) EnumTolerance(forestry.api.genetics.EnumTolerance) IBeeGenome(forestry.api.apiculture.IBeeGenome)

Aggregations

EnumTolerance (forestry.api.genetics.EnumTolerance)6 EnumHumidity (forestry.api.core.EnumHumidity)3 EnumTemperature (forestry.api.core.EnumTemperature)3 IErrorState (forestry.api.core.IErrorState)3 HashSet (java.util.HashSet)3 World (net.minecraft.world.World)3 IAlleleButterflySpecies (forestry.api.lepidopterology.IAlleleButterflySpecies)2 IAlleleBeeSpecies (forestry.api.apiculture.IAlleleBeeSpecies)1 IBeeGenome (forestry.api.apiculture.IBeeGenome)1 IBeeModifier (forestry.api.apiculture.IBeeModifier)1 IGuiElementLayout (forestry.api.core.IGuiElementLayout)1 IAllele (forestry.api.genetics.IAllele)1