Add stopwatch command and execute if stopwatch

Adds the stopwatches store saved in data/minecraft/stopwatches.dat, the /stopwatch create, query, restart and remove commands, and the execute if stopwatch condition, with the parse tree and parse fixture updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-10 06:20:08 +02:00
parent 5a5bdf6a9b
commit abb21704dd
10 changed files with 234 additions and 0 deletions
@@ -41,6 +41,7 @@ pub struct Registries {
pub bossbars: Vec<String>,
pub predicates: Vec<String>,
pub schedules: Vec<String>,
pub stopwatches: Vec<String>,
pub recipes: Vec<String>,
pub sounds: Vec<String>,
pub damage_types: Vec<String>,
@@ -156,6 +157,7 @@ pub enum ArgType {
TeamColor,
/// RangeArgument.Ints (`1`, `1..`, `..5`, `1..5`).
IntRange,
FloatRange,
/// NbtPathArgument (kept as text).
NbtPath,
/// NbtTagArgument: any SNBT value (kept as text).
@@ -426,6 +428,7 @@ pub enum Arg {
Anchor(bool),
ScoreHolder(ScoreHolderArg),
IntRange(IntRange),
DoubleRange(DoubleRange),
}
fn is_id_char(c: char) -> bool {
@@ -1750,6 +1753,7 @@ impl ArgType {
Arg::Str(name.to_owned())
}
ArgType::IntRange => Arg::IntRange(range_int(reader)?),
ArgType::FloatRange => Arg::DoubleRange(range_double(reader)?),
ArgType::Name(_) => Arg::Str(reader.read_string()?),
ArgType::Vec2 | ArgType::ColumnPos => {
let block = matches!(self, ArgType::ColumnPos);
@@ -1923,6 +1927,7 @@ impl ArgType {
"storages" => reg.storages.clone(),
"bossbars" => reg.bossbars.clone(),
"schedules" => reg.schedules.clone(),
"stopwatches" => reg.stopwatches.clone(),
"recipes" => reg.recipes.clone(),
"sounds" => reg.sounds.clone(),
"damage_types" => reg.damage_types.clone(),