Search in sources :

Example 1 with Property

use of net.minecraft.util.com.mojang.authlib.properties.Property in project mc-dev by Bukkit.

the class TileEntitySkull method d.

private void d() {
    if (this.j != null && !UtilColor.b(this.j.getName())) {
        if (!this.j.isComplete() || !this.j.getProperties().containsKey("textures")) {
            GameProfile gameprofile = MinecraftServer.getServer().getUserCache().getProfile(this.j.getName());
            if (gameprofile != null) {
                Property property = (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), null);
                if (property == null) {
                    gameprofile = MinecraftServer.getServer().av().fillProfileProperties(gameprofile, true);
                }
                this.j = gameprofile;
                this.update();
            }
        }
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 2 with Property

use of net.minecraft.util.com.mojang.authlib.properties.Property in project mc-dev by Bukkit.

the class PacketPlayOutNamedEntitySpawn method b.

public void b(PacketDataSerializer packetdataserializer) {
    packetdataserializer.b(this.a);
    UUID uuid = this.b.getId();
    packetdataserializer.a(uuid == null ? "" : uuid.toString());
    packetdataserializer.a(this.b.getName());
    packetdataserializer.b(this.b.getProperties().size());
    Iterator iterator = this.b.getProperties().values().iterator();
    while (iterator.hasNext()) {
        Property property = (Property) iterator.next();
        packetdataserializer.a(property.getName());
        packetdataserializer.a(property.getValue());
        packetdataserializer.a(property.getSignature());
    }
    packetdataserializer.writeInt(this.c);
    packetdataserializer.writeInt(this.d);
    packetdataserializer.writeInt(this.e);
    packetdataserializer.writeByte(this.f);
    packetdataserializer.writeByte(this.g);
    packetdataserializer.writeShort(this.h);
    this.i.a(packetdataserializer);
}
Also used : Iterator(java.util.Iterator) UUID(java.util.UUID) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 3 with Property

use of net.minecraft.util.com.mojang.authlib.properties.Property in project mc-dev by Bukkit.

the class PacketPlayOutNamedEntitySpawn method a.

public void a(PacketDataSerializer packetdataserializer) {
    this.a = packetdataserializer.a();
    UUID uuid = UUID.fromString(packetdataserializer.c(36));
    this.b = new GameProfile(uuid, packetdataserializer.c(16));
    int i = packetdataserializer.a();
    for (int j = 0; j < i; ++j) {
        String s = packetdataserializer.c(32767);
        String s1 = packetdataserializer.c(32767);
        String s2 = packetdataserializer.c(32767);
        this.b.getProperties().put(s, new Property(s, s1, s2));
    }
    this.c = packetdataserializer.readInt();
    this.d = packetdataserializer.readInt();
    this.e = packetdataserializer.readInt();
    this.f = packetdataserializer.readByte();
    this.g = packetdataserializer.readByte();
    this.h = packetdataserializer.readShort();
    this.j = DataWatcher.b(packetdataserializer);
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) UUID(java.util.UUID) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 4 with Property

use of net.minecraft.util.com.mojang.authlib.properties.Property in project mc-dev by Bukkit.

the class GameProfileSerializer method serialize.

public static void serialize(NBTTagCompound nbttagcompound, GameProfile gameprofile) {
    if (!UtilColor.b(gameprofile.getName())) {
        nbttagcompound.setString("Name", gameprofile.getName());
    }
    if (gameprofile.getId() != null) {
        nbttagcompound.setString("Id", gameprofile.getId().toString());
    }
    if (!gameprofile.getProperties().isEmpty()) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        Iterator iterator = gameprofile.getProperties().keySet().iterator();
        while (iterator.hasNext()) {
            String s = (String) iterator.next();
            NBTTagList nbttaglist = new NBTTagList();
            NBTTagCompound nbttagcompound2;
            for (Iterator iterator1 = gameprofile.getProperties().get(s).iterator(); iterator1.hasNext(); nbttaglist.add(nbttagcompound2)) {
                Property property = (Property) iterator1.next();
                nbttagcompound2 = new NBTTagCompound();
                nbttagcompound2.setString("Value", property.getValue());
                if (property.hasSignature()) {
                    nbttagcompound2.setString("Signature", property.getSignature());
                }
            }
            nbttagcompound1.set(s, nbttaglist);
        }
        nbttagcompound.set("Properties", nbttagcompound1);
    }
}
Also used : Iterator(java.util.Iterator) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 5 with Property

use of net.minecraft.util.com.mojang.authlib.properties.Property in project mc-dev by Bukkit.

the class GameProfileSerializer method deserialize.

public static GameProfile deserialize(NBTTagCompound nbttagcompound) {
    String s = null;
    String s1 = null;
    if (nbttagcompound.hasKeyOfType("Name", 8)) {
        s = nbttagcompound.getString("Name");
    }
    if (nbttagcompound.hasKeyOfType("Id", 8)) {
        s1 = nbttagcompound.getString("Id");
    }
    if (UtilColor.b(s) && UtilColor.b(s1)) {
        return null;
    } else {
        UUID uuid;
        try {
            uuid = UUID.fromString(s1);
        } catch (Throwable throwable) {
            uuid = null;
        }
        GameProfile gameprofile = new GameProfile(uuid, s);
        if (nbttagcompound.hasKeyOfType("Properties", 10)) {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Properties");
            Iterator iterator = nbttagcompound1.c().iterator();
            while (iterator.hasNext()) {
                String s2 = (String) iterator.next();
                NBTTagList nbttaglist = nbttagcompound1.getList(s2, 10);
                for (int i = 0; i < nbttaglist.size(); ++i) {
                    NBTTagCompound nbttagcompound2 = nbttaglist.get(i);
                    String s3 = nbttagcompound2.getString("Value");
                    if (nbttagcompound2.hasKeyOfType("Signature", 8)) {
                        gameprofile.getProperties().put(s2, new Property(s2, s3, nbttagcompound2.getString("Signature")));
                    } else {
                        gameprofile.getProperties().put(s2, new Property(s2, s3));
                    }
                }
            }
        }
        return gameprofile;
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) Iterator(java.util.Iterator) UUID(java.util.UUID) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Aggregations

Property (net.minecraft.util.com.mojang.authlib.properties.Property)5 Iterator (java.util.Iterator)3 UUID (java.util.UUID)3 GameProfile (net.minecraft.util.com.mojang.authlib.GameProfile)3