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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
package gregtech.loaders.misc.bees;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import forestry.api.genetics.ISpeciesRoot;
import gregtech.api.util.GTLanguageManager;
public enum GTFlowers implements IFlowerProvider, IAlleleFlowers, IChromosomeType {
FLAMING;
protected boolean dominant;
GTFlowers() {
dominant = true;
}
public static void doInit() {
for (GTFlowers effect : values()) {
effect.register();
}
}
@Override
public String getUID() {
return "for.flowers." + toString().toLowerCase();
}
@Override
public boolean isDominant() {
return dominant;
}
@Override
public IFlowerProvider getProvider() {
return this;
}
@Override
public String getDescription() {
return GTLanguageManager.getTranslation("for.flowers." + name().toLowerCase());
}
public void register() {
for (ItemStack stack : getItemStacks()) {
FlowerManager.flowerRegistry.registerAcceptableFlower(Block.getBlockFromItem(stack.getItem()), getUID());
}
AlleleManager.alleleRegistry.registerAllele(this, this);
}
public ItemStack[] getItemStacks() {
switch (this) {
case FLAMING:
return new ItemStack[] { new ItemStack(Blocks.fire) };
}
return new ItemStack[0];
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
return types.size() > 1 || !types.contains(EnumPlantType.Nether);
}
public boolean isAcceptedFlower(World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block == null) {
return false;
}
switch (this) {
case FLAMING:
return block == Blocks.fire;
}
return false;
}
@Override
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
return false;
}
@Override
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
public String getName() {
return getDescription();
}
@Override
public String getUnlocalizedName() {
return getUID();
}
@Override
public String getFlowerType() {
return getUID();
}
@Override
public Set<IFlower> getFlowers() {
return new HashSet<>();
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return getClass();
}
@Override
public ISpeciesRoot getSpeciesRoot() {
return AlleleManager.alleleRegistry.getSpeciesRoot(getUID());
}
}
|