From 708acf1c0ec05ac24faa013bada4b461b3ffa076 Mon Sep 17 00:00:00 2001 From: JunkyDeveloper Date: Sun, 1 Feb 2026 21:31:25 +0100 Subject: [PATCH 1/6] adds pos1 to make an assert about a full area --- .gitignore | 1 + src/executor/handlers.rs | 65 ++++++++++++++++++++++++++++------------ src/executor/mod.rs | 12 ++++++++ 3 files changed, 59 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 42f67a5..4763b0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target .cache/index.json +.idea \ No newline at end of file diff --git a/src/executor/handlers.rs b/src/executor/handlers.rs index b426d97..62dd99b 100644 --- a/src/executor/handlers.rs +++ b/src/executor/handlers.rs @@ -362,6 +362,12 @@ impl TestExecutor { Ok(()) } + pub(super) fn handle_pos1(&mut self, args: &[String]) { + let x = args[0].parse::().unwrap_or(0); + let y = args[1].parse::().unwrap_or(0); + let z = args[2].parse::().unwrap_or(0); + self.pos1 = Some([x, y, z]); + } pub(super) async fn handle_record_assert(&mut self, args: &[String]) -> Result<()> { let _recorder = match self.recorder.as_mut() { @@ -379,28 +385,49 @@ impl TestExecutor { let y = args[1].parse::().unwrap_or(0); let z = args[2].parse::().unwrap_or(0); let block_pos = [x, y, z]; - + let mut blocks = Vec::new(); + if let Some(pos1) = self.pos1 + { + let min_x = block_pos[0].min(pos1[0]); + let max_x = block_pos[0].max(pos1[0]); + let min_y = block_pos[1].min(pos1[1]); + let max_y = block_pos[1].max(pos1[1]); + let min_z = block_pos[2].min(pos1[2]); + let max_z = block_pos[2].max(pos1[2]); + + for x in min_x..=max_x { + for y in min_y..=max_y { + for z in min_z..=max_z { + blocks.push([x, y, z]); + } + } + } + } + else { + blocks.push(block_pos) + } // Get block at position - if let Some(block_str) = self.bot.get_block(block_pos).await? { - let block_id = block::extract_block_id(&block_str); - let recorder = self.recorder.as_mut().unwrap(); - recorder.add_assertion(block_pos, &block_id); + for pos in blocks { + if let Some(block_str) = self.bot.get_block(pos).await? { + let block_id = block::extract_block_id(&block_str); + let recorder = self.recorder.as_mut().unwrap(); + recorder.add_assertion(pos, &block_id); - self.bot - .send_command(&format!( - "say Added assert at [{}, {}, {}] = {}", - block_pos[0], block_pos[1], block_pos[2], block_id - )) - .await?; - } else { - self.bot - .send_command(&format!( - "say No block found at [{}, {}, {}]", - block_pos[0], block_pos[1], block_pos[2] - )) - .await?; + self.bot + .send_command(&format!( + "say Added assert at [{}, {}, {}] = {}", + pos[0], pos[1], pos[2], block_id + )) + .await?; + } else { + self.bot + .send_command(&format!( + "say No block found at [{}, {}, {}]", + pos[0], pos[1], pos[2] + )) + .await?; + } } - Ok(()) } diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 419b528..32b23a4 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -40,6 +40,7 @@ pub struct TestExecutor { verbose: bool, quiet: bool, fail_fast: bool, + pos1: Option<[i32; 3]>, } impl Default for TestExecutor { @@ -51,6 +52,7 @@ impl Default for TestExecutor { verbose: false, quiet: false, fail_fast: false, + pos1: None, } } } @@ -218,6 +220,16 @@ impl TestExecutor { self.handle_record_tick().await?; } + "!pos1" => { + if args.len() < 3 { + self.bot + .send_command("say Usage: !assert ") + .await?; + continue; + } + self.handle_pos1(&args); + } + "!assert" => { if args.len() < 3 { self.bot From 83b4e1c4cb87e7633e49851e5f1428afd1a0dc62 Mon Sep 17 00:00:00 2001 From: JunkyDeveloper Date: Sun, 1 Feb 2026 22:57:49 +0100 Subject: [PATCH 2/6] also allow !pos instead of !pos1 --- src/executor/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 32b23a4..320b820 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -220,7 +220,7 @@ impl TestExecutor { self.handle_record_tick().await?; } - "!pos1" => { + "!pos1" | "!pos" => { if args.len() < 3 { self.bot .send_command("say Usage: !assert ") From ddaf0e93183843548dff99847ba06e3af8713af3 Mon Sep 17 00:00:00 2001 From: JunkyDeveloper Date: Sun, 1 Feb 2026 23:00:12 +0100 Subject: [PATCH 3/6] cargo fmt --- src/executor/handlers.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/executor/handlers.rs b/src/executor/handlers.rs index 3a0c421..c7259d7 100644 --- a/src/executor/handlers.rs +++ b/src/executor/handlers.rs @@ -385,8 +385,7 @@ impl TestExecutor { let z = args[2].parse::().unwrap_or(0); let block_pos = [x, y, z]; let mut blocks = Vec::new(); - if let Some(pos1) = self.pos1 - { + if let Some(pos1) = self.pos1 { let min_x = block_pos[0].min(pos1[0]); let max_x = block_pos[0].max(pos1[0]); let min_y = block_pos[1].min(pos1[1]); @@ -401,8 +400,7 @@ impl TestExecutor { } } } - } - else { + } else { blocks.push(block_pos) } // Get block at position From c704c6a72a97ef2749881ee554e08d231ae94bb8 Mon Sep 17 00:00:00 2001 From: JunkyDeveloper Date: Sat, 7 Mar 2026 20:23:52 +0100 Subject: [PATCH 4/6] fixed some things again --- Cargo.lock | 3 --- Cargo.toml | 3 --- src/executor/handlers.rs | 4 ++++ src/executor/mod.rs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e68269d..9ff29f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1429,11 +1429,8 @@ dependencies = [ "clap_complete", "colored", "flint-core", - "futures", "parking_lot", - "serde", "serde_json", - "thiserror 2.0.17", "tokio", "tracing", "tracing-subscriber", diff --git a/Cargo.toml b/Cargo.toml index 72a18c7..2753645 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,15 +7,12 @@ license = "MIT" [dependencies] azalea = { git = "https://github.com/azalea-rs/azalea", rev = "1accbac" } tokio = { version = "1.48", features = ["full"] } -serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" anyhow = "1.0" -thiserror = "2.0" clap = { version = "4.5", features = ["derive"] } colored = "3.0" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } parking_lot = "0.12" -futures = "0.3" flint-core = { git = "https://github.com/FlintTestMC/flint-core", rev = "b04ad23" } clap_complete = "4.5.65" diff --git a/src/executor/handlers.rs b/src/executor/handlers.rs index c7259d7..ee68ad5 100644 --- a/src/executor/handlers.rs +++ b/src/executor/handlers.rs @@ -362,6 +362,10 @@ impl TestExecutor { Ok(()) } pub(super) fn handle_pos1(&mut self, args: &[String]) { + if args.is_empty() { + self.pos1 = None; + return; + } let x = args[0].parse::().unwrap_or(0); let y = args[1].parse::().unwrap_or(0); let z = args[2].parse::().unwrap_or(0); diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 6cc8ea3..8280b5e 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -220,7 +220,7 @@ impl TestExecutor { } "!pos1" | "!pos" => { - if args.len() < 3 { + if (args.len() > 0 && args.len() < 3) || args.len() > 3 { self.bot .send_command("say Usage: !assert ") .await?; From 1effaac04105fc2a5f307851cb328f61ae4b630b Mon Sep 17 00:00:00 2001 From: JunkyDeveloper Date: Tue, 10 Mar 2026 01:19:23 +0100 Subject: [PATCH 5/6] sprint, tick assert works for water --- src/executor/handlers.rs | 14 ++++++++++++++ src/executor/mod.rs | 21 ++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/executor/handlers.rs b/src/executor/handlers.rs index ee68ad5..0cec8e8 100644 --- a/src/executor/handlers.rs +++ b/src/executor/handlers.rs @@ -64,6 +64,12 @@ impl TestExecutor { self.bot .send_command("say Recorder actions: !assert , !assert_changes") .await?; + self.bot + .send_command("say Recorder actions: !pos1 , !pos - Allow to use assert for a 3d area") + .await?; + self.bot + .send_command("say Recorder actions: !sprint - ticks this ticks and asserts after each tick") + .await?; self.bot .send_command("say !stop - Exit interactive mode") .await?; @@ -581,4 +587,12 @@ impl TestExecutor { } Ok(()) } + + pub(super) async fn handle_record_sprint(&mut self, ticks: u32) -> Result<()> { + for _ in 0..ticks { + self.handle_record_tick().await?; + self.handle_record_assert(&self.last_assert_pos.clone()).await?; + } + Ok(()) + } } diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 8280b5e..bbfedac 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -14,7 +14,6 @@ use flint_core::results::{ActionOutcome, AssertFailure, TestResult}; use flint_core::test_spec::{TestSpec, TimelineEntry}; use flint_core::timeline::TimelineAggregate; use std::io::Write; - pub use tick::{COMMAND_DELAY_MS, MIN_RETRY_DELAY_MS}; // Timing constants @@ -40,6 +39,7 @@ pub struct TestExecutor { quiet: bool, fail_fast: bool, pos1: Option<[i32; 3]>, + last_assert_pos: Vec, } impl Default for TestExecutor { @@ -52,6 +52,7 @@ impl Default for TestExecutor { quiet: false, fail_fast: false, pos1: None, + last_assert_pos: vec![], } } } @@ -236,8 +237,26 @@ impl TestExecutor { .await?; continue; } + self.last_assert_pos = args.clone(); self.handle_record_assert(&args).await?; } + "!sprint" => { + if args.len() != 1 { + self.bot.send_command("say Usage: !sprint ").await?; + continue; + } + let ticks = args[0].parse::().unwrap_or(1); + if ticks == 0 { + self.bot.send_command("say Sprint ticks must be greater than 0").await?; + continue; + } + if self.last_assert_pos.is_empty(){ + self.bot.send_command("say Please assert a position first, which should be used for each string (can be also a 3d area)").await?; + continue; + } + self.handle_record_sprint(ticks) + .await?; + } "!save" => { if self.handle_record_save().await? { From e50b19b08a7e553e4a0e47c45e58781f5f22cf0f Mon Sep 17 00:00:00 2001 From: JunkyDeveloper Date: Tue, 10 Mar 2026 01:50:54 +0100 Subject: [PATCH 6/6] cargo fmt, fixed bug and some clippy --- src/executor/block.rs | 2 +- src/executor/handlers.rs | 9 ++++++--- src/executor/mod.rs | 11 ++++++----- src/executor/recorder/bounding_box.rs | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/executor/block.rs b/src/executor/block.rs index ec69d2d..6f5f866 100644 --- a/src/executor/block.rs +++ b/src/executor/block.rs @@ -106,7 +106,7 @@ pub fn make_block(block_str: &str) -> Block { if let Some((k, v)) = pair.split_once('=') { properties.insert( k.trim().to_string(), - serde_json::Value::String(v.trim().to_string()), + serde_json::Value::String(v.strip_prefix('_').unwrap_or(v).trim().to_string()), ); } } diff --git a/src/executor/handlers.rs b/src/executor/handlers.rs index 0cec8e8..9e6efc1 100644 --- a/src/executor/handlers.rs +++ b/src/executor/handlers.rs @@ -26,7 +26,7 @@ pub fn parse_command(message: &str) -> Option<(String, Vec)> { return None; }; - let parts: Vec<&str> = command_str.trim().split_whitespace().collect(); + let parts: Vec<&str> = command_str.split_whitespace().collect(); if parts.is_empty() { return None; } @@ -65,7 +65,9 @@ impl TestExecutor { .send_command("say Recorder actions: !assert , !assert_changes") .await?; self.bot - .send_command("say Recorder actions: !pos1 , !pos - Allow to use assert for a 3d area") + .send_command( + "say Recorder actions: !pos1 , !pos - Allow to use assert for a 3d area", + ) .await?; self.bot .send_command("say Recorder actions: !sprint - ticks this ticks and asserts after each tick") @@ -591,7 +593,8 @@ impl TestExecutor { pub(super) async fn handle_record_sprint(&mut self, ticks: u32) -> Result<()> { for _ in 0..ticks { self.handle_record_tick().await?; - self.handle_record_assert(&self.last_assert_pos.clone()).await?; + self.handle_record_assert(&self.last_assert_pos.clone()) + .await?; } Ok(()) } diff --git a/src/executor/mod.rs b/src/executor/mod.rs index bbfedac..184c92a 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -221,7 +221,7 @@ impl TestExecutor { } "!pos1" | "!pos" => { - if (args.len() > 0 && args.len() < 3) || args.len() > 3 { + if (!args.is_empty() && args.len() < 3) || args.len() > 3 { self.bot .send_command("say Usage: !assert ") .await?; @@ -247,15 +247,16 @@ impl TestExecutor { } let ticks = args[0].parse::().unwrap_or(1); if ticks == 0 { - self.bot.send_command("say Sprint ticks must be greater than 0").await?; + self.bot + .send_command("say Sprint ticks must be greater than 0") + .await?; continue; } - if self.last_assert_pos.is_empty(){ + if self.last_assert_pos.is_empty() { self.bot.send_command("say Please assert a position first, which should be used for each string (can be also a 3d area)").await?; continue; } - self.handle_record_sprint(ticks) - .await?; + self.handle_record_sprint(ticks).await?; } "!save" => { diff --git a/src/executor/recorder/bounding_box.rs b/src/executor/recorder/bounding_box.rs index 241c2d0..082cfe8 100644 --- a/src/executor/recorder/bounding_box.rs +++ b/src/executor/recorder/bounding_box.rs @@ -17,7 +17,7 @@ impl BoundingBox { /// Expand the bounding box to include a position pub fn expand(&mut self, pos: [i32; 3]) { - for i in 0..3 { + for (i, _) in pos.iter().enumerate() { self.min[i] = self.min[i].min(pos[i]); self.max[i] = self.max[i].max(pos[i]); }