From dde3514dce12684d2754937378d07f558b2e5a1f Mon Sep 17 00:00:00 2001 From: DrParadox7 <47131096+DrParadox7@users.noreply.github.com> Date: Wed, 27 Mar 2024 02:14:34 +0100 Subject: [PATCH] Add Butterfly Leaf Spawn Config (#67) Added `butterfly.entities.disable.leaf.spawns` config to Lepidopterology.cfg. When set to _True_, it will stop any butterfly from spontaneously spawning from Forestry's leaves [_False_ by default]. Pregnant butterflies remain unaffected for fans of the hobby. --- src/main/java/forestry/plugins/PluginLepidopterology.java | 6 +++++- src/main/resources/assets/forestry/lang/en_US.lang | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/forestry/plugins/PluginLepidopterology.java b/src/main/java/forestry/plugins/PluginLepidopterology.java index 74a508d9b..d077fde44 100755 --- a/src/main/java/forestry/plugins/PluginLepidopterology.java +++ b/src/main/java/forestry/plugins/PluginLepidopterology.java @@ -60,6 +60,7 @@ public class PluginLepidopterology extends ForestryPlugin { public static int spawnConstraint = 100; public static int entityConstraint = 1000; private static boolean allowPollination = true; + public static boolean disableButterflyLeafSpawns = false; public static ItemRegistryLepidopterology items; public static BlockRegistryLepidopterology blocks; @@ -112,7 +113,8 @@ public class PluginLepidopterology extends ForestryPlugin { blocks.lepidopterology.init(); - TreeManager.treeRoot.registerLeafTickHandler(new ButterflySpawner()); + if (!PluginLepidopterology.disableButterflyLeafSpawns) + TreeManager.treeRoot.registerLeafTickHandler(new ButterflySpawner()); RecipeSorter.register( "forestry:lepidopterologymating", @@ -127,6 +129,8 @@ public class PluginLepidopterology extends ForestryPlugin { spawnConstraint = config.getIntLocalized("butterfly.entities", "spawn.limit", spawnConstraint, 0, 500); entityConstraint = config.getIntLocalized("butterfly.entities", "maximum", entityConstraint, 0, 5000); allowPollination = config.getBooleanLocalized("butterfly.entities", "pollination", allowPollination); + disableButterflyLeafSpawns = config + .getBooleanLocalized("butterfly.entities", "disable.leaf.spawns", disableButterflyLeafSpawns); config.save(); } diff --git a/src/main/resources/assets/forestry/lang/en_US.lang b/src/main/resources/assets/forestry/lang/en_US.lang index d73fb3068..ee6b85589 100644 --- a/src/main/resources/assets/forestry/lang/en_US.lang +++ b/src/main/resources/assets/forestry/lang/en_US.lang @@ -1684,6 +1684,8 @@ for.config.butterfly.entities.maximum=Butterfly Maximum for.config.butterfly.entities.maximum.comment=New butterflies will stay in item form and will not take flight once this limit is reached. for.config.butterfly.entities.pollination=Butterfly Pollination for.config.butterfly.entities.pollination.comment=Allow butterflies to pollinate leaves. +for.config.butterfly.entities.disable.leaf.spawns=Disable Butterfly Leaf Spawns +for.config.butterfly.entities.disable.leaf.spawns.comment=Prevent random butterflies from autonomously spawning from Forestry leaves. for.config.backpacks.item.stacks.format=Add itemStacks for the %s's backpack here in the format 'modid:name:meta'. For wildcard metadata the format is 'modid:name'. for.config.backpacks.ore.dict.format=Add ore dictionary names for the %s's backpack here in the format 'oreDictName'.