Complete /execute and add functions, bossbars, items and tick
/execute now has every vanilla subcommand: store (result or success into scores, boss bars and entity, block or storage data with a type and scale), positioned over a heightmap, summon, on (owner, vehicle, controller, passengers, target, attacker), and the if/unless conditions score (all comparisons and matches), blocks, biome, predicate, function, data, items and slots on top of block, entity, loaded and dimension, with the vanilla pass, fail and count messages. Data packs in the world's datapacks folder (folders and zips) provide functions with comments, line continuation and $ macros, function tags including minecraft:load and minecraft:tick, and predicates; /function (with arguments or "with" sources), /return (value, fail and run), /schedule, /reload and /datapack list, enable and disable work against them. Also added: /bossbar with a boss bar overlay and saving, /item replace, fill and override over player, mob, armor stand, item frame and container slots, /random and /teammsg, and /tick rate, freeze, step and sprint on the game clock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -344,69 +344,11 @@ pub fn build() -> Dispatcher {
|
||||
|
||||
super::tree_scoreboard::register(&mut d, root);
|
||||
super::tree_data::register(&mut d, root);
|
||||
execute(&mut d, root);
|
||||
super::tree_execute::register(&mut d, root);
|
||||
super::tree_misc::register(&mut d, root);
|
||||
d
|
||||
}
|
||||
|
||||
/// ExecuteCommand: modifiers redirect back to `execute`, `run` to the root;
|
||||
/// conditions both execute (as a test) and continue the chain. `store`,
|
||||
/// `summon`, `on` and score/data conditions are not implemented.
|
||||
fn execute(d: &mut Dispatcher, root: usize) {
|
||||
let ex = d.literal(root, "execute");
|
||||
d.requires(ex, GAMEMASTERS);
|
||||
let run = d.literal(ex, "run");
|
||||
d.redirect(run, root);
|
||||
for name in ["as", "at"] {
|
||||
let l = d.literal(ex, name);
|
||||
let t = d.argument(l, "targets", ENTITIES);
|
||||
d.redirect(t, ex);
|
||||
}
|
||||
let positioned = d.literal(ex, "positioned");
|
||||
let pos = d.argument(positioned, "pos", ArgType::Vec3 { center: true });
|
||||
d.redirect(pos, ex);
|
||||
let as_ = d.literal(positioned, "as");
|
||||
let t = d.argument(as_, "targets", ENTITIES);
|
||||
d.redirect(t, ex);
|
||||
let rotated = d.literal(ex, "rotated");
|
||||
let rot = d.argument(rotated, "rot", ArgType::Rotation);
|
||||
d.redirect(rot, ex);
|
||||
let as_ = d.literal(rotated, "as");
|
||||
let t = d.argument(as_, "targets", ENTITIES);
|
||||
d.redirect(t, ex);
|
||||
let facing = d.literal(ex, "facing");
|
||||
let pos = d.argument(facing, "pos", ArgType::Vec3 { center: true });
|
||||
d.redirect(pos, ex);
|
||||
let entity = d.literal(facing, "entity");
|
||||
let t = d.argument(entity, "targets", ENTITIES);
|
||||
let anchor = d.argument(t, "anchor", ArgType::Anchor);
|
||||
d.redirect(anchor, ex);
|
||||
let align = d.literal(ex, "align");
|
||||
let axes = d.argument(align, "axes", ArgType::Swizzle);
|
||||
d.redirect(axes, ex);
|
||||
let anchored = d.literal(ex, "anchored");
|
||||
let anchor = d.argument(anchored, "anchor", ArgType::Anchor);
|
||||
d.redirect(anchor, ex);
|
||||
let in_ = d.literal(ex, "in");
|
||||
let dim = d.argument(in_, "dimension", ArgType::Dimension);
|
||||
d.redirect(dim, ex);
|
||||
for mode in ["if", "unless"] {
|
||||
let m = d.literal(ex, mode);
|
||||
let block = d.literal(m, "block");
|
||||
let pos = d.argument(block, "pos", ArgType::BlockPos);
|
||||
let predicate = d.argument(pos, "block", ArgType::BlockPredicate);
|
||||
let entity = d.literal(m, "entity");
|
||||
let targets = d.argument(entity, "entities", ENTITIES);
|
||||
let loaded = d.literal(m, "loaded");
|
||||
let lpos = d.argument(loaded, "pos", ArgType::BlockPos);
|
||||
let dimension = d.literal(m, "dimension");
|
||||
let dim = d.argument(dimension, "dimension", ArgType::Dimension);
|
||||
for node in [predicate, targets, lpos, dim] {
|
||||
d.executes(node, "execute");
|
||||
d.redirect(node, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// AdvancementCommands: grant|revoke <targets> only|from|until|through
|
||||
/// <advancement> | everything; `only` takes an optional criterion.
|
||||
fn advancement(d: &mut Dispatcher, root: usize) {
|
||||
|
||||
Reference in New Issue
Block a user