Added a config for the passive aura effects and also fix double flowers dropping items on the ground with the boost effect

Closes #7
This commit is contained in:
Ellpeck 2018-11-13 18:21:41 +01:00
parent a677ccfe67
commit b0ac500ec0
7 changed files with 21 additions and 9 deletions

View file

@ -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%")

View file

@ -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();
}

View file

@ -40,7 +40,7 @@ public class AuraChunk implements IAuraChunk {
for (Supplier<IDrainSpotEffect> 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);
}
}

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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;
}