Simplify texture updating in CraftMetaSkull

This commit is contained in:
md_5 2023-10-21 13:39:52 +11:00
parent e42510b064
commit f4d977e794
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -11,7 +11,6 @@ import net.minecraft.SystemUtils;
import net.minecraft.nbt.GameProfileSerializer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.level.block.entity.TileEntitySkull;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@ -143,12 +142,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
// SPIGOT-6558: Set initial textures
tag.put(SKULL_OWNER.NBT, serializedProfile);
// Fill in textures
TileEntitySkull.fillProfileTextures(profile).thenAccept((optional) -> {
optional.ifPresent((filledProfile) -> {
setProfile(filledProfile);
PlayerProfile ownerProfile = getOwnerProfile();
if (ownerProfile.getTextures().isEmpty()) {
ownerProfile.update().thenAccept((filledProfile) -> {
setOwnerProfile(filledProfile);
tag.put(SKULL_OWNER.NBT, serializedProfile);
});
});
}
}
if (noteBlockSound != null) {