#19 add config option to disable butterfly pollination

This commit is contained in:
mezz committed 2015-03-22 15:37:56 -07:00
1 parent 08a9badc54
commit 0f61cea75e
2 files changed
+11 -1

No files matched your search

@@ -14,6 +14,7 @@ import forestry.api.genetics.IPollinatable;
import forestry.arboriculture.genetics.FakePollinatable;
import forestry.arboriculture.genetics.ICheckPollinatable;
import forestry.core.utils.GeneticsUtil;
import forestry.plugins.PluginLepidopterology;
public class AIButterflyPollinate extends AIButterflyInteract {
@@ -26,7 +27,7 @@ public class AIButterflyPollinate extends AIButterflyInteract {
*/
@Override
protected boolean canInteract() {
if (entity.cooldownPollination > 0) {
if (entity.cooldownPollination > 0 || !PluginLepidopterology.isPollinationAllowed()) {
return false;
}
@@ -69,6 +69,7 @@ public class PluginLepidopterology extends ForestryPlugin {
private Configuration config;
public static int spawnConstraint = 100;
public static int entityConstraint = 1000;
private static boolean allowPollination = true;
public static IClassification geometridae;
public static IClassification saturniidae;
public static IClassification pieridae;
@@ -110,6 +111,10 @@ public class PluginLepidopterology extends ForestryPlugin {
property.comment = "determines the global butterfly entity count above which butterflies will stay in item form and will not take flight anymore.";
entityConstraint = Integer.parseInt(property.value);
property = config.get("entities.pollination.allowed", CONFIG_CATEGORY, allowPollination);
property.comment = "determines whether butterflies can pollinate leaves.";
allowPollination = Boolean.parseBoolean(property.value);
config.save();
PluginCore.rootCommand.addChildCommand(new CommandButterfly());
@@ -324,4 +329,8 @@ public class PluginLepidopterology extends ForestryPlugin {
public IGuiHandler getGuiHandler() {
return new GuiHandlerLepidopterology();
}
public static boolean isPollinationAllowed() {
return allowPollination;
}
}