mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-24 17:11:58 +01:00
Merge pull request #167 from MrBretze/master
Fixed write PlayerHead by a shift+click to get a player head with nbt
This commit is contained in:
commit
de66dcebe9
@ -126,17 +126,20 @@ public class PlayerHeadMeta extends ItemMeta {
|
|||||||
public void write(@NotNull NBTCompound compound) {
|
public void write(@NotNull NBTCompound compound) {
|
||||||
NBTCompound skullOwnerCompound = new NBTCompound();
|
NBTCompound skullOwnerCompound = new NBTCompound();
|
||||||
// Sets the identifier for the skull
|
// Sets the identifier for the skull
|
||||||
|
if (this.skullOwner != null)
|
||||||
skullOwnerCompound.setIntArray("Id", Utils.uuidToIntArray(this.skullOwner));
|
skullOwnerCompound.setIntArray("Id", Utils.uuidToIntArray(this.skullOwner));
|
||||||
|
|
||||||
if (this.playerSkin == null) {
|
if (this.playerSkin == null && this.skullOwner != null) {
|
||||||
this.playerSkin = PlayerSkin.fromUuid(this.skullOwner.toString());
|
this.playerSkin = PlayerSkin.fromUuid(this.skullOwner.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.playerSkin != null) {
|
||||||
NBTList<NBTCompound> textures = new NBTList<>(NBTTypes.TAG_Compound);
|
NBTList<NBTCompound> textures = new NBTList<>(NBTTypes.TAG_Compound);
|
||||||
String value = this.playerSkin.getTextures() == null ? "" : this.playerSkin.getTextures();
|
String value = this.playerSkin.getTextures() == null ? "" : this.playerSkin.getTextures();
|
||||||
String signature = this.playerSkin.getSignature() == null ? "" : this.playerSkin.getSignature();
|
String signature = this.playerSkin.getSignature() == null ? "" : this.playerSkin.getSignature();
|
||||||
textures.add(new NBTCompound().setString("Value", value).setString("Signature", signature));
|
textures.add(new NBTCompound().setString("Value", value).setString("Signature", signature));
|
||||||
skullOwnerCompound.set("Properties", new NBTCompound().set("textures", textures));
|
skullOwnerCompound.set("Properties", new NBTCompound().set("textures", textures));
|
||||||
|
}
|
||||||
|
|
||||||
compound.set("SkullOwner", skullOwnerCompound);
|
compound.set("SkullOwner", skullOwnerCompound);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user