WorldGenPumpkin .java

net.minecraft.world.gen.feature.WorldGenPumpkin (class, 27 lines): extends WorldGenerator. members: generate. imports: BlockPumpkin, EnumFacing, Blocks.

net.minecraft.world.gen.featureclass27 linescommonextends WorldGenerator983 B

API Surface (1)

boolean generate(World worldIn, Random rand, BlockPos position)

Code Graph: Dependencies (6)

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

Full Source

WorldGenPumpkin.java27 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.BlockPumpkin;
5
import net.minecraft.init.Blocks;
6
import net.minecraft.util.BlockPos;
7
import net.minecraft.util.EnumFacing;
8
import net.minecraft.world.World;
9
10
public class WorldGenPumpkin extends WorldGenerator
11
{
12
    public boolean generate(World worldIn, Random rand, BlockPos position)
13
    {
14
        for (int i = 0; i < 64; ++i)
15
        {
16
            BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
17
18
            if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos))
19
            {
20
                worldIn.setBlockState(blockpos, Blocks.pumpkin.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.Plane.HORIZONTAL.random(rand)), 2);
21
            }
22
        }
23
24
        return true;
25
    }
26
}
27

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