diff --git a/src/main/java/de/ellpeck/naturesaura/ModConfig.java b/src/main/java/de/ellpeck/naturesaura/ModConfig.java index 4cf19b51..832bd44f 100644 --- a/src/main/java/de/ellpeck/naturesaura/ModConfig.java +++ b/src/main/java/de/ellpeck/naturesaura/ModConfig.java @@ -9,6 +9,7 @@ import net.minecraftforge.common.config.Config.RangeDouble; public final class ModConfig { public static General general = new General(); + public static Features enabledFeatures = new Features(); public static Client client = new Client(); public static class General { @@ -26,6 +27,14 @@ public final class ModConfig { public int fieldCreatorRange = 8; } + public static class Features { + + @Comment("If the Aura Imbalance effect of grass and trees dying in the area if the Aura levels are too low should occur") + public boolean grassDieEffect = true; + @Comment("If the Aura Imbalance effect of plant growth being boosted if the Aura levels are high enough should occur") + public boolean plantBoostEffect = true; + } + public static class Client { @Comment("The percentage of particles that should be displayed, where 1 is 100% and 0 is 0%") diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java index 2071dc86..1a5f4971 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java @@ -11,7 +11,7 @@ public interface IDrainSpotEffect { void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, MutableInt spot); - boolean appliesToType(IAuraType type); + boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type); ResourceLocation getName(); } diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java index 2e666cdd..45f8845c 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java @@ -40,7 +40,7 @@ public class AuraChunk implements IAuraChunk { for (Supplier supplier : NaturesAuraAPI.DRAIN_SPOT_EFFECTS.values()) { IDrainSpotEffect effect = supplier.get(); - if (effect.appliesToType(this.type)) + if (effect.appliesHere(this.chunk, this, this.type)) this.effects.add(effect); } } diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java index 2fa53569..361d22ae 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.chunk.effect; +import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; @@ -58,8 +59,8 @@ public class GrassDieEffect implements IDrainSpotEffect { } @Override - public boolean appliesToType(IAuraType type) { - return type == NaturesAuraAPI.TYPE_OVERWORLD; + public boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type) { + return ModConfig.enabledFeatures.grassDieEffect && type == NaturesAuraAPI.TYPE_OVERWORLD; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/MigrationEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/MigrationEffect.java index b78b5761..e75ca6ec 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/MigrationEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/MigrationEffect.java @@ -38,7 +38,7 @@ public class MigrationEffect implements IDrainSpotEffect { } @Override - public boolean appliesToType(IAuraType type) { + public boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type) { return true; } diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java index 8d589ed1..853cf0a2 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.chunk.effect; +import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; @@ -43,7 +44,8 @@ public class PlantBoostEffect implements IDrainSpotEffect { if (plantPos.distanceSq(pos) <= dist * dist && world.isBlockLoaded(plantPos)) { IBlockState state = world.getBlockState(plantPos); Block block = state.getBlock(); - if (block instanceof IGrowable && block != Blocks.TALLGRASS && block != Blocks.GRASS) { + if (block instanceof IGrowable && + block != Blocks.TALLGRASS && block != Blocks.GRASS && block != Blocks.DOUBLE_PLANT) { IGrowable growable = (IGrowable) block; if (growable.canGrow(world, plantPos, state, false)) { growable.grow(world, world.rand, plantPos, state); @@ -60,8 +62,8 @@ public class PlantBoostEffect implements IDrainSpotEffect { } @Override - public boolean appliesToType(IAuraType type) { - return type == NaturesAuraAPI.TYPE_OVERWORLD; + public boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type) { + return ModConfig.enabledFeatures.plantBoostEffect && type == NaturesAuraAPI.TYPE_OVERWORLD; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/ReplenishingEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/ReplenishingEffect.java index 4ab9eada..5e60ce98 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/ReplenishingEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/ReplenishingEffect.java @@ -54,7 +54,7 @@ public class ReplenishingEffect implements IDrainSpotEffect { } @Override - public boolean appliesToType(IAuraType type) { + public boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type) { return true; }