BiomesOPlenty/src/main/java/biomesoplenty/common/world/gen/feature/XericShrublandFlowersFeatur...

31 lines
1.3 KiB
Java
Raw Normal View History

2019-05-04 03:55:34 +00:00
/*******************************************************************************
* Copyright 2014-2019, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.world.gen.feature;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
2019-06-13 05:08:11 +00:00
import net.minecraft.block.BlockState;
2019-05-04 03:55:34 +00:00
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.biome.Biome;
2019-06-13 11:30:50 +00:00
import net.minecraft.world.gen.feature.NoFeatureConfig;
2019-05-04 03:55:34 +00:00
2019-06-13 11:30:50 +00:00
import java.util.Random;
2019-12-26 06:42:37 +00:00
public class XericShrublandFlowersFeature extends DefaultFlowersFeatureNoConfig
2019-05-04 03:55:34 +00:00
{
2019-06-13 11:30:50 +00:00
private static final Block[] FLOWERS = new Block[]{BOPBlocks.wildflower};
@Override
2019-12-26 06:42:37 +00:00
public BlockState getRandomFlower(Random p_202355_1_, BlockPos p_202355_2_, NoFeatureConfig config)
2019-06-13 11:30:50 +00:00
{
2019-12-31 07:27:53 +00:00
double d0 = MathHelper.clamp((1.0D + Biome.BIOME_INFO_NOISE.getValue((double)p_202355_2_.getX() / 48.0D, (double)p_202355_2_.getZ() / 48.0D, false)) / 2.0D, 0.0D, 0.9999D);
2019-06-13 11:30:50 +00:00
Block block = FLOWERS[(int)(d0 * (double)FLOWERS.length)];
2019-12-31 07:27:53 +00:00
return block.defaultBlockState();
2019-06-13 11:30:50 +00:00
}
}