Posted December 30, 20213 yr [1.16.5] Hello, when I parse a JSON string to an ItemStack using JsonToNBT#parseTag with JSON seen beneath, the texture of the skull does not get applied. Any way to fix this? All other attributes / properties are being applied just fine. Here is the JSON I am using: { "id": "player_head", "Count": 1, "tag": { "CustomModelData": 100001, "HideFlags": -1, "SkullOwner": { "Id": [ 1334301174, 1630424667, -1957730237, 1373073981 ], "Properties": { "textures": [ { "Value": "ewogICJ0aW1lc3RhbXAiIDogMTYwMTU4MDc5MjcyMiwKICAicHJvZmlsZUlkIiA6ICJlZDUzZGQ4MTRmOWQ0YTNjYjRlYjY1MWRjYmE3N2U2NiIsCiAgInByb2ZpbGVOYW1lIiA6ICIwMTAwMDExMDAxMDAwMDExIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2FmMzgyMzQ1ZmQ3OWZjNzgzNjFjNjFjOTYyMzBjNjk0YzM0NDc5MzU4YWMwYWU0OWM0ZGI3YTYyNGE1YWZlNTQiCiAgICB9CiAgfQp9" } ] } }, "display": { "Name": "{\"italic\":false,\"color\":\"yellow\",\"text\":\"Next \\u003e\"}" } } } Kind regards, Kyllian
December 30, 20213 yr Author 5 minutes ago, diesieben07 said: Why are you using JsonToNBT for this? Because I have a bunch of JSON data of items and I want to turn them into actual ItemStacks. JsonToNBT is the first working class I found that does this.
December 30, 20213 yr Author 12 minutes ago, diesieben07 said: Have you verified that the NBT is created correctly? Do you mean when going from ItemStack to JSON or from JSON to ItemStack?
December 30, 20213 yr Author Just now, diesieben07 said: From JSON to ItemStack. Why are you doing the reverse? Okay let me explain a bit further: So the idea is you create a gui, it will then store all items from the gui as json and then you can load the exact same gui again. If that makes sense. As for how I create the ItemStack: ItemStack item = ItemStack.of(JsonToNBT.parseTag(itemObject.toString())); with itemObject being a JsonObject (the JSON for example showed in my OP)
December 30, 20213 yr Author 8 minutes ago, diesieben07 said: Just store it as NBT then? Why JSON? Alright, but how would I get the root NBT tag of an ItemStack? If I just use #getOrCreateTag it will just give me the tag and not the item ID etc right?
December 30, 20213 yr Author 6 minutes ago, diesieben07 said: ItemStack#save to save it to NBT and ItemStack.of to restore it. Oh, thanks. This also indeed fixed my texture problem. Thank you very much.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.