WIP: command and datapack tweaks
Work in progress on commands, functions and scoreboard handling carried over from the interrupted run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@ pub struct Registries {
|
||||
/// Boss bar ids and datapack predicate ids.
|
||||
pub bossbars: Vec<String>,
|
||||
pub predicates: Vec<String>,
|
||||
pub item_modifiers: Vec<String>,
|
||||
pub schedules: Vec<String>,
|
||||
pub stopwatches: Vec<String>,
|
||||
pub recipes: Vec<String>,
|
||||
@@ -1936,6 +1937,7 @@ impl ArgType {
|
||||
"templates" => reg.templates.clone(),
|
||||
"random_sequences" => reg.random_sequences.clone(),
|
||||
"predicates" => reg.predicates.clone(),
|
||||
"item_modifiers" => reg.item_modifiers.clone(),
|
||||
"time_markers" => reg.time_markers.clone(),
|
||||
"advancements" => reg.advancements.clone(),
|
||||
_ => Vec::new(),
|
||||
|
||||
@@ -222,6 +222,14 @@ fn data_and_tag_commands_parse() {
|
||||
assert_eq!(id, "data.get");
|
||||
assert_eq!(args, ["target", "path", "scale"]);
|
||||
assert_eq!(run("data get block ~ ~ ~ Items[0]").unwrap().0, "data.get");
|
||||
assert_eq!(
|
||||
run("item modify entity @s weapon.mainhand a:b").unwrap().0,
|
||||
"item.modify"
|
||||
);
|
||||
assert_eq!(
|
||||
run("item modify block 1 2 3 container.0 a:b").unwrap().0,
|
||||
"item.modify"
|
||||
);
|
||||
assert_eq!(run("data get storage my:store").unwrap().0, "data.get");
|
||||
assert_eq!(run("data merge storage a:b {x:1}").unwrap().0, "data.merge");
|
||||
assert_eq!(
|
||||
|
||||
@@ -151,6 +151,18 @@ pub fn register(d: &mut Dispatcher, root: usize) {
|
||||
fn item(d: &mut Dispatcher, root: usize) {
|
||||
let item = d.literal(root, "item");
|
||||
d.requires(item, GAMEMASTERS);
|
||||
let modify = d.literal(item, "modify");
|
||||
for provider in ["entity", "block"] {
|
||||
let p = d.literal(modify, provider);
|
||||
let target = if provider == "entity" {
|
||||
d.argument(p, "target", ENTITIES)
|
||||
} else {
|
||||
d.argument(p, "targetPos", ArgType::BlockPos)
|
||||
};
|
||||
let slot = d.argument(target, "slot", ArgType::Slot);
|
||||
let modifier = d.argument(slot, "modifier", ArgType::Id("item_modifiers"));
|
||||
d.executes(modifier, "item.modify");
|
||||
}
|
||||
for mode in ["replace", "fill", "override"] {
|
||||
let m = d.literal(item, mode);
|
||||
for provider in ["entity", "block"] {
|
||||
|
||||
Reference in New Issue
Block a user