Added config option to disable butterflies. #83

This commit is contained in:
Sollace 2022-12-04 15:57:53 +00:00
parent 8eace74353
commit 477741ff49
2 changed files with 17 additions and 11 deletions

View file

@ -30,6 +30,10 @@ public class Config extends com.minelittlepony.common.util.settings.Config {
.addComment("Disables this mod's built in fix for making sea plants waterlogged") .addComment("Disables this mod's built in fix for making sea plants waterlogged")
.addComment("Turn this ON if you're using another mod that does something similar of if you encounter copatibility issues with other mods."); .addComment("Turn this ON if you're using another mod that does something similar of if you encounter copatibility issues with other mods.");
public final Setting<Boolean> disableButterflySpawning = value("compatibility", "disableButterflySpawning", false)
.addComment("Removes butterflies from spawning in your world")
.addComment("Turn this ON if you have another mod that adds butterflies.");
public Config() { public Config() {
super(HEIRARCHICAL_JSON_ADAPTER, GamePaths.getConfigDirectory().resolve("unicopia.json")); super(HEIRARCHICAL_JSON_ADAPTER, GamePaths.getConfigDirectory().resolve("unicopia.json"));
} }

View file

@ -62,6 +62,7 @@ public interface UEntities {
FabricDefaultAttributeRegistry.register(TWITTERMITE, FairyEntity.createMobAttributes()); FabricDefaultAttributeRegistry.register(TWITTERMITE, FairyEntity.createMobAttributes());
FabricDefaultAttributeRegistry.register(AIR_BALLOON, FlyingEntity.createMobAttributes()); FabricDefaultAttributeRegistry.register(AIR_BALLOON, FlyingEntity.createMobAttributes());
if (!Unicopia.getConfig().disableButterflySpawning.get()) {
final Predicate<BiomeSelectionContext> butterflySpawnable = BiomeSelectors.foundInOverworld() final Predicate<BiomeSelectionContext> butterflySpawnable = BiomeSelectors.foundInOverworld()
.and(ctx -> ctx.getBiome().getPrecipitation() == Biome.Precipitation.RAIN); .and(ctx -> ctx.getBiome().getPrecipitation() == Biome.Precipitation.RAIN);
@ -74,6 +75,7 @@ public interface UEntities {
BiomeSelectors.tag(BiomeTags.IS_JUNGLE) BiomeSelectors.tag(BiomeTags.IS_JUNGLE)
.or(BiomeSelectors.tag(BiomeTags.IS_MOUNTAIN)) .or(BiomeSelectors.tag(BiomeTags.IS_MOUNTAIN))
), SpawnGroup.AMBIENT, BUTTERFLY, 7, 5, 19); ), SpawnGroup.AMBIENT, BUTTERFLY, 7, 5, 19);
}
UTradeOffers.bootstrap(); UTradeOffers.bootstrap();
EntityBehaviour.bootstrap(); EntityBehaviour.bootstrap();