Files
MagicBees/src/main/java/magicbees/bees/BeeMutation.java
T

644 lines
26 KiB
Java
Raw Normal View History

2013-05-23 21:07:28 -07:00
package magicbees.bees;
2012-12-24 15:12:37 -08:00
import java.util.ArrayList;
import java.util.Collection;
2012-12-24 15:12:37 -08:00
2013-06-05 00:11:40 -07:00
import magicbees.main.Config;
2013-06-04 13:26:44 -07:00
import magicbees.main.utils.LocalizationManager;
2014-08-02 18:55:38 +02:00
import magicbees.main.utils.LogHelper;
2013-05-23 21:07:28 -07:00
import magicbees.main.utils.MoonPhase;
2015-07-03 19:03:13 -07:00
import magicbees.main.utils.compat.AppliedEnergisticsHelper;
2013-05-23 21:07:28 -07:00
import magicbees.main.utils.compat.ArsMagicaHelper;
import magicbees.main.utils.compat.BloodMagicHelper;
2015-04-22 18:03:38 -07:00
import magicbees.main.utils.compat.BotaniaHelper;
2013-05-23 21:07:28 -07:00
import magicbees.main.utils.compat.EquivalentExchangeHelper;
import magicbees.main.utils.compat.ExtraBeesHelper;
import magicbees.main.utils.compat.ForestryHelper;
import magicbees.main.utils.compat.RedstoneArsenalHelper;
2013-05-23 21:07:28 -07:00
import magicbees.main.utils.compat.ThaumcraftHelper;
2014-01-16 14:31:09 -06:00
import magicbees.main.utils.compat.ThermalExpansionHelper;
2013-04-28 22:11:56 -07:00
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
2013-04-28 22:11:56 -07:00
import net.minecraft.item.ItemStack;
2013-06-04 13:26:44 -07:00
import net.minecraftforge.common.BiomeDictionary;
2013-06-06 15:39:36 -07:00
import net.minecraftforge.common.BiomeDictionary.Type;
2013-04-28 22:11:56 -07:00
import net.minecraftforge.oredict.OreDictionary;
2013-06-04 13:26:44 -07:00
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeMutation;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
2013-01-26 13:42:39 -08:00
public class BeeMutation implements IBeeMutation {
public static void setupMutations() {
IAlleleBeeSpecies baseA, baseB;
2013-06-04 13:26:44 -07:00
BeeMutation mutation;
// Forestry + These -> Common
BeeSpecies[] magicMundane = new BeeSpecies[] { BeeSpecies.MYSTICAL, BeeSpecies.SORCEROUS, BeeSpecies.UNUSUAL, BeeSpecies.ATTUNED };
String[] forestryMundane = new String[] { "Forest", "Meadows", "Modest", "Wintry", "Tropical", "Marshy" };
2013-06-04 13:26:44 -07:00
String[] binnieMundane = new String[] { "marble", "rock", "water", "basalt" };
for (BeeSpecies species : magicMundane) {
for (String str : forestryMundane) {
new BeeMutation(species, Allele.getBaseSpecies(str), ForestryHelper.getTemplateForestryForSpecies("Common"), 15);
}
if (ExtraBeesHelper.isActive()) {
for (String str : binnieMundane) {
2014-08-23 00:33:46 +02:00
LogHelper.info("Registering " + str);
try {
2013-07-16 23:08:57 -07:00
new BeeMutation(species, Allele.getExtraSpecies(str), ForestryHelper.getTemplateForestryForSpecies("Common"), 15);
}
catch (Exception e) {
2014-08-02 18:55:38 +02:00
LogHelper.info("Unable to register! This mutation will not be available.");
2013-07-16 23:08:57 -07:00
}
}
}
new BeeMutation(species, Allele.getBaseSpecies("Common"), ForestryHelper.getTemplateForestryForSpecies("Cultivated"), 12);
new BeeMutation(species, Allele.getBaseSpecies("Cultivated"), BeeSpecies.ELDRITCH, 12);
}
new BeeMutation(Allele.getBaseSpecies("Cultivated"), BeeSpecies.ELDRITCH, BeeSpecies.ESOTERIC, 10);
new BeeMutation(BeeSpecies.ELDRITCH, BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, 8);
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, BeeSpecies.ARCANE, 8)
.setMoonPhaseBonus(MoonPhase.WAXING_CRESCENT, MoonPhase.WAXING_GIBBOUS, 1.2f);
new BeeMutation(Allele.getBaseSpecies("Cultivated"), BeeSpecies.ELDRITCH, BeeSpecies.CHARMED, 10);
new BeeMutation(BeeSpecies.ELDRITCH, BeeSpecies.CHARMED, BeeSpecies.ENCHANTED, 8);
2013-06-04 13:26:44 -07:00
new BeeMutation(BeeSpecies.CHARMED, BeeSpecies.ENCHANTED, BeeSpecies.SUPERNATURAL, 8)
.setMoonPhaseBonus(MoonPhase.WANING_GIBBOUS, MoonPhase.WANING_CRESCENT, 1.2f);
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, 7);
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.WINDY, 14)
.setBlockRequired(Blocks.leaves);
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.WATERY, 14)
.setBlockRequired(Blocks.water);
2015-04-22 15:34:26 -07:00
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.EARTHY, 14)
.setBlockRequired(Blocks.brick_block);
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.FIREY, 14)
.setBlockRequired(Blocks.lava);
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.ATTUNED, BeeSpecies.AWARE, 10);
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.AWARE, BeeSpecies.SPIRIT, 8);
new BeeMutation(BeeSpecies.ATTUNED, BeeSpecies.AWARE, BeeSpecies.SPIRIT, 8);
new BeeMutation(BeeSpecies.AWARE, BeeSpecies.SPIRIT, BeeSpecies.SOUL, 7);
new BeeMutation(Allele.getBaseSpecies("Monastic"), BeeSpecies.ARCANE, BeeSpecies.PUPIL, 10);
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.PUPIL, BeeSpecies.SCHOLARLY, 8);
new BeeMutation(BeeSpecies.PUPIL, BeeSpecies.SCHOLARLY, BeeSpecies.SAVANT, 6);
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.ETHEREAL, BeeSpecies.TIMELY, 8);
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.TIMELY, BeeSpecies.LORDLY, 8);
new BeeMutation(BeeSpecies.TIMELY, BeeSpecies.LORDLY, BeeSpecies.DOCTORAL, 7);
2013-06-04 13:26:44 -07:00
new BeeMutation(BeeSpecies.INFERNAL, BeeSpecies.ELDRITCH, BeeSpecies.HATEFUL, 9)
.setBiomeRequired(BiomeDictionary.Type.NETHER);
2013-06-04 13:26:44 -07:00
new BeeMutation(BeeSpecies.INFERNAL, BeeSpecies.HATEFUL, BeeSpecies.SPITEFUL, 7)
.setBiomeRequired(BiomeDictionary.Type.NETHER);
2013-06-04 13:26:44 -07:00
new BeeMutation(Allele.getBaseSpecies("Demonic"), BeeSpecies.SPITEFUL, BeeSpecies.WITHERING, 6)
.setBiomeRequired(BiomeDictionary.Type.NETHER);
2013-06-04 13:26:44 -07:00
new BeeMutation(Allele.getBaseSpecies("Modest"), BeeSpecies.ELDRITCH, BeeSpecies.SKULKING, 12);
new BeeMutation(Allele.getBaseSpecies("Tropical"), BeeSpecies.SKULKING, BeeSpecies.SPIDERY, 10);
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.ETHEREAL, BeeSpecies.GHASTLY, 9);
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.HATEFUL, BeeSpecies.SMOULDERING, 7)
.setBiomeRequired(BiomeDictionary.Type.NETHER);
2015-07-03 14:50:14 -07:00
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.MYSTERIOUS, BeeSpecies.BIGBAD, 7)
.setMoonPhaseRestricted(MoonPhase.FULL, MoonPhase.FULL);
2013-06-04 13:26:44 -07:00
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.OBLIVION, BeeSpecies.NAMELESS, 10);
new BeeMutation(BeeSpecies.OBLIVION, BeeSpecies.NAMELESS, BeeSpecies.ABANDONED, 8);
new BeeMutation(BeeSpecies.NAMELESS, BeeSpecies.ABANDONED, BeeSpecies.FORLORN, 6);
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.ABANDONED, BeeSpecies.DRACONIC, 6)
.setBiomeRequired(BiomeDictionary.Type.END);
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.ELDRITCH, BeeSpecies.MUTABLE, 12);
2013-09-09 23:23:00 -07:00
new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.TRANSMUTING, 9);
new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.CRUMBLING, 9);
2013-09-25 21:21:03 -07:00
new BeeMutation(BeeSpecies.MYSTICAL, BeeSpecies.MUTABLE, BeeSpecies.INVISIBLE, 15);
if (BeeSpecies.COPPER.isActive()) {
2013-06-04 13:26:44 -07:00
new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Meadows"), BeeSpecies.COPPER, 12)
.setBlockRequired("blockCopper");
2013-06-04 13:26:44 -07:00
}
if (BeeSpecies.TIN.isActive()) {
2013-06-04 13:26:44 -07:00
new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Forest"), BeeSpecies.TIN, 12)
.setBlockRequired("blockTin");
2013-06-04 13:26:44 -07:00
}
2013-08-26 11:35:53 -07:00
new BeeMutation(Allele.getBaseSpecies("Common"), Allele.getBaseSpecies("Industrious"), BeeSpecies.IRON, 12)
.setBlockRequired(Blocks.iron_block);
if (BeeSpecies.LEAD.isActive()) {
2013-06-04 13:26:44 -07:00
baseA = (BeeSpecies.TIN.isActive()) ? BeeSpecies.TIN : (BeeSpecies.COPPER.isActive()) ? BeeSpecies.COPPER : BeeSpecies.IRON;
mutation = new BeeMutation(baseA, Allele.getBaseSpecies("Common"), BeeSpecies.LEAD, 10);
if (OreDictionary.getOres("blockLead").size() > 0) {
2013-06-04 13:26:44 -07:00
mutation.setBlockRequired("blockLead");
}
}
if (BeeSpecies.SILVER.isActive()) {
2013-06-04 13:26:44 -07:00
mutation = new BeeMutation(Allele.getBaseSpecies("Imperial"), Allele.getBaseSpecies("Modest"), BeeSpecies.SILVER, 8);
if (OreDictionary.getOres("blockSilver").size() > 0) {
2013-06-04 13:26:44 -07:00
mutation.setBlockRequired("blockSilver");
}
}
2013-06-04 13:26:44 -07:00
baseA = (BeeSpecies.EE_MINIUM.isActive()) ? BeeSpecies.EE_MINIUM : Allele.getBaseSpecies("Imperial");
baseB = (BeeSpecies.LEAD.isActive()) ? BeeSpecies.LEAD : BeeSpecies.IRON;
new BeeMutation(baseA, baseB, BeeSpecies.GOLD, 8)
.setBlockRequired(Blocks.gold_block);
if (BeeSpecies.ALUMINUM.isActive()) {
new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Cultivated"), BeeSpecies.ALUMINUM, 10)
.setBlockRequired("blockAluminum");
}
if (BeeSpecies.ARDITE.isActive()) {
new BeeMutation(Allele.getBaseSpecies("Industrious"), BeeSpecies.INFERNAL, BeeSpecies.ARDITE, 9)
.setBlockRequired("blockArdite");
}
if (BeeSpecies.COBALT.isActive()) {
boolean hasTConCobalt = OreDictionary.getOres("nuggetCobalt").size() > 0 && OreDictionary.getOres("blockCobalt").size() > 0;
boolean hasNaturalCobalt = OreDictionary.getOres("nuggetNaturalCobalt").size() > 0 && OreDictionary.getOres("blockNaturalCobalt").size() > 0;
if (hasTConCobalt) {
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.INFERNAL, BeeSpecies.COBALT, 11)
.setBlockRequired("blockCobalt");
}
if (hasNaturalCobalt) {
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.INFERNAL, BeeSpecies.COBALT, 11)
.setBlockRequired("blockNaturalCobalt");
}
if (!(hasTConCobalt || hasNaturalCobalt)) {
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.INFERNAL, BeeSpecies.COBALT, 7);
}
}
if (BeeSpecies.MANYULLYN.isActive()) {
new BeeMutation(BeeSpecies.ARDITE, BeeSpecies.COBALT, BeeSpecies.MANYULLYN, 9)
.setBlockRequired("blockManyullyn");
}
if (BeeSpecies.OSMIUM.isActive()) {
baseA = (BeeSpecies.SILVER.isActive()) ? BeeSpecies.SILVER : Allele.getBaseSpecies("Imperial");
baseB = (BeeSpecies.COBALT.isActive()) ? BeeSpecies.COBALT : BeeSpecies.INFERNAL;
mutation = new BeeMutation(baseA, baseB, BeeSpecies.OSMIUM, 11);
if (OreDictionary.getOres("blockOsmium").size() > 0) {
mutation.setBlockRequired("blockOsmium");
}
}
2013-06-04 13:26:44 -07:00
new BeeMutation(Allele.getBaseSpecies("Austere"), BeeSpecies.GOLD, BeeSpecies.DIAMOND, 7)
.setBlockRequired(Blocks.diamond_block);
2013-06-04 13:26:44 -07:00
baseA = (BeeSpecies.SILVER.isActive()) ? BeeSpecies.SILVER : Allele.getBaseSpecies("Imperial");
new BeeMutation(Allele.getBaseSpecies("Austere"), baseA, BeeSpecies.EMERALD, 6)
.setBlockRequired(Blocks.emerald_block);
2013-06-04 13:26:44 -07:00
new BeeMutation(Allele.getBaseSpecies("Rural"), BeeSpecies.COPPER, BeeSpecies.APATITE, 12)
.setBlockRequired("blockApatite");
2013-06-04 13:26:44 -07:00
2015-07-03 19:03:13 -07:00
if (BeeSpecies.SILICON.isActive()) {
baseA = (BeeSpecies.AE_SKYSTONE.isActive()) ? BeeSpecies.AE_SKYSTONE : BeeSpecies.EARTHY;
new BeeMutation(baseA, BeeSpecies.IRON, BeeSpecies.SILICON, 17);
}
if (BeeSpecies.CERTUS.isActive()) {
baseA = (BeeSpecies.SILICON.isActive()) ? BeeSpecies.SILICON : BeeSpecies.IRON;
baseB = (BeeSpecies.AE_SKYSTONE.isActive()) ? BeeSpecies.AE_SKYSTONE : BeeSpecies.EARTHY;
new BeeMutation(baseA, baseB, BeeSpecies.CERTUS, 13);
}
if (BeeSpecies.FLUIX.isActive()) {
if (BeeSpecies.CERTUS.isActive()) {
baseA = BeeSpecies.CERTUS;
}
else if (BeeSpecies.SILICON.isActive()) {
baseA = BeeSpecies.SILICON;
}
else {
baseA = BeeSpecies.IRON;
}
baseB = (BeeSpecies.AE_SKYSTONE.isActive()) ? BeeSpecies.AE_SKYSTONE : BeeSpecies.EARTHY;
new BeeMutation(baseA, baseB, BeeSpecies.FLUIX, 17);
}
if (ThaumcraftHelper.isActive()) {
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.WINDY, BeeSpecies.WINDY, BeeSpecies.TC_AIR, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.AIR.ordinal());
2013-06-06 15:39:36 -07:00
new BeeMutation(BeeSpecies.FIREY, BeeSpecies.FIREY, BeeSpecies.TC_FIRE, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.FIRE.ordinal());
2013-06-06 15:39:36 -07:00
new BeeMutation(BeeSpecies.WATERY, BeeSpecies.WATERY, BeeSpecies.TC_WATER, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.WATER.ordinal());
2013-06-06 15:39:36 -07:00
new BeeMutation(BeeSpecies.EARTHY, BeeSpecies.EARTHY, BeeSpecies.TC_EARTH, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.EARTH.ordinal());
2013-09-09 23:23:00 -07:00
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.ARCANE, BeeSpecies.TC_ORDER, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.ORDER.ordinal());
2013-09-09 23:23:00 -07:00
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.SUPERNATURAL, BeeSpecies.TC_CHAOS, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.CHAOS.ordinal());
2013-09-09 23:23:00 -07:00
2013-06-04 13:26:44 -07:00
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.WINDY, BeeSpecies.TC_BATTY, 9);
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.PUPIL, BeeSpecies.TC_BRAINY, 9);
2013-06-05 00:11:40 -07:00
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.GHASTLY, BeeSpecies.TC_WISPY, 9)
.setMoonPhaseRestricted(MoonPhase.WANING_CRESCENT, MoonPhase.WAXING_CRESCENT);
2013-06-06 15:39:36 -07:00
new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.TC_CHICKEN, 12)
.setBiomeRequired(Type.FOREST);
2013-06-06 15:39:36 -07:00
new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.TC_BEEF, 12)
.setBiomeRequired(Type.PLAINS);
2013-06-06 15:39:36 -07:00
new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.TC_PORK, 12)
.setBiomeRequired(Type.MOUNTAIN);
2013-06-04 13:26:44 -07:00
}
if (ArsMagicaHelper.isActive()) {
2013-06-04 13:26:44 -07:00
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.ETHEREAL, BeeSpecies.AM_ESSENCE, 10);
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.AM_ESSENCE, BeeSpecies.AM_QUINTESSENCE, 7);
2013-06-06 15:39:36 -07:00
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.WINDY, BeeSpecies.AM_AIR, 10);
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.EARTHY, BeeSpecies.AM_EARTH, 10);
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.FIREY, BeeSpecies.AM_FIRE, 10);
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.WATERY, BeeSpecies.AM_WATER, 10);
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.ETHEREAL, BeeSpecies.AM_ARCANE, 10);
new BeeMutation(BeeSpecies.WINDY, BeeSpecies.AM_AIR, BeeSpecies.AM_LIGHTNING, 8);
new BeeMutation(BeeSpecies.EARTHY, BeeSpecies.AM_EARTH, BeeSpecies.AM_PLANT, 8);
new BeeMutation(BeeSpecies.WATERY, BeeSpecies.AM_WATER, BeeSpecies.AM_ICE, 8);
2013-06-04 13:26:44 -07:00
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.AM_ESSENCE, BeeSpecies.AM_VORTEX, 8);
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.GHASTLY, BeeSpecies.AM_WIGHT, 8);
}
if (EquivalentExchangeHelper.isActive()) {
new BeeMutation(Allele.getBaseSpecies("Frugal"), BeeSpecies.MUTABLE, BeeSpecies.EE_MINIUM, 8);
2013-06-04 13:26:44 -07:00
}
2014-01-18 12:44:14 -08:00
if (BloodMagicHelper.isActive()) {
new BeeMutation(BeeSpecies.ELDRITCH, BeeSpecies.EARTHY, BeeSpecies.BM_BLOODY, 8)
.setMoonPhaseBonus(MoonPhase.WANING_CRESCENT, MoonPhase.WAXING_CRESCENT, 8)
.setBlockRequired(BloodMagicHelper.bloodStoneBrick);
new BeeMutation(BeeSpecies.BM_BLOODY, BeeSpecies.ARCANE, BeeSpecies.BM_BOUND, 8)
.setBlockRequired(BloodMagicHelper.masterRitualStone);
}
if (RedstoneArsenalHelper.isActive()) {
new BeeMutation(BeeSpecies.TE_ELECTRUM, BeeSpecies.TE_DESTABILIZED, BeeSpecies.RSA_FLUXED, 10)
.setBlockRequired("blockElectrumFlux");
2014-01-16 14:31:09 -06:00
}
if (ThermalExpansionHelper.isActive()) {
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TIN, BeeSpecies.COPPER, BeeSpecies.TE_BRONZE, 12)
.setBlockRequired("blockBronze");
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.GOLD, BeeSpecies.SILVER, BeeSpecies.TE_ELECTRUM, 10)
.setBlockRequired("blockElectrum");
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.IRON, BeeSpecies.ESOTERIC, BeeSpecies.TE_NICKEL, 14)
.setBlockRequired("blockNickel");
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.IRON, BeeSpecies.TE_NICKEL, BeeSpecies.TE_INVAR, 14)
.setBlockRequired("blockInvar");
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TE_NICKEL, BeeSpecies.TE_INVAR, BeeSpecies.TE_PLATINUM, 10)
.setBlockRequired("blockPlatinum");
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TIN, BeeSpecies.COPPER, BeeSpecies.TE_BRONZE, 12)
.setBlockRequired("blockBronze");
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.SPITEFUL, BeeSpecies.TIN, BeeSpecies.TE_COAL, 12)
.setBlockRequired(Blocks.coal_ore);
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.SPITEFUL, Allele.getBaseSpecies("Industrious"), BeeSpecies.TE_DESTABILIZED, 12)
.setBlockRequired(Blocks.redstone_ore);
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.SMOULDERING, BeeSpecies.INFERNAL, BeeSpecies.TE_LUX, 12)
.setBlockRequired(Blocks.glowstone);
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.SMOULDERING, Allele.getBaseSpecies("Austere"), BeeSpecies.TE_DANTE, 12)
.setBiomeRequired(BiomeDictionary.Type.NETHER);
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TE_DANTE, BeeSpecies.TE_COAL, BeeSpecies.TE_PYRO, 8)
.setBiomeRequired(BiomeDictionary.Type.NETHER);
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.SKULKING, Allele.getBaseSpecies("Wintry"), BeeSpecies.TE_BLIZZY, 12);
2014-01-18 12:44:14 -08:00
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TE_BLIZZY, Allele.getBaseSpecies("Icy"), BeeSpecies.TE_GELID, 8);
2014-01-18 12:44:14 -08:00
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TE_PLATINUM, BeeSpecies.OBLIVION, BeeSpecies.TE_WINSOME, 12);
2014-01-18 12:44:14 -08:00
2014-01-16 14:31:09 -06:00
new BeeMutation(BeeSpecies.TE_WINSOME, BeeSpecies.TE_COAL, BeeSpecies.TE_ENDEARING, 8)
.setBlockRequired("blockEnderium");
2014-01-16 14:31:09 -06:00
}
2015-04-22 18:03:38 -07:00
if (BotaniaHelper.isActive()) {
new BeeMutation(BeeSpecies.ELDRITCH, Allele.getBaseSpecies("Forest"), BeeSpecies.BOT_ROOTED, 15)
.setBlockRequired(BotaniaHelper.blockLivingWood);
new BeeMutation(BeeSpecies.BOT_ROOTED, BeeSpecies.WATERY, BeeSpecies.BOT_SOMNOLENT, 16)
.setRequiresNight();
2015-04-22 20:47:31 -07:00
new BeeMutation(BeeSpecies.WINDY, BeeSpecies.BOT_SOMNOLENT, BeeSpecies.BOT_DREAMING, 8)
2015-04-22 18:03:38 -07:00
.setRequiresNight();
new BeeMutation(BeeSpecies.BOT_BOTANIC, BeeSpecies.EARTHY, BeeSpecies.BOT_BLOSSOM, 12);
new BeeMutation(BeeSpecies.BOT_BOTANIC, BeeSpecies.BOT_BLOSSOM, BeeSpecies.BOT_FLORAL, 8);
}
2015-07-03 19:03:13 -07:00
if (AppliedEnergisticsHelper.isActive()) {
if (BeeSpecies.AE_SKYSTONE.isActive()) {
new BeeMutation(BeeSpecies.EARTHY, BeeSpecies.WINDY, BeeSpecies.AE_SKYSTONE, 20)
.setBlockRequired(AppliedEnergisticsHelper.skystone);
}
}
2013-02-09 14:12:43 -08:00
}
2015-04-22 18:03:38 -07:00
2012-12-24 15:12:37 -08:00
private IAllele parent1;
private IAllele parent2;
private IAllele mutationTemplate[];
2012-12-27 00:27:23 -08:00
private int baseChance;
2012-12-24 15:12:37 -08:00
private boolean isSecret;
2013-01-19 03:29:47 -08:00
private boolean isMoonRestricted;
private MoonPhase moonPhaseStart;
private MoonPhase moonPhaseEnd;
private float moonPhaseMutationBonus;
2015-04-22 18:03:38 -07:00
private boolean requiresNight;
2013-04-28 22:11:56 -07:00
private boolean requiresBlock;
private Block requiredBlock;
2013-04-28 22:11:56 -07:00
private int requiredBlockMeta;
private String requiredBlockOreDictEntry;
2013-06-14 13:30:00 -07:00
private String requiredBlockName;
2013-06-04 13:26:44 -07:00
private BiomeDictionary.Type requiredBiomeType;
public BeeMutation(IAlleleBeeSpecies species0, IAlleleBeeSpecies species1, BeeSpecies resultSpecies, int percentChance) {
this(species0, species1, resultSpecies.getGenome(), percentChance);
}
public BeeMutation(IAlleleBeeSpecies species0, IAlleleBeeSpecies species1, IAllele[] resultSpeciesGenome, int percentChance) {
2013-01-19 03:29:47 -08:00
this.parent1 = species0;
this.parent2 = species1;
this.mutationTemplate = resultSpeciesGenome;
2013-01-19 03:29:47 -08:00
this.baseChance = percentChance;
this.isSecret = false;
this.isMoonRestricted = false;
this.moonPhaseMutationBonus = -1f;
2015-04-22 18:03:38 -07:00
this.requiresNight = false;
2013-04-28 22:11:56 -07:00
this.requiresBlock = false;
this.requiredBlockMeta = OreDictionary.WILDCARD_VALUE;
this.requiredBlockOreDictEntry = null;
2013-06-04 13:26:44 -07:00
this.requiredBiomeType = null;
2013-06-14 13:30:00 -07:00
this.requiredBlockName = null;
2013-06-06 15:39:36 -07:00
BeeManager.beeRoot.registerMutation(this);
2012-12-24 15:12:37 -08:00
}
2013-05-29 17:49:54 -07:00
@Override
@Deprecated
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
if (allele0 instanceof IAlleleBeeSpecies && allele1 instanceof IAlleleBeeSpecies && genome0 instanceof IBeeGenome && genome1 instanceof IBeeGenome) {
return getChance(housing, (IAlleleBeeSpecies)allele0, (IAlleleBeeSpecies)allele1, (IBeeGenome)genome0, (IBeeGenome)genome1);
}
return 0;
}
@Override
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
2013-04-15 00:17:50 -07:00
float finalChance = 0f;
2013-01-19 03:29:47 -08:00
float chance = this.baseChance * 1f;
2012-12-27 00:27:23 -08:00
if (this.arePartners(allele0, allele1)) {
2012-12-27 00:27:23 -08:00
// This mutation applies. Continue calculation.
if (this.moonPhaseStart != null && this.moonPhaseEnd != null) {
2013-01-19 03:29:47 -08:00
// Only occurs during the phases.
if (this.isMoonRestricted && !MoonPhase.getMoonPhase(housing.getWorld()).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
2013-01-19 03:29:47 -08:00
chance = 0;
}
else if (this.moonPhaseMutationBonus != -1f) {
2013-01-19 03:29:47 -08:00
// There is a bonus to this mutation during moon phases...
if (MoonPhase.getMoonPhase(housing.getWorld()).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
2013-01-19 03:29:47 -08:00
chance = (int)(chance * this.moonPhaseMutationBonus);
}
}
}
if (this.requiresBlock) {
2013-06-14 13:30:00 -07:00
Block blockBelow;
int blockMeta;
int i = 1;
do {
blockBelow = housing.getWorld().getBlock(housing.getXCoord(), housing.getYCoord() - i,
housing.getZCoord());
2013-06-14 13:30:00 -07:00
blockMeta = housing.getWorld().getBlockMetadata(housing.getXCoord(), housing.getYCoord() - i, housing.getZCoord());
++i;
}
2013-07-19 15:34:54 -07:00
while (blockBelow != null && (blockBelow instanceof IBeeHousing || blockBelow == Config.fAlvearyBlock));
2013-04-28 22:11:56 -07:00
if (this.requiredBlockOreDictEntry != null) {
2014-08-23 00:33:46 +02:00
int[] dicId = OreDictionary.getOreIDs(new ItemStack(blockBelow, 1, blockMeta));
if (dicId.length != 0) {
if (!OreDictionary.getOreName(dicId[0]).equals(this.requiredBlockOreDictEntry)) {
2013-04-28 22:11:56 -07:00
chance = 0;
}
}
else {
2013-04-28 22:11:56 -07:00
chance = 0;
}
}
else if (this.requiredBlock != blockBelow ||
(this.requiredBlockMeta != OreDictionary.WILDCARD_VALUE && this.requiredBlockMeta != blockMeta)) {
2013-04-28 22:11:56 -07:00
chance = 0;
}
}
if (this.requiredBiomeType != null) {
2013-06-04 13:26:44 -07:00
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(housing.getWorld().getBiomeGenForCoords(housing.getXCoord(), housing.getZCoord()));
boolean found = false;
for (int i = 0; i < types.length; ++i) {
if (this.requiredBiomeType == types[i]) {
2013-06-04 13:26:44 -07:00
found = true;
break;
}
}
if (!found) {
2013-06-04 13:26:44 -07:00
chance = 0;
}
}
2015-04-22 18:03:38 -07:00
if (this.requiresNight) {
if (!housing.getWorld().isDaytime()) {
chance = 0;
}
}
finalChance = Math.round(chance
* housing.getMutationModifier((IBeeGenome)genome0,
(IBeeGenome)genome1, chance)
2013-06-06 15:39:36 -07:00
* BeeManager.beeRoot.getBeekeepingMode(housing.getWorld())
.getMutationModifier((IBeeGenome)genome0,
(IBeeGenome)genome1, chance));
2012-12-27 00:27:23 -08:00
}
2013-01-19 03:29:47 -08:00
return finalChance;
2012-12-24 15:12:37 -08:00
}
2013-05-29 17:49:54 -07:00
@Override
public IAllele getAllele0() {
2012-12-24 15:12:37 -08:00
return parent1;
}
2013-05-29 17:49:54 -07:00
@Override
public IAllele getAllele1() {
2012-12-24 15:12:37 -08:00
return parent2;
}
2013-05-29 17:49:54 -07:00
@Override
public IAllele[] getTemplate() {
2012-12-24 15:12:37 -08:00
return mutationTemplate;
}
2013-05-29 17:49:54 -07:00
@Override
public float getBaseChance() {
2012-12-27 00:27:23 -08:00
return baseChance;
2012-12-24 15:12:37 -08:00
}
2013-05-29 17:49:54 -07:00
@Override
public boolean isPartner(IAllele allele) {
2012-12-24 15:12:37 -08:00
return parent1.getUID().equals(allele.getUID()) || parent2.getUID().equals(allele.getUID());
}
2013-05-29 17:49:54 -07:00
@Override
public IAllele getPartner(IAllele allele) {
2012-12-24 15:12:37 -08:00
IAllele val = parent1;
if (val.getUID().equals(allele.getUID()))
val = parent2;
return val;
}
2013-05-29 17:49:54 -07:00
@Override
public Collection<String> getSpecialConditions() {
2013-06-04 13:26:44 -07:00
ArrayList<String> conditions = new ArrayList<String>();
if (this.isMoonRestricted && moonPhaseStart != null && moonPhaseEnd != null) {
if (moonPhaseStart != moonPhaseEnd) {
2013-06-04 13:26:44 -07:00
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt()));
2013-06-04 13:26:44 -07:00
}
else {
2013-06-04 13:26:44 -07:00
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
moonPhaseStart.getLocalizedName()));
}
}
2013-07-16 23:08:57 -07:00
if (this.requiresBlock) {
if (this.requiredBlockName != null) {
2013-06-14 13:30:00 -07:00
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"),
LocalizationManager.getLocalizedString(this.requiredBlockName)));
}
else if (this.requiredBlockOreDictEntry != null) {
2013-06-04 13:26:44 -07:00
ArrayList<ItemStack> ores = OreDictionary.getOres(this.requiredBlockOreDictEntry);
if (ores.size() > 0) {
2013-06-04 13:26:44 -07:00
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"), ores.get(0).getDisplayName()));
}
}
else {
int meta = OreDictionary.WILDCARD_VALUE;
if (this.requiredBlockMeta != OreDictionary.WILDCARD_VALUE) {
2013-06-14 13:30:00 -07:00
meta = this.requiredBlockMeta;
}
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"),
new ItemStack(this.requiredBlock, 1, meta).getDisplayName()));
2013-06-04 13:26:44 -07:00
}
}
2013-07-16 23:08:57 -07:00
if (this.requiredBiomeType != null) {
2013-06-04 13:26:44 -07:00
String biomeName = this.requiredBiomeType.name().substring(0, 1) + this.requiredBiomeType.name().substring(1).toLowerCase();
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBiome"), biomeName));
}
2015-04-22 20:47:31 -07:00
if (this.requiresNight) {
conditions.add(LocalizationManager.getLocalizedString("research.requiresNight"));
}
2013-06-04 13:26:44 -07:00
return conditions;
2013-05-29 17:49:54 -07:00
}
@Override
public IBeeRoot getRoot() {
2013-06-06 15:39:36 -07:00
return BeeManager.beeRoot;
2013-05-29 17:49:54 -07:00
}
2013-01-19 03:29:47 -08:00
public boolean arePartners(IAllele alleleA, IAllele alleleB) {
2013-01-26 13:42:39 -08:00
return (this.parent1.getUID().equals(alleleA.getUID())) && this.parent2.getUID().equals(alleleB.getUID()) ||
this.parent1.getUID().equals(alleleB.getUID()) && this.parent2.getUID().equals(alleleA.getUID());
}
public BeeMutation setSecret() {
2013-01-19 03:29:47 -08:00
this.isSecret = true;
return this;
}
2012-12-24 15:12:37 -08:00
public boolean isSecret() {
2012-12-24 15:12:37 -08:00
return isSecret;
}
2013-01-19 03:29:47 -08:00
public BeeMutation setBlockRequired(Block block) {
2013-04-28 22:11:56 -07:00
this.requiresBlock = true;
this.requiredBlock = block;
2013-04-28 22:11:56 -07:00
return this;
}
public BeeMutation setBlockAndMetaRequired(Block block, int meta) {
2013-04-28 22:11:56 -07:00
this.requiresBlock = true;
this.requiredBlock = block;
2013-04-28 22:11:56 -07:00
this.requiredBlockMeta = meta;
return this;
}
public BeeMutation setBlockRequired(String oreDictEntry) {
2013-04-28 22:11:56 -07:00
this.requiresBlock = true;
this.requiredBlockOreDictEntry = oreDictEntry;
return this;
}
public BeeMutation setBlockRequiredNameOverride(String blockName) {
2013-06-14 13:30:00 -07:00
this.requiredBlockName = blockName;
return this;
}
public BeeMutation setMoonPhaseRestricted(MoonPhase begin, MoonPhase end) {
2013-01-19 03:29:47 -08:00
this.isMoonRestricted = true;
this.moonPhaseStart = begin;
this.moonPhaseEnd = end;
return this;
}
public BeeMutation setMoonPhaseBonus(MoonPhase begin, MoonPhase end, float mutationBonus) {
2013-01-19 03:29:47 -08:00
this.moonPhaseMutationBonus = mutationBonus;
this.moonPhaseStart = begin;
this.moonPhaseEnd = end;
return this;
}
2013-01-26 13:42:39 -08:00
public BeeMutation setBiomeRequired(BiomeDictionary.Type biomeType) {
2013-06-04 13:26:44 -07:00
this.requiredBiomeType = biomeType;
return this;
}
2015-04-22 18:03:38 -07:00
public BeeMutation setRequiresNight() {
this.requiresNight = true;
return this;
}
2012-12-24 15:12:37 -08:00
}