Tweaked flower generation for certain biomes

This commit is contained in:
Forstride 2019-06-09 11:00:30 -04:00
parent 3a8abc08f0
commit 25025fa0ff
8 changed files with 98 additions and 85 deletions

View file

@ -79,13 +79,13 @@ public class LushGrasslandBiome extends BiomeBOP
this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, createCompositeFeature(Feature.MINABLE, new MinableConfig(MinableConfig.IS_ROCK, Blocks.LAPIS_ORE.getDefaultState(), 7), DEPTH_AVERAGE, new DepthAverageConfig(1, 16, 16))); this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, createCompositeFeature(Feature.MINABLE, new MinableConfig(MinableConfig.IS_ROCK, Blocks.LAPIS_ORE.getDefaultState(), 7), DEPTH_AVERAGE, new DepthAverageConfig(1, 16, 16)));
// Vegetation // Vegetation
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.RANDOM_FEATURE_LIST, new RandomDefaultFeatureListConfig(new Feature[]{BOPBiomeFeatures.SMALL_JUNGLE_TREE, BOPBiomeFeatures.OAK_TREE, BOPBiomeFeatures.PALM_TREE}, new IFeatureConfig[]{IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG}, new float[]{0.1F, 0.2F, 0.075F}, BOPBiomeFeatures.BUSH, IFeatureConfig.NO_FEATURE_CONFIG), AT_SURFACE_WITH_EXTRA, new AtSurfaceWithExtraConfig((int)0.9F, 0.6F, 1))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.RANDOM_FEATURE_LIST, new RandomDefaultFeatureListConfig(new Feature[]{BOPBiomeFeatures.SMALL_JUNGLE_TREE, BOPBiomeFeatures.OAK_TREE, BOPBiomeFeatures.PALM_TREE}, new IFeatureConfig[]{IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG}, new float[]{0.1F, 0.2F, 0.05F}, BOPBiomeFeatures.BUSH, IFeatureConfig.NO_FEATURE_CONFIG), AT_SURFACE_WITH_EXTRA, new AtSurfaceWithExtraConfig((int)0.9F, 0.6F, 1)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFlowerFeature(BOPBiomeFeatures.LUSH_GRASSLAND_FLOWERS, SURFACE_PLUS_32, new FrequencyConfig(6))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFlowerFeature(BOPBiomeFeatures.LUSH_GRASSLAND_FLOWERS, SURFACE_PLUS_32, new FrequencyConfig(6)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(BOPBlocks.watergrass), TWICE_SURFACE, new FrequencyConfig(6))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(BOPBlocks.watergrass), TWICE_SURFACE, new FrequencyConfig(6)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(new StandardGrassFeature(), IFeatureConfig.NO_FEATURE_CONFIG, TWICE_SURFACE, new FrequencyConfig(15))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(new StandardGrassFeature(), IFeatureConfig.NO_FEATURE_CONFIG, TWICE_SURFACE, new FrequencyConfig(15)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(Blocks.FERN), TWICE_SURFACE, new FrequencyConfig(2))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(Blocks.FERN), TWICE_SURFACE, new FrequencyConfig(4)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.DOUBLE_PLANT, new DoublePlantConfig(Blocks.TALL_GRASS.getDefaultState()), SURFACE_PLUS_32, new FrequencyConfig(8))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.DOUBLE_PLANT, new DoublePlantConfig(Blocks.TALL_GRASS.getDefaultState()), SURFACE_PLUS_32, new FrequencyConfig(8)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.DOUBLE_PLANT, new DoublePlantConfig(Blocks.LARGE_FERN.getDefaultState()), SURFACE_PLUS_32, new FrequencyConfig(1))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.DOUBLE_PLANT, new DoublePlantConfig(Blocks.LARGE_FERN.getDefaultState()), SURFACE_PLUS_32, new FrequencyConfig(2)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(Blocks.BROWN_MUSHROOM), TWICE_SURFACE_WITH_CHANCE, new ChanceConfig(4))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(Blocks.BROWN_MUSHROOM), TWICE_SURFACE_WITH_CHANCE, new ChanceConfig(4)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(Blocks.RED_MUSHROOM), TWICE_SURFACE_WITH_CHANCE, new ChanceConfig(8))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.BUSH, new BushConfig(Blocks.RED_MUSHROOM), TWICE_SURFACE_WITH_CHANCE, new ChanceConfig(8)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.WATERLILY, IFeatureConfig.NO_FEATURE_CONFIG, TWICE_SURFACE, new FrequencyConfig(10))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, createCompositeFeature(Feature.WATERLILY, IFeatureConfig.NO_FEATURE_CONFIG, TWICE_SURFACE, new FrequencyConfig(10)));

View file

@ -10,22 +10,23 @@ package biomesoplenty.common.world.gen.feature;
import java.util.Random; import java.util.Random;
import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature; import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class CherryBlossomGroveFlowersFeature extends AbstractFlowersFeature public class CherryBlossomGroveFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{BOPBlocks.pink_daffodil, Blocks.OXEYE_DAISY};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); int j = p_202355_1_.nextInt(2);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)]; switch(j)
return block.getDefaultState(); {
case 0:
return BOPBlocks.pink_daffodil.getDefaultState();
case 1:
default:
return Blocks.OXEYE_DAISY.getDefaultState();
} }
} }
}

View file

@ -9,22 +9,25 @@ package biomesoplenty.common.world.gen.feature;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature; import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class ExtendedFlowersFeature extends AbstractFlowersFeature public class ExtendedFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{Blocks.OXEYE_DAISY, Blocks.DANDELION, Blocks.POPPY};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); int j = p_202355_1_.nextInt(3);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)]; switch(j)
return block.getDefaultState(); {
case 0:
return Blocks.OXEYE_DAISY.getDefaultState();
case 1:
return Blocks.POPPY.getDefaultState();
case 2:
default:
return Blocks.DANDELION.getDefaultState();
} }
} }
}

View file

@ -9,27 +9,22 @@ package biomesoplenty.common.world.gen.feature;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature; import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class FlowerMeadowFlowersFeature extends AbstractFlowersFeature public class FlowerMeadowFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{Blocks.ORANGE_TULIP, Blocks.WHITE_TULIP, Blocks.PINK_TULIP, Blocks.RED_TULIP};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
int j = p_202355_1_.nextInt(4); double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
switch(j) Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
{ return block.getDefaultState();
case 0:
return Blocks.ORANGE_TULIP.getDefaultState();
case 1:
return Blocks.RED_TULIP.getDefaultState();
case 2:
return Blocks.PINK_TULIP.getDefaultState();
case 3:
default:
return Blocks.WHITE_TULIP.getDefaultState();
}
} }
} }

View file

@ -10,22 +10,25 @@ package biomesoplenty.common.world.gen.feature;
import java.util.Random; import java.util.Random;
import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature; import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class JungleFlowersFeature extends AbstractFlowersFeature public class JungleFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{BOPBlocks.orange_cosmos, Blocks.DANDELION, Blocks.POPPY};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); int j = p_202355_1_.nextInt(3);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)]; switch(j)
return block.getDefaultState(); {
case 0:
return BOPBlocks.orange_cosmos.getDefaultState();
case 1:
return Blocks.POPPY.getDefaultState();
case 2:
default:
return Blocks.DANDELION.getDefaultState();
} }
} }
}

View file

@ -20,12 +20,16 @@ import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class LushGrasslandFlowersFeature extends AbstractFlowersFeature public class LushGrasslandFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{BOPBlocks.orange_cosmos, Blocks.OXEYE_DAISY};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); int j = p_202355_1_.nextInt(2);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)]; switch(j)
return block.getDefaultState(); {
case 0:
return BOPBlocks.orange_cosmos.getDefaultState();
case 1:
default:
return Blocks.OXEYE_DAISY.getDefaultState();
} }
} }
}

View file

@ -10,22 +10,23 @@ package biomesoplenty.common.world.gen.feature;
import java.util.Random; import java.util.Random;
import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractFlowersFeature; import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class MoorFlowersFeature extends AbstractFlowersFeature public class MoorFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{BOPBlocks.violet, Blocks.ALLIUM};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); int j = p_202355_1_.nextInt(2);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)]; switch(j)
return block.getDefaultState(); {
case 0:
return BOPBlocks.violet.getDefaultState();
case 1:
default:
return Blocks.ALLIUM.getDefaultState();
} }
} }
}

View file

@ -20,12 +20,18 @@ import net.minecraft.world.gen.feature.AbstractFlowersFeature;
public class SnowyFlowersFeature extends AbstractFlowersFeature public class SnowyFlowersFeature extends AbstractFlowersFeature
{ {
private static final Block[] FLOWERS = new Block[]{BOPBlocks.violet, Blocks.DANDELION, Blocks.POPPY};
public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_) public IBlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_)
{ {
double d0 = MathHelper.clamp((1.0D + Biome.INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); int j = p_202355_1_.nextInt(3);
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)]; switch(j)
return block.getDefaultState(); {
case 0:
return BOPBlocks.violet.getDefaultState();
case 1:
return Blocks.POPPY.getDefaultState();
case 2:
default:
return Blocks.DANDELION.getDefaultState();
} }
} }
}