Prevented sprouts from generating in caves
This commit is contained in:
parent
b393c2f109
commit
7e0b396cb6
4 changed files with 64 additions and 8 deletions
|
@ -58,7 +58,7 @@ public class UndergrowthBiome extends NetherBiomeTemplate
|
|||
|
||||
builder.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPConfiguredFeatures.NETHER_BRAMBLE);
|
||||
builder.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPConfiguredFeatures.UNDERGROWTH_FLOWERS);
|
||||
builder.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPConfiguredFeatures.SPROUTS_75);
|
||||
builder.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPConfiguredFeatures.SPROUTS_UNDERGROWTH);
|
||||
builder.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPConfiguredFeatures.DEAD_GRASS_45);
|
||||
builder.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPConfiguredFeatures.NETHER_VINES);
|
||||
|
||||
|
|
|
@ -213,13 +213,14 @@ public class BOPConfiguredFeatures
|
|||
public static final ConfiguredFeature<?, ?> BUSH_15 = register("bush_15", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.bush.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(15)));
|
||||
public static final ConfiguredFeature<?, ?> BUSH_50 = register("bush_50", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.bush.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(50)));
|
||||
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_5 = register("sprouts_5", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(5)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_10 = register("sprouts_10", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(10)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_15 = register("sprouts_15", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(15)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_25 = register("sprouts_25", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(25)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_50 = register("sprouts_50", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(50)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_75 = register("sprouts_75", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(75)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_200 = register("sprouts_200", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE).decorated(FeatureUtil.denseCount(200)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_5 = register("sprouts_5", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(5)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_10 = register("sprouts_10", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(10)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_15 = register("sprouts_15", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(15)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_25 = register("sprouts_25", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(25)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_50 = register("sprouts_50", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(50)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_75 = register("sprouts_75", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(75)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_200 = register("sprouts_200", BOPFeatures.RANDOM_PATCH_ABOVE_GROUND.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE).decorated(FeatureUtil.denseCount(200)));
|
||||
public static final ConfiguredFeature<?, ?> SPROUTS_UNDERGROWTH = register("sprouts_undergrowth", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.sprout.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(75)));
|
||||
|
||||
public static final ConfiguredFeature<?, ?> DUNE_GRASS_128 = register("dune_grass_128", Feature.RANDOM_PATCH.configured(BiomeFeatureHelper.createClusterConfiguration(BOPBlocks.dune_grass.defaultBlockState())).decorated(Features.Placements.HEIGHTMAP_DOUBLE_SQUARE.count(128)));
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ public class BOPFeatures
|
|||
public static final Feature<NoFeatureConfig> RAINFOREST_CLIFFS_VINES = register("rainforest_cliffs_vines", new RainforestCliffsVinesFeature(NoFeatureConfig.CODEC.stable()));
|
||||
public static final Feature<NoFeatureConfig> PODZOL_SPLATTER = register("podzol_splatter", new PodzolSplatterFeature(NoFeatureConfig.CODEC.stable()));
|
||||
public static final Feature<NoFeatureConfig> PUMPKIN_PATCH = register("pumpkin_patch", new PumpkinPatchFeature(NoFeatureConfig.CODEC.stable()));
|
||||
public static final Feature<BlockClusterFeatureConfig> RANDOM_PATCH_ABOVE_GROUND = register("random_patch_above_ground", new RandomPatchAboveGroundFeature(BlockClusterFeatureConfig.CODEC));
|
||||
public static final Feature<NoFeatureConfig> SCATTERED_ROCKS = register("scattered_rocks", new ScatteredRocksFeature(NoFeatureConfig.CODEC.stable()));
|
||||
public static final Feature<NoFeatureConfig> SCRUB = register("scrub", new ScrubFeature(NoFeatureConfig.CODEC.stable()));
|
||||
public static final Feature<NoFeatureConfig> SHORT_BAMBOO = register("short_bamboo", new ShortBambooFeature(NoFeatureConfig.CODEC.stable()));
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package biomesoplenty.common.world.gen.feature;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.CarvedPumpkinBlock;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ISeedReader;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.gen.feature.BlockClusterFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomPatchAboveGroundFeature extends Feature<BlockClusterFeatureConfig> {
|
||||
public RandomPatchAboveGroundFeature(Codec<BlockClusterFeatureConfig> p_i231979_1_) {
|
||||
super(p_i231979_1_);
|
||||
}
|
||||
|
||||
public boolean place(ISeedReader p_241855_1_, ChunkGenerator p_241855_2_, Random p_241855_3_, BlockPos p_241855_4_, BlockClusterFeatureConfig p_241855_5_) {
|
||||
BlockState blockstate = p_241855_5_.stateProvider.getState(p_241855_3_, p_241855_4_);
|
||||
BlockPos blockpos;
|
||||
if (p_241855_5_.project) {
|
||||
blockpos = p_241855_1_.getHeightmapPos(Heightmap.Type.WORLD_SURFACE_WG, p_241855_4_);
|
||||
} else {
|
||||
blockpos = p_241855_4_;
|
||||
}
|
||||
|
||||
if (blockpos.getY() < 60)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
|
||||
|
||||
for(int j = 0; j < p_241855_5_.tries; ++j) {
|
||||
blockpos$mutable.setWithOffset(blockpos, p_241855_3_.nextInt(p_241855_5_.xspread + 1) - p_241855_3_.nextInt(p_241855_5_.xspread + 1), p_241855_3_.nextInt(p_241855_5_.yspread + 1) - p_241855_3_.nextInt(p_241855_5_.yspread + 1), p_241855_3_.nextInt(p_241855_5_.zspread + 1) - p_241855_3_.nextInt(p_241855_5_.zspread + 1));
|
||||
BlockPos blockpos1 = blockpos$mutable.below();
|
||||
BlockState blockstate1 = p_241855_1_.getBlockState(blockpos1);
|
||||
if ((p_241855_1_.isEmptyBlock(blockpos$mutable) || p_241855_5_.canReplace && p_241855_1_.getBlockState(blockpos$mutable).getMaterial().isReplaceable()) && blockstate.canSurvive(p_241855_1_, blockpos$mutable) && (p_241855_5_.whitelist.isEmpty() || p_241855_5_.whitelist.contains(blockstate1.getBlock())) && !p_241855_5_.blacklist.contains(blockstate1) && (!p_241855_5_.needWater || p_241855_1_.getFluidState(blockpos1.west()).is(FluidTags.WATER) || p_241855_1_.getFluidState(blockpos1.east()).is(FluidTags.WATER) || p_241855_1_.getFluidState(blockpos1.north()).is(FluidTags.WATER) || p_241855_1_.getFluidState(blockpos1.south()).is(FluidTags.WATER))) {
|
||||
p_241855_5_.blockPlacer.place(p_241855_1_, blockpos$mutable, blockstate, p_241855_3_);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return i > 0;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue