aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/forestry/bees/registry
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2024-05-24 19:50:35 +0100
committerRaven Szewczyk <git@eigenraven.me>2024-05-24 19:50:35 +0100
commit6d1b2216464d4dad449ac6fcfec476832224a55e (patch)
tree526a0c15f7056313c80e6c0386e025e9b3f61781 /src/main/java/gtPlusPlus/xmod/forestry/bees/registry
parentb5d35f40afa606ed1b07061dad82e0521a59c186 (diff)
downloadGT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.gz
GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.bz2
GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.zip
Merge addon sources
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/forestry/bees/registry')
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java50
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java301
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java86
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java69
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java89
5 files changed, 595 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java
new file mode 100644
index 0000000000..05ce6e56e6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java
@@ -0,0 +1,50 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+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 GTPP_AlleleBeeSpecies extends AlleleBeeSpecies {
+
+ public GTPP_AlleleBeeSpecies(String uid, boolean dominant, String unlocalizedName, String authority,
+ String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
+ super(
+ uid,
+ unlocalizedName,
+ authority,
+ unlocalizedDescription,
+ dominant,
+ branch,
+ binomial,
+ primaryColor,
+ secondaryColor);
+ 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);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java
new file mode 100644
index 0000000000..73418bdab8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java
@@ -0,0 +1,301 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import static forestry.api.apiculture.EnumBeeChromosome.EFFECT;
+import static forestry.api.apiculture.EnumBeeChromosome.HUMIDITY_TOLERANCE;
+import static forestry.api.apiculture.EnumBeeChromosome.LIFESPAN;
+import static forestry.api.apiculture.EnumBeeChromosome.SPECIES;
+import static forestry.api.apiculture.EnumBeeChromosome.TEMPERATURE_TOLERANCE;
+import static forestry.api.core.EnumHumidity.ARID;
+import static gregtech.api.enums.Mods.Forestry;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.function.Consumer;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.BiomeDictionary;
+
+import org.apache.commons.lang3.text.WordUtils;
+
+import forestry.api.apiculture.BeeManager;
+import forestry.api.apiculture.EnumBeeType;
+import forestry.api.apiculture.IAlleleBeeEffect;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBee;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeMutationCustom;
+import forestry.api.core.EnumHumidity;
+import forestry.api.core.EnumTemperature;
+import forestry.api.genetics.AlleleManager;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IAlleleFlowers;
+import forestry.apiculture.genetics.Bee;
+import forestry.apiculture.genetics.BeeVariation;
+import forestry.apiculture.genetics.IBeeDefinition;
+import forestry.apiculture.genetics.alleles.AlleleEffect;
+import forestry.core.genetics.alleles.AlleleHelper;
+import forestry.core.genetics.alleles.EnumAllele.Lifespan;
+import forestry.core.genetics.alleles.EnumAllele.Tolerance;
+import gregtech.api.enums.Materials;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.common.items.CombType;
+import gregtech.loaders.misc.GT_Bees;
+import gtPlusPlus.core.material.ELEMENT.STANDALONE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType;
+
+public enum GTPP_BeeDefinition implements IBeeDefinition {
+
+ DRAGONBLOOD(GTPP_BranchDefinition.LEGENDARY, "Dragon Blood", STANDALONE.DRAGON_METAL, true,
+ Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20), beeSpecies -> {
+ beeSpecies.addProduct(GT_ModHandler.getModItem(Forestry.ID, "beeCombs", 1, 8), 0.30f);
+ beeSpecies.addSpecialty(GTPP_Bees.combs.getStackForType(GTPP_CombType.DRAGONBLOOD), 0.10f);
+ beeSpecies.setHumidity(ARID);
+ beeSpecies.setTemperature(EnumTemperature.NORMAL);
+ beeSpecies.setHasEffect();
+ }, template -> {
+ AlleleHelper.instance.set(template, LIFESPAN, Lifespan.LONGER);
+ AlleleHelper.instance.set(template, EFFECT, AlleleEffect.effectAggressive);
+ AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_3);
+ AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_3);
+ }, dis -> {
+ IBeeMutationCustom tMutation = dis.registerMutation("DRAGONESSENCE", "NEUTRONIUM", 2);
+ tMutation.restrictHumidity(ARID);
+ tMutation.requireResource(STANDALONE.DRAGON_METAL.getBlock(), 1);
+ tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(1, "End")); // End Dim
+ }),
+ FORCE(GTPP_BranchDefinition.LEGENDARY, "Force", STANDALONE.FORCE, true, Utils.rgbtoHexValue(250, 250, 20),
+ Utils.rgbtoHexValue(200, 200, 5), beeSpecies -> {
+ beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.STONE), 0.30f);
+ beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.SALT), 0.15f);
+ beeSpecies.addSpecialty(GTPP_Bees.combs.getStackForType(GTPP_CombType.FORCE), 0.10f);
+ beeSpecies.setHumidity(EnumHumidity.NORMAL);
+ beeSpecies.setTemperature(EnumTemperature.HOT);
+ beeSpecies.setHasEffect();
+ }, template -> {
+ AlleleHelper.instance.set(template, LIFESPAN, Lifespan.NORMAL);
+ AlleleHelper.instance.set(template, EFFECT, AlleleEffect.effectAggressive);
+ AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_1);
+ AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_1);
+ }, dis -> {
+ IBeeMutationCustom tMutation = dis.registerMutation("STEEL", "GOLD", 10);
+ tMutation.restrictHumidity(ARID);
+ tMutation.restrictBiomeType(BiomeDictionary.Type.HOT);
+ }),;
+
+ private final GTPP_BranchDefinition branch;
+ private final GTPP_AlleleBeeSpecies species;
+ private final Consumer<GTPP_AlleleBeeSpecies> mSpeciesProperties;
+ private final Consumer<IAllele[]> mAlleles;
+ private final Consumer<GTPP_BeeDefinition> mMutations;
+ private IAllele[] template;
+ private IBeeGenome genome;
+
+ GTPP_BeeDefinition(GTPP_BranchDefinition branch, String binomial, Materials aMat, boolean dominant, int primary,
+ int secondary, Consumer<GTPP_AlleleBeeSpecies> aSpeciesProperties, Consumer<IAllele[]> aAlleles,
+ Consumer<GTPP_BeeDefinition> aMutations) {
+ this(
+ branch,
+ binomial,
+ MaterialUtils.generateMaterialFromGtENUM(aMat),
+ dominant,
+ primary,
+ secondary,
+ aSpeciesProperties,
+ aAlleles,
+ aMutations);
+ }
+
+ GTPP_BeeDefinition(GTPP_BranchDefinition branch, String binomial, Material aMat, boolean dominant, int primary,
+ int secondary, Consumer<GTPP_AlleleBeeSpecies> aSpeciesProperties, Consumer<IAllele[]> aAlleles,
+ Consumer<GTPP_BeeDefinition> aMutations) {
+ this.mAlleles = aAlleles;
+ this.mMutations = aMutations;
+ this.mSpeciesProperties = aSpeciesProperties;
+ String lowercaseName = this.toString()
+ .toLowerCase(Locale.ENGLISH);
+ String species = WordUtils.capitalize(binomial);
+ String uid = "gtpp.bee.species" + species;
+ String description = "for.description." + species;
+ String name = "for.bees.species." + lowercaseName;
+ GT_LanguageManager.addStringLocalization("for.bees.species." + lowercaseName, species, true);
+ GTPP_Bees.sMaterialMappings.put(
+ binomial.toLowerCase()
+ .replaceAll(" ", ""),
+ aMat);
+ this.branch = branch;
+ this.species = new GTPP_AlleleBeeSpecies(
+ uid,
+ dominant,
+ name,
+ "GT++",
+ description,
+ branch.getBranch(),
+ binomial,
+ primary,
+ secondary);
+ }
+
+ public static void initBees() {
+ for (GTPP_BeeDefinition bee : values()) {
+ bee.init();
+ }
+ for (GTPP_BeeDefinition bee : values()) {
+ bee.registerMutations();
+ }
+ }
+
+ private static IAlleleBeeEffect getEffect(byte modid, String name) {
+ String s = switch (modid) {
+ case GTPP_Bees.EXTRABEES -> "extrabees.effect." + name;
+ case GTPP_Bees.GENDUSTRY -> "gendustry.effect." + name;
+ case GTPP_Bees.MAGICBEES -> "magicbees.effect" + name;
+ case GTPP_Bees.GREGTECH -> "gregtech.effect" + name;
+ default -> "forestry.effect" + name;
+ };
+ return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s);
+ }
+
+ private static IAlleleFlowers getFlowers(byte modid, String name) {
+ String s = switch (modid) {
+ case GTPP_Bees.EXTRABEES -> "extrabees.flower." + name;
+ case GTPP_Bees.GENDUSTRY -> "gendustry.flower." + name;
+ case GTPP_Bees.MAGICBEES -> "magicbees.flower" + name;
+ case GTPP_Bees.GREGTECH -> "gregtech.flower" + name;
+ default -> "forestry.flowers" + name;
+ };
+ return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s);
+ }
+
+ private static IAlleleBeeSpecies getSpecies(byte modid, String name) {
+ String s = switch (modid) {
+ case GTPP_Bees.EXTRABEES -> "extrabees.species." + name;
+ case GTPP_Bees.GENDUSTRY -> "gendustry.bee." + name;
+ case GTPP_Bees.MAGICBEES -> "magicbees.species" + name;
+ case GTPP_Bees.GREGTECH -> "gregtech.species" + name;
+ default -> "forestry.species" + name;
+ };
+ IAlleleBeeSpecies ret = (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(s);
+ return ret;
+ }
+
+ private final void setSpeciesProperties(GTPP_AlleleBeeSpecies species2) {
+ this.mSpeciesProperties.accept(species2);
+ }
+
+ private final void setAlleles(IAllele[] template) {
+ this.mAlleles.accept(template);
+ }
+
+ private final void registerMutations() {
+ this.mMutations.accept(this);
+ }
+
+ private void init() {
+ setSpeciesProperties(species);
+
+ template = branch.getTemplate();
+ AlleleHelper.instance.set(template, SPECIES, species);
+ setAlleles(template);
+
+ genome = BeeManager.beeRoot.templateAsGenome(template);
+
+ BeeManager.beeRoot.registerTemplate(template);
+ }
+
+ private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2,
+ int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2,
+ int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2,
+ int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2,
+ int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance) {
+ return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, 1f);
+ }
+
+ /**
+ * Diese neue Funtion erlaubt Mutationsraten unter 1%. Setze dazu die Mutationsrate als Bruch mit chance /
+ * chancedivider This new function allows Mutation percentages under 1%. Set them as a fraction with chance /
+ * chancedivider
+ */
+ private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance,
+ float chancedivider) {
+ return new GTPP_Bee_Mutation(parent1, parent2, this.getTemplate(), chance, chancedivider);
+ }
+
+ private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance,
+ float chancedivider) {
+ return registerMutation(parent1.species, parent2, chance, chancedivider);
+ }
+
+ private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance,
+ float chancedivider) {
+ return registerMutation(parent1, parent2.species, chance, chancedivider);
+ }
+
+ private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2,
+ int chance, float chancedivider) {
+ return registerMutation(parent1.species, parent2, chance, chancedivider);
+ }
+
+ private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance, float chancedivider) {
+ return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, chancedivider);
+ }
+
+ @Override
+ public final IAllele[] getTemplate() {
+ return Arrays.copyOf(template, template.length);
+ }
+
+ @Override
+ public final IBeeGenome getGenome() {
+ return genome;
+ }
+
+ @Override
+ public final IBee getIndividual() {
+ return new Bee(genome);
+ }
+
+ @Override
+ public final ItemStack getMemberStack(EnumBeeType beeType) {
+ return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType.ordinal());
+ }
+
+ public final IBeeDefinition getRainResist() {
+ return new BeeVariation.RainResist(this);
+ }
+
+ private static final Class sGtBees = ReflectionUtils.getClass("gregtech.loaders.misc.GT_BeeDefinition");
+
+ public static IAlleleBeeSpecies getGregtechBeeType(String name) {
+ try {
+ Enum aBeeObject = ReflectionUtils.getEnum(sGtBees, name);
+ Field gtBeesField = ReflectionUtils.getField(sGtBees, "species");
+ IAlleleBeeSpecies beeType = ReflectionUtils.getFieldValue(gtBeesField, aBeeObject);
+ return beeType != null ? beeType : null;
+ } catch (Throwable t) {
+ t.printStackTrace();
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java
new file mode 100644
index 0000000000..d20b7ffb73
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java
@@ -0,0 +1,86 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import forestry.api.apiculture.BeeManager;
+import forestry.api.apiculture.IAlleleBeeSpecies;
+import forestry.api.apiculture.IBeeGenome;
+import forestry.api.apiculture.IBeeHousing;
+import forestry.api.apiculture.IBeeModifier;
+import forestry.api.core.IClimateProvider;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IMutationCondition;
+import forestry.apiculture.genetics.BeeMutation;
+import forestry.core.genetics.mutations.Mutation;
+
+public class GTPP_Bee_Mutation extends BeeMutation {
+
+ private final float split;
+
+ public GTPP_Bee_Mutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance,
+ float split) {
+ super(bee0, bee1, result, chance);
+ this.split = split;
+ BeeManager.beeRoot.registerMutation(this);
+ }
+
+ @Override
+ public float getBaseChance() {
+ return super.getBaseChance() / split;
+ }
+
+ @Override
+ public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1,
+ IBeeGenome genome0, IBeeGenome genome1) {
+ World world = housing != null ? housing.getWorld() : null;
+ ChunkCoordinates housingCoordinates = housing != null ? housing.getCoordinates() : null;
+ int x = housingCoordinates != null ? housingCoordinates.posX : 0;
+ int y = housingCoordinates != null ? housingCoordinates.posY : 0;
+ int z = housingCoordinates != null ? housingCoordinates.posZ : 0;
+
+ float processedChance = getBasicChance(world, x, y, z, allele0, allele1, genome0, genome1, housing);
+
+ if (processedChance <= 0f) {
+ return 0f;
+ }
+
+ IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
+ IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world)
+ .getBeeModifier();
+
+ processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
+ processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
+
+ return processedChance;
+ }
+
+ @SuppressWarnings("unchecked")
+ private float getBasicChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,
+ IGenome genome1, IClimateProvider climate) {
+ float mutationChance = this.getBaseChance();
+ List<IMutationCondition> mutationConditions = null;
+ Field f = FieldUtils.getDeclaredField(Mutation.class, "mutationConditions", true);
+ if (f == null) f = FieldUtils.getField(Mutation.class, "mutationConditions", true);
+ if (f == null) return mutationChance;
+ try {
+ mutationConditions = f.get(this) instanceof List ? (List<IMutationCondition>) f.get(this) : null;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ if (mutationConditions != null) for (IMutationCondition mutationCondition : mutationConditions) {
+ mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
+ if (mutationChance == 0) {
+ return 0;
+ }
+ }
+ return mutationChance;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
new file mode 100644
index 0000000000..77b7d57954
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
@@ -0,0 +1,69 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import static gregtech.api.enums.Mods.Forestry;
+
+import java.util.HashMap;
+
+import gregtech.GT_Mod;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType;
+import gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType;
+import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType;
+import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType;
+import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Comb;
+import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Drop;
+import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Pollen;
+import gtPlusPlus.xmod.forestry.bees.items.output.GTPP_Propolis;
+
+public class GTPP_Bees {
+
+ public static final byte FORESTRY = 0;
+ public static final byte EXTRABEES = 1;
+ public static final byte GENDUSTRY = 2;
+ public static final byte MAGICBEES = 3;
+ public static final byte GREGTECH = 4;
+
+ public static GTPP_Propolis propolis;
+ public static GTPP_Pollen pollen;
+ public static GTPP_Drop drop;
+ public static GTPP_Comb combs;
+
+ public static HashMap<String, Material> sMaterialMappings = new HashMap<>();
+ public static HashMap<Integer, GTPP_PropolisType> sPropolisMappings = new HashMap<>();
+ public static HashMap<Integer, GTPP_PollenType> sPollenMappings = new HashMap<>();
+ public static HashMap<Integer, GTPP_DropType> sDropMappings = new HashMap<>();
+ public static HashMap<Integer, GTPP_CombType> sCombMappings = new HashMap<>();
+
+ public GTPP_Bees() {
+ if (Forestry.isModLoaded() && GT_Mod.gregtechproxy.mGTBees) {
+ Logger.BEES("Creating required items.");
+ propolis = new GTPP_Propolis();
+ pollen = new GTPP_Pollen();
+ drop = new GTPP_Drop();
+ combs = new GTPP_Comb();
+
+ Logger.BEES("Loading types.");
+ initTypes();
+
+ Logger.BEES("Adding recipes.");
+ GTPP_Drop.initDropsRecipes();
+ GTPP_Propolis.initPropolisRecipes();
+ GTPP_Comb.initCombsRecipes();
+
+ Logger.BEES("Initialising bees.");
+ GTPP_BeeDefinition.initBees();
+
+ Logger.BEES("Done!");
+ }
+ }
+
+ private static void initTypes() {
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.registry.GTPP_BeeDefinition");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType");
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java
new file mode 100644
index 0000000000..39af813dec
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java
@@ -0,0 +1,89 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import static forestry.api.apiculture.EnumBeeChromosome.CAVE_DWELLING;
+import static forestry.api.apiculture.EnumBeeChromosome.EFFECT;
+import static forestry.api.apiculture.EnumBeeChromosome.FERTILITY;
+import static forestry.api.apiculture.EnumBeeChromosome.FLOWERING;
+import static forestry.api.apiculture.EnumBeeChromosome.FLOWER_PROVIDER;
+import static forestry.api.apiculture.EnumBeeChromosome.HUMIDITY_TOLERANCE;
+import static forestry.api.apiculture.EnumBeeChromosome.LIFESPAN;
+import static forestry.api.apiculture.EnumBeeChromosome.NOCTURNAL;
+import static forestry.api.apiculture.EnumBeeChromosome.SPEED;
+import static forestry.api.apiculture.EnumBeeChromosome.TEMPERATURE_TOLERANCE;
+import static forestry.api.apiculture.EnumBeeChromosome.TERRITORY;
+import static forestry.api.apiculture.EnumBeeChromosome.TOLERANT_FLYER;
+
+import java.util.Arrays;
+import java.util.function.Consumer;
+
+import forestry.api.apiculture.BeeManager;
+import forestry.api.apiculture.EnumBeeChromosome;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IClassification;
+import forestry.apiculture.genetics.alleles.AlleleEffect;
+import forestry.core.genetics.alleles.AlleleHelper;
+import forestry.core.genetics.alleles.EnumAllele.Fertility;
+import forestry.core.genetics.alleles.EnumAllele.Flowering;
+import forestry.core.genetics.alleles.EnumAllele.Flowers;
+import forestry.core.genetics.alleles.EnumAllele.Lifespan;
+import forestry.core.genetics.alleles.EnumAllele.Speed;
+import forestry.core.genetics.alleles.EnumAllele.Territory;
+import forestry.core.genetics.alleles.EnumAllele.Tolerance;
+
+public enum GTPP_BranchDefinition {
+
+ LEGENDARY("gtpp.legendary", "Summa Potestas", alleles -> {
+ AlleleHelper.instance.set(alleles, TEMPERATURE_TOLERANCE, Tolerance.BOTH_2);
+ AlleleHelper.instance.set(alleles, HUMIDITY_TOLERANCE, Tolerance.BOTH_2);
+ AlleleHelper.instance.set(alleles, TOLERANT_FLYER, true);
+ AlleleHelper.instance.set(alleles, NOCTURNAL, true);
+ AlleleHelper.instance.set(alleles, FLOWER_PROVIDER, Flowers.END);
+ AlleleHelper.instance.set(alleles, LIFESPAN, Lifespan.SHORT);
+ AlleleHelper.instance.set(alleles, FLOWERING, Flowering.SLOW);
+ AlleleHelper.instance.set(alleles, SPEED, Speed.FASTEST);
+ AlleleHelper.instance.set(alleles, TERRITORY, Territory.LARGER);
+ });
+
+ private static IAllele[] defaultTemplate;
+ private final IClassification branch;
+ private final Consumer<IAllele[]> mBranchProperties;
+
+ GTPP_BranchDefinition(String internal, String scientific, Consumer<IAllele[]> aBranchProperties) {
+ this.branch = BeeManager.beeFactory.createBranch(internal.toLowerCase(), scientific);
+ this.mBranchProperties = aBranchProperties;
+ }
+
+ private static IAllele[] getDefaultTemplate() {
+ if (defaultTemplate == null) {
+ defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
+
+ AlleleHelper.instance.set(defaultTemplate, SPEED, Speed.SLOWEST);
+ AlleleHelper.instance.set(defaultTemplate, LIFESPAN, Lifespan.SHORTER);
+ AlleleHelper.instance.set(defaultTemplate, FERTILITY, Fertility.NORMAL);
+ AlleleHelper.instance.set(defaultTemplate, TEMPERATURE_TOLERANCE, Tolerance.NONE);
+ AlleleHelper.instance.set(defaultTemplate, NOCTURNAL, false);
+ AlleleHelper.instance.set(defaultTemplate, HUMIDITY_TOLERANCE, Tolerance.NONE);
+ AlleleHelper.instance.set(defaultTemplate, TOLERANT_FLYER, false);
+ AlleleHelper.instance.set(defaultTemplate, CAVE_DWELLING, false);
+ AlleleHelper.instance.set(defaultTemplate, FLOWER_PROVIDER, Flowers.VANILLA);
+ AlleleHelper.instance.set(defaultTemplate, FLOWERING, Flowering.SLOWEST);
+ AlleleHelper.instance.set(defaultTemplate, TERRITORY, Territory.AVERAGE);
+ AlleleHelper.instance.set(defaultTemplate, EFFECT, AlleleEffect.effectNone);
+ }
+ return Arrays.copyOf(defaultTemplate, defaultTemplate.length);
+ }
+
+ private final void setBranchProperties(IAllele[] template) {
+ this.mBranchProperties.accept(template);
+ }
+
+ public final IAllele[] getTemplate() {
+ IAllele[] template = getDefaultTemplate();
+ setBranchProperties(template);
+ return template;
+ }
+
+ public final IClassification getBranch() {
+ return branch;
+ }
+}