package xyz.illuc.neuralgiacore.mixin.vanilla;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EntityRenderer.class)
public abstract class MixinRemovePlayerNametag {
    @Inject(
            method = "renderNameTag",
            at = @At("HEAD"),
            cancellable = true,
            remap = true
    )
    private void removeNametag(Entity entity, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_, CallbackInfo ci) {
        if (entity instanceof Player) {
            ci.cancel();
        }
    }
}
