package net.minecraft.world.level.block;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.block.entity.BlockEntity;
import java.util.UUID;
import com.mojang.authlib.GameProfile;
import org.apache.commons.lang3.StringUtils;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nullable;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockBehaviour;

public class PlayerHeadBlock extends SkullBlock {
    protected PlayerHeadBlock(final Properties c) {
        super(Types.PLAYER, c);
    }
    
    @Override
    public void setPlacedBy(final Level bqb, final BlockPos fu, final BlockState cfj, @Nullable final LivingEntity aoy, final ItemStack bki) {
        super.setPlacedBy(bqb, fu, cfj, aoy, bki);
        final BlockEntity cdl7 = bqb.getBlockEntity(fu);
        if (cdl7 instanceof SkullBlockEntity) {
            final SkullBlockEntity cei8 = (SkullBlockEntity)cdl7;
            GameProfile gameProfile9 = null;
            if (bki.hasTag()) {
                final CompoundTag le10 = bki.getTag();
                if (le10.contains("SkullOwner", 10)) {
                    gameProfile9 = NbtUtils.readGameProfile(le10.getCompound("SkullOwner"));
                }
                else if (le10.contains("SkullOwner", 8) && !StringUtils.isBlank((CharSequence)le10.getString("SkullOwner"))) {
                    gameProfile9 = new GameProfile((UUID)null, le10.getString("SkullOwner"));
                }
            }
            cei8.setOwner(gameProfile9);
        }
    }
}
