Java Code Examples for net.minecraft.init.Blocks.LEAVES

The following are Jave code examples for showing how to use LEAVES of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Bewitchment   File: HarvestEvent.java   View Source Code Vote up 5 votes
@SubscribeEvent
public void onHarvestOakLeaves(BlockEvent.HarvestDropsEvent event) {
	if ((event.getState().getBlock() == Blocks.LEAVES && event.getWorld().rand.nextInt(150) < 25)) {
		event.getDrops().clear();
		event.getDrops().add(new ItemStack(ModItems.oak_apple_gall, 1));
	}
}
 
Example 2
Project: MooncakeCraft   File: MooncakeEventHandlers.java   View Source Code Vote up 5 votes
@SubscribeEvent
public static void gatherDrop(BlockEvent.HarvestDropsEvent event) {
    if (event.getHarvester() != null
            && event.getHarvester().getRNG().nextInt(100) < 15) {
        //Drop lotus seeds
        if (event.getState().getBlock() == Blocks.WATERLILY)
            event.getDrops().add(new ItemStack(MooncakeConstants.LOTUS_SEED, 1));

        //Drop jujubes
        if (event.getState().getBlock() == Blocks.LEAVES && event.getState().getProperties().containsValue(BlockPlanks.EnumType.SPRUCE))
            event.getDrops().add(new ItemStack(MooncakeConstants.JUJUBE, 1));
    }
}
 
Example 3
Project: Bewitchment   File: IceWorldBrew.java   View Source Code Vote up 4 votes
@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
	int box = 1 + (int) ((float) amplifier / 2F);

	BlockPos posI = pos.add(box, box, box);
	BlockPos posF = pos.add(-box, -box, -box);

	Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
	for (BlockPos spot : spots) {
		Block block = world.getBlockState(spot).getBlock();
		IBlockState state = world.getBlockState(spot);
		boolean place = amplifier > 2 || world.rand.nextBoolean();
		if (place && stateMap.containsKey(block)) {
			world.setBlockState(spot, stateMap.get(block), 3);
		} else if (state.getBlock() == Blocks.LEAVES) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.LEAVES2) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.PLANKS) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.STONE) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.BRICK_BLOCK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.STONEBRICK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (BlockStairs.isBlockStairs(state)) {
			IBlockState newState = ModBlocks.fake_ice_stairs.getDefaultState()
					.withProperty(BlockStairs.FACING, state.getValue(BlockStairs.FACING))
					.withProperty(BlockStairs.HALF, state.getValue(BlockStairs.HALF));
			world.setBlockState(spot, newState);
		} else if (state.getBlock() == Blocks.OAK_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.ACACIA_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.BIRCH_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.DARK_OAK_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.JUNGLE_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.SPRUCE_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.NETHER_BRICK_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.SANDSTONE) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.NETHER_BRICK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.RED_NETHER_BRICK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.END_BRICKS) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == ModBlocks.scorned_bricks) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == ModBlocks.nethersteel) {
			world.setBlockState(spot, Blocks.PACKED_ICE.getDefaultState(), 3);
		}
	}
}