package net.mattias.cobblesnapshot.event;

import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import com.cobblemon.mod.common.pokemon.Pokemon;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
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 net.mattias.cobblesnapshot.item.ModItems;
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;

import java.time.LocalDate;

public class CameraUseEvents {

    @net.neoforged.bus.api.SubscribeEvent
    public static void onEntityRightClick(PlayerInteractEvent.EntityInteractSpecific event) {
        if (!(event.getTarget() instanceof PokemonEntity target)) return;
        Player player = event.getEntity();
        Level level = player.level();
        ItemStack camera = player.getItemInHand(event.getHand());

        if (!camera.is(ModItems.CAMERA.get())) return;

        // Check for film in inventory
        int filmSlot = findFirstSlotWithItem(player, ModItems.FILM.get());
        if (filmSlot == -1) {
            player.sendSystemMessage(Component.literal("You need film to take a snapshot!").withStyle(ChatFormatting.RED));
            return;
        }

        // Remove 1 film
        player.getInventory().removeItem(filmSlot, 1);

        // Get Pokémon data
        Pokemon pokemon = target.getPokemon();

        // Create image film item
        ItemStack snapshot = new ItemStack(ModItems.IMAGE_FILM.get());

        // Set custom name via NBT
        CompoundTag tag = snapshot.getTag() != null ? snapshot.getTag() : new CompoundTag();
        CompoundTag displayTag = new CompoundTag();
        displayTag.putString("Name", Component.Serializer.toJson(Component.literal("📸 Snapshot of " + pokemon.getDisplayName().getString())));
        tag.put("display", displayTag);

        // Set lore data
        tag.putString("TakenBy", player.getName().getString());
        tag.putString("TakenOn", LocalDate.now().toString());
        snapshot.setTag(tag);

        // Give item to player
        if (!player.addItem(snapshot)) {
            player.drop(snapshot, false);
        }

        player.sendSystemMessage(Component.literal("📸 You took a snapshot of " + pokemon.getDisplayName() + "!"));
        event.setCanceled(true);
        event.setCancellationResult(InteractionResult.SUCCESS);
    }

    private static int findFirstSlotWithItem(Player player, Item item) {
        for (int i = 0; i < player.getInventory().getContainerSize(); i++) {
            ItemStack stack = player.getInventory().getItem(i);
            if (stack.is(item)) return i;
        }
        return -1;
    }
}
Cannot resolve method 'getTag' in 'ItemStack'
Cannot resolve method 'getTag' in 'ItemStack'
Expected 2 arguments but found 1
Cannot resolve method 'setTag' in 'ItemStack'

package net.mattias.cobblesnapshot.item.custom;

import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.nbt.CompoundTag;

import java.util.List;

public class ImageFilmItem extends Item {
    public ImageFilmItem() {
        super(new Properties());
    }

    @Override
    public void appendHoverText(ItemStack stack, Level level, List<Component> tooltip, TooltipFlag flag) {
        CompoundTag tag = stack.getTag();
        if (tag != null) {
            String taker = tag.getString("TakenBy");
            String date = tag.getString("TakenOn");
            tooltip.add(Component.literal("Taken by: " + taker));
            tooltip.add(Component.literal("Taken on: " + date));
        }
    }
}
Method does not override method from its superclass
Cannot resolve method 'getTag' in 'ItemStack'

I am on NeoForge 1.21