Add config option to add a chance of additional princess spawn, for skyblock/limited land maps

Minor Cleanup
This commit is contained in:
Nirek-K authored and mezz committed 2015-02-15 13:26:27 -08:00
1 parent 786dbd82c7
commit 2b4dfcdae3
2 files changed
+19 -5

No files matched your search

@@ -381,11 +381,16 @@ public class BeekeepingLogic implements IBeekeepingLogic {
housing.onQueenDeath(getQueen());
// Princess
IBee heiress = queen.spawnPrincess(housing);
if (heiress != null) {
ItemStack princess = PluginApiculture.beeInterface.getMemberStack(heiress, EnumBeeType.PRINCESS.ordinal());
breedingTracker.registerPrincess(heiress);
offspring.push(princess);
boolean secondPrincess = this.housing.getWorld().rand.nextInt(100) < PluginApiculture.getSecondPrincessChance();
int count = secondPrincess ? 2 : 1;
while (count > 0) {
count--;
IBee heiress = queen.spawnPrincess(housing);
if (heiress != null) {
ItemStack princess = PluginApiculture.beeInterface.getMemberStack(heiress, EnumBeeType.PRINCESS.ordinal());
breedingTracker.registerPrincess(heiress);
offspring.push(princess);
}
}
// Drones
@@ -164,6 +164,7 @@ public class PluginApiculture extends ForestryPlugin {
private static final String CONFIG_CATEGORY = "apiculture";
private Configuration apicultureConfig;
public static String beekeepingMode = "NORMAL";
private static int secondPrincessChance = 0;
public static int ticksPerBeeWorkCycle = 550;
public static boolean apiarySideSensitive = false;
public static boolean fancyRenderedBees = false;
@@ -290,6 +291,10 @@ public class PluginApiculture extends ForestryPlugin {
beekeepingMode = property.value.trim();
Proxies.log.finer("Beekeeping mode read from config: " + beekeepingMode);
Property secondPrincess = apicultureConfig.get("beekeeping.secondprincess", CONFIG_CATEGORY, secondPrincessChance);
secondPrincess.comment = "percent chance of second princess drop, for limited/skyblock maps.";
secondPrincessChance = Integer.parseInt(secondPrincess.value);
property = apicultureConfig.get("beekeeping.flowers.custom", CONFIG_CATEGORY, "");
property.comment = "add additional flower blocks for apiaries here in the format id:meta. separate blocks using ';'. will be treated like vanilla flowers. not recommended for flowers implemented as tile entities.";
parseAdditionalFlowers(property.value, FlowerManager.plainFlowers);
@@ -1204,6 +1209,10 @@ public class PluginApiculture extends ForestryPlugin {
beeInterface.registerTemplate(BeeTemplates.getPhantasmalTemplate());
}
public static int getSecondPrincessChance() {
return secondPrincessChance;
}
private void parseAdditionalFlowers(String list, ArrayList<ItemStack> target) {
String[] parts = list.split("[;]+");