Also called 'spu'. An online tool that can help you update minecraft commands.
Type https://spu.spgoding.com in the web browser, or open the ./docs/index.html locally.
The WheelChief will try to parse your command(s) when you click 'Update'. All commands is stored in a CmdNode
, whose format is very similiar to the format of the commands.json
file that data generator provides:
interface CmdNode {
type: 'root' | 'literal' | 'argument'
children?: { [nodeName: string]: CmdNode }
parser?: string
properties?: { [propertyName: string]: any }
updater?: string
executable?: boolean
redirect?: string[]
spu_script?: string
}
e.g. You type foobar @a {baz:qux}
and it can be parsed in the following nodes:
{
type: 'root',
children: {
foobar: {
type: 'literal',
children: {
entity: {
type: 'argument',
parser: 'minecraft:entity',
properties: {
amount: 'multiple',
type: 'entities'
},
children: {
nbt: {
type: 'argument',
parser: 'minecraft:nbt',
updater: 'spgoding:entity_nbt',
executable: true,
spu_script: '%0 $setNbtToSelector%1%2'
}
}
}
}
}
}
}
And then the WheelChief will return this (if no updater
is specific in the CmdNode
, the WheelChief will store its parser
in updater
):
{
command: {
args: [
{ value: 'foobar', updater: undefined },
{ value: '@a', updater: 'minecraft:entity' },
{ value: '{baz:qux}', updater: 'spgoding:entity_nbt' }
],
spu_script: '%0 $setNbtToSelector%1%2'
},
...
}
The WheelChief will update every argument according to its updater
. All updaters are defined in src/utils/wheel_chief/updater.ts
and src/**to**/updater.ts
. After updating all arguments we will get this (well, it just adds some quotes):
{
command: {
args: [
{ value: 'foobar', updater: undefined },
{ value: '@a', updater: 'minecraft:entity' },
{ value: '{baz:"qux"}', updater: 'spgoding:entity_nbt' }
],
spu_script: '%0 $setNbtToSelector%1%2'
},
...
}
Finally the spu_script
will be executed. %0
will be replaced with the first argument of the command(args[0].value
), %1
will be the second(args[1].value
), and so on. A token that begins with $
will be executed as a function with following %n
as its parameter(s). So finally you will get foobar @a[nbt={baz:"qux"}]
. Is that amazing?
-
Fork this this repo and clone it to local.
-
Install dependencies.
npm i
-
Edit files in
./src
. -
Build it.
npm run build
-
Send
Pull Request
to me.