WorldGenMelon .java

net.minecraft.world.gen.feature.WorldGenMelon (class, 25 lines): extends WorldGenerator. members: generate. imports: Blocks.

net.minecraft.world.gen.featureclass25 linescommonextends WorldGenerator802 B

API Surface (1)

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

Code Graph: Dependencies (4)

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

Full Source

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

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