package top.r3944realms.lib39.base.compat.jade.provider;

import com.mojang.authlib.GameProfile;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import org.jetbrains.annotations.NotNull;
import snownee.jade.api.BlockAccessor;
import snownee.jade.api.IBlockComponentProvider;
import snownee.jade.api.ITooltip;
import snownee.jade.api.config.IPluginConfig;

import top.r3944realms.lib39.base.compat.jade.NeoForgeJadePlugin;
import top.r3944realms.lib39.content.block.blockentity.DollBlockEntity;

/**
 * The type Forge doll component provider.
 */
public class NeoForgeDollComponentProvider implements IBlockComponentProvider {
    @Override
    public Identifier getUid() {
        return NeoForgeJadePlugin.UID;
    }

    @Override
    public void appendTooltip(ITooltip iTooltip, @NotNull BlockAccessor blockAccessor, IPluginConfig iPluginConfig) {
        if (blockAccessor.getBlockEntity() instanceof DollBlockEntity doll) {
            GameProfile ownerProfile;
            if (doll.getOwnerProfile() != null) {
                ownerProfile = doll.getOwnerProfile().gameProfile();
                if (ownerProfile != null) {
                    iTooltip.add(Component.translatable("tooltip.lib39.content.doll.hover.1", ownerProfile.getName()));
                }
            }
        }
    }
}
