
package net.mcreator.customoregen.item;

import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.tags.TagKey;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Block;

import net.mcreator.customoregen.init.CustomOreGenModItems;
import net.mcreator.customoregen.config.ModConfigs;

public class SharddiamondpickaxeItem extends PickaxeItem {
	public SharddiamondpickaxeItem() {
		super(new Tier() {
			public int getUses() {
				return ModConfigs.isLoaded() ? ModConfigs.TOOL_STATS.shardDiamondPickaxeDurability.get() : 200;
			}

			public float getSpeed() {
				return ModConfigs.isLoaded() ? ModConfigs.TOOL_STATS.shardDiamondPickaxeSpeed.get().floatValue() : 7.0f;
			}

			public float getAttackDamageBonus() {
				return ModConfigs.isLoaded() ? ModConfigs.TOOL_STATS.shardDiamondPickaxeAttackDamage.get().floatValue() : 1.0f;
			}

			public int getEnchantmentValue() {
				return 9;
			}

			public Ingredient getRepairIngredient() {
				return Ingredient.of(new ItemStack(CustomOreGenModItems.DIAMONDSHARD.get()));
			}

			// 1.21 - new method required - returns diamond-tier incorrect blocks
			public TagKey<Block> getIncorrectBlocksForDrops() {
				return BlockTags.INCORRECT_FOR_DIAMOND_TOOL;
			}
		}, new Item.Properties());
	}

	@Override
	public int getMaxDamage(ItemStack stack) {
		return ModConfigs.isLoaded() ? ModConfigs.TOOL_STATS.shardDiamondPickaxeDurability.get() : 200;
	}

	@Override
	public float getDestroySpeed(ItemStack stack, BlockState state) {
		if (state.is(BlockTags.MINEABLE_WITH_PICKAXE)) {
			return ModConfigs.isLoaded() ? ModConfigs.TOOL_STATS.shardDiamondPickaxeSpeed.get().floatValue() : 7.0f;
		}
		return super.getDestroySpeed(stack, state);
	}
}
