diff --git a/sources/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/sources/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java index beac0e955..b1851324c 100644 --- a/sources/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/sources/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -42,6 +42,7 @@ public class PacketPlayOutMapChunk implements Packet { if (this.f() || (i & 1 << j) != 0) { NBTTagCompound nbttagcompound = tileentity.aa_(); + if (tileentity instanceof TileEntitySkull) { TileEntitySkull.sanitizeTileEntityUUID(nbttagcompound); } // Paper this.e.add(nbttagcompound); } diff --git a/sources/src/main/java/net/minecraft/server/TileEntitySkull.java b/sources/src/main/java/net/minecraft/server/TileEntitySkull.java index a66bb1893..faa5471b0 100644 --- a/sources/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/sources/src/main/java/net/minecraft/server/TileEntitySkull.java @@ -143,10 +143,38 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa public GameProfile getGameProfile() { return this.a; } + + // Paper start + static NBTTagCompound sanitizeTileEntityUUID(NBTTagCompound cmp) { + NBTTagCompound owner = cmp.getCompound("Owner"); + if (!owner.isEmpty()) { + sanitizeUUID(owner); + } + return cmp; + } + + static void sanitizeUUID(NBTTagCompound owner) { + NBTTagCompound properties = owner.getCompound("Properties"); + NBTTagList list = null; + if (!properties.isEmpty()) { + list = properties.getList("textures", 10); + } + + if (list != null && !list.isEmpty()) { + String textures = ((NBTTagCompound)list.get(0)).getString("Value"); + if (textures != null && textures.length() > 3) { + String uuid = UUID.nameUUIDFromBytes(textures.getBytes()).toString(); + owner.setString("Id", uuid); + return; + } + } + owner.setString("Id", UUID.randomUUID().toString()); + } + // Paper end @Nullable public PacketPlayOutTileEntityData getUpdatePacket() { - return new PacketPlayOutTileEntityData(this.position, 4, this.aa_()); + return new PacketPlayOutTileEntityData(this.position, 4, sanitizeTileEntityUUID(this.aa_())); // Paper } public NBTTagCompound aa_() {