@SuppressWarnings("unchecked")
public void applyTo(TagCompound tag) {
if (hasOwner()) {
TagCompound ownerTag = new TagCompound();
ownerTag.put("Name", new TagString(getOwner()));
if (hasTexture()) {
TagCompound propertiesTag = new TagCompound();
TagList textureList = new TagList();
TagCompound textureTag = new TagCompound();
JSONObject jsonObject = new JSONObject();
JSONObject texturesObject = new JSONObject();
JSONObject skinObject = new JSONObject();
jsonObject.put("textures", texturesObject);
texturesObject.put("SKIN", skinObject);
skinObject.put("url", getTexture());
String base64 = BaseEncoding.base64Url().encode(jsonObject.toJSONString().getBytes());
textureTag.put("Value", new TagString(base64));
textureList.addTag(textureTag);
propertiesTag.put("textures", textureList);
ownerTag.put("Properties", propertiesTag);
}
tag.put("SkullOwner", ownerTag);
}
}