sandstone
sandstone copied to clipboard
JSON Text Components with Selector syntax
The following example does not compile because the selector only accepts strings. It would be nice to be able to use selectors in JSON Text Components without appending .toString()
. This is already implemented for score components.
import { Selector, MCFunction, tellraw } from 'sandstone'
MCFunction('hello', () => {
const closest = Selector('@p', {distance: [.1, Infinity]})
tellraw(Selector('@a'), {
text: 'My closest friend is ',
extra: [
{ selector: closest }
]
})
})
Also, the selector component is missing the optional "separator" property, which is very useful.
Reference: https://minecraft.fandom.com/wiki/Raw_JSON_text_format#Entity_Names