Search in sources :

Example 1 with IAlleleBoolean

use of forestry.api.genetics.IAlleleBoolean in project ForestryMC by ForestryMC.

the class AlleleHelper method init.

public void init() {
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
        createAlleles(EnumAllele.Fertility.class, EnumBeeChromosome.FERTILITY);
        createAlleles(EnumAllele.Flowering.class, EnumBeeChromosome.FLOWERING);
        createAlleles(EnumAllele.Territory.class, EnumBeeChromosome.TERRITORY);
    }
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE)) || ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.LEPIDOPTEROLOGY))) {
        createAlleles(EnumAllele.Speed.class, EnumBeeChromosome.SPEED, EnumButterflyChromosome.SPEED);
        createAlleles(EnumAllele.Lifespan.class, EnumBeeChromosome.LIFESPAN, EnumButterflyChromosome.LIFESPAN);
        createAlleles(EnumAllele.Tolerance.class, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumButterflyChromosome.HUMIDITY_TOLERANCE);
        createAlleles(EnumAllele.Flowers.class, EnumBeeChromosome.FLOWER_PROVIDER, EnumButterflyChromosome.FLOWER_PROVIDER);
    }
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.ARBORICULTURE))) {
        createAlleles(EnumAllele.Height.class, EnumTreeChromosome.HEIGHT);
        createAlleles(EnumAllele.Saplings.class, EnumTreeChromosome.FERTILITY);
        createAlleles(EnumAllele.Yield.class, EnumTreeChromosome.YIELD);
        createAlleles(EnumAllele.Fireproof.class, EnumTreeChromosome.FIREPROOF);
        createAlleles(EnumAllele.Maturation.class, EnumTreeChromosome.MATURATION);
        createAlleles(EnumAllele.Sappiness.class, EnumTreeChromosome.SAPPINESS);
    }
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.LEPIDOPTEROLOGY))) {
        createAlleles(EnumAllele.Size.class, EnumButterflyChromosome.SIZE);
    }
    Map<Integer, IAlleleInteger> integers = new HashMap<>();
    for (int i = 1; i <= 10; i++) {
        IAlleleInteger alleleInteger = new AlleleInteger(modId, "i", i + "d", i, true);
        AlleleManager.alleleRegistry.registerAllele(alleleInteger, EnumTreeChromosome.GIRTH, EnumButterflyChromosome.METABOLISM, EnumButterflyChromosome.FERTILITY);
        integers.put(i, alleleInteger);
    }
    alleleMaps.put(Integer.class, integers);
    Map<Boolean, IAlleleBoolean> booleans = new HashMap<>();
    booleans.put(true, new AlleleBoolean(modId, "bool", true, false));
    booleans.put(false, new AlleleBoolean(modId, "bool", false, false));
    for (IAlleleBoolean alleleBoolean : booleans.values()) {
        AlleleManager.alleleRegistry.registerAllele(alleleBoolean, EnumBeeChromosome.NEVER_SLEEPS, EnumBeeChromosome.TOLERATES_RAIN, EnumBeeChromosome.CAVE_DWELLING, EnumButterflyChromosome.NOCTURNAL, EnumButterflyChromosome.TOLERANT_FLYER, EnumButterflyChromosome.FIRE_RESIST);
    }
    alleleMaps.put(Boolean.class, booleans);
}
Also used : IAlleleInteger(forestry.api.genetics.IAlleleInteger) IAlleleBoolean(forestry.api.genetics.IAlleleBoolean) IAlleleInteger(forestry.api.genetics.IAlleleInteger) HashMap(java.util.HashMap) ResourceLocation(net.minecraft.util.ResourceLocation) IAlleleBoolean(forestry.api.genetics.IAlleleBoolean) IAlleleInteger(forestry.api.genetics.IAlleleInteger) IAlleleBoolean(forestry.api.genetics.IAlleleBoolean)

Example 2 with IAlleleBoolean

use of forestry.api.genetics.IAlleleBoolean in project ForestryMC by ForestryMC.

the class Tree method addTooltip.

@Override
public void addTooltip(List<String> list) {
    // No info 4 u!
    if (!isAnalyzed) {
        list.add("<" + Translator.translateToLocal("for.gui.unknown") + ">");
        return;
    }
    // You analyzed it? Juicy tooltip coming up!
    IAlleleTreeSpecies primary = genome.getPrimary();
    IAlleleTreeSpecies secondary = genome.getSecondary();
    if (!isPureBred(EnumTreeChromosome.SPECIES)) {
        list.add(TextFormatting.BLUE + Translator.translateToLocal("for.trees.hybrid").replaceAll("%PRIMARY", primary.getAlleleName()).replaceAll("%SECONDARY", secondary.getAlleleName()));
    }
    String sappiness = TextFormatting.GOLD + "S: " + genome.getActiveAllele(EnumTreeChromosome.SAPPINESS).getAlleleName();
    String maturation = TextFormatting.RED + "M: " + genome.getActiveAllele(EnumTreeChromosome.MATURATION).getAlleleName();
    String height = TextFormatting.LIGHT_PURPLE + "H: " + genome.getActiveAllele(EnumTreeChromosome.HEIGHT).getAlleleName();
    String girth = TextFormatting.AQUA + "G: " + String.format("%sx%s", genome.getGirth(), genome.getGirth());
    String saplings = TextFormatting.YELLOW + "S: " + genome.getActiveAllele(EnumTreeChromosome.FERTILITY).getAlleleName();
    String yield = TextFormatting.WHITE + "Y: " + genome.getActiveAllele(EnumTreeChromosome.YIELD).getAlleleName();
    String carbonization = TextFormatting.GRAY + "CA: " + secondary.getWoodProvider().getCarbonization();
    list.add(String.format("%s, %s", saplings, maturation));
    list.add(String.format("%s, %s", height, girth));
    list.add(String.format("%s, %s", yield, sappiness));
    list.add(String.format("%s", carbonization));
    IAlleleBoolean primaryFireproof = (IAlleleBoolean) genome.getActiveAllele(EnumTreeChromosome.FIREPROOF);
    if (primaryFireproof.getValue()) {
        list.add(TextFormatting.RED + Translator.translateToLocal("for.gui.fireresist"));
    }
    IAllele fruit = getGenome().getActiveAllele(EnumTreeChromosome.FRUITS);
    if (fruit != AlleleFruits.fruitNone) {
        String strike = "";
        if (!canBearFruit()) {
            strike = TextFormatting.STRIKETHROUGH.toString();
        }
        list.add(strike + TextFormatting.GREEN + "F: " + genome.getFruitProvider().getDescription());
    }
}
Also used : IAllele(forestry.api.genetics.IAllele) IAlleleBoolean(forestry.api.genetics.IAlleleBoolean) IAlleleTreeSpecies(forestry.api.arboriculture.IAlleleTreeSpecies)

Example 3 with IAlleleBoolean

use of forestry.api.genetics.IAlleleBoolean in project ForestryMC by ForestryMC.

the class AlleleFactory method createBoolean.

@Override
public IAlleleBoolean createBoolean(String modId, String category, boolean value, boolean isDominant, IChromosomeType... types) {
    IAlleleBoolean alleleBoolean = new AlleleBoolean(modId, category, value, isDominant);
    AlleleManager.alleleRegistry.registerAllele(alleleBoolean, types);
    return alleleBoolean;
}
Also used : IAlleleBoolean(forestry.api.genetics.IAlleleBoolean) IAlleleBoolean(forestry.api.genetics.IAlleleBoolean)

Aggregations

IAlleleBoolean (forestry.api.genetics.IAlleleBoolean)3 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)1 IAllele (forestry.api.genetics.IAllele)1 IAlleleInteger (forestry.api.genetics.IAlleleInteger)1 HashMap (java.util.HashMap)1 ResourceLocation (net.minecraft.util.ResourceLocation)1