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("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() {
super(HEIRARCHICAL_JSON_ADAPTER, GamePaths.getConfigDirectory().resolve("unicopia.json"));
}

View file

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