package pokefenn.totemic.item.music;

import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
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 pokefenn.totemic.api.TotemicAPI;
import pokefenn.totemic.init.ModContent;
import pokefenn.totemic.init.ModItems;

public class FluteItem extends Item {
    public FluteItem(Properties properties) {
        super(properties);
    }

    @SuppressWarnings("null")
    @Override
    public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
        TotemicAPI.get().music().playMusic(player, ModContent.flute);

        player.getCooldowns().addCooldown(ModItems.flute.get(), 20);
        player.getCooldowns().addCooldown(ModItems.infused_flute.get(), 20);

        player.awardStat(Stats.ITEM_USED.get(this));
        return InteractionResultHolder.success(player.getItemInHand(hand));
    }
}

@@ -574,38 +574,8 @@
  %7D%0A%0A
-    @SuppressWarnings(%22null%22)%0A
     
@@ -584,16 +584,16 @@
 verride%0A
+
     publ
@@ -682,24 +682,204 @@
 and hand) %7B%0A
+        if(!world.isClientSide) %7B%0A            if(player.isShiftKeyDown())%0A                TotemicAPI.get().music().playSelector(player, ModContent.flute);%0A            else%0A        
         Tote
@@ -935,16 +935,26 @@
 .flute);
+%0A        %7D
 %0A%0A      

Make flute item work properly