Java Code Examples for net.minecraft.init.Blocks#SAND

The following examples show how to use net.minecraft.init.Blocks#SAND . 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 check out the related API usage on the sidebar.
Example 1
Source File: BiomeCanyon.java    From CommunityMod with GNU Lesser General Public License v2.1 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 2
Source File: BiomeCragCliffs.java    From CommunityMod with GNU Lesser General Public License v2.1 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;
					}
				}
			}
		}
	}
}
 
Example 3
Source File: BlockTraverseDeadGrass.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public boolean canSustainBush(IBlockState state) {
    return state.getBlock() == getBlock("red_rock") || state.getBlock() == Blocks.SAND || state.getBlock() == Blocks.HARDENED_CLAY || state.getBlock() == Blocks.STAINED_HARDENED_CLAY;
}
 
Example 4
Source File: BiomeCanyon.java    From Traverse-Legacy-1-12-2 with 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 5
Source File: BiomeCragCliffs.java    From Traverse-Legacy-1-12-2 with 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;
					}
				}
			}
		}
	}
}
 
Example 6
Source File: BlockTraverseDeadGrass.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
public boolean canSustainBush(IBlockState state) {
    return state.getBlock() == getBlock("red_rock") || state.getBlock() == Blocks.SAND || state.getBlock() == Blocks.HARDENED_CLAY || state.getBlock() == Blocks.STAINED_HARDENED_CLAY;
}