package common.block;

import common.init.Config;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.LightType;
import common.world.State;
import common.world.AWorldServer;

public class BlockSnowBlock extends Block
{
	public BlockSnowBlock()
    {
        super(Material.craftedSnow);
        this.setTickRandomly();
        this.setTab(CheatTab.tabNature);
    }

    /**
     * Get the Item that this Block should drop when harvested.
     */
    public Item getItemDropped(State state, Random rand, int fortune)
    {
        return Items.snowball;
    }

    /**
     * Returns the quantity of items to drop on block destruction.
     */
    public int quantityDropped(Random random)
    {
        return 4;
    }

    public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
    {
        if (Config.snowFullMelt && worldIn.getLightFor(LightType.BLOCK, pos) > 11)
        {
            this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0);
            worldIn.setBlockToAir(pos);
        }
    }
}
