diff --git a/crates/horizon-client/src/command/codec.rs b/crates/horizon-client/src/command/codec.rs index 783d26e30..bfade24e7 100644 --- a/crates/horizon-client/src/command/codec.rs +++ b/crates/horizon-client/src/command/codec.rs @@ -130,7 +130,17 @@ pub fn decode(registry: &str, t: &Tag, reg: &Registries) -> Result<(), String> { "minecraft:slot_source" => element_or_list(t, &|x| { dispatch(x, reg, "minecraft:slot_source_type", &|_, _, _| Ok(())) }), - "minecraft:dialog" => dispatch(t, reg, "minecraft:dialog_type", &|_, _, _| Ok(())), + // Dialog types: CommonDialogData's title, then each type's own. + "minecraft:dialog" => dispatch(t, reg, "minecraft:dialog_type", &|id, map, t| { + let own: &[&str] = match id { + "minecraft:confirmation" => &["yes", "no"], + "minecraft:multi_action" => &["actions"], + "minecraft:dialog_list" => &["dialogs"], + _ => &[], + }; + 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 { Tag::Compound(_) => Ok(()), _ => Err(not_map(t)), diff --git a/crates/horizon-client/src/game/commands.rs b/crates/horizon-client/src/game/commands.rs index c55a4af0c..940c46a74 100644 --- a/crates/horizon-client/src/game/commands.rs +++ b/crates/horizon-client/src/game/commands.rs @@ -866,7 +866,9 @@ impl Game<'_> { ], ))); } - for _ in &targets { + // An air stack is empty: nothing is given (but the message still is). + let empty = id == "minecraft:air"; + for _ in targets.iter().filter(|_| !empty) { let mut remaining = count; while remaining > 0 { let size = remaining.min(max_stack); diff --git a/crates/horizon-client/src/game/commands/extra.rs b/crates/horizon-client/src/game/commands/extra.rs index 498898d92..5605194b7 100644 --- a/crates/horizon-client/src/game/commands/extra.rs +++ b/crates/horizon-client/src/game/commands/extra.rs @@ -45,6 +45,8 @@ pub(in crate::game) struct CommandExtras { pub waypoint_icons: HashMap, /// The dialog `/dialog show` opened (its id or inline definition). pub dialog: Option, + /// `/datapack disable vanilla` took the built-in pack out of the selection. + pub vanilla_disabled: bool, /// The waypoint manager's tracked transmitters (None until first used). pub waypoints: Option>, /// Entities whose waypoint transmit range changed since they last ticked. diff --git a/crates/horizon-client/src/game/commands/world_cmds.rs b/crates/horizon-client/src/game/commands/world_cmds.rs index 00b52a0b0..bd00c40f1 100644 --- a/crates/horizon-client/src/game/commands/world_cmds.rs +++ b/crates/horizon-client/src/game/commands/world_cmds.rs @@ -1025,145 +1025,215 @@ impl Game<'_> { if targets.is_empty() { return Err(err("argument.entity.notfound.entity", &[])); } - // Units: each entity, or each team together with `respectTeams`. - let mut units: Vec> = Vec::new(); - let mut teams: Vec<(String, usize)> = Vec::new(); - for &t in &targets { - let team = if respect { - self.holder_name(t) - .and_then(|h| self.score.board.players_team(&h).map(|x| x.name.clone())) - } else { - None - }; - match team { - Some(name) => match teams.iter().find(|(n, _)| *n == name) { - Some((_, i)) => units[*i].push(t), - None => { - teams.push((name, units.len())); - units.push(vec![t]); - } - }, - None => units.push(vec![t]), + // SpreadPlayersCommand: one position per entity, or per team (every + // non-player and team-less player sharing one) with respectTeams. + let team_of = |g: &mut Self, t: Target| -> Option { + if t != Target::Player { + return None; } + g.holder_name(t) + .and_then(|h| g.score.board.players_team(&h).map(|x| x.name.clone())) + }; + let count = if respect { + let mut seen: Vec> = Vec::new(); + for &t in &targets { + let team = team_of(self, t); + if !seen.contains(&team) { + seen.push(team); + } + } + seen.len() + } else { + targets.len() + }; + let centre_f = [centre[0] as f32, centre[2] as f32]; + let (cx, cz) = (f64::from(centre_f[0]), f64::from(centre_f[1])); + let (min_x, max_x) = (cx - range, cx + range); + let (min_z, max_z) = (cz - range, cz + range); + // Mth.nextDouble. + let next = |g: &mut Self, lo: f64, hi: f64| { + if lo >= hi { + lo + } else { + g.world.random.next_double() * (hi - lo) + lo + } + }; + let mut points: Vec<[f64; 2]> = Vec::with_capacity(count); + for _ in 0..count { + let x = next(self, min_x, max_x); + let z = next(self, min_z, max_z); + points.push([x, z]); } - let (min_x, max_x) = (centre[0] - range, centre[0] + range); - let (min_z, max_z) = (centre[2] - range, centre[2] + range); - let mut points: Vec<[f64; 2]> = units - .iter() - .map(|_| { - let r = &mut self.world.random; - [ - min_x + r.next_double() * (max_x - min_x), - min_z + r.next_double() * (max_z - min_z), - ] - }) - .collect(); - let n = points.len(); - let mut ok = false; - for _ in 0..10_000 { - let mut moved = false; - let mut crowded = 0; - for i in 0..n { - let mut push = [0.0, 0.0]; - let mut near = 0; - for j in 0..n { + let mut collisions = true; + let mut min_distance = f64::from(f32::MAX); + let mut iteration = 0; + while iteration < 10_000 && collisions { + collisions = false; + min_distance = f64::from(f32::MAX); + for i in 0..points.len() { + let mut neighbours = 0; + let mut avg = [0.0f64, 0.0f64]; + for j in 0..points.len() { if i == j { continue; } - let (dx, dz) = (points[j][0] - points[i][0], points[j][1] - points[i][1]); - let d = (dx * dx + dz * dz).sqrt(); - if d < spread { - near += 1; - if d > 1.0e-6 { - push[0] -= dx / d; - push[1] -= dz / d; - } else { - let r = &mut self.world.random; - push[0] += r.next_double() - 0.5; - push[1] += r.next_double() - 0.5; - } + let (dx, dz) = (points[i][0] - points[j][0], points[i][1] - points[j][1]); + let dist = (dx * dx + dz * dz).sqrt(); + min_distance = min_distance.min(dist); + if dist < spread { + neighbours += 1; + avg[0] += points[j][0] - points[i][0]; + avg[1] += points[j][1] - points[i][1]; } } - if near > 0 { - crowded += 1; - let len = (push[0] * push[0] + push[1] * push[1]).sqrt().max(1.0e-6); - points[i][0] += push[0] / len; - points[i][1] += push[1] / len; - moved = true; + if neighbours > 0 { + avg[0] /= f64::from(neighbours); + avg[1] /= f64::from(neighbours); + let length = (avg[0] * avg[0] + avg[1] * avg[1]).sqrt(); + if length > 0.0 { + points[i][0] -= avg[0] / length; + points[i][1] -= avg[1] / length; + } else { + points[i][0] = next(self, min_x, max_x); + points[i][1] = next(self, min_z, max_z); + } + collisions = true; + } + let p = &mut points[i]; + let before = *p; + p[0] = if p[0] < min_x { min_x } else if p[0] > max_x { max_x } else { p[0] }; + p[1] = if p[1] < min_z { min_z } else if p[1] > max_z { max_z } else { p[1] }; + if before != *p { + collisions = true; } - let before = points[i]; - points[i][0] = points[i][0].clamp(min_x, max_x); - points[i][1] = points[i][1].clamp(min_z, max_z); - moved |= before != points[i]; } - if !moved || crowded == 0 { - ok = true; - break; + if !collisions { + for i in 0..points.len() { + if !self.spread_safe(points[i], max_y) { + points[i][0] = next(self, min_x, max_x); + points[i][1] = next(self, min_z, max_z); + collisions = true; + } + } } + iteration += 1; } - if !ok { - let key = if teams.is_empty() { - "commands.spreadplayers.failed.entities" - } else { + if min_distance == f64::from(f32::MAX) { + min_distance = 0.0; + } + let float = |v: f32| Text::literal(horizon_client::snbt::java_float(v)); + if iteration >= 10_000 { + let key = if respect { "commands.spreadplayers.failed.teams" + } else { + "commands.spreadplayers.failed.entities" }; - return Err(err( + return Err(text_error( key, &[ - &n, - &format!("{:.2}", centre[0]), - &format!("{:.2}", centre[2]), - &format!("{:.2}", spread), + num(points.len()), + float(centre_f[0]), + float(centre_f[1]), + Text::literal(format!("{min_distance:.2}")), ], )); } - // Stand each unit on the ground under `max_y`. + // setPlayerPositions. let mut total = 0.0; - for (unit, p) in units.iter().zip(&points) { - let (bx, bz) = (p[0].floor() as i32, p[1].floor() as i32); - let mut y = None; - for yy in (horizon_client::chunk::MIN_Y - ..max_y.min(horizon_client::chunk::MIN_Y + horizon_client::chunk::HEIGHT)) - .rev() - { - let solid = |dy: i32| { - self.res - .facts - .get(self.world.block(bx, yy + dy, bz)) - .full_collision - }; - if solid(-1) && !solid(0) && !solid(1) { - y = Some(yy); - break; + let mut index = 0; + let mut team_points: Vec<(Option, usize)> = Vec::new(); + for &t in &targets { + let i = if respect { + let team = team_of(self, t); + match team_points.iter().find(|(k, _)| *k == team) { + Some((_, i)) => *i, + None => { + team_points.push((team, index)); + index += 1; + index - 1 + } } - } - let y = y.unwrap_or(max_y); - for &t in unit { - self.teleport_to( - t, - [f64::from(bx) + 0.5, f64::from(y), f64::from(bz) + 0.5], - None, - ); - } - let (dx, dz) = (p[0] - centre[0], p[1] - centre[2]); - total += (dx * dx + dz * dz).sqrt(); + } else { + index += 1; + index - 1 + }; + let p = points[i]; + let y = self.spread_spawn_y(p, max_y); + self.teleport_to( + t, + [p[0].floor() + 0.5, f64::from(y), p[1].floor() + 0.5], + None, + ); + let closest = points + .iter() + .enumerate() + .filter(|(j, _)| *j != i) + .map(|(_, q)| ((p[0] - q[0]).powi(2) + (p[1] - q[1]).powi(2)).sqrt()) + .fold(f64::MAX, f64::min); + total += closest; } - let average = if n == 0 { 0.0 } else { total / n as f64 }; - let key = if teams.is_empty() { - "commands.spreadplayers.success.entities" + let average = if targets.len() < 2 { + 0.0 } else { + total / targets.len() as f64 + }; + let key = if respect { "commands.spreadplayers.success.teams" + } else { + "commands.spreadplayers.success.entities" }; self.feedback(Text::translate( key, &[ - num(n), - Text::literal(format!("{:.2}", centre[0])), - Text::literal(format!("{:.2}", centre[2])), + num(points.len()), + float(centre_f[0]), + float(centre_f[1]), Text::literal(format!("{average:.2}")), ], )); - Ok(n as i32) + Ok(points.len() as i32) + } + /// `SpreadPlayersCommand.Position.getSpawnY`. + fn spread_spawn_y(&self, p: [f64; 2], max_y: i32) -> i32 { + let (x, z) = (p[0].floor() as i32, p[1].floor() as i32); + let air = |y: i32| { + let name: &str = &self.res.facts.get(self.world.block(x, y, z)).name; + matches!( + name, + "minecraft:air" | "minecraft:cave_air" | "minecraft:void_air" + ) + }; + let mut y = max_y + 1; + let mut air2 = air(y); + y -= 1; + let mut air1 = air(y); + while y > horizon_client::chunk::MIN_Y { + y -= 1; + let current = air(y); + if !current && air1 && air2 { + return y + 1; + } + air2 = air1; + air1 = current; + } + max_y + 1 + } + /// `SpreadPlayersCommand.Position.isSafe`. + fn spread_safe(&self, p: [f64; 2], max_y: i32) -> bool { + let y = self.spread_spawn_y(p, max_y) - 1; + let (x, z) = (p[0].floor() as i32, p[1].floor() as i32); + let name = self.res.facts.get(self.world.block(x, y, z)).name.clone(); + let liquid = matches!(&*name, "minecraft:water" | "minecraft:lava"); + let teleportable = self + .res + .items + .block_tags + .get("entities_can_teleport_to") + .or_else(|| self.res.items.block_tags.get("minecraft:entities_can_teleport_to")) + .is_some_and(|set| { + set.contains(&*name) || set.contains(name.trim_start_matches("minecraft:")) + }); + y < max_y && !liquid && teleportable } } diff --git a/crates/horizon-client/src/game/functions.rs b/crates/horizon-client/src/game/functions.rs index ef69a0284..419cb3d0e 100644 --- a/crates/horizon-client/src/game/functions.rs +++ b/crates/horizon-client/src/game/functions.rs @@ -298,9 +298,10 @@ impl Game<'_> { pub(in crate::game) fn functions_named(&mut self, name: &str) -> R> { self.ensure_datapacks(); match name.strip_prefix('#') { + // ServerFunctionLibrary.getTag: an unknown tag is empty. Some(tag) => { if !self.fns.store.function_tags.contains_key(tag) { - return Err(err("arguments.function.tag.unknown", &[&tag])); + return Ok(Vec::new()); } Ok(self .fns @@ -347,7 +348,8 @@ impl Game<'_> { }; let functions = self.functions_named(&name)?; if functions.is_empty() { - return Err(err("commands.function.scheduled.no_functions", &[&name])); + let id = name.trim_start_matches('#'); + return Err(err("commands.function.scheduled.no_functions", &[&id])); } let args = if ctx.has("with") { let r = self.data_ref_named(ctx, 0, "source")?; @@ -470,12 +472,8 @@ impl Game<'_> { let replace = !ctx.has("append"); let tick_time = self.world.game_time + i64::from(time); let schedule_id = match name.strip_prefix('#') { - Some(tag) => { - if !self.fns.store.function_tags.contains_key(tag) { - return Err(err("arguments.function.tag.unknown", &[&tag])); - } - name.clone() - } + // An unknown tag is empty, and scheduling it is allowed. + Some(_) => name.clone(), None => { let Some(f) = self.fns.store.functions.get(&name) else { return Err(err("arguments.function.unknown", &[&name])); @@ -519,11 +517,14 @@ impl Game<'_> { self.sync_function_registries(); Ok((tick_time.rem_euclid(i64::from(i32::MAX))) as i32) } + /// ReloadCommand: the message, then the (asynchronous) reload; returns 0. pub(super) fn cmd_reload(&mut self) -> R { - self.reload_datapacks(true); self.feedback(Text::translate("commands.reload.success", &[])); - Ok(1) + self.reload_datapacks(true); + Ok(0) } + /// `PackLocationInfo.createChatLink`: the id decorated with its source + /// (`pack.nameAndSource`, grey) in brackets, green when enabled. fn pack_link(&self, id: &str, enabled: bool) -> Text { let hint = if enabled { "disable" } else { "enable" }; let style = text::Style { @@ -541,7 +542,27 @@ impl Game<'_> { hover: Some(Box::new(Text::literal(format!("{id}\n{description}")))), ..style }; - bracketed(Text::literal(id).with_style(&style)) + let source = if id == "vanilla" { + "pack.source.builtin" + } else if FEATURE_PACKS.iter().any(|(p, _)| *p == id) { + "pack.source.feature" + } else { + "pack.source.world" + }; + let name = Text::translate( + "pack.nameAndSource", + &[Text::literal(id), Text::translate(source, &[])], + ) + .with_color(text::GRAY); + bracketed(name).with_style(&style) + } + /// The selected packs, lowest priority first. + fn selected_packs(&self) -> Vec { + let vanilla = (!self.cmds.vanilla_disabled).then(|| "vanilla".to_owned()); + vanilla + .into_iter() + .chain(self.fns.enabled.iter().cloned()) + .collect() } pub(super) fn cmd_datapack(&mut self, id: &str, ctx: &Context) -> R { self.ensure_datapacks(); @@ -549,34 +570,37 @@ impl Game<'_> { Some(Arg::Str(n)) => Some(n.clone()), _ => None, }; - let enabled_ids: Vec = std::iter::once("vanilla".to_owned()) - .chain(self.fns.enabled.iter().cloned()) - .collect(); - let available: Vec = self - .fns - .packs - .iter() - .map(|p| p.id.clone()) - .filter(|p| !enabled_ids.contains(p)) + let selected = self.selected_packs(); + // Feature packs need features this world lacks: never available. + let available: Vec = std::iter::once("vanilla".to_owned()) + .chain(self.fns.packs.iter().map(|p| p.id.clone())) + .filter(|p| !selected.contains(p)) .collect(); + let known = |g: &Self, n: &str| { + n == "vanilla" + || FEATURE_PACKS.iter().any(|(p, _)| *p == n) + || g.fns.packs.iter().any(|p| p.id == n) + }; match id { "datapack.list" => { let want_enabled = ctx.has("enabled") || (!ctx.has("available")); let want_available = ctx.has("available") || (!ctx.has("enabled")); let mut total = 0; if want_enabled { - let links: Vec = enabled_ids - .iter() - .map(|p| self.pack_link(p, true)) - .collect(); - total += links.len(); - self.feedback(Text::translate( - "commands.datapack.list.enabled.success", - &[ - Text::literal(links.len().to_string()), - horizon_client::scoreboard_cmd::format_list(links), - ], - )); + if selected.is_empty() { + self.feedback(Text::translate("commands.datapack.list.enabled.none", &[])); + } else { + let links: Vec = + selected.iter().map(|p| self.pack_link(p, true)).collect(); + total += links.len(); + self.feedback(Text::translate( + "commands.datapack.list.enabled.success", + &[ + Text::literal(links.len().to_string()), + horizon_client::scoreboard_cmd::format_list(links), + ], + )); + } } if want_available { if available.is_empty() { @@ -601,57 +625,68 @@ impl Game<'_> { } "datapack.enable" => { let name = name.unwrap_or_default(); - if !self.fns.packs.iter().any(|p| p.id == name) && name != "vanilla" { + if !known(self, &name) { return Err(err("commands.datapack.unknown", &[&name])); } - if enabled_ids.contains(&name) { + if selected.contains(&name) { return Err(err("commands.datapack.enable.failed", &[&name])); } - let existing = match ctx.get("existing") { - Some(Arg::Str(e)) => Some(e.clone()), - _ => None, - }; - let position = if ctx.has("first") { - 0 - } else if let Some(e) = &existing { - let Some(i) = self.fns.enabled.iter().position(|p| p == e) else { - return Err(err("commands.datapack.unknown", &[e])); - }; - if ctx.has("before") { i } else { i + 1 } + if let Some((_, flag)) = FEATURE_PACKS.iter().find(|(p, _)| *p == name) { + return Err(err("commands.datapack.enable.failed.no_flags", &[&name, flag])); + } + if name == "vanilla" { + self.cmds.vanilla_disabled = false; } else { - self.fns.enabled.len() - }; - self.fns.enabled.insert(position, name.clone()); + let existing = match ctx.get("existing") { + Some(Arg::Str(e)) => Some(e.clone()), + _ => None, + }; + let position = if ctx.has("first") { + 0 + } else if let Some(e) = &existing { + let Some(i) = self.fns.enabled.iter().position(|p| p == e) else { + return Err(err("commands.datapack.unknown", &[e])); + }; + if ctx.has("before") { i } else { i + 1 } + } else { + self.fns.enabled.len() + }; + self.fns.enabled.insert(position, name.clone()); + } self.feedback(Text::translate( "commands.datapack.modify.enable", &[self.pack_link(&name, true)], )); self.apply_pack_change(); - Ok(self.fns.enabled.len() as i32) + Ok(self.selected_packs().len() as i32) } _ => { let name = name.unwrap_or_default(); - if !self.fns.packs.iter().any(|p| p.id == name) && name != "vanilla" { + if !known(self, &name) { return Err(err("commands.datapack.unknown", &[&name])); } - let Some(i) = self.fns.enabled.iter().position(|p| p == &name) else { + if !selected.contains(&name) { return Err(err("commands.datapack.disable.failed", &[&name])); - }; - self.fns.enabled.remove(i); + } + if name == "vanilla" { + self.cmds.vanilla_disabled = true; + } else { + self.fns.enabled.retain(|p| p != &name); + } self.feedback(Text::translate( "commands.datapack.modify.disable", - &[self.pack_link(&name, false)], + &[self.pack_link(&name, true)], )); self.apply_pack_change(); - Ok(self.fns.enabled.len() as i32) + Ok(self.selected_packs().len() as i32) } } } + /// `ReloadCommand.reloadPacks`: no message of its own. fn apply_pack_change(&mut self) { self.save_datapack_settings(); self.rebuild_store(); self.fns.load_pending = true; - self.feedback(Text::translate("commands.reload.success", &[])); } // ---- predicates ------------------------------------------------------------------- @@ -667,3 +702,11 @@ impl Game<'_> { Ok(self.conditions_hold(&json, view.as_ref(), source.pos)) } } + +/// The built-in feature packs and the feature flag each needs (none of them +/// enabled in a world created without experiments). +const FEATURE_PACKS: &[(&str, &str)] = &[ + ("minecart_improvements", "minecraft:minecart_improvements"), + ("redstone_experiments", "minecraft:redstone_experiments"), + ("trade_rebalance", "minecraft:trade_rebalance"), +]; diff --git a/crates/horizon-client/src/items.rs b/crates/horizon-client/src/items.rs index e5af5d995..1aa72b554 100644 --- a/crates/horizon-client/src/items.rs +++ b/crates/horizon-client/src/items.rs @@ -2,7 +2,7 @@ //! tool mining rules and block loot tables (`LootTable`/`LootPool` semantics //! for the condition, entry and modifier types used by block drops). use crate::{Result, blocks::BlockFacts}; -use horizon_core::random::{LegacyRandom, RandomSource}; +use horizon_core::random::RandomSource; use horizon_world::registry::{BlockRegistry, BlockStateId}; use serde_json::Value; use std::{ @@ -1001,6 +1001,7 @@ impl LootContext<'_> { #[cfg(test)] mod tests { use super::*; + use horizon_core::random::LegacyRandom; use serde_json::json; fn ctx<'a>( diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCommandExecOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCommandExecOracle.java index a22f72af4..4b61558d8 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCommandExecOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCommandExecOracle.java @@ -202,8 +202,11 @@ public final class VanillaCommandExecOracle { messages.clear(); // Answers computed off-thread (profile lookups) reach the // server's task queue before the next tick. - for (int wait = 0; wait < 2000 && this.getPendingTasksCount() == 0 && op.has("record"); wait++) { - try { Thread.sleep(5); } catch (InterruptedException e) { throw new RuntimeException(e); } + // (Other queued tasks may be pending already, so give + // the stub resolvers a fixed moment rather than + // waiting for the queue to fill.) + if (op.has("record")) { + try { Thread.sleep(300); } catch (InterruptedException e) { throw new RuntimeException(e); } } for (int i = 0; i < n; i++) { tick(); @@ -246,9 +249,16 @@ public final class VanillaCommandExecOracle { super.tickServer(() -> false); // The player's network listener ticks it each server tick // (ServerGamePacketListenerImpl.tickPlayer); this one has no - // listening connection, so tick the player here. + // listening connection. Its movement is the client's, so of + // that tick only apply changed attributes (waypoint range...). if (player != null) { - player.doTick(); + try { + var refresh = net.minecraft.world.entity.LivingEntity.class.getDeclaredMethod("refreshDirtyAttributes"); + refresh.setAccessible(true); + refresh.invoke(player); + } catch (ReflectiveOperationException e) { + throw new RuntimeException(e); + } } drain(); } diff --git a/tools/command_exec_corpus.py b/tools/command_exec_corpus.py index 66a303c6e..671830335 100644 --- a/tools/command_exec_corpus.py +++ b/tools/command_exec_corpus.py @@ -655,7 +655,14 @@ def functions_and_packs(): cmd('/datapack list available'), cmd('/datapack list enabled'), cmd('/datapack enable vanilla'), + # Disabling vanilla reloads without its data; enable it again before + # anything observes the empty registries. cmd('/datapack disable vanilla'), + {'op': 'tick', 'n': 20}, + cmd('/datapack list enabled'), + cmd('/datapack enable vanilla'), + {'op': 'tick', 'n': 20}, + cmd('/datapack list'), cmd('/datapack enable "file/missing"'), cmd('/datapack enable trade_rebalance'), cmd('/datapack disable trade_rebalance'),