Java Code Examples for net.minecraft.block.material.Material.VINE

The following are Jave code examples for showing how to use VINE of the net.minecraft.block.material.Material class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Adventurers-Toolbox   File: ItemATSword.java   Source Code and License Vote up 5 votes
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state) {
	Block block = state.getBlock();

	if (block == Blocks.WEB) {
		return 15.0F;
	} else {
		Material material = state.getMaterial();
		return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL
				&& material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F;
	}
}
 
Example 2
Project: Adventurers-Toolbox   File: ItemATMace.java   Source Code and License Vote up 5 votes
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state) {
	Block block = state.getBlock();

	if (block == Blocks.WEB) {
		return 15.0F;
	} else {
		Material material = state.getMaterial();
		return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL
				&& material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F;
	}
}
 
Example 3
Project: CustomWorldGen   File: BlockDoublePlant.java   Source Code and License Vote up 5 votes
public BlockDoublePlant()
{
    super(Material.VINE);
    this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockDoublePlant.EnumPlantType.SUNFLOWER).withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, EnumFacing.NORTH));
    this.setHardness(0.0F);
    this.setSoundType(SoundType.PLANT);
    this.setUnlocalizedName("doublePlant");
}
 
Example 4
Project: Backmemed   File: ItemSword.java   Source Code and License Vote up 5 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Block block = state.getBlock();

    if (block == Blocks.WEB)
    {
        return 15.0F;
    }
    else
    {
        Material material = state.getMaterial();
        return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL && material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F;
    }
}
 
Example 5
Project: CustomWorldGen   File: ItemSword.java   Source Code and License Vote up 5 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Block block = state.getBlock();

    if (block == Blocks.WEB)
    {
        return 15.0F;
    }
    else
    {
        Material material = state.getMaterial();
        return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL && material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F;
    }
}
 
Example 6
Project: rtap   File: toolJelloAxe.java   Source Code and License Vote up 4 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Material material = state.getMaterial();
    return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
 
Example 7
Project: ExPetrum   File: ItemAxe.java   Source Code and License Vote up 4 votes
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
   {
       Material material = state.getMaterial();
       return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.getStats(stack).getEfficiency();
   }
 
Example 8
Project: rtap   File: toolCatHairAxe.java   Source Code and License Vote up 4 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Material material = state.getMaterial();
    return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
 
Example 9
Project: rtap   File: toolBolognaAxe.java   Source Code and License Vote up 4 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Material material = state.getMaterial();
    return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
 
Example 10
Project: Got-Wood   File: WorldGenRubber.java   Source Code and License Vote up 4 votes
public boolean generate(World worldIn, Random rand, BlockPos position) {
	int i = 2 + rand.nextInt(1) + this.minTreeHeight;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) {
			int k = 1;

			if (j == position.getY()) {
				k = 0;
			}

			if (j >= position.getY() + 1 + i - 2) {
				k = 2;
			}

			BlockPos.MutableBlockPos blockposmutableblockpos = new BlockPos.MutableBlockPos();

			for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) {
				for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) {
					if (j >= 0 && j < worldIn.getHeight()) {
						if (!this.isReplaceable(worldIn, blockposmutableblockpos.setPos(l, j, i1))) {
							flag = false;
						}
					} else {
						flag = false;
					}
				}
			}
		}

		if (!flag) {
			return false;
		} else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
					int i4 = i3 - (position.getY() + i);
					int j1 = 1 - i4 / 2;

					for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
						int l1 = k1 - position.getX();

						for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
							int j2 = i2 - position.getZ();

							if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
								BlockPos blockpos = new BlockPos(k1, i3, i2);
								state = worldIn.getBlockState(blockpos);

								if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
									this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
								}
							}
						}
					}
				}

				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 11
Project: Got-Wood   File: WorldGenApple.java   Source Code and License Vote up 4 votes
public boolean generate(World worldIn, Random rand, BlockPos position) {
	int i = 2 + rand.nextInt(1) + this.minTreeHeight;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) {
			int k = 1;

			if (j == position.getY()) {
				k = 0;
			}

			if (j >= position.getY() + 1 + i - 2) {
				k = 2;
			}

			BlockPos.MutableBlockPos blockposmutableblockpos = new BlockPos.MutableBlockPos();

			for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) {
				for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) {
					if (j >= 0 && j < worldIn.getHeight()) {
						if (!this.isReplaceable(worldIn, blockposmutableblockpos.setPos(l, j, i1))) {
							flag = false;
						}
					} else {
						flag = false;
					}
				}
			}
		}

		if (!flag) {
			return false;
		} else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
					int i4 = i3 - (position.getY() + i);
					int j1 = 1 - i4 / 2;

					for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
						int l1 = k1 - position.getX();

						for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
							int j2 = i2 - position.getZ();

							if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
								BlockPos blockpos = new BlockPos(k1, i3, i2);
								state = worldIn.getBlockState(blockpos);

								if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
									this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves.withProperty(BlockFruitingLeaves.FRUITING, rand.nextInt(ConfigurationHandler.appleFruitingGenChance) == 0?rand.nextInt(1)+1:0));
								}
							}
						}
					}
				}

				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 12
Project: Got-Wood   File: WorldGenMaple.java   Source Code and License Vote up 4 votes
private boolean generateNormal(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(3) + 5;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {

		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		} else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
					int i4 = i3 - (position.getY() + i);
					int j1 = 1 - i4 / 2;

					for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
						int l1 = k1 - position.getX();

						for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
							int j2 = i2 - position.getZ();

							if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
								BlockPos blockpos = new BlockPos(k1, i3, i2);
								state = worldIn.getBlockState(blockpos);

								if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
									this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
								}
							}
						}
					}
				}

				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 13
Project: Got-Wood   File: WorldGenMaple.java   Source Code and License Vote up 4 votes
private boolean generateBig(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(2) + 9;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		}

		//If we can actually make the tree
		else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				//MAKE LEAVES
				final int[][] leafPos = new int[][] { { -1, 0, 0 }, { 0, 0, 1 }, { 0, 0, -1 }, { 1, 0, 0 }, { -1, 1, 1 }, { -1, 1, 0 }, { -1, 1, -1 }, { 0, 1, 1 }, { 0, 1, -1 }, { 1, 1, 1 }, { 1, 1, 0 }, { 1, 1, -1 }, { 2, 1, 1 }, { -2, 1, 1 }, { -2, 1, 0 }, { -2, 1, -1 }, { -1, 1, 2 }, { -1, 1, -2 }, { 0, 1, 2 }, { 0, 1, -2 }, { 2, 1, 0 }, { 2, 1, -1 }, { 1, 1, 2 }, { 1, 1, -2 }, { -3, 1, 0 }, { 3, 1, 0 }, { 0, 1, -3 }, { 0, 1, 3 }, { -2, 1, 2 }, { -2, 1, -2 }, { 2, 1, 2 }, { 2, 1, -2 }, { -1, 2, 1 }, { -1, 2, 0 }, { -1, 2, -1 }, { 0, 2, 1 }, { 0, 2, -1 }, { 1, 2, 1 }, { 1, 2, 0 }, { 1, 2, -1 }, { 2, 2, 1 }, { -2, 2, 1 }, { -2, 2, 0 }, { -2, 2, -1 }, { -1, 2, 2 }, { -1, 2, -2 }, { 0, 2, 2 }, { 0, 2, -2 }, { 2, 2, 0 }, { 2, 2, -1 }, { 1, 2, 2 }, { 1, 2, -2 }, { -3, 2, 0 }, { 3, 2, 0 },
					{ 0, 2, -3 }, { 0, 2, 3 }, { -2, 2, 2 }, { -2, 2, -2 }, { 2, 2, 2 }, { 2, 2, -2 }, { -3, 2, -1 }, { -3, 2, 1 }, { -1, 2, -3 }, { -1, 2, 3 }, { 1, 2, 3 }, { 3, 2, 1 }, { 1, 2, -3 }, { 3, 2, -1 }, { -1, 3, 1 }, { -1, 3, 0 }, { -1, 3, -1 }, { 0, 3, 1 }, { 0, 3, -1 }, { 1, 3, 1 }, { 1, 3, 0 }, { 1, 3, -1 }, { 2, 3, 1 }, { -2, 3, 1 }, { -2, 3, 0 }, { -2, 3, -1 }, { -1, 3, 2 }, { -1, 3, -2 }, { 0, 3, 2 }, { 0, 3, -2 }, { 2, 3, 0 }, { 2, 3, -1 }, { 1, 3, 2 }, { 1, 3, -2 }, { -3, 3, 0 }, { 3, 3, 0 }, { 0, 3, -3 }, { 0, 3, 3 }, { -2, 3, 2 }, { -2, 3, -2 }, { 2, 3, 2 }, { 2, 3, -2 }, { -3, 3, -1 }, { -3, 3, 1 }, { -1, 3, -3 }, { -1, 3, 3 }, { 1, 3, 3 }, { 3, 3, 1 }, { 1, 3, -3 }, { 3, 3, -1 }, { -1, 4, 1 }, { -1, 4, 0 }, { -1, 4, -1 }, { 0, 4, 1 }, { 0, 4, -1 }, { 1, 4, 1 },
					{ 1, 4, 0 }, { 1, 4, -1 }, { 2, 4, 1 }, { -2, 4, 1 }, { -2, 4, 0 }, { -2, 4, -1 }, { -1, 4, 2 }, { -1, 4, -2 }, { 0, 4, 2 }, { 0, 4, -2 }, { 2, 4, 0 }, { 2, 4, -1 }, { 1, 4, 2 }, { 1, 4, -2 }, { -3, 4, 0 }, { 3, 4, 0 }, { 0, 4, -3 }, { 0, 4, 3 }, { -1, 5, 1 }, { -1, 5, 0 }, { -1, 5, -1 }, { 0, 5, 1 }, { 0, 5, -1 }, { 1, 5, 1 }, { 1, 5, 0 }, { 1, 5, -1 }, { 2, 5, 1 }, { -2, 5, 1 }, { -2, 5, 0 }, { -2, 5, -1 }, { -1, 5, 2 }, { -1, 5, -2 }, { 0, 5, 2 }, { 0, 5, -2 }, { 2, 5, 0 }, { 2, 5, -1 }, { 1, 5, 2 }, { 1, 5, -2 }, { -1, 6, 0 }, { 0, 6, 1 }, { 0, 6, -1 }, { 1, 6, 0 }, { 0, 7, 0 } };

				for (int[] coord : leafPos) {
					BlockPos blockpos = position.add(coord[0], coord[1] + (i - 7), coord[2]);
					state = worldIn.getBlockState(blockpos);
					if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
					}
				}

				//MAKE TRUNK
				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
						if (j3 == i - 4) {

							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}

						} else if (j3 == i - 6) {
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}
						}
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 14
Project: Got-Wood   File: WorldGenMaple.java   Source Code and License Vote up 4 votes
private boolean generateMini(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(2) + 6;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		}

		//If we can actually make the tree
		else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				//MAKE LEAVES
				final int[][] leafPos = new int[][] { { -1, 0, 1 }, { -1, 0, 0 }, { -1, 0, -1 }, { 0, 0, 1 }, { 0, 0, -1 }, { 1, 0, 1 }, { 1, 0, 0 }, { 1, 0, -1 }, { -1, 1, 1 }, { -1, 1, 0 }, { -1, 1, -1 }, { 0, 1, 1 }, { 0, 1, -1 }, { 0, 1, -2 }, { 1, 1, 1 }, { 1, 1, 0 }, { 1, 1, -1 }, { -1, 1, 0 }, { -1, 1, -1 }, { -2, 1, 1 }, { -2, 1, 0 }, { -2, 1, -1 }, { 2, 1, -1 }, { 2, 1, 0 }, { 2, 1, 1 }, { -1, 1, 2 }, { 0, 1, 2 }, { 1, 1, 2 }, { -1, 1, -2 }, { 1, 1, -2 }, { 1, 1, -2 }, { -1, 2, 1 }, { -1, 2, 0 }, { -1, 2, -1 }, { 0, 2, 1 }, { 0, 2, -1 }, { 1, 2, 1 }, { 1, 2, 0 }, { 1, 2, -1 }, { -2, 2, 0 }, { 2, 2, 0 }, { 0, 2, 2 }, { 0, 2, -2 }, { -1, 3, 1 }, { -1, 3, 0 }, { -1, 3, -1 }, { 0, 3, 1 }, { 0, 3, -1 }, { 1, 3, 1 }, { 1, 3, 0 }, { 1, 3, -1 }, { -1, 4, 0 }, { 0, 4, 1 },
					{ 0, 4, -1 }, { 1, 4, 0 }, { 0, 5, 0 } };

				for (int[] coord : leafPos) {
					BlockPos blockpos = position.add(coord[0], coord[1] + (i - 5), coord[2]);
					state = worldIn.getBlockState(blockpos);
					if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
					}
				}
				//MAKE TRUNK
				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
						if (j3 == i - 4) {

							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}

						}
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 15
Project: Got-Wood   File: WorldGenPalm.java   Source Code and License Vote up 4 votes
private boolean generateNormal(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(3) + 5;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		
		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		} else {
			
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, net.minecraft.init.Blocks.DEADBUSH) && position.getY() < worldIn.getHeight() - i - 1) {
				System.out.println("doot ");
				this.setDirtAt(worldIn, position.down());

				for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
					int i4 = i3 - (position.getY() + i);
					int j1 = 1 - i4 / 2;

					for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
						int l1 = k1 - position.getX();

						for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
							int j2 = i2 - position.getZ();

							if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
								BlockPos blockpos = new BlockPos(k1, i3, i2);
								state = worldIn.getBlockState(blockpos);

								if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
									this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
								}
							}
						}
					}
				}

				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 16
Project: Got-Wood   File: WorldGenPalm.java   Source Code and License Vote up 4 votes
private boolean generateBig(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(2) + 9;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		}

		//If we can actually make the tree
		else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				//MAKE LEAVES
				final int[][] leafPos = new int[][] { { -1, 0, 0 }, { 0, 0, 1 }, { 0, 0, -1 }, { 1, 0, 0 }, { -1, 1, 1 }, { -1, 1, 0 }, { -1, 1, -1 }, { 0, 1, 1 }, { 0, 1, -1 }, { 1, 1, 1 }, { 1, 1, 0 }, { 1, 1, -1 }, { 2, 1, 1 }, { -2, 1, 1 }, { -2, 1, 0 }, { -2, 1, -1 }, { -1, 1, 2 }, { -1, 1, -2 }, { 0, 1, 2 }, { 0, 1, -2 }, { 2, 1, 0 }, { 2, 1, -1 }, { 1, 1, 2 }, { 1, 1, -2 }, { -3, 1, 0 }, { 3, 1, 0 }, { 0, 1, -3 }, { 0, 1, 3 }, { -2, 1, 2 }, { -2, 1, -2 }, { 2, 1, 2 }, { 2, 1, -2 }, { -1, 2, 1 }, { -1, 2, 0 }, { -1, 2, -1 }, { 0, 2, 1 }, { 0, 2, -1 }, { 1, 2, 1 }, { 1, 2, 0 }, { 1, 2, -1 }, { 2, 2, 1 }, { -2, 2, 1 }, { -2, 2, 0 }, { -2, 2, -1 }, { -1, 2, 2 }, { -1, 2, -2 }, { 0, 2, 2 }, { 0, 2, -2 }, { 2, 2, 0 }, { 2, 2, -1 }, { 1, 2, 2 }, { 1, 2, -2 }, { -3, 2, 0 }, { 3, 2, 0 },
					{ 0, 2, -3 }, { 0, 2, 3 }, { -2, 2, 2 }, { -2, 2, -2 }, { 2, 2, 2 }, { 2, 2, -2 }, { -3, 2, -1 }, { -3, 2, 1 }, { -1, 2, -3 }, { -1, 2, 3 }, { 1, 2, 3 }, { 3, 2, 1 }, { 1, 2, -3 }, { 3, 2, -1 }, { -1, 3, 1 }, { -1, 3, 0 }, { -1, 3, -1 }, { 0, 3, 1 }, { 0, 3, -1 }, { 1, 3, 1 }, { 1, 3, 0 }, { 1, 3, -1 }, { 2, 3, 1 }, { -2, 3, 1 }, { -2, 3, 0 }, { -2, 3, -1 }, { -1, 3, 2 }, { -1, 3, -2 }, { 0, 3, 2 }, { 0, 3, -2 }, { 2, 3, 0 }, { 2, 3, -1 }, { 1, 3, 2 }, { 1, 3, -2 }, { -3, 3, 0 }, { 3, 3, 0 }, { 0, 3, -3 }, { 0, 3, 3 }, { -2, 3, 2 }, { -2, 3, -2 }, { 2, 3, 2 }, { 2, 3, -2 }, { -3, 3, -1 }, { -3, 3, 1 }, { -1, 3, -3 }, { -1, 3, 3 }, { 1, 3, 3 }, { 3, 3, 1 }, { 1, 3, -3 }, { 3, 3, -1 }, { -1, 4, 1 }, { -1, 4, 0 }, { -1, 4, -1 }, { 0, 4, 1 }, { 0, 4, -1 }, { 1, 4, 1 },
					{ 1, 4, 0 }, { 1, 4, -1 }, { 2, 4, 1 }, { -2, 4, 1 }, { -2, 4, 0 }, { -2, 4, -1 }, { -1, 4, 2 }, { -1, 4, -2 }, { 0, 4, 2 }, { 0, 4, -2 }, { 2, 4, 0 }, { 2, 4, -1 }, { 1, 4, 2 }, { 1, 4, -2 }, { -3, 4, 0 }, { 3, 4, 0 }, { 0, 4, -3 }, { 0, 4, 3 }, { -1, 5, 1 }, { -1, 5, 0 }, { -1, 5, -1 }, { 0, 5, 1 }, { 0, 5, -1 }, { 1, 5, 1 }, { 1, 5, 0 }, { 1, 5, -1 }, { 2, 5, 1 }, { -2, 5, 1 }, { -2, 5, 0 }, { -2, 5, -1 }, { -1, 5, 2 }, { -1, 5, -2 }, { 0, 5, 2 }, { 0, 5, -2 }, { 2, 5, 0 }, { 2, 5, -1 }, { 1, 5, 2 }, { 1, 5, -2 }, { -1, 6, 0 }, { 0, 6, 1 }, { 0, 6, -1 }, { 1, 6, 0 }, { 0, 7, 0 } };

				for (int[] coord : leafPos) {
					BlockPos blockpos = position.add(coord[0], coord[1] + (i - 7), coord[2]);
					state = worldIn.getBlockState(blockpos);
					if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
					}
				}

				//MAKE TRUNK
				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
						if (j3 == i - 4) {

							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}

						} else if (j3 == i - 6) {
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}
						}
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
Example 17
Project: CustomWorldGen   File: ItemAxe.java   Source Code and License Vote up 4 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Material material = state.getMaterial();
    return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
 
Example 18
Project: CustomWorldGen   File: BlockTallGrass.java   Source Code and License Vote up 4 votes
protected BlockTallGrass()
{
    super(Material.VINE);
    this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockTallGrass.EnumType.DEAD_BUSH));
}
 
Example 19
Project: Backmemed   File: ItemAxe.java   Source Code and License Vote up 4 votes
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
    Material material = state.getMaterial();
    return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
 
Example 20
Project: Backmemed   File: BlockTallGrass.java   Source Code and License Vote up 4 votes
protected BlockTallGrass()
{
    super(Material.VINE);
    this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockTallGrass.EnumType.DEAD_BUSH));
}