content: package com.aizistral.etherium.items;
  
  import java.util.List;
  import java.util.Set;
  
  import javax.annotation.Nullable;
  
  import com.aizistral.enigmaticlegacy.config.EtheriumConfigHandler;
  import com.aizistral.enigmaticlegacy.helpers.AOEMiningHelper;
  import com.aizistral.enigmaticlegacy.helpers.ItemLoreHelper;
  import com.aizistral.etherium.core.EtheriumUtil;
  import com.aizistral.etherium.core.IEtheriumConfig;
  import com.aizistral.etherium.items.generic.ItemEtheriumTool;
  import com.google.common.collect.Sets;
  
  import net.minecraft.ChatFormatting;
  import net.minecraft.client.Minecraft;
  import net.minecraft.client.gui.screens.Screen;
  import net.minecraft.core.BlockPos;
  import net.minecraft.core.Direction;
  import net.minecraft.network.chat.Component;
  import net.minecraft.resources.ResourceLocation;
  import net.minecraft.tags.BlockTags;
  import net.minecraft.world.InteractionHand;
  import net.minecraft.world.InteractionResult;
  import net.minecraft.world.InteractionResultHolder;
  import net.minecraft.world.entity.LivingEntity;
  import net.minecraft.world.entity.Mob;
  import net.minecraft.world.entity.player.Player;
  import net.minecraft.world.item.ItemStack;
  import net.minecraft.world.item.Items;
  import net.minecraft.world.item.Rarity;
  import net.minecraft.world.item.TooltipFlag;
  import net.minecraft.world.item.context.UseOnContext;
  import net.minecraft.world.level.ClipContext;
  import net.minecraft.world.level.Level;
  import net.minecraft.world.level.block.state.BlockState;
  import net.minecraft.world.phys.BlockHitResult;
  import net.minecraft.world.phys.HitResult;
  import net.minecraftforge.api.distmarker.Dist;
  import net.minecraftforge.api.distmarker.OnlyIn;
  import net.minecraftforge.common.ToolAction;
  import net.minecraftforge.common.ToolActions;
  
  public class EtheriumShovel extends ItemEtheriumTool {
  
  	public EtheriumShovel() {
  		super(2.5F, -3.0F, BlockTags.MINEABLE_WITH_SHOVEL, EtheriumUtil.defaultProperties(EtheriumShovel.class)
  				.defaultDurability((int) (EtheriumConfigHandler.instance().getToolMaterial().getUses() * 1.5))
  				.rarity(Rarity.RARE)
  				.fireResistant());
  	}
  
  	@Override
  	@OnlyIn(Dist.CLIENT)
  	public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> list, TooltipFlag flagIn) {
  		if (this.getConfig().getShovelMiningRadius() == -1)
  			return;
  
  		if (Screen.hasShiftDown()) {
  			ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.etheriumShovel1", ChatFormatting.GOLD, this.getConfig().getShovelMiningRadius() + this.getConfig().getAOEBoost(Minecraft.getInstance().player), this.getConfig().getShovelMiningDepth());
  			ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.void");
  
  			if (!this.getConfig().disableAOEShiftInhibition()) {
  				ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.etheriumShovel2");
  			}
  			ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.etheriumShovel3");
  		} else {
  			ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.holdShift");
  		}
  
  		if (!this.areaEffectsAllowed(stack)) {
  			ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.void");
  			ItemLoreHelper.addLocalizedString(list, "tooltip.enigmaticlegacy.aoeDisabled");
  		}
  	}
  
  	@Override
  	public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity entityLiving) {
  		if (entityLiving instanceof Player && this.areaEffectsEnabled((Player) entityLiving, stack) && this.isCorrectToolForDrops(stack, state) && !world.isClientSide && this.getConfig().getShovelMiningRadius() != -1) {
  			HitResult trace = AOEMiningHelper.calcRayTrace(world, (Player) entityLiving, ClipContext.Fluid.ANY);
  
  			if (trace.getType() == HitResult.Type.BLOCK) {
  				BlockHitResult blockTrace = (BlockHitResult) trace;
  				Direction face = blockTrace.getDirection();
  
  				AOEMiningHelper.harvestCube(world, (Player) entityLiving, face, pos, (s) -> this.isCorrectToolForDrops(stack, s), this.getConfig().getShovelMiningRadius() + this.getConfig().getAOEBoost((Player) entityLiving), this.getConfig().getShovelMiningDepth(), false, pos, stack, (objPos, objState) -> {
  					stack.hurtAndBreak(1, entityLiving, p -> p.broadcastBreakEvent(Mob.getEquipmentSlotForItem(stack)));
  				});
  			}
  		}
  
  		return super.mineBlock(stack, world, state, pos, entityLiving);
  	}
  
  	@Override
  	public InteractionResult useOn(UseOnContext context) {
  		if (context.getPlayer().isCrouching())
  			return this.use(context.getLevel(), context.getPlayer(), context.getHand()).getResult();
  		else
  			return Items.DIAMOND_SHOVEL.useOn(context);
  	}
  
  	@Override
  	public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
  		ItemStack stack = player.getItemInHand(hand);
  		player.startUsingItem(hand);
  
  		if (player.isCrouching()) {
  			this.toggleAreaEffects(player, stack);
  
  			return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack);
  		} else
  			return super.use(world, player, hand);
  	}
  
  	@Override
  	public boolean canPerformAction(ItemStack stack, ToolAction toolAction) {
  		return ToolActions.DEFAULT_SHOVEL_ACTIONS.contains(toolAction);
  	}
  
  }
  