Upstream Paper

This commit is contained in:
Sotr
2018-08-05 19:09:01 +08:00
parent 48b9fea5af
commit 996c3e4949
2 changed files with 30 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
if (this.f() || (i & 1 << j) != 0) {
NBTTagCompound nbttagcompound = tileentity.aa_();
if (tileentity instanceof TileEntitySkull) { TileEntitySkull.sanitizeTileEntityUUID(nbttagcompound); } // Paper
this.e.add(nbttagcompound);
}

View File

@@ -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_() {