misode.github.io
misode.github.io copied to clipboard
SNBT output type can generate invalid SNBT arrays (containing more than 1 data type)
For example, this item modifer outputs:
{
function: "minecraft:set_name",
name: [
{
text: "Hello"
},
" World"
]
}
Which is invalid SNBT because arrays can only contain elements of the same type, but this contains a compound and a string.
In this specific case, the plain string, " World", should be changed to the compound {text:" World"} as that's how the game naturally would handle it.
This seems like something that would need case-by-case solving. You could always just have a little warning sign if it does happen somewhere that isn't solved saying "Warning this isn't actually valid SNBT!".
Other examples include places where you can have lists of text components, or other objects and plain text lines. Examples:
-
set_written_book_pageshttps://misode.github.io/item-modifier/?share=pLbe99uqhS -
set_lorehttps://misode.github.io/item-modifier/?share=Fx7buhJc1V -
set_writable_book_pageshttps://misode.github.io/item-modifier/?share=FFMJO4v3c3