UNPKG

minecraft-pcc

Version:

A simple, but powerful command compiler for Minecraft command players.

49 lines (45 loc) 2.05 kB
# Structure This file explain the project structure. Please be reminded to modify this if any changes has been made. + project + Parser: + Split lines, record line number(in string) + Remove empty lines, comments + Get embedded scripts, and run by JsRunner + Get #run commands and run by JsRunner, parse the result + Process inherit prefix, join lines + Parse into modules, procedures, chains + JsRunner: + Use eval.call in this scope + Load script from URL (local and http) + Run scripts + Evaluate #run command + Parse commands. (Check for custom commands, or parse the inline expression) + Chain: + Handle #chain command + Count number of commands(Determining Looping chain length) + Handle Wrapping, Looping + Handle annotation + Handle coordinate issues + CommandBlock: + Get final setblock command (Parse command at that time by JsRunner) + Handle prefix + Procedure: + Convert commands into advancements + CommandCombiner: + Combine multiple commands into one commmand. (May generate multiple 'one command' if the number of characters exceeds the limit) + CommandUtil: + Functions for string NBT, etc. + CommandModule: + Store module, filter modules + Options.json: + Options of the compiler + Translate & TranslateStrings.json + Translations for the outputs of the compiler + App: + Handle parameters + Handle options For the line number, we will use string, as there may have some line numbers like '12.34', which is generated by the '#run' command. For the scope, the current implementation is to write classes of different scopes. When the parser parse the lines, it will create the scope, and add elements(scope/line) to the scope. The scope will have an addElement method, to add elements(another scope/line) to the object. And it will have a generator function, to give back its content(lines) to its parent scope if needed. (For example, a chain)