From 2e42dd5be36a3b7aad60ecfc66ace2bd2d71e19f Mon Sep 17 00:00:00 2001 From: MysteriousAges Date: Tue, 21 Apr 2015 15:57:19 -0700 Subject: [PATCH] Adding Ignoble trait to Hiveacynth Princesses; Config option for rate of Pristine princesses. --- .../main/utils/compat/BotaniaHelper.java | 7 ++++++- .../compat/botania/SubTileHiveacynth.java | 20 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java b/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java index 8ff5a93..92b079b 100644 --- a/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java +++ b/src/main/java/magicbees/main/utils/compat/BotaniaHelper.java @@ -69,6 +69,7 @@ public class BotaniaHelper { public static double hiveacynthManaMultiplier; public static double hiveacynthRainResistRate; public static double hiveacynthPrincessSpawnRate; + public static double hiveacynthPristineRate; public static boolean isActive() { return isBotaniaActive; @@ -144,12 +145,16 @@ public class BotaniaHelper { hiveacynthManaMultiplier = p.getDouble(); p = configuration.get(section, "hiveacynthRainResistRate", 0.1); - p.comment = "Rate at which the hiveacynth applies rain resist to spawned bees. Default: 0.1 Setting to 0 will disable."; + p.comment = "Rate at which the Hiveacynth applies rain resist to spawned bees. Default: 0.1 Setting to 0 will disable."; hiveacynthRainResistRate = p.getDouble(); p = configuration.get(section, "hiveacynthPrincessSpawnRate", 0.09); p.comment = "Rate at which the Hiveacynth will spawn a Princess instead of a Drone. Default: 0.09. Setting to 0 will disable."; hiveacynthPrincessSpawnRate = p.getDouble(); + + p = configuration.get(section, "hiveacynthPristineRate", 0.15); + p.comment = "Rate at which the Hiveacynth will produce a Pristine Princess, when it produces a princess. Default: 0.15. Setting to 0 will disable."; + hiveacynthPristineRate = p.getDouble(); } public static boolean requestMana(ItemStack stack, EntityPlayer player, int manaPerDamage, int charges) { 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 e83543d..a540ca4 100644 --- a/src/main/java/magicbees/main/utils/compat/botania/SubTileHiveacynth.java +++ b/src/main/java/magicbees/main/utils/compat/botania/SubTileHiveacynth.java @@ -33,15 +33,21 @@ public class SubTileHiveacynth extends SubTileFunctional { } if (readyToProduceProduct()) { + Random r = supertile.getWorldObj().rand; EnumBeeType beeType = EnumBeeType.DRONE; - if (supertile.getWorldObj().rand.nextDouble() < BotaniaHelper.hiveacynthPrincessSpawnRate) { + IBee bee = getRandomBee(r); + + if (r.nextDouble() < BotaniaHelper.hiveacynthPrincessSpawnRate) { beeType = EnumBeeType.PRINCESS; + + if (BotaniaHelper.hiveacynthPristineRate < r.nextDouble()) { + bee.setIsNatural(false); + } } + + ItemStack stack = BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal()); - ItemStack stack = BeeManager.beeRoot.getMemberStack(getRandomBee(), beeType.ordinal()); - - Random r = supertile.getWorldObj().rand; EntityItem entity = new EntityItem(supertile.getWorldObj(), supertile.xCoord - RANGE + r.nextInt(RANGE * 2 + 1), supertile.yCoord + 1, supertile.zCoord - RANGE + r.nextInt(RANGE * 2 + 1), stack); entity.motionX = 0; @@ -51,11 +57,11 @@ public class SubTileHiveacynth extends SubTileFunctional { } } - private IBee getRandomBee() { - IAlleleBeeSpecies dropSpecies = BeeManager.getRandomWorldgenSpecies(supertile.getWorldObj().rand); + private IBee getRandomBee(Random random) { + IAlleleBeeSpecies dropSpecies = BeeManager.getRandomWorldgenSpecies(random); IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(dropSpecies.getUID()); - if (supertile.getWorldObj().rand.nextDouble() < BotaniaHelper.hiveacynthRainResistRate) { + if (random.nextDouble() < BotaniaHelper.hiveacynthRainResistRate) { speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate); }