mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-24 22:04:34 +00:00
Refactor Bee mutations, genomes, and species.
This commit is contained in:
1 parent
a875a54b93
commit
f51d691002
25 files changed
+1375
-1150
No files matched your search
@@ -0,0 +1,57 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public abstract class BeeVariation implements IBeeDefinition {
|
||||
|
||||
private final IAllele[] template;
|
||||
private final IBeeGenome genome;
|
||||
|
||||
public BeeVariation(IBeeDefinition bee) {
|
||||
template = bee.getTemplate();
|
||||
initializeTemplate(template);
|
||||
genome = PluginApiculture.beeInterface.templateAsGenome(template);
|
||||
}
|
||||
|
||||
protected abstract void initializeTemplate(IAllele[] template);
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeGenome getGenome() {
|
||||
return genome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBee getIndividual() {
|
||||
return new Bee(genome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ItemStack getMemberStack(EnumBeeType beeType) {
|
||||
IBee bee = getIndividual();
|
||||
return PluginApiculture.beeInterface.getMemberStack(bee, beeType.ordinal());
|
||||
}
|
||||
|
||||
public static class RainResist extends BeeVariation {
|
||||
public RainResist(IBeeDefinition bee) {
|
||||
super(bee);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeTemplate(IAllele[] template) {
|
||||
template[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user