content: package com.github.alexthe666.iceandfire.item;
  
  import com.github.alexthe666.iceandfire.IceAndFire;
  import com.github.alexthe666.iceandfire.entity.EntityDeathWormEgg;
  import com.github.alexthe666.iceandfire.entity.IafEntityRegistry;
  import net.minecraft.sounds.SoundEvents;
  import net.minecraft.sounds.SoundSource;
  import net.minecraft.world.InteractionHand;
  import net.minecraft.world.InteractionResult;
  import net.minecraft.world.InteractionResultHolder;
  import net.minecraft.world.entity.player.Player;
  import net.minecraft.world.item.Item;
  import net.minecraft.world.item.ItemStack;
  import net.minecraft.world.level.Level;
  import org.jetbrains.annotations.NotNull;
  
  public class ItemDeathwormEgg extends Item {
      private final boolean gigantic;
  
      public ItemDeathwormEgg(boolean gigantic) {
          super(new Item.Properties().tab(IceAndFire.TAB_ITEMS).stacksTo(1));
          this.gigantic = gigantic;
      }
  
  
      @Override
      public @NotNull InteractionResultHolder<ItemStack> use(@NotNull Level worldIn, Player playerIn, @NotNull InteractionHand handIn) {
          ItemStack itemstack = playerIn.getItemInHand(handIn);
  
          if (!playerIn.isCreative()) {
              itemstack.shrink(1);
          }
  
          worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundEvents.EGG_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (worldIn.random.nextFloat() * 0.4F + 0.8F));
  
          if (!worldIn.isClientSide) {
              EntityDeathWormEgg entityegg = new EntityDeathWormEgg(IafEntityRegistry.DEATH_WORM_EGG.get(), playerIn,
                  worldIn, gigantic);
              entityegg.shootFromRotation(playerIn, playerIn.getXRot(), playerIn.getYRot(), 0.0F, 1.5F, 1.0F);
              worldIn.addFreshEntity(entityegg);
          }
  
          return new InteractionResultHolder<>(InteractionResult.SUCCESS, itemstack);
      }
  }
  