Compare commits

..

3 commits

3 changed files with 22 additions and 6 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '37.6'
version = '37.7'
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'NaturesAura'

View file

@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.BasicAuraType;
import de.ellpeck.naturesaura.api.misc.WeightedOre;
import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect;
import de.ellpeck.naturesaura.chunk.effect.PlantBoostEffect;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
@ -20,6 +21,7 @@ public final class ModConfig {
public ConfigValue<List<? extends String>> auraTypeOverrides;
public ConfigValue<List<? extends String>> additionalOres;
public ConfigValue<List<? extends String>> oreExceptions;
public ConfigValue<List<? extends String>> plantBoostExceptions;
public ConfigValue<List<? extends String>> additionalProjectiles;
public ConfigValue<Integer> fieldCreatorRange;
public ConfigValue<Double> auraToRFRatio;
@ -66,6 +68,10 @@ public final class ModConfig {
.comment("Blocks that are exempt from being recognized as generatable ores for the passive ore generation effect. Each entry needs to be formatted as modid:block[prop1=value1,...] where block state properties are optional")
.translation("config." + NaturesAura.MOD_ID + ".oreExceptions")
.defineList("oreExceptions", Collections.emptyList(), s -> true);
this.plantBoostExceptions = builder
.comment("Blocks that are exept from being fertilized by the plant boost effect. Each entry needs to be formatted as modid:block")
.translation("config." + NaturesAura.MOD_ID + ".plantBoostExceptions")
.defineList("plantBoostExceptions", Collections.emptyList(), s -> true);
this.additionalProjectiles = builder
.comment("Additional projectile types that are allowed to be consumed by the projectile generator. Each entry needs to be formatted as entity_registry_name->aura_amount")
.translation("config." + NaturesAura.MOD_ID + ".additionalProjectiles")
@ -227,6 +233,14 @@ public final class ModConfig {
NaturesAura.LOGGER.warn("Error parsing oreExceptions", e);
}
try {
for (String s : this.plantBoostExceptions.get())
PlantBoostEffect.EXCEPTIONS.add(Objects.requireNonNull(ForgeRegistries.BLOCKS.getValue(new ResourceLocation(s))));
} catch (Exception e) {
NaturesAura.LOGGER.warn("Error parsing plantBoostExceptions", e);
}
try {
for (String s : this.additionalProjectiles.get()) {
var split = s.split("->");

View file

@ -17,14 +17,16 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.DoublePlantBlock;
import net.minecraft.world.level.block.TallGrassBlock;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.chunk.LevelChunk;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class PlantBoostEffect implements IDrainSpotEffect {
public static final Set<Block> EXCEPTIONS = new HashSet<>(List.of(Blocks.GRASS_BLOCK, Blocks.MOSS_BLOCK, Blocks.GLOW_LICHEN, Blocks.SMALL_DRIPLEAF, Blocks.BIG_DRIPLEAF, Blocks.BIG_DRIPLEAF_STEM));
public static final ResourceLocation NAME = new ResourceLocation(NaturesAura.MOD_ID, "plant_boost");
private int amount;
@ -75,7 +77,7 @@ public class PlantBoostEffect implements IDrainSpotEffect {
var state = level.getBlockState(plantPos);
var block = state.getBlock();
if (block instanceof BonemealableBlock growable && !(block instanceof DoublePlantBlock) && !(block instanceof TallGrassBlock) && block != Blocks.GRASS_BLOCK && block != Blocks.MOSS_BLOCK) {
if (block instanceof BonemealableBlock growable && !PlantBoostEffect.EXCEPTIONS.contains(block) && !(block instanceof DoublePlantBlock) && !(block instanceof TallGrassBlock)) {
if (growable.isValidBonemealTarget(level, plantPos, state, false)) {
try {
growable.performBonemeal((ServerLevel) level, level.random, plantPos, state);