| 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 WorldGenLiquids extends WorldGenerator
|
| 11 | {
|
| 12 | private Block block;
|
| 13 |
|
| 14 | public WorldGenLiquids(Block p_i45465_1_)
|
| 15 | {
|
| 16 | this.block = p_i45465_1_;
|
| 17 | }
|
| 18 |
|
| 19 | public boolean generate(World worldIn, Random rand, BlockPos position)
|
| 20 | {
|
| 21 | if (worldIn.getBlockState(position.up()).getBlock() != Blocks.stone)
|
| 22 | {
|
| 23 | return false;
|
| 24 | }
|
| 25 | else if (worldIn.getBlockState(position.down()).getBlock() != Blocks.stone)
|
| 26 | {
|
| 27 | return false;
|
| 28 | }
|
| 29 | else if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.stone)
|
| 30 | {
|
| 31 | return false;
|
| 32 | }
|
| 33 | else
|
| 34 | {
|
| 35 | int i = 0;
|
| 36 |
|
| 37 | if (worldIn.getBlockState(position.west()).getBlock() == Blocks.stone)
|
| 38 | {
|
| 39 | ++i;
|
| 40 | }
|
| 41 |
|
| 42 | if (worldIn.getBlockState(position.east()).getBlock() == Blocks.stone)
|
| 43 | {
|
| 44 | ++i;
|
| 45 | }
|
| 46 |
|
| 47 | if (worldIn.getBlockState(position.north()).getBlock() == Blocks.stone)
|
| 48 | {
|
| 49 | ++i;
|
| 50 | }
|
| 51 |
|
| 52 | if (worldIn.getBlockState(position.south()).getBlock() == Blocks.stone)
|
| 53 | {
|
| 54 | ++i;
|
| 55 | }
|
| 56 |
|
| 57 | int j = 0;
|
| 58 |
|
| 59 | if (worldIn.isAirBlock(position.west()))
|
| 60 | {
|
| 61 | ++j;
|
| 62 | }
|
| 63 |
|
| 64 | if (worldIn.isAirBlock(position.east()))
|
| 65 | {
|
| 66 | ++j;
|
| 67 | }
|
| 68 |
|
| 69 | if (worldIn.isAirBlock(position.north()))
|
| 70 | {
|
| 71 | ++j;
|
| 72 | }
|
| 73 |
|
| 74 | if (worldIn.isAirBlock(position.south()))
|
| 75 | {
|
| 76 | ++j;
|
| 77 | }
|
| 78 |
|
| 79 | if (i == 3 && j == 1)
|
| 80 | {
|
| 81 | worldIn.setBlockState(position, this.block.getDefaultState(), 2);
|
| 82 | worldIn.forceBlockUpdateTick(this.block, position, rand);
|
| 83 | }
|
| 84 |
|
| 85 | return true;
|
| 86 | }
|
| 87 | }
|
| 88 | }
|
| 89 |
|