aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/bees/GTAlleleBeeSpecies.java
blob: 59bc4737e2481efa119d85fe7685223ebcf2aaaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package gregtech.common.bees;

import java.awt.Color;

import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;

import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IClassification;
import forestry.apiculture.genetics.alleles.AlleleBeeSpecies;

public class GTAlleleBeeSpecies extends AlleleBeeSpecies {

    public GTAlleleBeeSpecies(String uid, boolean dominant, String unlocalizedName, String authority,
        String unlocalizedDescription, IClassification branch, String binomial, Color primaryColor,
        Color secondaryColor) {
        super(
            uid,
            unlocalizedName,
            authority,
            unlocalizedDescription,
            dominant,
            branch,
            binomial,
            primaryColor.getRGB(),
            secondaryColor.getRGB());
        AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES);
    }

    @Override
    public IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance) {
        if (product == null || product.getItem() == null) {
            product = new ItemStack(Items.boat);
        }
        if (chance <= 0.0f || chance > 1.0f) {
            chance = 0.1f;
        }
        return super.addProduct(product, chance);
    }

    @Override
    public IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance) {
        if (specialty == null || specialty.getItem() == null) {
            specialty = new ItemStack(Items.boat);
        }
        if (chance <= 0.0f || chance > 1.0f) {
            chance = 0.1f;
        }
        return super.addSpecialty(specialty, chance);
    }
}