WorldGenGlowStone2 .java

net.minecraft.world.gen.feature.WorldGenGlowStone2 (class, 58 lines): extends WorldGenerator. members: generate. imports: EnumFacing.

net.minecraft.world.gen.featureclass58 linescommonextends WorldGenerator1.7 KB

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

WorldGenGlowStone2.java58 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.material.Material;
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 WorldGenGlowStone2 extends WorldGenerator
11
{
12
    public boolean generate(World worldIn, Random rand, BlockPos position)
13
    {
14
        if (!worldIn.isAirBlock(position))
15
        {
16
            return false;
17
        }
18
        else if (worldIn.getBlockState(position.up()).getBlock() != Blocks.netherrack)
19
        {
20
            return false;
21
        }
22
        else
23
        {
24
            worldIn.setBlockState(position, Blocks.glowstone.getDefaultState(), 2);
25
26
            for (int i = 0; i < 1500; ++i)
27
            {
28
                BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8));
29
30
                if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
31
                {
32
                    int j = 0;
33
34
                    for (EnumFacing enumfacing : EnumFacing.values())
35
                    {
36
                        if (worldIn.getBlockState(blockpos.offset(enumfacing)).getBlock() == Blocks.glowstone)
37
                        {
38
                            ++j;
39
                        }
40
41
                        if (j > 1)
42
                        {
43
                            break;
44
                        }
45
                    }
46
47
                    if (j == 1)
48
                    {
49
                        worldIn.setBlockState(blockpos, Blocks.glowstone.getDefaultState(), 2);
50
                    }
51
                }
52
            }
53
54
            return true;
55
        }
56
    }
57
}
58

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