WorldGenDoublePlant .java

net.minecraft.world.gen.feature.WorldGenDoublePlant (class): members: field_150549_a, setPlantType, generate. imports: BlockDoublePlant, Blocks, World.

net.minecraft.world.gen.featureclass36 linescommonextends WorldGenerator1.1 KB

API Surface (2)

void setPlantType(BlockDoublePlant.EnumPlantType p_180710_1_)
boolean generate(World worldIn, Random rand, BlockPos position)

Fields & Constants (1)

field_150549_a

Code Graph: Dependencies (5)

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

Full Source

WorldGenDoublePlant.java36 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.BlockDoublePlant;
5
import net.minecraft.init.Blocks;
6
import net.minecraft.util.BlockPos;
7
import net.minecraft.world.World;
8
9
public class WorldGenDoublePlant extends WorldGenerator
10
{
11
    private BlockDoublePlant.EnumPlantType field_150549_a;
12
13
    public void setPlantType(BlockDoublePlant.EnumPlantType p_180710_1_)
14
    {
15
        this.field_150549_a = p_180710_1_;
16
    }
17
18
    public boolean generate(World worldIn, Random rand, BlockPos position)
19
    {
20
        boolean flag = false;
21
22
        for (int i = 0; i < 64; ++i)
23
        {
24
            BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
25
26
            if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 254) && Blocks.double_plant.canPlaceBlockAt(worldIn, blockpos))
27
            {
28
                Blocks.double_plant.placeAt(worldIn, blockpos, this.field_150549_a, 2);
29
                flag = true;
30
            }
31
        }
32
33
        return flag;
34
    }
35
}
36

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