diff --git a/src/main/java/magicbees/bees/BeeGenomeManager.java b/src/main/java/magicbees/bees/BeeGenomeManager.java index 1a2b386..b1a95e6 100644 --- a/src/main/java/magicbees/bees/BeeGenomeManager.java +++ b/src/main/java/magicbees/bees/BeeGenomeManager.java @@ -1293,9 +1293,17 @@ public class BeeGenomeManager { return genome; } - public static IAllele[] getTemplateBotBotanic() { + public static IAllele[] getTemplateBotRooted() { IAllele[] genome = getTemplateBotaniaBase(); + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_ROOTED; + + return genome; + } + + public static IAllele[] getTemplateBotBotanic() { + IAllele[] genome = getTemplateBotRooted(); + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_BOTANIC; genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerBotania; @@ -1323,9 +1331,33 @@ public class BeeGenomeManager { } public static IAllele[] getTemplateBotVazbee() { - IAllele[] genome = getTemplateBotaniaBase(); + IAllele[] genome = getTemplateBotFloral(); genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_VAZBEE; + genome[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.getBaseAllele("fertilityLow"); + + return genome; + } + + public static IAllele[] getTemplateBotSomnolent() { + IAllele[] genome = getTemplateBotaniaBase(); + + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_SOMNOLENT; + genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerBotania; + genome[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceUp2"); + genome[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.getBaseAllele("boolTrue"); + genome[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.getBaseAllele("boolTrue"); + genome[EnumBeeChromosome.SPEED.ordinal()] = Allele.getBaseAllele("speedSlowest"); + + return genome; + } + + public static IAllele[] getTemplateBotDreaming() { + IAllele[] genome = getTemplateBotSomnolent(); + + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_DREAMING; + genome[EnumBeeChromosome.SPEED.ordinal()] = Allele.getBaseAllele("speedNormal"); + genome[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.getBaseAllele("territoryLarger"); return genome; } diff --git a/src/main/java/magicbees/bees/BeeManager.java b/src/main/java/magicbees/bees/BeeManager.java index 27edd7e..7862a1e 100644 --- a/src/main/java/magicbees/bees/BeeManager.java +++ b/src/main/java/magicbees/bees/BeeManager.java @@ -10,9 +10,15 @@ import magicbees.item.types.DropType; import magicbees.main.Config; import magicbees.main.utils.Tuple; import magicbees.main.utils.compat.ExtraBeesHelper; +import net.minecraft.item.ItemStack; +import forestry.api.apiculture.EnumBeeChromosome; +import forestry.api.apiculture.EnumBeeType; import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeRoot; import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAllele; public class BeeManager { @@ -35,6 +41,22 @@ public class BeeManager beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f); } + public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies species, EnumBeeType type) { + IBee bee = getBeeFromSpecies(species, false); + return BeeManager.beeRoot.getMemberStack(bee, type.ordinal()); + } + + public static IBee getBeeFromSpecies(IAlleleBeeSpecies species, boolean applyRainResist) { + IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(species.getUID()); + + if (applyRainResist) { + speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate); + } + + IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate); + return BeeManager.beeRoot.getBee(null, genome); + } + public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) { Collections.shuffle(worldgenSpeciesWeights); double value = r.nextDouble() * worldgenSpeciesWeightsTotal; diff --git a/src/main/java/magicbees/bees/BeeMutation.java b/src/main/java/magicbees/bees/BeeMutation.java index c7f2aa1..080d991 100644 --- a/src/main/java/magicbees/bees/BeeMutation.java +++ b/src/main/java/magicbees/bees/BeeMutation.java @@ -8,6 +8,7 @@ import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LogHelper; import magicbees.main.utils.MoonPhase; import magicbees.main.utils.compat.ArsMagicaHelper; +import magicbees.main.utils.compat.BotaniaHelper; import magicbees.main.utils.compat.EquivalentExchangeHelper; import magicbees.main.utils.compat.ExtraBeesHelper; import magicbees.main.utils.compat.ForestryHelper; @@ -290,8 +291,21 @@ public class BeeMutation implements IBeeMutation new BeeMutation(BeeSpecies.TE_WINSOME, BeeSpecies.TE_COAL, BeeSpecies.TE_ENDEARING, 8) .setBlockRequired("blockEnderium"); } + + 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(); + new BeeMutation(BeeSpecies.BOT_ROOTED, BeeSpecies.BOT_SOMNOLENT, BeeSpecies.BOT_DREAMING, 8) + .setRequiresNight(); + + new BeeMutation(BeeSpecies.BOT_BOTANIC, BeeSpecies.EARTHY, BeeSpecies.BOT_BLOSSOM, 12); + new BeeMutation(BeeSpecies.BOT_BOTANIC, BeeSpecies.BOT_BLOSSOM, BeeSpecies.BOT_FLORAL, 8); + } } - + private IAllele parent1; private IAllele parent2; private IAllele mutationTemplate[]; @@ -301,6 +315,7 @@ public class BeeMutation implements IBeeMutation private MoonPhase moonPhaseStart; private MoonPhase moonPhaseEnd; private float moonPhaseMutationBonus; + private boolean requiresNight; private boolean requiresBlock; private Block requiredBlock; private int requiredBlockMeta; @@ -322,7 +337,7 @@ public class BeeMutation implements IBeeMutation this.isSecret = false; this.isMoonRestricted = false; this.moonPhaseMutationBonus = -1f; - //this.nodeType = null; + this.requiresNight = false; this.requiresBlock = false; this.requiredBlockMeta = OreDictionary.WILDCARD_VALUE; this.requiredBlockOreDictEntry = null; @@ -412,6 +427,12 @@ public class BeeMutation implements IBeeMutation } } + if (this.requiresNight) { + if (!housing.getWorld().isDaytime()) { + chance = 0; + } + } + finalChance = Math.round(chance * housing.getMutationModifier((IBeeGenome)genome0, (IBeeGenome)genome1, chance) @@ -597,4 +618,10 @@ public class BeeMutation implements IBeeMutation return this; } + + public BeeMutation setRequiresNight() { + this.requiresNight = true; + + return this; + } } diff --git a/src/main/java/magicbees/bees/BeeSpecies.java b/src/main/java/magicbees/bees/BeeSpecies.java index fa854cb..7ea09c6 100644 --- a/src/main/java/magicbees/bees/BeeSpecies.java +++ b/src/main/java/magicbees/bees/BeeSpecies.java @@ -115,6 +115,8 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider BeeClassification.SKULKING, 0x0888888, 0x222222, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), SMOULDERING("Smouldering", "flagrantia", BeeClassification.SKULKING, 0xFFC747, 0xEA8344, EnumTemperature.HELLISH, EnumHumidity.NORMAL, false, false), + BIGBAD("BigBad", "magnumalum", + BeeClassification.SKULKING, 0x000000, 0x000000, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), TIMELY("Timely", "gallifreis", BeeClassification.TIME, 0xC6AF86, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), @@ -299,15 +301,26 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider //----------------------Botania Bees--------------------------------------- + BOT_ROOTED("BotRooted", "truncus", + BeeClassification.BOTANICAL, 0x00A800, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), + BOT_BOTANIC("BotBotanic", "botanica", - BeeClassification.BOTANICAL, 0xffffff, 0x6666ff, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), + BeeClassification.BOTANICAL, 0x94C661, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), BOT_BLOSSOM("BotBlossom", "viridis", - BeeClassification.BOTANICAL, 0x00ffff, 0x6666ff, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), + BeeClassification.BOTANICAL, 0xA4C193, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), BOT_FLORAL("BotFloral", "florens", - BeeClassification.BOTANICAL, 0x0000ff, 0x6666ff, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), + BeeClassification.BOTANICAL, 0x29D81A, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), BOT_VAZBEE("BotVazbee", "vazbii", - BeeClassification.BOTANICAL, 0x00ff00, 0x6666ff, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, false), + BeeClassification.BOTANICAL, 0xff6b9c, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), + + BOT_SOMNOLENT("BotSomnolent", "soporatus", + BeeClassification.BOTANICAL, 0x2978C6, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true), + BOT_DREAMING("BotDreaming", "somnior", + BeeClassification.BOTANICAL, 0x123456, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, true), + + BOT_AELFHEIM("BotAelfheim", "aelfheimis", + BeeClassification.BOTANICAL, 0x987654, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, false), ; @@ -351,7 +364,7 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider TC_BEEF.setInactive(); TC_PORK.setInactive(); } - // TODO: Temporary always off. Maybe. + TC_WISPY.setInactive(); TC_TAINT.setInactive(); TC_ATTRACT.setInactive(); @@ -444,7 +457,16 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider if (BotaniaHelper.isActive()) { + for (int i = 0; i < 16; ++i) { + ItemStack petal = new ItemStack(BotaniaHelper.itemPetal, 1, i); + BOT_BOTANIC.addSpecialty(petal, 1); + BOT_BLOSSOM.addSpecialty(petal, 1); + BOT_FLORAL.addSpecialty(petal, 1); + } + for (PastureSeed type : PastureSeed.values()) { + BOT_VAZBEE.addSpecialty(new ItemStack(BotaniaHelper.itemPastureSeed, 1, type.ordinal()), 4); + } } else { @@ -994,34 +1016,43 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider .setGenome(BeeGenomeManager.getTemplateBMBound()) .register(); + BOT_ROOTED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 10) + .setGenome(BeeGenomeManager.getTemplateBotRooted()) + .register(); + BOT_BOTANIC.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 10) + .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 5) .setGenome(BeeGenomeManager.getTemplateBotBotanic()) .register(); BOT_BLOSSOM.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 20) + .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 5) .setGenome(BeeGenomeManager.getTemplateBotBlossom()) .register(); BOT_FLORAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 25) + .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 5) .setGenome(BeeGenomeManager.getTemplateBotFloral()) .register(); - - for (int i = 0; i < 16; ++i) { - ItemStack petal = new ItemStack(BotaniaHelper.itemPetal, 1, i); - BOT_BOTANIC.addSpecialty(petal, 1); - BOT_BLOSSOM.addSpecialty(petal, 1); - BOT_FLORAL.addSpecialty(petal, 1); - } - + BOT_VAZBEE.addProduct(Config.combs.getStackForType(CombType.SOUL), 5) + .addProduct(new ItemStack(Items.dye, 1, 9), 20) + .addProduct(new ItemStack(Blocks.wool, 1, 9), 2) + .addProduct(new ItemStack(Blocks.red_flower, 1, 7), 6) .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 15) .setGenome(BeeGenomeManager.getTemplateBotVazbee()) .register(); - for (PastureSeed type : PastureSeed.values()) { - BOT_VAZBEE.addSpecialty(new ItemStack(BotaniaHelper.itemPastureSeed, 1, type.ordinal()), 4); - } + BOT_SOMNOLENT.addProduct(Config.combs.getStackForType(CombType.WATERY), 8) + .addProduct(Config.combs.getStackForType(CombType.SOUL), 15) + .setGenome(BeeGenomeManager.getTemplateBotSomnolent()) + .register(); + BOT_DREAMING.addProduct(Config.combs.getStackForType(CombType.WATERY), 16) + .addProduct(Config.combs.getStackForType(CombType.SOUL), 33) + .setGenome(BeeGenomeManager.getTemplateBotDreaming()) + .register(); + } @@ -1042,7 +1073,6 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider private IAllele genomeTemplate[]; private String uid; private boolean dominant; - private int complexity; @SideOnly(Side.CLIENT) private IIcon[][] icons; @@ -1092,8 +1122,8 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider hasEffect = hasGlowEffect; isSecret = isSpeciesSecret; isCounted = isSpeciesCounted; - products = new HashMap(); - specialties = new HashMap(); + products = new HashMap(); + specialties = new HashMap(); this.branch = classification; this.branch.addMemberSpecies(this); this.isActive = true; @@ -1206,13 +1236,13 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider } @Override - public HashMap getProducts() + public HashMap getProducts() { return products; } @Override - public HashMap getSpecialty() + public HashMap getSpecialty() { return specialties; } diff --git a/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java b/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java index e769ec3..d6d95e3 100644 --- a/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java +++ b/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java @@ -1,10 +1,12 @@ package magicbees.main.utils.compat; import magicbees.bees.BeeManager; +import magicbees.bees.BeeSpecies; import magicbees.main.Config; import magicbees.main.utils.BlockInterface; import magicbees.main.utils.ItemInterface; import magicbees.main.utils.compat.botania.BotaniaAPIDistanceHelper; +import magicbees.main.utils.compat.botania.SpeciesRecipeManaInfusion; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -15,11 +17,13 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.IIcon; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; +import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.mana.ManaItemHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import forestry.api.apiculture.EnumBeeType; public class BotaniaHelper { diff --git a/src/main/java/magicbees/main/utils/compat/ForestryHelper.java b/src/main/java/magicbees/main/utils/compat/ForestryHelper.java index 742c17f..80a04ec 100644 --- a/src/main/java/magicbees/main/utils/compat/ForestryHelper.java +++ b/src/main/java/magicbees/main/utils/compat/ForestryHelper.java @@ -4,17 +4,18 @@ import java.util.Locale; import magicbees.bees.BeeManager; import magicbees.bees.HiveDescription; -import magicbees.block.types.HiveType; import magicbees.main.Config; import magicbees.main.utils.BlockInterface; import magicbees.main.utils.ItemInterface; import magicbees.main.utils.VersionInfo; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.api.apiculture.hives.HiveManager; import forestry.api.apiculture.hives.IHiveRegistry; import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.EnumTolerance; import forestry.api.genetics.IAllele; public class ForestryHelper @@ -139,17 +140,9 @@ public class ForestryHelper private static void getBlocks() { - try - { - Class c = Class.forName("forestry.core.config.ForestryBlock"); - Config.fAlvearyBlock = BlockInterface.getBlock("alveary"); - Config.fHiveBlock = BlockInterface.getBlock("beehives"); - Config.fApicultureBlock = BlockInterface.getBlock("apiculture"); - } - catch (Exception e) - { - - } + Config.fAlvearyBlock = BlockInterface.getBlock("alveary"); + Config.fHiveBlock = BlockInterface.getBlock("beehives"); + Config.fApicultureBlock = BlockInterface.getBlock("apiculture"); } private static void getItems() @@ -176,8 +169,15 @@ public class ForestryHelper return EnumHumidity.getFromValue(rawHumidity); } - public static boolean isHumidityWithinTolerance(EnumHumidity humid, EnumHumidity beeHumidityBase, EnumTolerance value) { - // TODO Auto-generated method stub - return false; + public static ItemStack replaceSpecies(ItemStack stack, IAlleleBeeSpecies outputSpecies) { + ItemStack copyStack = stack.copy(); + NBTTagCompound compound = (NBTTagCompound) copyStack.getTagCompound(); + NBTTagCompound genomeCompound = compound.getCompoundTag("Genome"); + NBTTagList chromosomeCompoundList = (NBTTagList)genomeCompound.getTag("Chromosomes"); + NBTTagCompound speciesCompound = chromosomeCompoundList.getCompoundTagAt(0); + speciesCompound.setString("UID0", outputSpecies.getUID()); + speciesCompound.setString("UID1", outputSpecies.getUID()); + + return copyStack; } } diff --git a/src/main/java/magicbees/main/utils/compat/botania/BotaniaAPIDistanceHelper.java b/src/main/java/magicbees/main/utils/compat/botania/BotaniaAPIDistanceHelper.java index 91f5eb8..3dfd3d7 100644 --- a/src/main/java/magicbees/main/utils/compat/botania/BotaniaAPIDistanceHelper.java +++ b/src/main/java/magicbees/main/utils/compat/botania/BotaniaAPIDistanceHelper.java @@ -1,11 +1,14 @@ package magicbees.main.utils.compat.botania; +import forestry.api.apiculture.EnumBeeType; +import magicbees.bees.BeeSpecies; import magicbees.main.utils.compat.BotaniaHelper; import magicbees.main.utils.compat.BotaniaHelper.ManaResource; import net.minecraft.item.ItemStack; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; +import vazkii.botania.api.recipe.RecipeManaInfusion; import vazkii.botania.api.recipe.RecipePetals; /** @@ -17,6 +20,9 @@ public class BotaniaAPIDistanceHelper { public static LexiconEntry entryBeegonia; public static LexiconEntry entryHiveacynth; + public static RecipeManaInfusion infusionBeeBotanical; + public static RecipeManaInfusion infusionBeeVazbee; + public static void registerSubtiles() { BotaniaAPI.registerSubTile(SubTileBeegonia.NAME, SubTileBeegonia.class); BotaniaAPI.registerSubTileSignature(SubTileBeegonia.class, new BotaniaSignature(SubTileBeegonia.NAME)); @@ -28,6 +34,12 @@ public class BotaniaAPIDistanceHelper { } public static void setupCraftingAndLexicon() { + infusionBeeBotanical = new SpeciesRecipeManaInfusion(BeeSpecies.BOT_BOTANIC, BeeSpecies.BOT_ROOTED, 55000, EnumBeeType.DRONE); + BotaniaAPI.manaInfusionRecipes.add(infusionBeeBotanical); + + infusionBeeVazbee = new SpeciesRecipeManaInfusion(BeeSpecies.BOT_VAZBEE, BeeSpecies.BOT_VAZBEE, 167392, EnumBeeType.PRINCESS); + BotaniaAPI.manaInfusionRecipes.add(infusionBeeVazbee); + LexiconEntry manasteelEntry = getLexiconEntryForName(BotaniaHelper.LEXICON_ENTRY_MANA_GEAR); manasteelEntry.addPage(BotaniaAPI.internalHandler.craftingRecipePage("magicbees.botania.lexicon.manasteelScoop", BotaniaHelper.manasteelScoopRecipe)); manasteelEntry.addPage(BotaniaAPI.internalHandler.craftingRecipePage("magicbees.botania.lexicon.manasteelGrafter", BotaniaHelper.manasteelGrafterRecipe)); diff --git a/src/main/java/magicbees/main/utils/compat/botania/SpeciesRecipeManaInfusion.java b/src/main/java/magicbees/main/utils/compat/botania/SpeciesRecipeManaInfusion.java new file mode 100644 index 0000000..1e585bb --- /dev/null +++ b/src/main/java/magicbees/main/utils/compat/botania/SpeciesRecipeManaInfusion.java @@ -0,0 +1,48 @@ +package magicbees.main.utils.compat.botania; + +import magicbees.bees.BeeManager; +import magicbees.main.utils.compat.ForestryHelper; +import net.minecraft.item.ItemStack; +import vazkii.botania.api.recipe.RecipeManaInfusion; +import forestry.api.apiculture.EnumBeeType; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBee; + +public class SpeciesRecipeManaInfusion extends RecipeManaInfusion { + + private IAlleleBeeSpecies outputSpecies; + private IAlleleBeeSpecies inputSpecies; + private EnumBeeType beeType; + + private ItemStack outputCache; + + public SpeciesRecipeManaInfusion(IAlleleBeeSpecies outSpecies, IAlleleBeeSpecies inSpecies, int mana, EnumBeeType type) { + super(BeeManager.getDefaultItemStackForSpecies(outSpecies, type), BeeManager.getDefaultItemStackForSpecies(inSpecies, type), mana); + outputSpecies = outSpecies; + inputSpecies = inSpecies; + this.beeType = type; + } + + @Override + public boolean matches(ItemStack stack) { + if (!BeeManager.beeRoot.isMember(stack, beeType.ordinal())) { + return false; + } + + IBee bee = BeeManager.beeRoot.getMember(stack); + if (bee.getGenome().getPrimary().equals(inputSpecies)) { + outputCache = ForestryHelper.replaceSpecies(stack, outputSpecies); + return true; + } + + return false; + } + + @Override + public ItemStack getOutput() { + ItemStack currentOutput = outputCache; + outputCache = super.getOutput(); + return currentOutput; + } + +} diff --git a/src/main/java/magicbees/main/utils/compat/botania/SubTileHiveacynth.java b/src/main/java/magicbees/main/utils/compat/botania/SubTileHiveacynth.java index a540ca4..fabe44d 100644 --- a/src/main/java/magicbees/main/utils/compat/botania/SubTileHiveacynth.java +++ b/src/main/java/magicbees/main/utils/compat/botania/SubTileHiveacynth.java @@ -1,21 +1,18 @@ package magicbees.main.utils.compat.botania; -import magicbees.bees.BeeGenomeManager; +import java.util.Random; + import magicbees.bees.BeeManager; import magicbees.main.utils.compat.BotaniaHelper; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.Random; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.subtile.SubTileFunctional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.EnumBeeType; -import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.genetics.IAllele; public class SubTileHiveacynth extends SubTileFunctional { @@ -36,7 +33,7 @@ public class SubTileHiveacynth extends SubTileFunctional { Random r = supertile.getWorldObj().rand; EnumBeeType beeType = EnumBeeType.DRONE; - IBee bee = getRandomBee(r); + IBee bee = BeeManager.getBeeFromSpecies(BeeManager.getRandomWorldgenSpecies(r), r.nextDouble() < BotaniaHelper.hiveacynthRainResistRate); if (r.nextDouble() < BotaniaHelper.hiveacynthPrincessSpawnRate) { beeType = EnumBeeType.PRINCESS; @@ -56,18 +53,6 @@ public class SubTileHiveacynth extends SubTileFunctional { supertile.getWorldObj().spawnEntityInWorld(entity); } } - - private IBee getRandomBee(Random random) { - IAlleleBeeSpecies dropSpecies = BeeManager.getRandomWorldgenSpecies(random); - IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(dropSpecies.getUID()); - - if (random.nextDouble() < BotaniaHelper.hiveacynthRainResistRate) { - speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate); - } - - IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate); - return BeeManager.beeRoot.getBee(supertile.getWorldObj(), genome); - } private boolean readyToProduceProduct() { return redstoneSignal == 0 && ticksExisted % 200 == 0 && mana >= getFinalCost(); diff --git a/src/main/resources/assets/magicbees/lang/en_US.lang b/src/main/resources/assets/magicbees/lang/en_US.lang index b726f01..126719b 100644 --- a/src/main/resources/assets/magicbees/lang/en_US.lang +++ b/src/main/resources/assets/magicbees/lang/en_US.lang @@ -413,14 +413,20 @@ magicbees.speciesBMBloody=Bloody magicbees.speciesBMBloody.description=....|Apinomicon magicbees.speciesBMBound=Bound magicbees.speciesBMBound.description=....|Apinomicon +magicbees.speciesBotRooted=Rooted +magicbees.speciesBotRooted.description=.... magicbees.speciesBotBotanic=Botanic -magicbees.speciesBotBotanic.description= +magicbees.speciesBotBotanic.description=.... magicbees.speciesBotBlossom=Blossom -magicbees.speciesBotBlossom.description= +magicbees.speciesBotBlossom.description=.... magicbees.speciesBotFloral=Floral -magicbees.speciesBotFloral.description= +magicbees.speciesBotFloral.description=.... magicbees.speciesBotVazbee=Vazbee -magicbees.speciesBotVazbee.description= +magicbees.speciesBotVazbee.description=.... +magicbees.speciesBotSomnolent=Somnolent +magicbees.speciesBotSomnolent.description=.... +magicbees.speciesBotDreaming=Dreaming +magicbees.speciesBotDreaming.description=.... magicbees.species= magicbees.species.description= magicbees.speedBlinding=Blinding @@ -486,6 +492,8 @@ classification.alchemical=Alchemical classification.alchemical.description=These bees have a changeable nature.|Apinomicon classification.essential=Essential classification.essential.description=These bees have an increased affinity for aspected magic.|Apinomicon +classification.botanical=Botanical +classification.botanical.description=A peculiar variant of mundane bees, they seem to have a hightened affinity for flowers.|Apinomicon tc.aspect.tempus=Time, Moment, Eternity tc.research_category.MAGICBEES=Apimancy