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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
package gregtech.loaders.misc;
import java.util.Arrays;
import java.util.Locale;
import cpw.mods.fml.common.Loader;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.core.genetics.alleles.Allele;
import forestry.core.utils.StringUtil;
import gregtech.GT_Mod;
import gregtech.common.items.ItemComb;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.DimensionManager;
public class GT_Bees {
static IAlleleInteger noFertility;
static IAlleleInteger superFertility;
static IAlleleInteger noFlowering;
static IAlleleInteger superFlowering;
static IAlleleArea noTerritory;
static IAlleleArea superTerritory;
static IAlleleFloat noWork;
static IAlleleFloat speedBlinding;
static IAlleleFloat superSpeed;
static IAlleleInteger blinkLife;
static IAlleleInteger superLife;
public static ItemComb combs;
public GT_Bees() {
if (Loader.isModLoaded("Forestry") && GT_Mod.gregtechproxy.mGTBees) {
setupGTAlleles();
combs = new ItemComb();
combs.initCombsRecipes();
GT_BeeDefinition.initBees();
}
}
private static void setupGTAlleles(){
noFertility = new AlleleInteger("fertilitySterile", 0, false, EnumBeeChromosome.FERTILITY);
superFertility = new AlleleInteger("fertilityMultiply", 8, false, EnumBeeChromosome.FERTILITY);
noFlowering = new AlleleInteger("floweringNonpollinating", 0, false, EnumBeeChromosome.FLOWERING);
superFlowering = new AlleleInteger("floweringNaturalistic", 240, false, EnumBeeChromosome.FLOWERING);
noTerritory = new AlleleArea("areaLethargic", 1, 1, false);
superTerritory = new AlleleArea("areaExploratory", 32, 16, false);
noWork = new AlleleFloat("speedUnproductive", 0, false);
speedBlinding = (IAlleleFloat) AlleleManager.alleleRegistry.getAllele("magicbees.speedBlinding");
superSpeed = new AlleleFloat("speedAccelerated", 4F, false);
blinkLife = new AlleleInteger("lifeBlink", 2, false, EnumBeeChromosome.LIFESPAN);
superLife = new AlleleInteger("lifeEon", 600, false, EnumBeeChromosome.LIFESPAN);
}
private static class AlleleFloat extends Allele implements IAlleleFloat {
private float value;
public AlleleFloat(String id, float val, boolean isDominant) {
super("gregtech."+id, "gregtech."+id, isDominant);
this.value = val;
AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPEED);
}
@Override
public float getValue(){
return this.value;
}
}
private static class AlleleInteger extends Allele implements IAlleleInteger {
private int value;
public AlleleInteger(String id, int val, boolean isDominant, EnumBeeChromosome c) {
super("gregtech."+id, "gregtech."+id, isDominant);
this.value = val;
AlleleManager.alleleRegistry.registerAllele(this, c);
}
@Override
public int getValue(){
return this.value;
}
}
private static class AlleleArea extends Allele implements IAlleleArea {
private int[] value;
public AlleleArea(String id, int rangeXZ,int rangeY, boolean isDominant) {
super("gregtech."+id, "gregtech."+id, isDominant);
this.value = new int[] {rangeXZ,rangeY,rangeXZ};
AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.TERRITORY);
}
@Override
public int[] getValue(){
return this.value;
}
}
public static class DimensionMutationCondition implements IMutationCondition {
int dimID;
public DimensionMutationCondition(int id) {
dimID = id;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,IGenome genome1) {
if(world.provider.dimensionId == dimID)return 1;
return 0;
}
@Override
public String getDescription() {
if (DimensionManager.getProvider(dimID)!=null) {
String dimName = DimensionManager.getProvider(dimID).getDimensionName().toLowerCase(Locale.ENGLISH);
return StringUtil.localizeAndFormat("mutation.condition.dim", dimName);
}
return "";
}
}
public static class BiomeIDMutationCondition implements IMutationCondition {
int biomeID;
public BiomeIDMutationCondition(int id) {
biomeID = id;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,IGenome genome1) {
if(world.getBiomeGenForCoords(x, z).biomeID == biomeID) return 1;
return 0;
}
@Override
public String getDescription() {
if (BiomeGenBase.getBiome(biomeID)!=null) {
String biomeName = BiomeGenBase.getBiome(biomeID).biomeName.toLowerCase(Locale.ENGLISH);
return StringUtil.localizeAndFormat("mutation.condition.biomeid", biomeName);
}
return "";
}
}
}
|