Java Code Examples for net.minecraft.init.Items#FLINT_AND_STEEL

The following examples show how to use net.minecraft.init.Items#FLINT_AND_STEEL . 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: BlockDecorativePot.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
protected boolean applyItemToGarden (World world, int x, int y, int z, EntityPlayer player, ItemStack itemStack, float hitX, float hitY, float hitZ, boolean hitValid) {
    ItemStack item = (itemStack == null) ? player.inventory.getCurrentItem() : itemStack;

    if (item != null && item.getItem() == Items.flint_and_steel) {
        ItemStack substrate = getGardenSubstrate(world, x, y, z, Slot2Profile.SLOT_CENTER);
        if (substrate != null && substrate.getItem() == Item.getItemFromBlock(Blocks.netherrack)) {
            if (world.isAirBlock(x, y + 1, z)) {
                world.playSoundEffect(x + .5, y + .5, z + .5, "fire.ignite", 1, world.rand.nextFloat() * .4f + .8f);
                world.setBlock(x, y + 1, z, ModBlocks.smallFire);

                world.notifyBlocksOfNeighborChange(x, y, z, this);
                world.notifyBlocksOfNeighborChange(x, y - 1, z, this);
            }

            item.damageItem(1, player);
            return true;
        }
    }

    return super.applyItemToGarden(world, x, y, z, player, itemStack, hitX, hitY, hitZ, hitValid);
}