Search in sources :

Example 11 with IBeeGenome

use of forestry.api.apiculture.IBeeGenome in project Binnie by ForestryMC.

the class ControlBiomes method setSpecies.

public void setSpecies(IAlleleBeeSpecies species) {
    tolerated.clear();
    IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(BeeManager.beeRoot.getTemplate(species));
    IBee bee = BeeManager.beeRoot.getBee(genome);
}
Also used : IBee(forestry.api.apiculture.IBee) IBeeGenome(forestry.api.apiculture.IBeeGenome)

Example 12 with IBeeGenome

use of forestry.api.apiculture.IBeeGenome in project Binnie by ForestryMC.

the class ControlProductsBox method setSpecies.

public void setSpecies(IAlleleBeeSpecies species) {
    if (species == this.species || (this.species = species) == null) {
        return;
    }
    IAllele[] template = BeeManager.beeRoot.getTemplate(species.getUID());
    if (template == null) {
        return;
    }
    IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(template);
    float speed = genome.getSpeed();
    float modeSpeed = BeeManager.beeRoot.getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f);
    List<Product> strings = new ArrayList<>();
    if (type == Type.PRODUCTS) {
        for (Map.Entry<ItemStack, Float> entry : species.getProductChances().entrySet()) {
            strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
        }
    } else {
        for (Map.Entry<ItemStack, Float> entry : species.getSpecialtyChances().entrySet()) {
            strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
        }
    }
    setOptions(strings);
}
Also used : IAllele(forestry.api.genetics.IAllele) ArrayList(java.util.ArrayList) IBeeGenome(forestry.api.apiculture.IBeeGenome) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map)

Example 13 with IBeeGenome

use of forestry.api.apiculture.IBeeGenome 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

IBeeGenome (forestry.api.apiculture.IBeeGenome)13 IBee (forestry.api.apiculture.IBee)7 IAllele (forestry.api.genetics.IAllele)4 ItemStack (net.minecraft.item.ItemStack)3 World (net.minecraft.world.World)3 IChromosome (forestry.api.genetics.IChromosome)2 ArrayList (java.util.ArrayList)2 GameProfile (com.mojang.authlib.GameProfile)1 EnumBeeType (forestry.api.apiculture.EnumBeeType)1 IAlleleBeeSpecies (forestry.api.apiculture.IAlleleBeeSpecies)1 IApiaristTracker (forestry.api.apiculture.IApiaristTracker)1 IBeeMutation (forestry.api.apiculture.IBeeMutation)1 IBeeRoot (forestry.api.apiculture.IBeeRoot)1 IBeekeepingMode (forestry.api.apiculture.IBeekeepingMode)1 EnumHumidity (forestry.api.core.EnumHumidity)1 EnumTemperature (forestry.api.core.EnumTemperature)1 EnumTolerance (forestry.api.genetics.EnumTolerance)1 IMutation (forestry.api.genetics.IMutation)1 Bee (forestry.apiculture.genetics.Bee)1 Map (java.util.Map)1