From f3fee3af39b880310c4b9ac8838d9f49391caca7 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 21 Mar 2021 17:53:36 +0100 Subject: [PATCH] added a config for the animal powder's maximum --- .../de/ellpeck/naturesaura/ModConfig.java | 62 ++++++++++--------- .../chunk/effect/AnimalEffect.java | 2 +- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/ModConfig.java b/src/main/java/de/ellpeck/naturesaura/ModConfig.java index 5305758c..5cbc0734 100644 --- a/src/main/java/de/ellpeck/naturesaura/ModConfig.java +++ b/src/main/java/de/ellpeck/naturesaura/ModConfig.java @@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect; import net.minecraft.entity.EntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; import net.minecraftforge.registries.ForgeRegistries; import java.util.Collections; @@ -16,36 +17,37 @@ import java.util.Objects; public final class ModConfig { public static ModConfig instance; - public ForgeConfigSpec.ConfigValue> additionalBotanistPickaxeConversions; - public ForgeConfigSpec.ConfigValue> auraTypeOverrides; - public ForgeConfigSpec.ConfigValue> additionalOres; - public ForgeConfigSpec.ConfigValue> oreExceptions; - public ForgeConfigSpec.ConfigValue> additionalProjectiles; - public ForgeConfigSpec.ConfigValue fieldCreatorRange; - public ForgeConfigSpec.ConfigValue auraToRFRatio; + public ConfigValue> additionalBotanistPickaxeConversions; + public ConfigValue> auraTypeOverrides; + public ConfigValue> additionalOres; + public ConfigValue> oreExceptions; + public ConfigValue> additionalProjectiles; + public ConfigValue fieldCreatorRange; + public ConfigValue auraToRFRatio; + public ConfigValue maxAnimalsAroundPowder; - public ForgeConfigSpec.ConfigValue rfConverter; - public ForgeConfigSpec.ConfigValue chunkLoader; - public ForgeConfigSpec.ConfigValue grassDieEffect; - public ForgeConfigSpec.ConfigValue netherDecayEffect; - public ForgeConfigSpec.ConfigValue plantBoostEffect; - public ForgeConfigSpec.ConfigValue cacheRechargeEffect; - public ForgeConfigSpec.ConfigValue explosionEffect; - public ForgeConfigSpec.ConfigValue breathlessEffect; - public ForgeConfigSpec.ConfigValue angerEffect; - public ForgeConfigSpec.ConfigValue animalEffect; - public ForgeConfigSpec.ConfigValue oreEffect; - public ForgeConfigSpec.ConfigValue auraBlooms; - public ForgeConfigSpec.ConfigValue netherGrassEffect; + public ConfigValue rfConverter; + public ConfigValue chunkLoader; + public ConfigValue grassDieEffect; + public ConfigValue netherDecayEffect; + public ConfigValue plantBoostEffect; + public ConfigValue cacheRechargeEffect; + public ConfigValue explosionEffect; + public ConfigValue breathlessEffect; + public ConfigValue angerEffect; + public ConfigValue animalEffect; + public ConfigValue oreEffect; + public ConfigValue auraBlooms; + public ConfigValue netherGrassEffect; - public ForgeConfigSpec.ConfigValue particleAmount; - public ForgeConfigSpec.ConfigValue respectVanillaParticleSettings; - public ForgeConfigSpec.ConfigValue excessParticleAmount; - public ForgeConfigSpec.ConfigValue auraBarLocation; - public ForgeConfigSpec.ConfigValue cacheBarLocation; - public ForgeConfigSpec.ConfigValue debugText; - public ForgeConfigSpec.ConfigValue debugWorld; - public ForgeConfigSpec.ConfigValue renderItemsOnPlayer; + public ConfigValue particleAmount; + public ConfigValue respectVanillaParticleSettings; + public ConfigValue excessParticleAmount; + public ConfigValue auraBarLocation; + public ConfigValue cacheBarLocation; + public ConfigValue debugText; + public ConfigValue debugWorld; + public ConfigValue renderItemsOnPlayer; public ModConfig(ForgeConfigSpec.Builder builder) { builder.push("general"); @@ -77,6 +79,10 @@ public final class ModConfig { .comment("The Aura to RF ratio used by the RF converter, read as aura*ratio = rf") .translation("config." + NaturesAura.MOD_ID + ".auraToRFRatio") .define("auraToRFRatio", 0.05); + this.maxAnimalsAroundPowder = builder + .comment("The maximum amount of animals that can be around the powder of fertility before it stops working") + .translation("config." + NaturesAura.MOD_ID + ".maxAnimalsAroundPowder") + .define("maxAnimalsAroundPowder", 200); builder.pop(); builder.push("features"); diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java index 96c3cd2c..75047f6e 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java @@ -72,7 +72,7 @@ public class AnimalEffect implements IDrainSpotEffect { return; List animals = world.getEntitiesWithinAABB(AnimalEntity.class, this.bb); - if (animals.size() >= 200) + if (animals.size() >= ModConfig.instance.maxAnimalsAroundPowder.get()) return; List items = world.getEntitiesWithinAABB(ItemEntity.class, this.bb);