#Getting skull with texture from link

1 messages · Page 1 of 1 (latest)

molten nimbus
#

Hi, I tried numerous times to get texture from a link, and it just doesn't work, it always returns the default texture (Steve)

this is my code rn: (Kotlin but very similar to Java)

var profile = Bukkit.getOfflinePlayer(UUID.randomUUID()).playerProfile
        
val textures = profile.textures
textures.skin = URL(link)
profile.setTextures(textures)
val skull = ItemStack(Material.PLAYER_HEAD)
val meta = skull.itemMeta as SkullMeta
meta.ownerProfile = profile
skull.itemMeta = meta

return skull!!

link is always a textures.minecraft.net / ... link which resolves to real textures (for example, this one http://textures.minecraft.net/texture/3d8af980ff608867b6bc3736111c4c01b41f1ff6899a21e59858bce3d44dcf86)

left harbor
#

Use Bukkit.createPlayerProfile(uuid) instead of the offline player stuff

molten nimbus
#

alright i'll try it 😇

#

still didn't work unfortunately

#

for some reason the skull doesn't display correctly when I'm trying to get the item, or trying to set a block, but when I'm setting ItemDisplay to the skull it works

#

this is not new behaviour though

left harbor
#

Weird

#

Do you have client mods that may be messing with it

molten nimbus
#

no

#

vanilla minecraft and paper server. I tried spigot .jar too and there is no change in behaviour

left harbor
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

molten nimbus
#

thank you

left harbor
#

Your code does look fine though

molten nimbus
#

yeah I've been going in circles for almost two days trying to find even the smallest hint on why would it not work

#

i feel like I'm going insane

molten nimbus
#

update: I think i figured it out