show skins for real for real this time

This commit is contained in:
yrsegal@gmail.com 2022-06-15 17:04:41 -04:00
parent 13d97af5bf
commit f8468b8862

View file

@ -31,6 +31,9 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
private GameProfile storedPlayerProfile = null;
private UUID storedPlayer = null;
private GameProfile cachedDisplayProfile = null;
private ItemStack cachedDisplayStack = null;
public BlockEntityStoredPlayerImpetus(BlockPos pWorldPosition, BlockState pBlockState) {
super(HexBlockEntities.IMPETUS_STOREDPLAYER_TILE, pWorldPosition, pBlockState);
}
@ -84,10 +87,15 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
var name = this.getPlayerName();
if (name != null) {
if (!name.equals(cachedDisplayProfile) || cachedDisplayStack == null) {
cachedDisplayProfile = name;
var head = new ItemStack(Items.PLAYER_HEAD);
NBTHelper.put(head, "SkullOwner", NbtUtils.writeGameProfile(new CompoundTag(), name));
lines.add(
new Pair<>(head, new TranslatableComponent("hexcasting.tooltip.lens.impetus.storedplayer", name.getName())));
head.getItem().verifyTagAfterLoad(head.getOrCreateTag());
cachedDisplayStack = head;
}
lines.add(new Pair<>(cachedDisplayStack,
new TranslatableComponent("hexcasting.tooltip.lens.impetus.storedplayer", name.getName())));
} else {
lines.add(new Pair<>(new ItemStack(Items.BARRIER),
new TranslatableComponent("hexcasting.tooltip.lens.impetus.storedplayer.none")));