Java Code Examples for net.minecraft.world.World#getSeaLevel()

The following examples show how to use net.minecraft.world.World#getSeaLevel() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public StructureTofuMineshaftStart(World p_i47149_1_, Random p_i47149_2_, int p_i47149_3_, int p_i47149_4_, MapGenTofuMineshaft.Type p_i47149_5_)
{
    super(p_i47149_3_, p_i47149_4_);
    this.mineShaftType = p_i47149_5_;
    StructureTofuMineshaftPieces.Room structuremineshaftpieces$room = new StructureTofuMineshaftPieces.Room(0, p_i47149_2_, (p_i47149_3_ << 4) + 2, (p_i47149_4_ << 4) + 2, this.mineShaftType);
    this.components.add(structuremineshaftpieces$room);
    structuremineshaftpieces$room.buildComponent(structuremineshaftpieces$room, this.components, p_i47149_2_);
    this.updateBoundingBox();

    if (p_i47149_5_ == MapGenTofuMineshaft.Type.BUILDING)
    {
        int j = p_i47149_1_.getSeaLevel() - this.boundingBox.maxY + this.boundingBox.getYSize() / 2 - -5;
        this.boundingBox.offset(0, j, 0);

        for (StructureComponent structurecomponent : this.components)
        {
            structurecomponent.offset(0, j, 0);
        }
    }
    else
    {
        this.markAvailableHeight(p_i47149_1_, p_i47149_2_, 10);
    }
}
 
Example 2
public CachedGridEntry(World world, int gridX, int gridZ, int primerChunkX, int primerChunkZ) {
    this.gridX = gridX;
    this.gridZ = gridZ;
    long worldSeed = world.getSeed();
    this.gridRandom = new XSTR(31 * 31 * gridX + gridZ * 31 + Long.hashCode(worldSeed));

    int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16;
    int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16;
    BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), gridZ * gridSizeZ + gridSizeZ / 2);
    Biome currentBiome = world.getBiomeProvider().getBiome(blockPos);
    this.cachedDepositMap = new ArrayList<>(WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome));

    this.worldSeaLevel = world.getSeaLevel();
    this.masterEntry = searchMasterOrNull(world);
    if (masterEntry == null) {
        Chunk primerChunk = world.getChunkFromChunkCoords(primerChunkX, primerChunkZ);
        BlockPos heightSpot = findOptimalSpot(gridX, gridZ, primerChunkX, primerChunkZ);
        int masterHeight = world.getHeight(heightSpot).getY();
        int masterBottomHeight = world.getTopSolidOrLiquidBlock(heightSpot).getY();
        this.masterEntry = primerChunk.getCapability(GTWorldGenCapability.CAPABILITY, null);
        this.masterEntry = new GTWorldGenCapability();
        this.masterEntry.setMaxHeight(masterHeight, masterBottomHeight);
    }

    triggerVeinsGeneration();
}
 
Example 3
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = redRock;
					}

					if (j == 0 && iblockstate1 == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = redRock;
					}
				}
			}
		}
	}
}
 
Example 4
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = blueRock;
					}

					if (j == 0 && iblockstate1 == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = blueRock;
					}
				}
			}
		}
	}
}
 
Example 5
Source Project: Traverse-Legacy-1-12-2   File: BiomeCanyon.java    License: MIT License 4 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = redRock;
					}

					if (j == 0 && iblockstate1 == redRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = redRock;
					}
				}
			}
		}
	}
}
 
Example 6
Source Project: Traverse-Legacy-1-12-2   File: BiomeCragCliffs.java    License: MIT License 4 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
	int i = worldIn.getSeaLevel();
	IBlockState iblockstate = this.topBlock;
	IBlockState iblockstate1 = this.fillerBlock;
	int j = -1;
	int k = (int) (noiseVal / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
	int l = x & 15;
	int i1 = z & 15;
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

	for (int j1 = 255; j1 >= 0; --j1) {
		if (j1 <= rand.nextInt(5)) {
			chunkPrimerIn.setBlockState(i1, j1, l, BEDROCK);
		} else {
			IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l);

			if (iblockstate2.getMaterial() == Material.AIR) {
				j = -1;
			} else if (iblockstate2.getBlock() == Blocks.STONE) {
				if (j == -1) {
					if (k <= 0) {
						iblockstate = AIR;
						iblockstate1 = STONE;
					} else if (j1 >= i - 4 && j1 <= i + 1) {
						iblockstate = this.topBlock;
						iblockstate1 = this.fillerBlock;
					}

					if (j1 < i && (iblockstate == null || iblockstate.getMaterial() == Material.AIR)) {
						if (this.getTemperature(blockpos$mutableblockpos.setPos(x, j1, z)) < 0.15F) {
							iblockstate = ICE;
						} else {
							iblockstate = WATER;
						}
					}

					j = k;

					if (j1 >= i - 1) {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate);
					} else if (j1 < i - 7 - k) {
						iblockstate = AIR;
						iblockstate1 = STONE;
						chunkPrimerIn.setBlockState(i1, j1, l, GRAVEL);
					} else {
						chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);
					}
				} else if (j > 0) {
					--j;
					chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1);

					if (j == 0 && iblockstate1.getBlock() == Blocks.SAND && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? RED_SANDSTONE : SANDSTONE;
					}

					if (j == 0 && iblockstate == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate = blueRock;
					}

					if (j == 0 && iblockstate1 == blueRock && k > 1) {
						j = rand.nextInt(4) + Math.max(0, j1 - 63);
						iblockstate1 = blueRock;
					}
				}
			}
		}
	}
}