@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); } }
public void load(TagCompound nbtTagCompound) { TagList items = nbtTagCompound.getAs("Items", TagList.class); for (int i = 0; i < items.size(); i++) { TagCompound itemCompound = items.getTagAs(i, TagCompound.class); ItemStack itemStack = ItemStackNBTConverter.compundToItemStack(itemCompound); setItem(itemCompound.getAs("Slot", TagByte.class).getByteData(), itemStack); } }
public TagCompound save(TagCompound compound) { List<TagCompound> itemList = new ArrayList<>(); for (int i = 0; i < this.items.size(); i++) { ItemStack itemStack = this.items.get(i); if (itemStack != null) { TagCompound item = ItemStackNBTConverter.itemStackToCompund(itemStack); item.getCompoundData().put("Slot", new TagByte((byte) i)); itemList.add(item); } } compound.getCompoundData().put("Items", new TagList(itemList)); return compound; }
TagList TagList = (TagList) tag; NBTTagList tagList = new NBTTagList(); for (TagBase tagInList : TagList.getReadOnlyList()) { tagList.add(compoundToVanillaCompound(tagInList));
properties.getCompoundData().put("Equipment", new TagList(equipmentList));
return new TagList(compoundList); case 10: TagCompound compound = new TagCompound();