package common.block.natural;

import common.block.Block;
import common.block.Material;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.rng.Random;
import common.util.BlockPos;
import common.vars.Vars;
import common.world.LightType;
import common.world.State;
import common.world.AWorldServer;

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

	public Item getItemDropped(State state, Random rand, int fortune) {
		return Items.snowball;
	}

	public int quantityDropped(Random rand) {
		return rand.range(2, 4);
	}

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