package com.mrcrayfish.furniture.blocks; import java.util.Random; import com.mrcrayfish.furniture.init.FurnitureBlocks; import com.mrcrayfish.furniture.init.FurnitureItems; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; public class BlockFirePitOff extends BlockFirePit { public BlockFirePitOff(Material materialIn) { super(materialIn); this.setDefaultState(this.blockState.getBaseState().withProperty(STAGE, 0)); } @Override public boolean isBurning() { return false; } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack current = playerIn.getCurrentEquippedItem(); if(current != null) { if(current.getItem() instanceof ItemFlintAndSteel) { if(getMetaFromState(state) == 3) { worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, RANDOM.nextFloat() * 0.4F + 0.8F); worldIn.setBlockState(pos, FurnitureBlocks.fire_pit_on.getDefaultState()); current.damageItem(1, playerIn); } return true; } } return false; } @Override public int quantityDropped(IBlockState state, int fortune, Random random) { return getMetaFromState(state) + 1; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return FurnitureItems.itemLog; } }