2025-11-24 22:52:51 +03:00

31 lines
1.0 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.world.item;
import net.minecraft.core.Direction;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.StandingAndWallBlockItem;
import net.minecraft.world.item.component.ResolvableProfile;
import net.minecraft.world.level.block.Block;
public class PlayerHeadItem
extends StandingAndWallBlockItem {
public PlayerHeadItem(Block block, Block wallBlock, Item.Properties properties) {
super(block, wallBlock, Direction.DOWN, properties);
}
@Override
public Component getName(ItemStack itemStack) {
ResolvableProfile profile = itemStack.get(DataComponents.PROFILE);
if (profile != null && profile.name().isPresent()) {
return Component.translatable(this.descriptionId + ".named", profile.name().get());
}
return super.getName(itemStack);
}
}