Format and lint the command parity changes

Clippy and rustfmt clean, and the scoreboard test now expects vanilla's
removeObjective, which keeps holders tracked without scores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-11 18:00:32 +02:00
parent 2e775aff2f
commit 7d35a25906
19 changed files with 568 additions and 124 deletions
+12 -4
View File
@@ -91,7 +91,11 @@ impl Registries {
pub fn fill_from_export(&mut self, r: &serde_json::Value) {
fn strings(v: &serde_json::Value) -> Vec<String> {
v.as_array()
.map(|a| a.iter().filter_map(|x| x.as_str().map(str::to_owned)).collect())
.map(|a| {
a.iter()
.filter_map(|x| x.as_str().map(str::to_owned))
.collect()
})
.unwrap_or_default()
}
let fill = |field: &mut Vec<String>, key: &str| {
@@ -135,12 +139,14 @@ impl Registries {
}
if self.clock_time_markers.is_empty() {
for (clock, markers) in r["clock_time_markers"].as_object().into_iter().flatten() {
self.clock_time_markers.insert(clock.clone(), strings(markers));
self.clock_time_markers
.insert(clock.clone(), strings(markers));
}
}
if self.advancement_criteria.is_empty() {
for (id, criteria) in r["advancement_criteria"].as_object().into_iter().flatten() {
self.advancement_criteria.insert(id.clone(), strings(criteria));
self.advancement_criteria
.insert(id.clone(), strings(criteria));
}
}
}
@@ -353,7 +359,9 @@ pub fn select_resources<'a>(ids: &'a [String], pattern: &str) -> Vec<&'a String>
} else {
format!("minecraft:{pattern}")
};
ids.iter().filter(|id| wildcard_match(id, &pattern)).collect()
ids.iter()
.filter(|id| wildcard_match(id, &pattern))
.collect()
}
/// SlotRanges.SLOTS: every slot range name and its size, in vanilla order.
+3 -1
View File
@@ -150,7 +150,9 @@ pub fn decode(registry: &str, t: &Tag, reg: &Registries) -> Result<(), String> {
"minecraft:dialog_list" => &["dialogs"],
_ => &[],
};
let keys: Vec<&str> = std::iter::once("title").chain(own.iter().copied()).collect();
let keys: Vec<&str> = std::iter::once("title")
.chain(own.iter().copied())
.collect();
require(map, t, &keys)
}),
"minecraft:worldgen/feature" | "minecraft:loot_table" => match t {
@@ -4,32 +4,231 @@
//! tools/generate_command_order.py; do not edit by hand.
pub const ORDER: &[(&str, &[&str])] = &[
("", &["advancement", "attribute", "execute", "bossbar", "clear", "clone", "compute", "damage", "data", "datapack", "debug", "defaultgamemode", "dialog", "difficulty", "effect", "me", "enchant", "experience", "xp", "fill", "fillbiome", "forceload", "function", "gamemode", "gamerule", "give", "help", "item", "kick", "kill", "list", "locate", "loot", "msg", "tell", "w", "swing", "particle", "place", "playsound", "posteffect", "random", "reload", "recipe", "fetchprofile", "return", "ride", "rotate", "say", "schedule", "scoreboard", "seed", "version", "setblock", "spawnpoint", "setworldspawn", "spectate", "spreadplayers", "stopsound", "stopwatch", "summon", "tag", "team", "teammsg", "tm", "teleport", "tp", "tellraw", "test", "tick", "time", "title", "trigger", "waypoint", "weather", "worldborder", "jfr", "publish", "unpublish"]),
("execute", &["run", "if", "unless", "as", "at", "store", "positioned", "rotated", "facing", "align", "anchored", "in", "summon", "on"]),
("execute if", &["block", "biome", "loaded", "dimension", "score", "blocks", "entity", "predicate", "function", "stopwatch", "data", "items", "slots"]),
("execute unless", &["block", "biome", "loaded", "dimension", "score", "blocks", "entity", "predicate", "function", "stopwatch", "data", "items", "slots"]),
(
"",
&[
"advancement",
"attribute",
"execute",
"bossbar",
"clear",
"clone",
"compute",
"damage",
"data",
"datapack",
"debug",
"defaultgamemode",
"dialog",
"difficulty",
"effect",
"me",
"enchant",
"experience",
"xp",
"fill",
"fillbiome",
"forceload",
"function",
"gamemode",
"gamerule",
"give",
"help",
"item",
"kick",
"kill",
"list",
"locate",
"loot",
"msg",
"tell",
"w",
"swing",
"particle",
"place",
"playsound",
"posteffect",
"random",
"reload",
"recipe",
"fetchprofile",
"return",
"ride",
"rotate",
"say",
"schedule",
"scoreboard",
"seed",
"version",
"setblock",
"spawnpoint",
"setworldspawn",
"spectate",
"spreadplayers",
"stopsound",
"stopwatch",
"summon",
"tag",
"team",
"teammsg",
"tm",
"teleport",
"tp",
"tellraw",
"test",
"tick",
"time",
"title",
"trigger",
"waypoint",
"weather",
"worldborder",
"jfr",
"publish",
"unpublish",
],
),
(
"execute",
&[
"run",
"if",
"unless",
"as",
"at",
"store",
"positioned",
"rotated",
"facing",
"align",
"anchored",
"in",
"summon",
"on",
],
),
(
"execute if",
&[
"block",
"biome",
"loaded",
"dimension",
"score",
"blocks",
"entity",
"predicate",
"function",
"stopwatch",
"data",
"items",
"slots",
],
),
(
"execute unless",
&[
"block",
"biome",
"loaded",
"dimension",
"score",
"blocks",
"entity",
"predicate",
"function",
"stopwatch",
"data",
"items",
"slots",
],
),
("execute facing", &["entity", "pos"]),
("datapack", &["enable", "disable", "list", "create"]),
("datapack enable name", &["after", "before", "last", "first"]),
(
"datapack enable name",
&["after", "before", "last", "first"],
),
("item", &["replace", "fill", "override", "modify"]),
("item replace entity target slots", &["from", "with"]),
("item fill entity target slots", &["from", "with"]),
("item override entity target slots", &["from", "with"]),
("loot replace entity entities slot", &["fish", "loot", "kill", "mine", "count"]),
("loot replace entity entities slot fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot replace entity entities slot mine pos", &["tool", "mainhand", "offhand"]),
("loot replace entity entities slot count fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot replace entity entities slot count mine pos", &["tool", "mainhand", "offhand"]),
("loot replace block targetPos slot", &["fish", "loot", "kill", "mine", "count"]),
("loot replace block targetPos slot fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot replace block targetPos slot mine pos", &["tool", "mainhand", "offhand"]),
("loot replace block targetPos slot count fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot replace block targetPos slot count mine pos", &["tool", "mainhand", "offhand"]),
("loot insert targetPos fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot insert targetPos mine pos", &["tool", "mainhand", "offhand"]),
("loot give players fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot give players mine pos", &["tool", "mainhand", "offhand"]),
("loot spawn targetPos fish loot_table pos", &["tool", "mainhand", "offhand"]),
("loot spawn targetPos mine pos", &["tool", "mainhand", "offhand"]),
("scoreboard players", &["list", "set", "get", "add", "remove", "reset", "enable", "display", "operation"]),
(
"loot replace entity entities slot",
&["fish", "loot", "kill", "mine", "count"],
),
(
"loot replace entity entities slot fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace entity entities slot mine pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace entity entities slot count fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace entity entities slot count mine pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace block targetPos slot",
&["fish", "loot", "kill", "mine", "count"],
),
(
"loot replace block targetPos slot fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace block targetPos slot mine pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace block targetPos slot count fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot replace block targetPos slot count mine pos",
&["tool", "mainhand", "offhand"],
),
(
"loot insert targetPos fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot insert targetPos mine pos",
&["tool", "mainhand", "offhand"],
),
(
"loot give players fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot give players mine pos",
&["tool", "mainhand", "offhand"],
),
(
"loot spawn targetPos fish loot_table pos",
&["tool", "mainhand", "offhand"],
),
(
"loot spawn targetPos mine pos",
&["tool", "mainhand", "offhand"],
),
(
"scoreboard players",
&[
"list",
"set",
"get",
"add",
"remove",
"reset",
"enable",
"display",
"operation",
],
),
];