WorldGenFlowers .java

net.minecraft.world.gen.feature.WorldGenFlowers (class): members: setGeneratedBlock, field_175915_b, flower, generate. imports: BlockFlower, IBlockState.

net.minecraft.world.gen.featureclass40 linescommonextends WorldGenerator1.3 KB

API Surface (2)

void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_)
boolean generate(World worldIn, Random rand, BlockPos position)

Fields & Constants (2)

flower
field_175915_b

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

WorldGenFlowers.java40 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.BlockFlower;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.util.BlockPos;
7
import net.minecraft.world.World;
8
9
public class WorldGenFlowers extends WorldGenerator
10
{
11
    private BlockFlower flower;
12
    private IBlockState field_175915_b;
13
14
    public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_)
15
    {
16
        this.setGeneratedBlock(p_i45632_1_, p_i45632_2_);
17
    }
18
19
    public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_)
20
    {
21
        this.flower = p_175914_1_;
22
        this.field_175915_b = p_175914_1_.getDefaultState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_);
23
    }
24
25
    public boolean generate(World worldIn, Random rand, BlockPos position)
26
    {
27
        for (int i = 0; i < 64; ++i)
28
        {
29
            BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
30
31
            if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b))
32
            {
33
                worldIn.setBlockState(blockpos, this.field_175915_b, 2);
34
            }
35
        }
36
37
        return true;
38
    }
39
}
40

Deobfuscated MCP 1.8.9 source of WorldGenFlowers from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/gen/feature/WorldGenFlowers.java), stored verbatim.