| 1 | package net.minecraft.world.gen.feature;
|
| 2 |
|
| 3 | import java.util.Random;
|
| 4 | import net.minecraft.block.Block;
|
| 5 | import net.minecraft.block.material.Material;
|
| 6 | import net.minecraft.init.Blocks;
|
| 7 | import net.minecraft.util.BlockPos;
|
| 8 | import net.minecraft.world.World;
|
| 9 |
|
| 10 | public class WorldGenHellLava extends WorldGenerator
|
| 11 | {
|
| 12 | private final Block field_150553_a;
|
| 13 | private final boolean field_94524_b;
|
| 14 |
|
| 15 | public WorldGenHellLava(Block p_i45453_1_, boolean p_i45453_2_)
|
| 16 | {
|
| 17 | this.field_150553_a = p_i45453_1_;
|
| 18 | this.field_94524_b = p_i45453_2_;
|
| 19 | }
|
| 20 |
|
| 21 | public boolean generate(World worldIn, Random rand, BlockPos position)
|
| 22 | {
|
| 23 | if (worldIn.getBlockState(position.up()).getBlock() != Blocks.netherrack)
|
| 24 | {
|
| 25 | return false;
|
| 26 | }
|
| 27 | else if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.netherrack)
|
| 28 | {
|
| 29 | return false;
|
| 30 | }
|
| 31 | else
|
| 32 | {
|
| 33 | int i = 0;
|
| 34 |
|
| 35 | if (worldIn.getBlockState(position.west()).getBlock() == Blocks.netherrack)
|
| 36 | {
|
| 37 | ++i;
|
| 38 | }
|
| 39 |
|
| 40 | if (worldIn.getBlockState(position.east()).getBlock() == Blocks.netherrack)
|
| 41 | {
|
| 42 | ++i;
|
| 43 | }
|
| 44 |
|
| 45 | if (worldIn.getBlockState(position.north()).getBlock() == Blocks.netherrack)
|
| 46 | {
|
| 47 | ++i;
|
| 48 | }
|
| 49 |
|
| 50 | if (worldIn.getBlockState(position.south()).getBlock() == Blocks.netherrack)
|
| 51 | {
|
| 52 | ++i;
|
| 53 | }
|
| 54 |
|
| 55 | if (worldIn.getBlockState(position.down()).getBlock() == Blocks.netherrack)
|
| 56 | {
|
| 57 | ++i;
|
| 58 | }
|
| 59 |
|
| 60 | int j = 0;
|
| 61 |
|
| 62 | if (worldIn.isAirBlock(position.west()))
|
| 63 | {
|
| 64 | ++j;
|
| 65 | }
|
| 66 |
|
| 67 | if (worldIn.isAirBlock(position.east()))
|
| 68 | {
|
| 69 | ++j;
|
| 70 | }
|
| 71 |
|
| 72 | if (worldIn.isAirBlock(position.north()))
|
| 73 | {
|
| 74 | ++j;
|
| 75 | }
|
| 76 |
|
| 77 | if (worldIn.isAirBlock(position.south()))
|
| 78 | {
|
| 79 | ++j;
|
| 80 | }
|
| 81 |
|
| 82 | if (worldIn.isAirBlock(position.down()))
|
| 83 | {
|
| 84 | ++j;
|
| 85 | }
|
| 86 |
|
| 87 | if (!this.field_94524_b && i == 4 && j == 1 || i == 5)
|
| 88 | {
|
| 89 | worldIn.setBlockState(position, this.field_150553_a.getDefaultState(), 2);
|
| 90 | worldIn.forceBlockUpdateTick(this.field_150553_a, position, rand);
|
| 91 | }
|
| 92 |
|
| 93 | return true;
|
| 94 | }
|
| 95 | }
|
| 96 | }
|
| 97 |
|