From c344a26e80c4b85c39775d54e7727d7babdae9d5 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 23:05:26 +0200 Subject: [PATCH 01/17] Java shader packs: occlusion culling while the pack draws the terrain The pack's terrain program draws the solid sections the last test saw, the boxes of the others are tested against the pack's depth in a pass of their own (OpenGL's layout: y flipped, depth 0 near, so a second depth-only culling pipeline), and the program then draws the sections in sight from the culling's phase 2 draws. The flat path, which has no occlusion culling, is unchanged. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/gfx.rs | 57 ++++++--- crates/horizon-client/src/gfx/cull.rs | 120 +++++++++++++----- crates/horizon-client/src/gfx/cull.wgsl | 38 +++++- crates/horizon-client/src/gfx/java_stages.rs | 54 ++++---- crates/horizon-client/src/gfx/java_terrain.rs | 24 +++- docs/shader-packs.md | 6 +- 6 files changed, 213 insertions(+), 86 deletions(-) diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index bc49052f1..1d924e229 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -2541,17 +2541,22 @@ impl Renderer { i += run; } } - /// Horizon's terrain, solid or `translucent`, with a Java pack's - /// geometry pipelines (`java_terrain::DrawTerrain`): the frame's flat - /// draws or its section draws, each page with its group 3. + /// One `layer` of Horizon's terrain with a Java pack's geometry + /// pipelines (`java_terrain::DrawTerrain`): the frame's flat draws or its + /// section draws, each page with its group 3. `draws` are the frame's + /// phase 1 solid draws, all its solid draws and its translucent ones; + /// `culling` tells whether phase 2's come from occlusion culling. fn draw_java_terrain( &self, pass: &mut wgpu::RenderPass<'_>, - translucent: bool, + layer: java_terrain::Layer, pipelines: &java_terrain::TerrainPipelines, flat_frame: bool, - draws: [u32; 2], + draws: [u32; 3], + culling: bool, ) { + use java_terrain::Layer; + let translucent = layer == Layer::Translucent; let page = |pass: &mut wgpu::RenderPass<'_>, page: u32| { if let Some(Some((_, group))) = self.java_pages.get(page as usize) { pass.set_bind_group(3, group, &[]); @@ -2559,6 +2564,8 @@ impl Renderer { }; pass.set_bind_group(2, pipelines.group, &[]); match (self.flat.as_ref().filter(|_| flat_frame), pipelines.flat) { + // The flat path doesn't cull by occlusion: phase 1 is everything. + (Some(_), Some(_)) if layer == Layer::Revealed => {} (Some(flat), Some(pipeline)) => { pass.set_pipeline(pipeline); let calls = if translucent { @@ -2570,16 +2577,22 @@ impl Renderer { } (Some(_), None) => {} (None, _) => { + let [phase1, solid, translucent_draws] = draws; + let cull = self.cull.as_ref().filter(|_| culling); + let (indirect, base, first, count) = match (layer, cull) { + (Layer::Solid, Some(_)) => (&self.indirect, 0, 0, phase1), + (Layer::Solid, None) => (&self.indirect, 0, 0, solid), + (Layer::Revealed, Some(c)) => (&c.phase2, phase1, phase1, solid - phase1), + (Layer::Revealed, None) => return, + (Layer::Translucent, _) => (&self.indirect, 0, solid, translucent_draws), + }; + if count == 0 { + return; + } pass.set_pipeline(pipelines.instanced); pass.set_index_buffer(self.indices.slice(..), wgpu::IndexFormat::Uint32); pass.set_vertex_buffer(1, self.instances.slice(..)); - let [solid, translucent_draws] = draws; - let (first, count) = if translucent { - (solid, translucent_draws) - } else { - (0, solid) - }; - self.draw_sections_with(pass, &self.indirect, 0, first, count, page); + self.draw_sections_with(pass, indirect, base, first, count, page); } } } @@ -3185,8 +3198,8 @@ impl Renderer { .inverse() .transform_point3(Vec3::ZERO); // A Java pack that draws the terrain (`gfx/java_terrain.rs`): the - // world pass leaves it out, and occlusion culling (which tests - // against its depth) is off. + // world pass leaves it out, and occlusion culling tests against the + // pack's depth (`Cull::test_gl`). let java_terrain = !frame.title && self.java_table.is_some() && matches!(&self.pack, Some(Pack::Java(j)) if j.draws_terrain(frame.shader.dimension)); @@ -3200,7 +3213,6 @@ impl Renderer { && !frame.title && self.multi_draw && !(self.flat_on && self.flat.is_some()) - && !java_terrain }) .and_then(|cull| cull.begin(&self.device).then_some(cull)); self.phase2_draws.clear(); @@ -3887,11 +3899,17 @@ impl Renderer { && let Some(mut stages) = self.pack.take() { // The pack's terrain programs draw with the frame's draws. - let draws = [solid_draws, translucent_draws]; + let draws = [phase1_draws, solid_draws, translucent_draws]; let draw = |render: &mut wgpu::RenderPass<'_>, - translucent: bool, + layer: java_terrain::Layer, pipelines: &java_terrain::TerrainPipelines| { - self.draw_java_terrain(render, translucent, pipelines, flat_frame, draws); + self.draw_java_terrain(render, layer, pipelines, flat_frame, draws, culling); + }; + let cull = self.cull.as_ref().filter(|_| culling && solid_draws > 0); + let occlusion = |encoder: &mut wgpu::CommandEncoder, depth: &wgpu::TextureView| { + if let Some(cull) = cull { + cull.test_gl(encoder, depth); + } }; let world = java_terrain::JavaWorld { sprites: &self.sprite_textures, @@ -3900,6 +3918,9 @@ impl Renderer { animated: &self.animated, lightmap: &self.lightmap_view, draw: &draw, + occlusion: cull + .is_some() + .then_some(&occlusion as &java_terrain::OcclusionTest), }; let output = match &mut stages { Pack::Horizon(stages) => stages.run( diff --git a/crates/horizon-client/src/gfx/cull.rs b/crates/horizon-client/src/gfx/cull.rs index bcb738de3..57acec5f5 100644 --- a/crates/horizon-client/src/gfx/cull.rs +++ b/crates/horizon-client/src/gfx/cull.rs @@ -76,6 +76,8 @@ struct Group { pub struct Cull { pipeline: wgpu::RenderPipeline, + /// [`Self::test_gl`]'s: a depth-only pass in OpenGL's layout. + gl_pipeline: wgpu::RenderPipeline, layout: wgpu::BindGroupLayout, group: Option, params: wgpu::Buffer, @@ -187,43 +189,63 @@ impl Cull { bind_group_layouts: &[Some(&layout)], ..Default::default() }); - let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: Some("Section culling"), - layout: Some(&pipeline_layout), - vertex: wgpu::VertexState { - module: &module, - entry_point: Some("vs_box"), - compilation_options: Default::default(), - buffers: &[], - }, - primitive: wgpu::PrimitiveState { - cull_mode: Some(wgpu::Face::Back), - ..Default::default() - }, - // The world pass's reversed depth test, without writes. - depth_stencil: Some(wgpu::DepthStencilState { - format: wgpu::TextureFormat::Depth32Float, - depth_write_enabled: Some(false), - depth_compare: Some(wgpu::CompareFunction::GreaterEqual), - stencil: Default::default(), - bias: Default::default(), - }), - multisample: Default::default(), - fragment: Some(wgpu::FragmentState { - module: &module, - entry_point: Some("fs_box"), - compilation_options: Default::default(), - targets: &[Some(wgpu::ColorTargetState { - format: color, - blend: None, - write_mask: wgpu::ColorWrites::empty(), - })], - }), - multiview_mask: None, - cache: None, - }); + let pipeline = |label, gl: bool, targets: &[Option]| { + device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: Some(label), + layout: Some(&pipeline_layout), + vertex: wgpu::VertexState { + module: &module, + entry_point: Some(if gl { "vs_box_gl" } else { "vs_box" }), + compilation_options: Default::default(), + buffers: &[], + }, + // OpenGL's layout flips y, and with it the faces' winding. + primitive: wgpu::PrimitiveState { + cull_mode: Some(wgpu::Face::Back), + front_face: if gl { + wgpu::FrontFace::Cw + } else { + wgpu::FrontFace::Ccw + }, + ..Default::default() + }, + // The pass's depth test (reversed in the world pass, OpenGL's + // in a Java pack's), without writes. + depth_stencil: Some(wgpu::DepthStencilState { + format: wgpu::TextureFormat::Depth32Float, + depth_write_enabled: Some(false), + depth_compare: Some(if gl { + wgpu::CompareFunction::LessEqual + } else { + wgpu::CompareFunction::GreaterEqual + }), + stencil: Default::default(), + bias: Default::default(), + }), + multisample: Default::default(), + fragment: Some(wgpu::FragmentState { + module: &module, + entry_point: Some(if gl { "fs_box_depth" } else { "fs_box" }), + compilation_options: Default::default(), + targets, + }), + multiview_mask: None, + cache: None, + }) + }; + let gl_pipeline = pipeline("Section culling, OpenGL layout", true, &[]); + let pipeline = pipeline( + "Section culling", + false, + &[Some(wgpu::ColorTargetState { + format: color, + blend: None, + write_mask: wgpu::ColorWrites::empty(), + })], + ); Self { pipeline, + gl_pipeline, layout, group: None, params: buffer( @@ -413,6 +435,34 @@ impl Cull { pass.draw(0..36, 0..self.test_data.len() as u32); } + /// [`Self::test`] for a Java shader pack that draws the terrain + /// (`gfx/java_stages.rs`): in a pass of its own against `depth`, the + /// pack's depth after phase 1 in OpenGL's layout (y up, 0 near). + pub fn test_gl(&self, encoder: &mut wgpu::CommandEncoder, depth: &wgpu::TextureView) { + let Some(Group { group, .. }) = &self.group else { + return; + }; + if self.test_data.is_empty() { + return; + } + let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some("Section culling, Java shader pack"), + color_attachments: &[], + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { + view: depth, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Load, + store: wgpu::StoreOp::Store, + }), + stencil_ops: None, + }), + ..Default::default() + }); + pass.set_pipeline(&self.gl_pipeline); + pass.set_bind_group(0, group, &[]); + pass.draw(0..36, 0..self.test_data.len() as u32); + } + /// After the world passes: copy the results for reading back, when a /// readback buffer is free. pub fn end(&mut self, device: &wgpu::Device, encoder: &mut wgpu::CommandEncoder) { diff --git a/crates/horizon-client/src/gfx/cull.wgsl b/crates/horizon-client/src/gfx/cull.wgsl index faa495caf..8345c15ae 100644 --- a/crates/horizon-client/src/gfx/cull.wgsl +++ b/crates/horizon-client/src/gfx/cull.wgsl @@ -52,6 +52,10 @@ fn corner(origin: vec3, c: u32) -> vec3 { // section fail the depth test against the final depth, which is only nearer. @vertex fn vs_box(@builtin(vertex_index) v: u32, @builtin(instance_index) t: u32) -> Box { + return box_vertex(v, t); +} + +fn box_vertex(v: u32, t: u32) -> Box { let origin = origins[tests[t].x].xyz; var out: Box; out.test = t; @@ -86,16 +90,36 @@ fn vs_box(@builtin(vertex_index) v: u32, @builtin(instance_index) t: u32) -> Box return out; } -// Runs only for fragments that pass the depth test (forced early). -@fragment -@early_depth_test(force) -fn fs_box(in: Box) -> @location(0) vec4 { - if results[in.test] != params.stamp { - results[in.test] = params.stamp; - let test = tests[in.test]; +// The same box in OpenGL's layout, for a Java shader pack's terrain depth +// (gfx/java_stages.rs): y flipped, depth from 0 near to 1 far. +@vertex +fn vs_box_gl(@builtin(vertex_index) v: u32, @builtin(instance_index) t: u32) -> Box { + var out = box_vertex(v, t); + out.position = vec4(out.position.x, -out.position.y, out.position.w - out.position.z, out.position.w); + return out; +} + +fn seen(index: u32) { + if results[index] != params.stamp { + results[index] = params.stamp; + let test = tests[index]; for (var k = 0u; k < test.z; k++) { phase2[(test.y + k) * 5u + 1u] = 1u; } } +} + +// Runs only for fragments that pass the depth test (forced early). +@fragment +@early_depth_test(force) +fn fs_box(in: Box) -> @location(0) vec4 { + seen(in.test); return vec4(0.0); } + +// fs_box in a pass without colour targets. +@fragment +@early_depth_test(force) +fn fs_box_depth(in: Box) { + seen(in.test); +} diff --git a/crates/horizon-client/src/gfx/java_stages.rs b/crates/horizon-client/src/gfx/java_stages.rs index 19e2109e0..52bba0893 100644 --- a/crates/horizon-client/src/gfx/java_stages.rs +++ b/crates/horizon-client/src/gfx/java_stages.rs @@ -13,7 +13,7 @@ //! into the pack's targets right after, against the world's depth, and its //! `gbuffers_water` draws the translucent terrain after `deferred`, as in //! Iris. `depthtex1` and `depthtex2` then hold the depth before it. -use super::java_terrain::{Atlas, JavaWorld, TerrainPipelines}; +use super::java_terrain::{Atlas, JavaWorld, Layer, TerrainPipelines}; use super::pack_stages::FrameUniform; use crate::java_pack::{JavaFolder, JavaPasses}; use glam::{Mat3, Mat4, Vec3, Vec4}; @@ -1748,28 +1748,38 @@ impl PassGpu { Some(color_attachment(side, None)) }) .collect(); - let mut render = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: Some(&self.program), - color_attachments: &attachments, - depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { - view: depth, - depth_ops: Some(wgpu::Operations { - load: wgpu::LoadOp::Load, - store: wgpu::StoreOp::Store, + let pipelines = TerrainPipelines { + instanced: &self.pipeline, + flat: self.flat_pipeline.as_ref(), + group, + }; + let draw = |encoder: &mut wgpu::CommandEncoder, layer| { + let mut render = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some(&self.program), + color_attachments: &attachments, + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { + view: depth, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Load, + store: wgpu::StoreOp::Store, + }), + stencil_ops: None, }), - stencil_ops: None, - }), - ..Default::default() - }); - (world.draw)( - &mut render, - translucent, - &TerrainPipelines { - instanced: &self.pipeline, - flat: self.flat_pipeline.as_ref(), - group, - }, - ); + ..Default::default() + }); + (world.draw)(&mut render, layer, &pipelines); + }; + if translucent { + draw(encoder, Layer::Translucent); + return; + } + draw(encoder, Layer::Solid); + // Occlusion culling: the sections left out, tested against what + // phase 1 drew, then the ones in sight. + if let Some(test) = world.occlusion { + test(encoder, depth); + draw(encoder, Layer::Revealed); + } } /// Draw into the targets of `draw_buffers`, on the side it doesn't read. diff --git a/crates/horizon-client/src/gfx/java_terrain.rs b/crates/horizon-client/src/gfx/java_terrain.rs index 6411efda1..dd0416428 100644 --- a/crates/horizon-client/src/gfx/java_terrain.rs +++ b/crates/horizon-client/src/gfx/java_terrain.rs @@ -204,9 +204,25 @@ pub fn page_layout(device: &wgpu::Device) -> wgpu::BindGroupLayout { }) } -/// Draws Horizon's terrain with a pack's pipelines: the solid layer or the -/// translucent one. Set by the renderer, which owns the sections. -pub type DrawTerrain<'a> = dyn Fn(&mut wgpu::RenderPass<'_>, bool, &TerrainPipelines<'_>) + 'a; +/// Which of Horizon's terrain draws a pack's program draws. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum Layer { + /// The solid sections: all of them, or with occlusion culling + /// ([`JavaWorld::occlusion`]) the ones the last test saw (phase 1). + Solid, + /// With occlusion culling, the solid sections the test after phase 1 + /// found in sight (phase 2). + Revealed, + Translucent, +} + +/// Draws Horizon's terrain with a pack's pipelines. Set by the renderer, +/// which owns the sections. +pub type DrawTerrain<'a> = dyn Fn(&mut wgpu::RenderPass<'_>, Layer, &TerrainPipelines<'_>) + 'a; + +/// Occlusion culling's test between [`Layer::Solid`] and +/// [`Layer::Revealed`], against the pack's depth (OpenGL's layout). +pub type OcclusionTest<'a> = dyn Fn(&mut wgpu::CommandEncoder, &wgpu::TextureView) + 'a; /// What the renderer binds to draw with a pack's geometry program: the /// pipeline of its draw path and the pack's group (group 2). Group 1 is the @@ -229,6 +245,8 @@ pub struct JavaWorld<'a> { pub animated: &'a [(u32, u32)], pub lightmap: &'a wgpu::TextureView, pub draw: &'a DrawTerrain<'a>, + /// Set when the frame culls solid sections by occlusion. + pub occlusion: Option<&'a OcclusionTest<'a>>, } const ATLAS: &str = r#" diff --git a/docs/shader-packs.md b/docs/shader-packs.md index 3d32e37f6..263372d16 100644 --- a/docs/shader-packs.md +++ b/docs/shader-packs.md @@ -367,6 +367,10 @@ sprite arrays (animated sprites copied in each frame), `lightmap` is Horizon's l and fragments under alpha 0.1 are discarded (`alphaTestRef`). `RGBA16` targets are 16-bit unorm where the GPU can render them (Chocapic13' packs its G-buffer into them; half floats broke it). +Occlusion culling works as in Horizon's world pass where the GPU has it: the pack's terrain program draws the +sections the last test saw, the boxes of the others are tested against that depth (in OpenGL's layout, in a pass of +their own since the pack's targets vary), and the pack's program then draws the ones in sight. + What makes Horizon look like OpenGL to the pack: - **Layout.** The translator ends every vertex shader by flipping `gl_Position.y` and moving depth from `[-w, w]` to @@ -401,7 +405,7 @@ grade and light Horizon's world as their post-processing would. Sildur's Vibrant Without the other `gbuffers_*` and `shadow`, no pack has its shadows or sky look yet; Distant Horizons' and Voxy's depth read as far. Not supported yet: images and compute (`.csh`; a pack that needs them doesn't load), mipmapped targets (`colortexNMipmapEnabled` is read but ignored), custom textures, the option screen; shadow matrices are identity. With the pack's terrain: entities, the -sky, the hand, weather and clouds are still Horizon's (in `colortex0` only), GPU occlusion culling is off, block ids +sky, the hand, weather and clouds are still Horizon's (in `colortex0` only), block ids come from sprite names rather than block states, distant (LOD) terrain doesn't repeat its textures, and only the overworld has been checked. From fe6ae937effdd9a7e5ef89c33c3fea9504f24cae Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 23:41:18 +0200 Subject: [PATCH 02/17] Java shader packs: the pack's shadow programs draw the shadow map A Java pack's shadow program (shadow_cutout, shadow or shadow_solid for the solid layer, shadow_water or shadow for the translucent one) draws Horizon's terrain from the light after begin, as Iris's ShadowRenderer: - shadowModelView and shadowProjection are Iris's ShadowMatrices, with the pack's shadowMapResolution, shadowDistance, near and far planes, shadowIntervalSize and sunPathRotation; shadow programs get them as their model view and projection. - The renderer picks every resident section inside the light's box (no cave culling, no face culling) and draws it instanced, solid then translucent, with origins after the camera's. - shadowtex0 holds everything, shadowtex1 the depth before translucent terrain, bound as depth textures for comparisons and as float copies for plain reads; shadowcolor0..7 take the pack's formats and clears (white by default). A shadow program that fails to compile leaves the pack without its shadow map, with a warning; its terrain programs still run. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/gfx.rs | 162 ++++- crates/horizon-client/src/gfx/java_stages.rs | 615 +++++++++++++++++- crates/horizon-client/src/gfx/java_terrain.rs | 4 + crates/horizon-client/src/java_pack.rs | 52 +- crates/horizon-shaderpack/src/pipeline.rs | 133 ++++ docs/shader-packs.md | 34 +- 6 files changed, 951 insertions(+), 49 deletions(-) diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index 1d924e229..8e7f765a6 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -120,6 +120,18 @@ struct Globals { dynamic_lights: [[f32; 4]; crate::dynamic_light::MAX], } pub type SectionKey = (i32, i32, i32); +/// The sections a Java pack's shadow map draws ([`Renderer`]'s `shadow`). +#[derive(Default)] +struct ShadowList { + visible: Vec, + draws: Vec<[u32; 5]>, + pages: Vec<(u32, Option)>, + /// How many of `draws` are solid. + solid: u32, + indirect: Option, + capacity: u64, +} + struct SectionGpu { /// Arena page and first vertex in it: solid quads, then translucent ones. page: u32, @@ -427,6 +439,10 @@ pub struct Renderer { /// built, and their pages. phase2_draws: Vec<[u32; 5]>, phase2_pages: Vec<(u32, Option)>, + /// A Java pack's shadow map (`gfx/java_terrain.rs`): the sections in + /// the light's view, their draws (solid then translucent, instances + /// after the camera's), and the indirect buffer they're uploaded to. + shadow: ShadowList, /// Block-entity blocks per meshed section (world position, state id). block_entities: HashMap>, /// Changes whenever `block_entities` does (unique across renderers). @@ -2193,6 +2209,7 @@ impl Renderer { draw_pages: Vec::new(), phase2_draws: Vec::new(), phase2_pages: Vec::new(), + shadow: ShadowList::default(), block_entities: HashMap::new(), block_entity_revision: next_block_entity_revision(), occlusion: occlusion::Occlusion::new(crate::chunk::MIN_Y, crate::chunk::HEIGHT / 16), @@ -2518,11 +2535,26 @@ impl Renderer { first: u32, count: u32, page_group: impl Fn(&mut wgpu::RenderPass<'_>, u32), + ) { + let list = (&self.draws[..], &self.draw_pages[..]); + self.draw_list(pass, indirect, list, base, first, count, page_group); + } + /// [`Self::draw_sections_with`] over another list of draws and pages. + #[allow(clippy::too_many_arguments)] + fn draw_list( + &self, + pass: &mut wgpu::RenderPass<'_>, + indirect: &wgpu::Buffer, + (draws, pages): (&[[u32; 5]], &[(u32, Option)]), + base: u32, + first: u32, + count: u32, + page_group: impl Fn(&mut wgpu::RenderPass<'_>, u32), ) { let (mut i, end) = (first as usize, (first + count) as usize); while i < end { - let (page, index_page) = self.draw_pages[i]; - let run = self.draw_pages[i..end] + let (page, index_page) = pages[i]; + let run = pages[i..end] .iter() .take_while(|&&p| p == (page, index_page)) .count(); @@ -2534,7 +2566,7 @@ impl Renderer { let offset = (i - base as usize) as u64 * 20; pass.multi_draw_indexed_indirect(indirect, offset, run as u32); } else { - for d in &self.draws[i..i + run] { + for d in &draws[i..i + run] { pass.draw_indexed(d[2]..d[2] + d[0], d[3] as i32, d[4]..d[4] + 1); } } @@ -2556,12 +2588,32 @@ impl Renderer { culling: bool, ) { use java_terrain::Layer; - let translucent = layer == Layer::Translucent; let page = |pass: &mut wgpu::RenderPass<'_>, page: u32| { if let Some(Some((_, group))) = self.java_pages.get(page as usize) { pass.set_bind_group(3, group, &[]); } }; + if matches!(layer, Layer::ShadowSolid | Layer::ShadowTranslucent) { + let shadow = &self.shadow; + let all = shadow.draws.len() as u32; + let (first, count) = if layer == Layer::ShadowSolid { + (0, shadow.solid) + } else { + (shadow.solid, all - shadow.solid) + }; + // Without multi-draw the draws are read from the list. + let indirect = shadow.indirect.as_ref().unwrap_or(&self.indirect); + if count == 0 { + return; + } + pass.set_bind_group(2, pipelines.group, &[]); + pass.set_pipeline(pipelines.instanced); + pass.set_vertex_buffer(1, self.instances.slice(..)); + let list = (&shadow.draws[..], &shadow.pages[..]); + self.draw_list(pass, indirect, list, 0, first, count, page); + return; + } + let translucent = layer == Layer::Translucent; pass.set_bind_group(2, pipelines.group, &[]); match (self.flat.as_ref().filter(|_| flat_frame), pipelines.flat) { // The flat path doesn't cull by occlusion: phase 1 is everything. @@ -2585,6 +2637,7 @@ impl Renderer { (Layer::Revealed, Some(c)) => (&c.phase2, phase1, phase1, solid - phase1), (Layer::Revealed, None) => return, (Layer::Translucent, _) => (&self.indirect, 0, solid, translucent_draws), + (Layer::ShadowSolid | Layer::ShadowTranslucent, _) => return, }; if count == 0 { return; @@ -3163,8 +3216,48 @@ impl Renderer { visible_lods.sort_unstable_by_key(|v| (v.distance, v.key)); } self.drawn_sections = visible.len() + visible_lods.len(); - if self.drawn_sections as u64 > self.instance_capacity { - self.instance_capacity = (self.drawn_sections as u64).next_power_of_two(); + // A Java pack's shadow map: the sections in the light's orthographic + // box, whatever the camera sees (Iris turns cave culling off too). + let mut shadow_visible = std::mem::take(&mut self.shadow.visible); + shadow_visible.clear(); + let shadow_view = match &self.pack { + Some(Pack::Java(j)) if !frame.title && self.java_table.is_some() => j.shadow_view( + frame.shader.dimension, + &java_stages::JavaFrame { + eye_light: frame.shader.eye_light, + sun_angle: frame.sky.sun_angle, + moon_angle: frame.sky.moon_angle, + }, + camera.as_vec3(), + ), + _ => None, + }; + if let Some((view, [half, near, far])) = shadow_view { + // Inside when `plane ยท (p, 1) >= 0`: |x|, |y| <= half and the + // eye depth between the near and far planes (GL looks down -z). + let (x, y, z) = (view.row(0), view.row(1), view.row(2)); + let planes = [ + Vec4::W * half - x, + Vec4::W * half + x, + Vec4::W * half - y, + Vec4::W * half + y, + -z - Vec4::W * near, + z + Vec4::W * far, + ]; + crate::spans::time("shadow visibility", || { + self.sections.visible( + camera, + (frame.detail_distance / 16.0) as i32, + &Frustum { planes }, + |_| true, + |_, _| false, + &mut shadow_visible, + ) + }); + } + let instances = self.drawn_sections + shadow_visible.len(); + if instances as u64 > self.instance_capacity { + self.instance_capacity = (instances as u64).next_power_of_two(); self.instances = self.device.create_buffer(&wgpu::BufferDescriptor { label: Some("Section origins"), size: self.instance_capacity * 16, @@ -3179,8 +3272,63 @@ impl Renderer { visible .iter() .map(|v| section_instance(v.origin)) - .chain(visible_lods.iter().map(|v| lod::instance(v.origin))), + .chain(visible_lods.iter().map(|v| lod::instance(v.origin))) + .chain(shadow_visible.iter().map(|v| section_instance(v.origin))), ); + // The shadow map's draws: every solid quad (no face is culled), then + // the translucent ones in the order the camera's sort left them. + let shadow = &mut self.shadow; + shadow.draws.clear(); + shadow.pages.clear(); + for pass in [false, true] { + for (j, v) in shadow_visible.iter().enumerate() { + let s = self.sections.get(v.slot); + let instance = (self.drawn_sections + j) as u32; + match (pass, s.sorted_indices) { + (false, _) if s.solid > 0 => { + shadow + .draws + .push([s.solid * 6, 1, 0, s.start as u32, instance]); + shadow.pages.push((s.page, None)); + } + (true, Some((index_page, index_start))) if s.translucent > 0 => { + let first = s.start + u64::from(s.solid) * 4; + shadow.draws.push([ + s.translucent * 6, + 1, + index_start as u32, + first as u32, + instance, + ]); + shadow.pages.push((s.page, Some(index_page))); + } + _ => {} + } + } + if !pass { + shadow.solid = shadow.draws.len() as u32; + } + } + if self.multi_draw && !shadow.draws.is_empty() { + if shadow.draws.len() as u64 > shadow.capacity || shadow.indirect.is_none() { + shadow.capacity = (shadow.draws.len() as u64).next_power_of_two(); + shadow.indirect = Some(self.device.create_buffer(&wgpu::BufferDescriptor { + label: Some("Java shader pack shadow draws"), + size: shadow.capacity * 20, + usage: wgpu::BufferUsages::INDIRECT | wgpu::BufferUsages::COPY_DST, + mapped_at_creation: false, + })); + } + if let Some(indirect) = &shadow.indirect { + self.uploads.buffer( + &mut encoder, + indirect, + 0, + bytemuck::cast_slice(&shadow.draws), + ); + } + } + shadow.visible = shadow_visible; if !self.origins.is_empty() { self.uploads.buffer( &mut encoder, diff --git a/crates/horizon-client/src/gfx/java_stages.rs b/crates/horizon-client/src/gfx/java_stages.rs index 52bba0893..dbe03dae9 100644 --- a/crates/horizon-client/src/gfx/java_stages.rs +++ b/crates/horizon-client/src/gfx/java_stages.rs @@ -168,6 +168,19 @@ struct Views<'a> { depth_solid: &'a wgpu::TextureView, atlas: Option<&'a wgpu::TextureView>, lightmap: Option<&'a wgpu::TextureView>, + shadow: Option<&'a ShadowViews>, +} + +/// The shadow map's textures, as the passes read them. +struct ShadowViews { + /// `shadowtex0` and `shadowtex1` for comparisons (`Depth32Float`). + depth: wgpu::TextureView, + depth_solid: wgpu::TextureView, + /// The same as plain floats, for `sampler2D` reads (`R32Float`). + float: wgpu::TextureView, + float_solid: wgpu::TextureView, + /// `shadowcolor`, for the targets the shadow programs write. + colors: Vec>, } /// A colour target's two sides. @@ -190,10 +203,15 @@ enum Source { /// (the world's depth when the pack doesn't draw the terrain). DepthSolid, Noise, - /// `shadowtex*`: no shadow map yet, so a far depth (nothing in shadow); - /// also Distant Horizons' and Voxy's depth, as without those mods. - Shadow, - /// Anything else (`shadowcolor*`, custom textures): white or black. + /// `shadowtex0` (with translucent terrain) or `shadowtex1` (without): + /// the shadow map when the pack draws one, else a far depth (nothing in + /// shadow). + ShadowDepth(u32), + /// `shadowcolor`: the shadow map's colour target, else white. + ShadowColor(u32), + /// Distant Horizons' and Voxy's depth: far, as without those mods. + Far, + /// Anything else (custom textures): white or black. Blank(bool), /// In geometry programs: the block atlas (`gtexture`), the lightmap, /// and a flat normal map for `normals` (sprites have no LabPBR maps). @@ -212,9 +230,13 @@ fn source(name: &str, geometry: bool) -> Source { "depthtex0" | "gdepthtex" => Source::Depth, "depthtex1" | "depthtex2" => Source::DepthSolid, "noisetex" => Source::Noise, - "shadowtex0" | "shadowtex1" | "shadow" | "watershadow" => Source::Shadow, - n if n.starts_with("dhDepthTex") || n.starts_with("vxDepthTex") => Source::Shadow, - n if n.starts_with("shadowcolor") => Source::Blank(true), + "shadowtex0" | "shadow" | "watershadow" => Source::ShadowDepth(0), + "shadowtex1" => Source::ShadowDepth(1), + n if n.starts_with("dhDepthTex") || n.starts_with("vxDepthTex") => Source::Far, + "shadowcolor" => Source::ShadowColor(0), + n if let Some(i) = n.strip_prefix("shadowcolor").and_then(|i| i.parse().ok()) => { + Source::ShadowColor(i) + } n => target_index(n).map_or(Source::Blank(false), Source::Target), } } @@ -253,6 +275,8 @@ struct PassGpu { /// them), and the targets written on their alternate side. flat_pipeline: Option, geometry: Option>, + /// A shadow program: the light's matrices, `shadowcolor` targets. + shadow: bool, } /// What a pass draws into. @@ -269,6 +293,8 @@ struct GeometrySetup<'a> { /// Each draw buffer's blending. blends: &'a [Option], layouts: &'a GeometryLayouts<'a>, + /// A shadow program: no face culling (Iris's `ShadowRenderer`). + shadow: bool, } /// The renderer's bind group layouts a geometry program's pipelines use: @@ -284,6 +310,19 @@ struct FolderGeometry { terrain: PassGpu, water: Option, translucent_at: usize, + /// Its shadow programs, when it has some and they compile. + shadow: Option, +} + +/// A folder's shadow map: its programs over the solid and translucent +/// terrain, its `shadowcolor` targets, and where it runs. +struct FolderShadow { + solid: PassGpu, + water: Option, + /// Per `shadowcolor` target: its format and clear colour. + targets: Vec<(wgpu::TextureFormat, Option)>, + /// How many passes run before it (`begin*`). + at: usize, } /// What every pass of the pack shares. @@ -315,6 +354,7 @@ struct Bound { /// Per pass, then `final`. groups: Vec, geometry: Option, + shadow: Option, world_in: (wgpu::RenderPipeline, wgpu::BindGroup), /// The world goes to colortex0's alternate side. world_alt: bool, @@ -326,6 +366,25 @@ struct Bound { _blank: Vec, } +/// The shadow map's textures and its programs' groups. +struct BoundShadow { + views: ShadowViews, + /// The depth buffer the shadow programs draw with (`shadowtex0`), and + /// its copy before translucent terrain (`shadowtex1`). + depth: wgpu::Texture, + depth_solid: wgpu::Texture, + /// The `shadowcolor` targets cleared each frame, with their colour, + /// and those cleared only when made (kept between frames). + clears: Vec<(wgpu::TextureView, wgpu::Color)>, + initial: Vec<(wgpu::TextureView, wgpu::Color)>, + solid: wgpu::BindGroup, + water: Option, + /// `depth` for `depth_out` into the float copies. + out_group: wgpu::BindGroup, + /// A pass reads the depth as plain floats: the copies are made. + float_reads: bool, +} + /// What a folder's geometry programs draw with at one size. struct BoundGeometry { /// The depth buffer the geometry tests against: the world's, then the @@ -442,6 +501,24 @@ impl JavaStages { }) } + /// Where the pack's shadow map looks this frame in `dimension`, when + /// it draws one: its view of camera-relative positions (`camera` is the + /// camera's position), and its half width, near and far planes, for + /// the renderer to pick the sections it draws. + pub fn shadow_view( + &self, + dimension: i8, + world: &JavaFrame, + camera: Vec3, + ) -> Option<(Mat4, [f32; 3])> { + let index = self.folder_for[(dimension.clamp(-1, 1) + 1) as usize].unwrap_or(0); + let folder = self.folders.get(index)?; + folder.geometry.as_ref()?.shadow.as_ref()?; + let d = folder.directives; + let (view, _) = shadow_matrices(&d, shadow_angle(world), camera); + Some((view, [d.shadow.distance, d.shadow.near, d.shadow.far])) + } + /// Whether the pack draws the terrain in `dimension` (0 overworld, -1 /// the Nether, 1 the End): the renderer then leaves it out of the world /// and gives `run` a [`JavaWorld`]. @@ -480,9 +557,10 @@ impl JavaStages { self.atlas = Atlas::new(device, queue, w); self.bound = None; } - if self.bound.as_ref().is_none_or(|b| { + let fresh = self.bound.as_ref().is_none_or(|b| { b.folder != folder || b.size != size || b.geometry.is_some() != terrain.is_some() - }) { + }); + if fresh { self.bound = Some(self.bind(device, queue, folder, color, depth, size, post, terrain)); } let now = std::time::Instant::now(); @@ -498,6 +576,8 @@ impl JavaStages { self.previous, ); inputs.set_world(&world, directives.sun_path_rotation); + (inputs.shadow_view, inputs.shadow_projection) = + shadow_matrices(&directives, inputs.shadow_angle, inputs.camera); if let Some(atlas) = &self.atlas { inputs.atlas_size = atlas.size().map(|v| v as f32); } @@ -537,7 +617,14 @@ impl JavaStages { let translucent_at = geometry.map_or(usize::MAX, |((g, _), _)| { g.translucent_at.min(folder.passes.len()) }); + let shadow = geometry + .and_then(|((g, b), w)| Some((g.shadow.as_ref()?, bound.shadow.as_ref()?, b, w))); for i in 0..=folder.passes.len() { + if let Some((sh, b, g, w)) = shadow + && i == sh.at.min(folder.passes.len()) + { + draw_shadow(queue, encoder, sh, b, g, &inputs, w, fresh); + } if i == world_at { world_in(encoder, bound); if let Some(((g, b), w)) = geometry { @@ -594,6 +681,151 @@ impl JavaStages { &bound.output } + /// The shadow map's textures at the folder's `shadowMapResolution`, + /// and its programs' groups. + #[allow(clippy::too_many_arguments)] + fn bind_shadow( + &self, + device: &wgpu::Device, + queue: &wgpu::Queue, + folder: &Folder, + shadow: &FolderShadow, + targets: &BTreeMap, + world: Option<&JavaWorld>, + blank: &mut Vec, + ) -> BoundShadow { + let side = folder + .directives + .shadow + .resolution + .clamp(1, device.limits().max_texture_dimension_2d); + let texture = |label, format, usage| { + device.create_texture(&wgpu::TextureDescriptor { + label: Some(label), + size: wgpu::Extent3d { + width: side, + height: side, + depth_or_array_layers: 1, + }, + mip_level_count: 1, + sample_count: 1, + dimension: wgpu::TextureDimension::D2, + format, + usage, + view_formats: &[], + }) + }; + use wgpu::TextureUsages as U; + let depth = texture( + "Java shader pack shadow depth", + wgpu::TextureFormat::Depth32Float, + U::RENDER_ATTACHMENT | U::TEXTURE_BINDING | U::COPY_SRC, + ); + let depth_solid = texture( + "Java shader pack shadow depth before translucent terrain", + wgpu::TextureFormat::Depth32Float, + U::TEXTURE_BINDING | U::COPY_DST, + ); + let float = |label| { + texture( + label, + wgpu::TextureFormat::R32Float, + U::RENDER_ATTACHMENT | U::TEXTURE_BINDING, + ) + .create_view(&Default::default()) + }; + // The colour targets the shadow programs write or a pass reads. + let passes = folder.passes.iter().chain(&folder.final_pass).chain( + folder + .geometry + .iter() + .flat_map(|g| std::iter::once(&g.terrain).chain(&g.water)), + ); + let mut used: BTreeSet = shadow + .solid + .draw_buffers + .iter() + .chain(shadow.water.iter().flat_map(|w| &w.draw_buffers)) + .copied() + .collect(); + let mut float_reads = false; + for s in passes.clone().flat_map(|p| &p.samplers) { + match s.source { + Source::ShadowColor(i) => { + used.insert(i); + } + Source::ShadowDepth(_) if !s.compare => float_reads = true, + _ => {} + } + } + let mut colors = Vec::new(); + let mut clears = Vec::new(); + let mut initial = Vec::new(); + for (i, &(format, clear)) in shadow.targets.iter().enumerate() { + if !used.contains(&(i as u32)) { + colors.push(None); + continue; + } + let view = texture( + "Java shader pack shadowcolor", + format, + U::RENDER_ATTACHMENT | U::TEXTURE_BINDING, + ) + .create_view(&Default::default()); + match clear { + Some(color) => clears.push((view.clone(), color)), + // Kept between frames: white to start with, as Iris's. + None => initial.push((view.clone(), wgpu::Color::WHITE)), + } + colors.push(Some(view)); + } + let views = ShadowViews { + depth: depth.create_view(&Default::default()), + depth_solid: depth_solid.create_view(&Default::default()), + float: float("Java shader pack shadowtex0"), + float_solid: float("Java shader pack shadowtex1"), + colors, + }; + // The shadow programs read neither the shadow map nor the size of + // the world's depth. + let unused = texture( + "Java shader pack shadow pass depth", + wgpu::TextureFormat::R32Float, + U::TEXTURE_BINDING, + ) + .create_view(&Default::default()); + let pass_views = Views { + depth: &unused, + depth_solid: &unused, + atlas: self.atlas.as_ref().map(|a| &a.view), + lightmap: world.map(|w| w.lightmap), + shadow: None, + }; + let mut bind = + |pass: &PassGpu| pass.bind(device, queue, targets, &pass_views, &self.common, blank); + let solid = bind(&shadow.solid); + let water = shadow.water.as_ref().map(&mut bind); + let out_group = device.create_bind_group(&wgpu::BindGroupDescriptor { + label: Some("Java shader pack shadow depth"), + layout: &self.common.depth_layout, + entries: &[wgpu::BindGroupEntry { + binding: 1, + resource: wgpu::BindingResource::TextureView(&views.depth), + }], + }); + BoundShadow { + views, + depth, + depth_solid, + clears, + initial, + solid, + water, + out_group, + float_reads, + } + } + #[allow(clippy::too_many_arguments)] fn bind( &self, @@ -702,13 +934,17 @@ impl JavaStages { .create_view(&Default::default()), None => depth.clone(), }; + let mut blank = Vec::new(); + let shadow = geometry + .and_then(|g| g.shadow.as_ref()) + .map(|sh| self.bind_shadow(device, queue, folder, sh, &targets, world, &mut blank)); let views = Views { depth: &depth, depth_solid: &depth_solid, atlas: self.atlas.as_ref().map(|a| &a.view), lightmap: world.map(|w| w.lightmap), + shadow: shadow.as_ref().map(|s| &s.views), }; - let mut blank = Vec::new(); let groups = all .clone() .map(|pass| pass.bind(device, queue, &targets, &views, &self.common, &mut blank)) @@ -839,6 +1075,7 @@ impl JavaStages { depth_solid, groups, geometry, + shadow, world_in: (world_pipeline, world_group), world_alt: plan.flipped_after_prepare.contains(&0), final_target, @@ -869,6 +1106,7 @@ fn folder_geometry( flat_vertex: g.variants.first().unwrap_or(&g.program.vertex), blends, layouts, + shadow: false, }), ) }; @@ -882,11 +1120,15 @@ fn folder_geometry( terrain, water, translucent_at: plan.translucent_at, + shadow: None, }) }); let error = pollster::block_on(scope.pop()); match (made, error) { - (Ok(geometry), None) => Some(geometry), + (Ok(mut geometry), None) => { + geometry.shadow = folder_shadow(device, plan, layouts); + Some(geometry) + } (Err(e), _) => { log::warn!("Horizon: shader pack {}: {e}", terrain.program.pass.program); None @@ -898,6 +1140,210 @@ fn folder_geometry( } } +/// A folder's shadow programs on the GPU, or `None` (with a warning: the +/// pack then reads a shadow map with nothing in shadow) when wgpu refuses +/// them. +fn folder_shadow( + device: &wgpu::Device, + plan: &JavaFolder, + layouts: &GeometryLayouts, +) -> Option { + let solid = plan.shadow.as_ref()?; + let formats: Vec = plan + .shadow_targets + .iter() + .map(|t| target_format(&t.format, false)) + .collect(); + // Instanced draws only: the flat draws hold what the camera sees. + let layouts = GeometryLayouts { + flat: None, + page: layouts.page, + }; + let scope = device.push_error_scope(wgpu::ErrorFilter::Validation); + let gpu = |g: &GeometryProgram, blends: &[Option]| { + PassGpu::new( + device, + &g.program, + &formats, + Output::Geometry(GeometrySetup { + flat_vertex: &g.program.vertex, + blends, + layouts: &layouts, + shadow: true, + }), + ) + }; + let made = gpu(solid, &plan.shadow_blends).and_then(|solid_gpu| { + let water = plan + .shadow_water + .as_ref() + .map(|w| gpu(w, &plan.shadow_water_blends)) + .transpose()?; + Ok((solid_gpu, water)) + }); + let error = pollster::block_on(scope.pop()); + let warn = |e: &dyn std::fmt::Display| { + log::warn!("Horizon: shader pack {}: {e}", solid.program.pass.program); + }; + match (made, error) { + (Ok((solid_gpu, water)), None) => Some(FolderShadow { + solid: solid_gpu, + water, + targets: plan + .shadow_targets + .iter() + .zip(&formats) + .map(|(t, &format)| { + let clear = t.clear.then(|| { + let [r, g, b, a] = t.clear_color.unwrap_or([1.0; 4]); + wgpu::Color { + r: r.into(), + g: g.into(), + b: b.into(), + a: a.into(), + } + }); + (format, clear) + }) + .collect(), + at: plan.shadow_at, + }), + (Err(e), _) => { + warn(&e); + None + } + (_, Some(e)) => { + warn(&e); + None + } + } +} + +/// The shadow map: Horizon's terrain from the light with the pack's +/// shadow programs, solid then translucent (`ShadowRenderer`), with the +/// depth before translucent terrain kept for `shadowtex1`. +#[allow(clippy::too_many_arguments)] +fn draw_shadow( + queue: &wgpu::Queue, + encoder: &mut wgpu::CommandEncoder, + shadow: &FolderShadow, + b: &BoundShadow, + geometry: &BoundGeometry, + inputs: &Inputs, + world: &JavaWorld, + fresh: bool, +) { + if fresh { + for (view, color) in &b.initial { + clear_view(encoder, view, *color); + } + } + for (view, color) in &b.clears { + clear_view(encoder, view, *color); + } + let draw = |encoder: &mut wgpu::CommandEncoder, + pass: &PassGpu, + group: &wgpu::BindGroup, + layer: Layer, + first: bool| { + pass.write_uniforms(queue, inputs); + let attachments: Vec> = pass + .draw_buffers + .iter() + .map(|&i| { + let view = b.views.colors.get(i as usize)?.as_ref()?; + Some(color_attachment(view, None)) + }) + .collect(); + let mut render = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some(&pass.program), + color_attachments: &attachments, + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { + view: &b.views.depth, + depth_ops: Some(wgpu::Operations { + load: if first { + wgpu::LoadOp::Clear(1.0) + } else { + wgpu::LoadOp::Load + }, + store: wgpu::StoreOp::Store, + }), + stencil_ops: None, + }), + ..Default::default() + }); + (world.draw)( + &mut render, + layer, + &TerrainPipelines { + instanced: &pass.pipeline, + flat: None, + group, + }, + ); + }; + let float_out = |encoder: &mut wgpu::CommandEncoder, solid: bool| { + if !b.float_reads { + return; + } + let mut attachments = vec![Some(color_attachment(&b.views.float, None))]; + if solid { + attachments.push(Some(color_attachment(&b.views.float_solid, None))); + } + let mut render = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some("Java shader pack shadow depth"), + color_attachments: &attachments, + ..Default::default() + }); + render.set_pipeline(if solid { + &geometry.out_both + } else { + &geometry.out + }); + render.set_bind_group(0, &b.out_group, &[]); + render.draw(0..3, 0..1); + }; + draw(encoder, &shadow.solid, &b.solid, Layer::ShadowSolid, true); + encoder.copy_texture_to_texture( + b.depth.as_image_copy(), + b.depth_solid.as_image_copy(), + b.depth.size(), + ); + float_out(encoder, true); + if let (Some(pass), Some(group)) = (&shadow.water, &b.water) { + draw(encoder, pass, group, Layer::ShadowTranslucent, false); + float_out(encoder, false); + } +} + +/// Iris's `shadowModelView` and `shadowProjection` (`ShadowMatrices`): +/// the light's view of camera-relative positions, snapped to the pack's +/// `shadowIntervalSize` as the camera moves, and an orthographic +/// projection `shadowDistance` wide each way of the camera. +pub fn shadow_matrices(directives: &Directives, shadow_angle: f32, camera: Vec3) -> (Mat4, Mat4) { + let sky = if shadow_angle < 0.25 { + shadow_angle + 0.75 + } else { + shadow_angle - 0.25 + }; + let mut view = Mat4::from_rotation_x(90f32.to_radians()) + * Mat4::from_rotation_z((sky * -360.0).to_radians()) + * Mat4::from_rotation_x(directives.sun_path_rotation.to_radians()); + let d = &directives.shadow; + if d.interval != 0.0 { + // Java's `%` keeps the dividend's sign, as Rust's does. + let offset = Vec3::new( + camera.x % d.interval, + camera.y % d.interval, + camera.z % d.interval, + ) - Vec3::splat(d.interval / 2.0); + view *= Mat4::from_translation(offset); + } + let h = d.distance; + let projection = Mat4::orthographic_rh_gl(-h, h, -h, h, d.near, d.far); + (view, projection) +} + fn world_in(encoder: &mut wgpu::CommandEncoder, bound: &Bound) { let colortex0 = &bound.targets[&0]; let side = if bound.world_alt { @@ -1257,7 +1703,10 @@ impl PassGpu { )), ) } - (false, Source::Depth | Source::DepthSolid | Source::Shadow) => ( + ( + false, + Source::Depth | Source::DepthSolid | Source::ShadowDepth(_) | Source::Far, + ) => ( wgpu::TextureSampleType::Float { filterable: false }, Some(false), ), @@ -1441,6 +1890,7 @@ impl PassGpu { scale: program.pass.scale.clamp(0.0, 1.0), flat_pipeline: None, geometry: None, + shadow: false, }) } @@ -1523,9 +1973,10 @@ impl PassGpu { compilation_options: Default::default(), buffers: &buffers, }, - // The y flip into GL's layout turns the faces around. + // The y flip into GL's layout turns the faces around. The + // shadow map culls none (a mountain's back casts shadows). primitive: wgpu::PrimitiveState { - cull_mode: Some(wgpu::Face::Back), + cull_mode: (!setup.shadow).then_some(wgpu::Face::Back), front_face: wgpu::FrontFace::Cw, ..Default::default() }, @@ -1583,6 +2034,7 @@ impl PassGpu { scale: 1.0, flat_pipeline, geometry: Some(flipped), + shadow: setup.shadow, }) } @@ -1599,8 +2051,31 @@ impl PassGpu { let depth = textures.depth; let mut views = Vec::new(); for s in &self.samplers { + let shadow = textures + .shadow + .filter(|_| s.dimension == wgpu::TextureViewDimension::D2); let view = match (s.compare, s.source) { + (true, Source::ShadowDepth(i)) if let Some(sh) = shadow => { + if i == 0 { + sh.depth.clone() + } else { + sh.depth_solid.clone() + } + } (true, _) => blank_view(device, queue, blank, s, BlankKind::FarDepth), + (false, Source::ShadowDepth(i)) if let Some(sh) = shadow => { + if i == 0 { + sh.float.clone() + } else { + sh.float_solid.clone() + } + } + (false, Source::ShadowColor(i)) + if let Some(view) = + shadow.and_then(|sh| sh.colors.get(i as usize)?.as_ref()) => + { + view.clone() + } (false, Source::Target(i)) if s.dimension == wgpu::TextureViewDimension::D2 => { match targets.get(&i) { Some(t) if self.reads_alt.contains(&i) => t.alt_view.clone(), @@ -1629,7 +2104,12 @@ impl PassGpu { (false, Source::FlatNormal) => { blank_view(device, queue, blank, s, BlankKind::FlatNormal) } - (false, Source::Shadow) => blank_view(device, queue, blank, s, BlankKind::Far), + (false, Source::ShadowDepth(_) | Source::Far) => { + blank_view(device, queue, blank, s, BlankKind::Far) + } + (false, Source::ShadowColor(_)) => { + blank_view(device, queue, blank, s, BlankKind::Color(true)) + } (false, Source::Noise) if s.dimension == wgpu::TextureViewDimension::D2 => { common.noise.clone() } @@ -1648,7 +2128,10 @@ impl PassGpu { (true, _) => &common.compare, _ if s.signed.is_some() => &common.nearest, (false, Source::Noise) => &common.repeat, - (false, Source::Depth | Source::DepthSolid | Source::Shadow) => &common.nearest, + ( + false, + Source::Depth | Source::DepthSolid | Source::ShadowDepth(_) | Source::Far, + ) => &common.nearest, (false, Source::Atlas) => &common.atlas, (false, Source::Target(i)) => { match targets.get(&i).map(|t| sample_type(t.format)) { @@ -1697,7 +2180,12 @@ impl PassGpu { }; let mut bytes = vec![0u8; *block_size as usize]; for (name, slots) in &self.uniforms { - if let Some(values) = inputs.value(name, self.geometry.is_some()) { + let values = if self.shadow { + inputs.shadow(name).or_else(|| inputs.value(name, true)) + } else { + inputs.value(name, self.geometry.is_some()) + }; + if let Some(values) = values { for (&(offset, int), value) in slots.iter().zip(values) { let at = offset as usize..offset as usize + 4; bytes[at].copy_from_slice(&if int { @@ -2073,6 +2561,19 @@ struct Inputs { custom: HashMap>, /// `atlasSize`, in geometry programs. atlas_size: [f32; 2], + /// `shadowModelView` and `shadowProjection` ([`shadow_matrices`]). + shadow_view: Mat4, + shadow_projection: Mat4, +} + +/// `shadowAngle`: the sun's angle by day, the moon's by night, 0..1. +fn shadow_angle(world: &JavaFrame) -> f32 { + let sun = celestial_angle(world.sun_angle); + if sun < 180.0 { + sun / 360.0 + } else { + celestial_angle(world.moon_angle) / 360.0 + } } /// `CelestialUniforms.getSunAngle`: the body's angle plus 90, in 0..360 @@ -2128,6 +2629,8 @@ impl Inputs { is_day: true, custom: HashMap::new(), atlas_size: [0.0; 2], + shadow_view: Mat4::IDENTITY, + shadow_projection: Mat4::IDENTITY, }; out.set_world(&JavaFrame::default(), 0.0); out @@ -2153,11 +2656,7 @@ impl Inputs { let sun = celestial_angle(world.sun_angle); self.is_day = sun < 180.0; self.sun_angle = sun / 360.0; - self.shadow_angle = if self.is_day { - sun - } else { - celestial_angle(world.moon_angle) - } / 360.0; + self.shadow_angle = shadow_angle(world); } /// The value of uniform `name`, as its scalars in order: Iris's own, @@ -2207,6 +2706,26 @@ impl Inputs { }) } + /// The uniforms whose value differs in shadow programs: the light's + /// matrices instead of the camera's. + fn shadow(&self, name: &str) -> Option> { + let mat = |m: Mat4| m.to_cols_array().to_vec(); + let (view, projection) = (self.shadow_view, self.shadow_projection); + Some(match name { + "iris_ModelViewMatrix" | "modelViewMatrix" => mat(view), + "iris_ModelViewMatrixInverse" | "modelViewMatrixInverse" => mat(view.inverse()), + "iris_ProjectionMatrix" | "projectionMatrix" => mat(projection), + "iris_ProjectionMatrixInverse" | "projectionMatrixInverse" => mat(projection.inverse()), + "iris_ModelViewProjectionMatrix" => mat(projection * view), + "iris_NormalMatrix" | "normalMatrix" => Mat3::from_mat4(view) + .inverse() + .transpose() + .to_cols_array() + .to_vec(), + _ => return None, + }) + } + /// The value of Iris uniform `name`; `None` for one Horizon doesn't /// provide. fn builtin(&self, name: &str) -> Option> { @@ -2269,10 +2788,10 @@ impl Inputs { "iris_ProjectionMatrixInverse" => mat(screen.inverse()), "iris_TextureMatrix" => (0..8).flat_map(|_| mat(Mat4::IDENTITY)).collect(), "iris_NormalMatrix" => Mat3::IDENTITY.to_cols_array().to_vec(), - "shadowModelView" - | "shadowModelViewInverse" - | "shadowProjection" - | "shadowProjectionInverse" => mat(Mat4::IDENTITY), + "shadowModelView" => mat(self.shadow_view), + "shadowModelViewInverse" => mat(self.shadow_view.inverse()), + "shadowProjection" => mat(self.shadow_projection), + "shadowProjectionInverse" => mat(self.shadow_projection.inverse()), _ => return None, }) } @@ -2310,14 +2829,52 @@ mod tests { ); } + #[test] + fn shadow_matrices_are_iris_s() { + use horizon_shaderpack::pipeline::ShadowDirectives; + let close = |a: Mat4, b: Mat4| { + for (x, y) in a.to_cols_array().iter().zip(b.to_cols_array()) { + assert!((x - y).abs() < 1e-5, "{a} != {b}"); + } + }; + // ShadowMatrices.Tests: shadowDistance 32, planes 0.05 and 256. + let directives = Directives { + shadow: ShadowDirectives { + distance: 32.0, + near: 0.05, + far: 256.0, + interval: 0.0, + ..ShadowDirectives::default() + }, + ..Directives::default() + }; + let (view, projection) = shadow_matrices(&directives, 0.25, Vec3::ZERO); + close( + projection, + Mat4::from_cols_array(&[ + 0.03125, 0.0, 0.0, 0.0, 0.0, 0.03125, 0.0, 0.0, 0.0, 0.0, -0.007_814_026, 0.0, 0.0, + 0.0, -1.000_390_6, 1.0, + ]), + ); + // Noon: the light looks straight down (up is toward it, +z). + assert!((view.transform_vector3(Vec3::Y) - Vec3::Z).length() < 1e-5); + // Snapped to the interval: x 5.5 % 2 = 1.5 further than 0 % 2. + let directives = Directives::default(); + let (snapped, _) = shadow_matrices(&directives, 0.25, Vec3::new(5.5, 0.0, 0.0)); + let (plain, _) = shadow_matrices(&directives, 0.25, Vec3::ZERO); + close(snapped, plain * Mat4::from_translation(Vec3::new(1.5, 0.0, 0.0))); + } + #[test] fn samplers_read_what_iris_binds() { assert_eq!(source("colortex4", false), Source::Target(4)); assert_eq!(source("gaux1", false), Source::Target(4)); assert_eq!(source("gdepthtex", false), Source::Depth); - assert_eq!(source("shadowtex1", false), Source::Shadow); - assert_eq!(source("dhDepthTex0", false), Source::Shadow); - assert_eq!(source("shadowcolor0", false), Source::Blank(true)); + assert_eq!(source("shadowtex1", false), Source::ShadowDepth(1)); + assert_eq!(source("shadow", false), Source::ShadowDepth(0)); + assert_eq!(source("dhDepthTex0", false), Source::Far); + assert_eq!(source("shadowcolor1", false), Source::ShadowColor(1)); + assert_eq!(source("shadowcolor", false), Source::ShadowColor(0)); assert_eq!(source("cloudTexture", false), Source::Blank(false)); // Before translucent terrain; geometry programs' own textures. assert_eq!(source("depthtex1", false), Source::DepthSolid); diff --git a/crates/horizon-client/src/gfx/java_terrain.rs b/crates/horizon-client/src/gfx/java_terrain.rs index dd0416428..eb71959c9 100644 --- a/crates/horizon-client/src/gfx/java_terrain.rs +++ b/crates/horizon-client/src/gfx/java_terrain.rs @@ -214,6 +214,10 @@ pub enum Layer { /// found in sight (phase 2). Revealed, Translucent, + /// The shadow map's sections ([`super::Renderer`]'s shadow list), solid + /// then translucent. + ShadowSolid, + ShadowTranslucent, } /// Draws Horizon's terrain with a pack's pipelines. Set by the renderer, diff --git a/crates/horizon-client/src/java_pack.rs b/crates/horizon-client/src/java_pack.rs index f0a1b85f0..5035e7fd2 100644 --- a/crates/horizon-client/src/java_pack.rs +++ b/crates/horizon-client/src/java_pack.rs @@ -44,6 +44,16 @@ pub struct JavaFolder { /// Each draw buffer's blending in `terrain` and `water`. pub terrain_blends: Vec>, pub water_blends: Vec>, + /// The shadow map's programs over Horizon's solid and translucent + /// terrain (instanced draws only), drawn after `begin*`, into + /// `shadowcolor` targets set by `shadow_targets`. + pub shadow: Option, + pub shadow_water: Option, + pub shadow_targets: Vec, + pub shadow_blends: Vec>, + pub shadow_water_blends: Vec>, + /// How many of `passes` run before the shadow map (`begin*`). + pub shadow_at: usize, } /// A loaded Java pack. @@ -138,9 +148,14 @@ pub fn load( } // A geometry program that doesn't translate leaves that terrain to // Horizon, with a warning. - let geometry = |pass: &Option, alpha_test| { + let geometry_with = |pass: &Option, + alpha_test, + flat: &[bool]| { let pass = pass.as_ref()?; - let glues = [false, true].map(|flat| crate::gfx::java_terrain::glue(flat, alpha_test)); + let glues: Vec<_> = flat + .iter() + .map(|&flat| crate::gfx::java_terrain::glue(flat, alpha_test)) + .collect(); match pack.compile_geometry(pass, &plan.targets, &values, &env, &properties, &glues) { Ok(program) => Some(program), Err(e) => { @@ -149,9 +164,20 @@ pub fn load( } } }; + let geometry = |pass: &Option, alpha_test| { + geometry_with(pass, alpha_test, &[false, true]) + }; // Iris's alpha test of cutout terrain (`AlphaTests.ONE_TENTH_ALPHA`). let terrain = geometry(&plan.terrain, Some(0.1)); let water = terrain.as_ref().and_then(|_| geometry(&plan.water, None)); + // The shadow map draws only with the pack's terrain, and only from + // instanced draws (the flat draws hold what the camera sees). + let shadow = terrain + .as_ref() + .and_then(|_| geometry_with(&plan.shadow, Some(0.1), &[false])); + let shadow_water = shadow + .as_ref() + .and_then(|_| geometry_with(&plan.shadow_water, None, &[false])); let translucent_at = early.clone().count() + plan.deferred.len(); let blends = |g: &Option, default| { g.as_ref().map_or_else(Vec::new, |g| { @@ -164,6 +190,9 @@ pub fn load( }) }; let terrain_blends = blends(&terrain, None); + // Iris's shadow programs don't blend (`BlendModeOverride.OFF`). + let shadow_blends = blends(&shadow, None); + let shadow_water_blends = blends(&shadow_water, None); // Vanilla's translucent blending (`BlendFunction.TRANSLUCENT`). let water_blends = blends( &water, @@ -195,6 +224,12 @@ pub fn load( flipped_after_translucent: plan.flipped_after_translucent, terrain_blends, water_blends, + shadow, + shadow_water, + shadow_targets: plan.shadow_targets, + shadow_blends, + shadow_water_blends, + shadow_at: plan.begin.len(), }); } if folders.is_empty() { @@ -324,10 +359,13 @@ mod tests { .folders .iter() .flat_map(|f| f.passes.iter().chain(&f.final_pass)); - let geometry = pack - .folders - .iter() - .flat_map(|f| f.terrain.iter().chain(&f.water)); + let geometry = pack.folders.iter().flat_map(|f| { + f.terrain + .iter() + .chain(&f.water) + .chain(&f.shadow) + .chain(&f.shadow_water) + }); passes .flat_map(|p| [(p, &p.vertex, "vsh"), (p, &p.fragment, "fsh")]) .chain(geometry.flat_map(|g| { @@ -379,6 +417,8 @@ mod tests { .terrain .iter() .chain(&f.water) + .chain(&f.shadow) + .chain(&f.shadow_water) .map(|g| g.program.pass.program.as_str()) .collect(); format!("{} {n} passes, terrain {geometry:?}", f.folder) diff --git a/crates/horizon-shaderpack/src/pipeline.rs b/crates/horizon-shaderpack/src/pipeline.rs index bcc1f310d..1619bc497 100644 --- a/crates/horizon-shaderpack/src/pipeline.rs +++ b/crates/horizon-shaderpack/src/pipeline.rs @@ -325,6 +325,74 @@ pub struct Passes { /// The program its translucent terrain is drawn with /// ([`WATER_PROGRAMS`]), after `deferred`. pub water: Option, + /// The programs the shadow map's solid and translucent terrain are + /// drawn with ([`SHADOW_PROGRAMS`], [`SHADOW_WATER_PROGRAMS`]), after + /// `begin`. Their draw buffers are `shadowcolor` targets. + pub shadow: Option, + pub shadow_water: Option, + /// `shadowcolor0..7`: white and cleared each frame unless the pack + /// says otherwise. + pub shadow_targets: Vec, +} + +/// The programs Iris draws the shadow map's solid terrain with. Horizon's +/// solid layer holds cutout blocks too, so `shadow_cutout` (with its alpha +/// test) comes first. +pub const SHADOW_PROGRAMS: &[&str] = &["shadow_cutout", "shadow", "shadow_solid"]; + +/// The programs Iris draws the shadow map's translucent terrain with. +pub const SHADOW_WATER_PROGRAMS: &[&str] = &["shadow_water", "shadow"]; + +/// How many `shadowcolor` targets Iris has. +pub const MAX_SHADOW_COLOR_BUFFERS: u32 = 8; + +/// `shadowcolorFormat`, `Clear` and `ClearColor` from `fragments`. +pub fn shadow_target_settings<'a>( + fragments: impl IntoIterator, +) -> Vec { + let mut targets = vec![ + TargetSettings { + clear_color: Some([1.0; 4]), + ..TargetSettings::default() + }; + MAX_SHADOW_COLOR_BUFFERS as usize + ]; + let key = |key: &str, suffix: &str| { + let i: u32 = key + .strip_prefix("shadowcolor")? + .strip_suffix(suffix)? + .parse() + .ok()?; + (i < MAX_SHADOW_COLOR_BUFFERS).then_some(i as usize) + }; + for fragment in fragments { + for c in const_directives(fragment) { + match c.ty { + "int" => { + if let Some(i) = key(&c.key, "Format") { + let format = c.value.to_uppercase(); + if TEXTURE_FORMATS.contains(&format.as_str()) { + targets[i].format = format; + } + } + } + "bool" => { + if let (Some(i), Ok(clear)) = (key(&c.key, "Clear"), c.value.parse()) { + targets[i].clear = clear; + } + } + "vec4" => { + if let (Some(i), Some(color)) = + (key(&c.key, "ClearColor"), parse_vec4(&c.value)) + { + targets[i].clear_color = Some(color); + } + } + _ => {} + } + } + } + targets } /// The programs Iris draws solid terrain with, the first the pack has @@ -356,6 +424,7 @@ pub struct Directives { pub sun_path_rotation: f32, /// `eyeBrightnessHalflife`, tenths of a second: `eyeBrightnessSmooth`. pub eye_brightness_half_life: f32, + pub shadow: ShadowDirectives, } impl Default for Directives { @@ -363,6 +432,35 @@ impl Default for Directives { Self { sun_path_rotation: 0.0, eye_brightness_half_life: 10.0, + shadow: ShadowDirectives::default(), + } + } +} + +/// The shadow map's `const` directives (`PackShadowDirectives`), with +/// Iris's defaults. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct ShadowDirectives { + /// `shadowMapResolution`: the shadow targets' width and height. + pub resolution: u32, + /// `shadowDistance`: half the side of the orthographic projection. + pub distance: f32, + /// `shadowNearPlane` and `shadowFarPlane` (`ShadowMatrices.NEAR`/`FAR`). + pub near: f32, + pub far: f32, + /// `shadowIntervalSize`: the light's view snaps to a grid this size as + /// the camera moves, so shadows don't shimmer. + pub interval: f32, +} + +impl Default for ShadowDirectives { + fn default() -> Self { + Self { + resolution: 1024, + distance: 160.0, + near: -100.05, + far: 156.0, + interval: 2.0, } } } @@ -378,6 +476,13 @@ impl Directives { match (c.ty, c.key.as_str(), value) { ("float", "sunPathRotation", Ok(v)) => out.sun_path_rotation = v, ("float", "eyeBrightnessHalflife", Ok(v)) => out.eye_brightness_half_life = v, + ("int", "shadowMapResolution", Ok(v)) if v >= 1.0 => { + out.shadow.resolution = v as u32; + } + ("float", "shadowDistance", Ok(v)) => out.shadow.distance = v, + ("float", "shadowNearPlane", Ok(v)) => out.shadow.near = v, + ("float", "shadowFarPlane", Ok(v)) => out.shadow.far = v, + ("float", "shadowIntervalSize", Ok(v)) => out.shadow.interval = v, _ => {} } } @@ -501,6 +606,7 @@ impl JavaPack { } let mut out = Passes { targets: target_settings(sources.iter().map(String::as_str), properties), + shadow_targets: shadow_target_settings(sources.iter().map(String::as_str)), directives: Directives::read(sources.iter().map(String::as_str)), ..Passes::default() }; @@ -529,6 +635,7 @@ impl JavaPack { }; let mut flipped = BTreeSet::new(); out.begin = run(&groups[0], "begin_pre", &mut flipped)?; + let flipped_after_begin = flipped.clone(); out.prepare = run(&groups[1], "prepare_pre", &mut flipped)?; out.flipped_after_prepare = flipped.clone(); out.deferred = run(&groups[2], "deferred_pre", &mut flipped)?; @@ -551,6 +658,8 @@ impl JavaPack { }; out.terrain = geometry(TERRAIN_PROGRAMS, &out.flipped_after_prepare)?; out.water = geometry(WATER_PROGRAMS, &out.flipped_after_translucent)?; + out.shadow = geometry(SHADOW_PROGRAMS, &flipped_after_begin)?; + out.shadow_water = geometry(SHADOW_WATER_PROGRAMS, &flipped_after_begin)?; if exists("final") { out.final_pass = Some(Pass { program: path("final"), @@ -849,6 +958,30 @@ mod tests { assert_eq!(d.eye_brightness_half_life, 4.0); } + #[test] + fn shadow_directives_and_targets() { + let text = "\ +const int shadowMapResolution = 2048; +const float shadowDistance = 128.0; +const float shadowIntervalSize = 3.0; +const bool shadowcolor0Clear = false; +const int shadowcolor1Format = RGBA16; +const vec4 shadowcolor1ClearColor = vec4(0.0, 0.0, 0.0, 0.0); +"; + let d = Directives::read([text]); + assert_eq!(d.shadow.resolution, 2048); + assert_eq!(d.shadow.distance, 128.0); + assert_eq!(d.shadow.interval, 3.0); + assert_eq!(d.shadow.near, ShadowDirectives::default().near); + let targets = shadow_target_settings([text]); + assert!(!targets[0].clear); + assert_eq!(targets[1].format, "RGBA16"); + assert_eq!(targets[1].clear_color, Some([0.0; 4])); + // Iris clears the others to white. + assert_eq!(targets[2].clear_color, Some([1.0; 4])); + assert!(targets[2].clear); + } + #[test] fn const_directives_and_target_settings() { let text = "\ diff --git a/docs/shader-packs.md b/docs/shader-packs.md index 263372d16..96013f15b 100644 --- a/docs/shader-packs.md +++ b/docs/shader-packs.md @@ -23,7 +23,8 @@ Both are off by default. With no pack selected the renderer draws exactly what i | Java shader packs: full-screen passes drawn (`java_pack.rs`, `gfx/java_stages.rs`: `begin`, `prepare`, `deferred*`, `composite*`, `final` over Horizon's world) | first slice: BSL and Complementary run (below) | | Java shader packs: custom uniforms (`horizon_shaderpack::uniforms`), `sunPathRotation`, `clouds`/`sun`/`moon`, eye light | done for the full-screen passes (below) | | Java shader packs: `gbuffers_terrain`, `gbuffers_water` (`gfx/java_terrain.rs`: Horizon's terrain fed to the pack's programs) | first slice: MakeUp Ultra Fast, Chocapic13' and BSL draw their own terrain and water (below) | -| Java shader packs: other `gbuffers_*`, `shadow`, custom textures, images, compute, option screen | planned | +| Java shader packs: `shadow` programs (`gfx/java_stages.rs`: the shadow map from Horizon's terrain) | first slice: terrain shadows for MakeUp Ultra Fast, Chocapic13' and BSL (below) | +| Java shader packs: other `gbuffers_*`, entity shadows, `shadowcomp`, custom textures, images, compute, option screen | planned | ## How the renderer draws a frame today @@ -371,6 +372,24 @@ Occlusion culling works as in Horizon's world pass where the GPU has it: the pac sections the last test saw, the boxes of the others are tested against that depth (in OpenGL's layout, in a pass of their own since the pack's targets vary), and the pack's program then draws the ones in sight. +When the pack has a `shadow` program (`shadow_cutout`, `shadow` or `shadow_solid` for the solid layer, which holds +cutout blocks; `shadow_water` or `shadow` for the translucent one), it draws a shadow map after `begin*`, as Iris's +`ShadowRenderer`: + +- the light's matrices are Iris's `ShadowMatrices`: `shadowModelView` turns camera-relative positions toward the sun + (the moon at night) with the pack's `sunPathRotation`, snapped to `shadowIntervalSize`; `shadowProjection` is + orthographic, `shadowDistance` each way, between `shadowNearPlane` and `shadowFarPlane` (Iris's defaults when the + pack sets none); the shadow programs get them as `gl_ModelViewMatrix` and `gl_ProjectionMatrix`; +- the renderer draws every section inside that box from its own list (not the camera's: cave culling is off as in + Iris, and no face is culled), solid then translucent, instanced draws only; +- `shadowtex0` holds all of it, `shadowtex1` the depth before translucent terrain; both are bound as depth textures + for `sampler2DShadow` (linear comparison, Iris's hardware filtering) and as float copies for `sampler2D` reads; +- `shadowcolor0..7` are `shadowMapResolution` square in their `shadowcolorFormat`, cleared each frame to + `shadowcolorClearColor` (white by default) unless `shadowcolorClear` is false. + +A shadow program that doesn't translate or that wgpu refuses leaves the pack without its shadow map, with a warning: +the terrain programs still run and every `shadowtex` reads as far (nothing in shadow). + What makes Horizon look like OpenGL to the pack: - **Layout.** The translator ends every vertex shader by flipping `gl_Position.y` and moving depth from `[-w, w]` to @@ -402,9 +421,10 @@ What makes Horizon look like OpenGL to the pack: Measured on the Mac mini (M4 Pro) with the packs' default options: BSL v10.1.8 and Complementary Reimagined r5.9.3 grade and light Horizon's world as their post-processing would. Sildur's Vibrant v2.02 draws only its sky: its `deferred` reads the albedo `gbuffers_*` write to `colortex4` (not checked again since the terrain programs run). -Without the other `gbuffers_*` and `shadow`, no pack has its shadows or sky look yet; Distant Horizons' and Voxy's depth read as far. Not supported yet: images and +Without the other `gbuffers_*`, no pack has its own sky yet, and only terrain casts shadows; Distant Horizons' and Voxy's depth read as far. Not supported yet: images and compute (`.csh`; a pack that needs them doesn't load), mipmapped targets (`colortexNMipmapEnabled` is read but -ignored), custom textures, the option screen; shadow matrices are identity. With the pack's terrain: entities, the +ignored), custom textures, the option screen, `shadowcomp` passes, `shadowMapFov` (a perspective shadow map), +`shadow.culling` and `shadowDistanceRenderMul` (the box above is the only bound). With the pack's terrain: entities, the sky, the hand, weather and clouds are still Horizon's (in `colortex0` only), block ids come from sprite names rather than block states, distant (LOD) terrain doesn't repeat its textures, and only the overworld has been checked. @@ -415,8 +435,8 @@ Tested on 2026-10-22 on the Mac mini (M4 Pro, Metal) with each pack's default op the authors' pages (dev-only test inputs, kept outside the repository). "Loads" means every pass the pack enables for the overworld, Nether and End is preprocessed, translated and validated, as the game does when the pack is picked (`java_pack::tests::real_packs_load` with `HORIZON_TEST_SHADERPACKS`); "drawn" means it was also picked in the game -and screenshotted. Full-screen passes, `gbuffers_terrain` and `gbuffers_water` run (above); no pack has its own -shadows, entities or sky yet. +and screenshotted. Full-screen passes, `gbuffers_terrain`, `gbuffers_water` and the terrain's shadow map run +(above); no pack has its own entities or sky yet. | Pack | Version | Result | First thing that stops it | | --- | --- | --- | --- | @@ -472,7 +492,7 @@ What the translator does for these packs, as Iris (JCPP and its GLSL transformer into Iris's attributes (`mc_Entity` from `block.properties`, `mc_midTexCoord`, `at_tangent`, lightmap), a second set of terrain pipelines writing the pack's render targets. 5. **Entities, block entities, hand, weather, clouds, particles** `gbuffers_*`. -6. **Shadow pass**: terrain and entities from the sun into `shadowtex0/1` and `shadowcolor0/1`, culled from the - light's view, with the pack's distortion. +6. **Shadow pass** (terrain done, above): entities and block entities from the sun into `shadowtex0/1` and + `shadowcolor0/1`, culled from the light's view, with the pack's distortion; `shadowcomp`. 7. **The rest**: custom textures, compute programs and images, per-dimension folders, `entity.properties`/`item.properties`. From 5858cb113e56af1cbc53e1a386b42b1d9c9c82aa Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 01:21:05 +0200 Subject: [PATCH 03/17] Java shader packs: the shadow map leaves out sections whose shadow can't reach the view A section's shadow is its box swept away from the light; when the box is outside one of the camera frustum's planes and the sweep never crosses it, nothing it casts can be seen (Iris's advanced shadow culling, conservatively). The picture is the same; BSL's 256-block shadow distance draws far fewer sections. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/gfx.rs | 57 ++++++++++++++++++-- crates/horizon-client/src/gfx/java_stages.rs | 23 ++++++-- docs/shader-packs.md | 5 +- 3 files changed, 77 insertions(+), 8 deletions(-) diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index 8e7f765a6..d02755fb9 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -3232,10 +3232,10 @@ impl Renderer { ), _ => None, }; - if let Some((view, [half, near, far])) = shadow_view { + if let Some((light_view, [half, near, far])) = shadow_view { // Inside when `plane ยท (p, 1) >= 0`: |x|, |y| <= half and the // eye depth between the near and far planes (GL looks down -z). - let (x, y, z) = (view.row(0), view.row(1), view.row(2)); + let (x, y, z) = (light_view.row(0), light_view.row(1), light_view.row(2)); let planes = [ Vec4::W * half - x, Vec4::W * half + x, @@ -3244,12 +3244,23 @@ impl Renderer { -z - Vec4::W * near, z + Vec4::W * far, ]; + // Toward the light: the light's view looks down its -z. + let light = z.truncate().normalize_or_zero(); + let casts = |k: SectionKey| { + let min = DVec3::new( + f64::from(k.0 * 16), + f64::from(crate::chunk::MIN_Y + k.1 * 16), + f64::from(k.2 * 16), + ) - camera; + let min = min.as_vec3(); + view.casts_into(min, min + Vec3::splat(16.0), light) + }; crate::spans::time("shadow visibility", || { self.sections.visible( camera, (frame.detail_distance / 16.0) as i32, &Frustum { planes }, - |_| true, + casts, |_, _| false, &mut shadow_visible, ) @@ -4413,6 +4424,21 @@ impl Frustum { p.truncate().dot(v) + p.w < 0.0 }) } + /// Whether the camera-relative box `min..max`, lit from the direction + /// `light` (toward the light), can cast a shadow inside: its shadow is + /// the box swept away from the light, which stays outside a plane the + /// box is outside of unless the sweep crosses it (Iris's advanced + /// shadow culling, conservatively). + pub fn casts_into(&self, min: Vec3, max: Vec3, light: Vec3) -> bool { + !self.planes.iter().any(|p| { + let v = Vec3::new( + if p.x >= 0.0 { max.x } else { min.x }, + if p.y >= 0.0 { max.y } else { min.y }, + if p.z >= 0.0 { max.z } else { min.z }, + ); + p.truncate().dot(v) + p.w < 0.0 && p.truncate().dot(light) >= 0.0 + }) + } } /// Vanilla's `Projection`: reversed depth (near maps to 1, far to 0, tests /// are GREATER_THAN_OR_EQUAL), which keeps far faces a hair apart, like @@ -4505,6 +4531,31 @@ fn frustum(m: Mat4) -> [Vec4; 6] { #[cfg(test)] mod tests { + #[test] + fn shadow_casters_are_the_boxes_whose_shadow_can_reach_the_view() { + use glam::Vec3; + // Looking north (-z) from the origin, level. + let m = super::world_projection(70.0, 16.0 / 9.0, 256.0) + * crate::camera::view_matrix(180.0, 0.0); + let view = super::Frustum { + planes: super::frustum(m), + }; + let cube = + |x: f32, y: f32, z: f32| (Vec3::new(x, y, z), Vec3::new(x + 16.0, y + 16.0, z + 16.0)); + let noon = Vec3::Y; + // In view: casts. + let (min, max) = cube(-8.0, -8.0, -64.0); + assert!(view.intersects(min, max) && view.casts_into(min, max, noon)); + // Far above the view, the sun overhead: its shadow falls into it. + let (min, max) = cube(-8.0, 200.0, -64.0); + assert!(!view.intersects(min, max) && view.casts_into(min, max, noon)); + // Behind the camera: its shadow falls straight down, behind it too. + let (min, max) = cube(-8.0, -8.0, 32.0); + assert!(!view.casts_into(min, max, noon)); + // The same box with a low sun behind the camera (south): it does. + assert!(view.casts_into(min, max, Vec3::new(0.0, 0.2, 1.0).normalize())); + } + #[test] fn surface_is_8_bit_and_not_srgb() { use super::surface_format; diff --git a/crates/horizon-client/src/gfx/java_stages.rs b/crates/horizon-client/src/gfx/java_stages.rs index dbe03dae9..a8a445746 100644 --- a/crates/horizon-client/src/gfx/java_stages.rs +++ b/crates/horizon-client/src/gfx/java_stages.rs @@ -2852,8 +2852,22 @@ mod tests { close( projection, Mat4::from_cols_array(&[ - 0.03125, 0.0, 0.0, 0.0, 0.0, 0.03125, 0.0, 0.0, 0.0, 0.0, -0.007_814_026, 0.0, 0.0, - 0.0, -1.000_390_6, 1.0, + 0.03125, + 0.0, + 0.0, + 0.0, + 0.0, + 0.03125, + 0.0, + 0.0, + 0.0, + 0.0, + -0.007_814_026, + 0.0, + 0.0, + 0.0, + -1.000_390_6, + 1.0, ]), ); // Noon: the light looks straight down (up is toward it, +z). @@ -2862,7 +2876,10 @@ mod tests { let directives = Directives::default(); let (snapped, _) = shadow_matrices(&directives, 0.25, Vec3::new(5.5, 0.0, 0.0)); let (plain, _) = shadow_matrices(&directives, 0.25, Vec3::ZERO); - close(snapped, plain * Mat4::from_translation(Vec3::new(1.5, 0.0, 0.0))); + close( + snapped, + plain * Mat4::from_translation(Vec3::new(1.5, 0.0, 0.0)), + ); } #[test] diff --git a/docs/shader-packs.md b/docs/shader-packs.md index 96013f15b..de0e82717 100644 --- a/docs/shader-packs.md +++ b/docs/shader-packs.md @@ -380,8 +380,9 @@ cutout blocks; `shadow_water` or `shadow` for the translucent one), it draws a s (the moon at night) with the pack's `sunPathRotation`, snapped to `shadowIntervalSize`; `shadowProjection` is orthographic, `shadowDistance` each way, between `shadowNearPlane` and `shadowFarPlane` (Iris's defaults when the pack sets none); the shadow programs get them as `gl_ModelViewMatrix` and `gl_ProjectionMatrix`; -- the renderer draws every section inside that box from its own list (not the camera's: cave culling is off as in - Iris, and no face is culled), solid then translucent, instanced draws only; +- the renderer draws every section inside that box whose shadow can reach the camera's view (the box swept away + from the light against the view's planes, as Iris's advanced shadow culling), from its own list (cave culling is + off as in Iris, and no face is culled), solid then translucent, instanced draws only; - `shadowtex0` holds all of it, `shadowtex1` the depth before translucent terrain; both are bound as depth textures for `sampler2DShadow` (linear comparison, Iris's hardware filtering) and as float copies for `sampler2D` reads; - `shadowcolor0..7` are `shadowMapResolution` square in their `shadowcolorFormat`, cleared each frame to From 717f54bf281cd81952af1382b5ba8cfcfd14daab Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:48:06 +0200 Subject: [PATCH 04/17] Creative search tab: number keys over a slot move its item to the hotbar CreativeModeInventoryScreen.keyPressed on the search tab tries the hotbar keys on the hovered slot before the search box: a digit or keypad key bound to key.hotbar.N swaps when the cursor is over a slot holding an item, or any slot that is not a display slot, and the cursor stack is empty (checkHotbarKeyPressed). Over an empty display slot, outside every slot or with a stack held, the key still types. Horizon sent every key to the search box (#1460). Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/creative.rs | 39 +++++++++++++ crates/horizon-client/src/game.rs | 83 ++++++++++++++++++++++----- 2 files changed, 108 insertions(+), 14 deletions(-) diff --git a/crates/horizon-client/src/creative.rs b/crates/horizon-client/src/creative.rs index 55e4eb28e..e1d1c262e 100644 --- a/crates/horizon-client/src/creative.rs +++ b/crates/horizon-client/src/creative.rs @@ -425,6 +425,29 @@ fn split_id(id: &str) -> (String, String) { None => ("minecraft".to_owned(), id.to_owned()), } } +/// The slot under the cursor, for the search tab's keys. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum Hover { + Nothing, + /// A display slot (`isCreativeSlot`), showing an item or past the end. + Display { + filled: bool, + }, + /// Any other slot: the hotbar row, or the inventory tab's slots. + Slot, +} + +/// `CreativeModeInventoryScreen.keyPressed` on the search tab: whether a +/// key is a hotbar swap on the hovered slot instead of text for the search +/// box. `numeric` is `getNumericKeyValue().isPresent()` (the digit and keypad +/// keys); `hotbar_key` is a `keyHotbarSlots` key. Over an empty display slot +/// the key types (`doQuickSwap` is false), and `checkHotbarKeyPressed` needs +/// a hovered slot and an empty cursor. +pub fn search_key_swaps(numeric: bool, hotbar_key: bool, hover: Hover, carrying: bool) -> bool { + let quick_swap = hover != Hover::Display { filled: false }; + quick_swap && numeric && hotbar_key && !carrying && hover != Hover::Nothing +} + /// What a click on an item tab's display slot does besides changing the /// carried stack. #[derive(Clone, PartialEq, Debug)] @@ -529,6 +552,22 @@ mod tests { (carried, effect) } + #[test] + fn search_tab_number_keys_swap_over_a_slot_before_typing() { + let filled = Hover::Display { filled: true }; + let empty = Hover::Display { filled: false }; + // Over an item, the hotbar row or another slot: the hotbar swap. + assert!(search_key_swaps(true, true, filled, false)); + assert!(search_key_swaps(true, true, Hover::Slot, false)); + // Over an empty display slot, nothing or with a carried stack: text. + assert!(!search_key_swaps(true, true, empty, false)); + assert!(!search_key_swaps(true, true, Hover::Nothing, false)); + assert!(!search_key_swaps(true, true, filled, true)); + // Letters always type; so do the digits no hotbar key is bound to. + assert!(!search_key_swaps(false, false, filled, false)); + assert!(!search_key_swaps(true, false, filled, false)); + } + #[test] fn display_slot_clicks_follow_slot_clicked() { use crate::menu::Input::*; diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 03854e9f8..49ef4c4ca 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -5955,6 +5955,37 @@ impl Game<'_> { } true } + /// `CreativeModeInventoryScreen.keyPressed` on the search tab: a hotbar + /// key over a slot swaps before the search box sees it. + fn search_tab_hotbar_key(&mut self, code: KeyCode) -> bool { + use horizon_client::creative::{Hover, search_key_swaps}; + let hotbar_key = HOTBAR_DIGITS.contains(&code); + let numeric = hotbar_key || NUMERIC_KEYS.contains(&code); + if !numeric { + return false; + } + let Some(size) = self + .renderer + .as_ref() + .map(|r| [r.config.width, r.config.height]) + else { + return false; + }; + let batch = HudBatch::new(size); + let hover = match self.slot_at(&batch, self.cursor.0, self.cursor.1) { + None => Hover::Nothing, + Some(slot) if slot >= Creative::DISPLAY => { + let first = self.creative_screen.first_row(&self.pack.names); + let shown = self.creative_screen.items(&self.pack.names).len(); + Hover::Display { + filled: first * 9 + slot - Creative::DISPLAY < shown, + } + } + Some(_) => Hover::Slot, + }; + search_key_swaps(numeric, hotbar_key, hover, self.carried.is_some()) + && self.inventory_hotkey(code) + } /// Number keys, F and Q over a slot of the open menu: SWAP with a hotbar /// slot or the off hand, THROW one or the whole stack. fn inventory_hotkey(&mut self, key: KeyCode) -> bool { @@ -5970,19 +6001,7 @@ impl Game<'_> { let Some(slot) = self.slot_at(&batch, self.cursor.0, self.cursor.1) else { return false; }; - let digit = [ - KeyCode::Digit1, - KeyCode::Digit2, - KeyCode::Digit3, - KeyCode::Digit4, - KeyCode::Digit5, - KeyCode::Digit6, - KeyCode::Digit7, - KeyCode::Digit8, - KeyCode::Digit9, - ] - .iter() - .position(|k| *k == key); + let digit = HOTBAR_DIGITS.iter().position(|k| *k == key); let done = match (digit, key) { (Some(n), _) => self.menu_click(Some(slot), n as i32, Input::Swap), (None, KeyCode::KeyF) => self.menu_click(Some(slot), 40, Input::Swap), @@ -10267,6 +10286,11 @@ impl Game<'_> { if (self.screen == Screen::Inventory || (self.screen == Screen::Creative && !self.creative_screen.tab().search)) && self.inventory_hotkey(key) => {} + // The search tab's number keys (scripted presses; the window's + // keys reach search_tab_hotbar_key before the search box). + _ if self.screen == Screen::Creative + && self.creative_screen.tab().search + && self.search_tab_hotbar_key(key) => {} KeyCode::KeyT if self.screen == Screen::Inventory => self.recipe_focus_search(), KeyCode::KeyT if self.screen == Screen::Playing => self.open_chat(""), // key.advancements. @@ -11138,7 +11162,11 @@ impl ApplicationHandler for Game<'_> { && event.state == ElementState::Pressed && !matches!(event.physical_key, PhysicalKey::Code(KeyCode::Escape)) => { - if let Some(shortcut) = self.edit_shortcut(&event) { + if let PhysicalKey::Code(key) = event.physical_key + && self.search_tab_hotbar_key(key) + { + // The hovered slot took the key (`ignoreTextInput`). + } else if let Some(shortcut) = self.edit_shortcut(&event) { self.creative_search_shortcut(shortcut); } else { let backspace = event.physical_key == PhysicalKey::Code(KeyCode::Backspace); @@ -12065,6 +12093,33 @@ impl Game<'_> { } } +/// `key.hotbar.1` to `key.hotbar.9` in a menu. +const HOTBAR_DIGITS: [KeyCode; 9] = [ + KeyCode::Digit1, + KeyCode::Digit2, + KeyCode::Digit3, + KeyCode::Digit4, + KeyCode::Digit5, + KeyCode::Digit6, + KeyCode::Digit7, + KeyCode::Digit8, + KeyCode::Digit9, +]; +/// The other keys `InputConstants.Key.getNumericKeyValue` gives a digit. +const NUMERIC_KEYS: [KeyCode; 11] = [ + KeyCode::Digit0, + KeyCode::Numpad0, + KeyCode::Numpad1, + KeyCode::Numpad2, + KeyCode::Numpad3, + KeyCode::Numpad4, + KeyCode::Numpad5, + KeyCode::Numpad6, + KeyCode::Numpad7, + KeyCode::Numpad8, + KeyCode::Numpad9, +]; + const STAGES: u32 = 10; const STAGE_LINES: [&str; 10] = [ "Loading menu", From eb79cfdb010fc01ce88a31a3c6e30b5361fafde0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 19:05:32 +0200 Subject: [PATCH 05/17] Entity shadows: no more z-fighting with chicken feet and other model feet Shadow quads were lifted 0.001 above the block top and drawn in the entity batch with depth writes. LivingEntityRenderer's translate(0, -1.501, 0) puts a model's feet 0.001 above the ground too, so a chicken's feet and the shadow under it were coplanar and flickered (#1440). ShadowFeatureRenderer puts the quads on the block top itself (relativeY + shapeBelow.minY), and RenderPipelines.ENTITY_SHADOW tests depth without writing it. Shadows are now their own entity material (overlay 14) drawn by such a pipeline after the entities. A small depth bias, constant plus 1.5% of the slope, keeps them over the terrain under them, whose vertices snap to the subpixel grid differently (without it whole shadows vanished at some camera positions), while staying under feet 0.001 higher. The shader pack shadow map no longer draws entity shadows as casters. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/gfx.rs | 49 ++++++++++++++--- crates/horizon-client/src/gfx/entity_batch.rs | 15 ++++-- crates/horizon-client/src/shadows.rs | 53 ++++++++++++++++++- 3 files changed, 104 insertions(+), 13 deletions(-) diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index fc217bf5c..dbd3d9fd6 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -35,7 +35,7 @@ fn entity_shader() -> String { mod entity_batch; mod weather; use entity_batch::EntityBatch; -pub use entity_batch::WATER_MASK_OVERLAY; +pub use entity_batch::{SHADOW_OVERLAY, WATER_MASK_OVERLAY}; /// Window.getAppropriateLineWidth, in framebuffer pixels. pub fn outline_width(width: u32) -> f32 { @@ -375,6 +375,7 @@ pub struct Renderer { entity_pipeline: wgpu::RenderPipeline, weather: weather::Weather, crumbling_pipeline: wgpu::RenderPipeline, + shadow_blob_pipeline: wgpu::RenderPipeline, /// `RenderPipelines.WATER_MASK`: depth writes only, no colour. water_mask_pipeline: wgpu::RenderPipeline, cloud_pipeline: wgpu::RenderPipeline, @@ -1815,6 +1816,26 @@ impl Renderer { CRUMBLING_BLEND, false, ); + // RenderPipelines.ENTITY_SHADOW: translucent, depth test without + // writes. The quads lie on the block tops like vanilla's, but the + // terrain under them snaps to the subpixel grid at other vertices, so + // at a slant their depths differ by up to 1/256 of a pixel's depth + // slope and whole shadows failed the test. The bias covers that and + // the rounding, and stays below the 0.001 a model's feet sit higher + // (1/27 of a pixel's slope at the 16-block shadow range in 720p). + let shadow_blob_pipeline = entity_pipeline( + "Entity shadows", + None, + false, + wgpu::CompareFunction::GreaterEqual, + wgpu::DepthBiasState { + constant: 16, + slope_scale: 0.015, + clamp: 0.0, + }, + alpha_blend, + false, + ); let cloud_pipeline = entity_pipeline( "Clouds", Some(wgpu::Face::Back), @@ -2332,6 +2353,7 @@ impl Renderer { entity_pipeline, weather, crumbling_pipeline, + shadow_blob_pipeline, water_mask_pipeline, cloud_pipeline, cloud_mesh: Default::default(), @@ -3510,6 +3532,7 @@ impl Renderer { crumbling_quads, translucent_crumbling_quads, water_mask_quads, + shadow_quads, ] = self.entity_batch.update( frame.entities, frame.additive, @@ -3517,8 +3540,11 @@ impl Renderer { frame.see_through, ); let weather_quads = frame.weather.len() as u32 / 4; - let world_quads = - entity_quads + crumbling_quads + translucent_crumbling_quads + water_mask_quads; + let world_quads = entity_quads + + crumbling_quads + + translucent_crumbling_quads + + water_mask_quads + + shadow_quads; let cloud_quads = if let Some(input) = &frame.clouds { let (rebuilt, uniform) = crate::spans::time("clouds", || self.cloud_mesh.prepare(input)); @@ -3972,6 +3998,17 @@ impl Renderer { pass.draw_indexed(0..crumbling_quads * 6, (entity_quads * 4) as i32, 0..1); pass.set_bind_group(0, &self.group, &[]); } + if shadow_quads > 0 { + pass.set_pipeline(&self.shadow_blob_pipeline); + pass.set_bind_group(0, &self.entity_group, &[]); + pass.set_vertex_buffer(0, self.entity_buffer.slice(..)); + pass.draw_indexed( + 0..shadow_quads * 6, + ((world_quads - shadow_quads) * 4) as i32, + 0..1, + ); + pass.set_bind_group(0, &self.group, &[]); + } // BoatRenderer's water patch (RenderTypes.waterMask): depth only, // before translucent terrain, so no water shows inside the boat. if water_mask_quads > 0 { @@ -4625,14 +4662,14 @@ mod tests { normal: [0; 4], }; 4] }; - let entities: Vec<_> = [(0, 0), (4, 1), (11, 2), (7, 3), (4, 4), (12, 7)] + let entities: Vec<_> = [(0, 0), (14, 9), (4, 1), (11, 2), (7, 3), (4, 4), (12, 7)] .into_iter() .flat_map(|(layer, id)| quad(layer, id)) .collect(); let mut batch = super::EntityBatch::default(); let counts = batch.update(&entities, &quad(3, 5), &quad(0, 6), &quad(0, 8)); let vertices = &batch.combined; - assert_eq!(counts, [4, 1, 1, 0]); + assert_eq!(counts, [4, 1, 1, 0, 1]); assert_eq!( vertices .as_chunks::<4>() @@ -4640,7 +4677,7 @@ mod tests { .iter() .map(|q| q[0].light) .collect::>(), - [0, 1, 3, 4, 2, 7, 5, 6, 8] + [0, 1, 3, 4, 2, 7, 9, 5, 6, 8] ); } #[test] diff --git a/crates/horizon-client/src/gfx/entity_batch.rs b/crates/horizon-client/src/gfx/entity_batch.rs index 999113761..56ffb04b9 100644 --- a/crates/horizon-client/src/gfx/entity_batch.rs +++ b/crates/horizon-client/src/gfx/entity_batch.rs @@ -2,11 +2,14 @@ use super::Vertex; /// Entity materials by a quad's overlay (`Vertex::layer`), in draw order: -/// ordinary entities, breaking cracks (11), translucent breaking cracks (12) -/// and the boat water mask (13, `RenderPipelines.WATER_MASK`). -const MATERIALS: usize = 4; +/// ordinary entities, breaking cracks (11), translucent breaking cracks (12), +/// the boat water mask (13, `RenderPipelines.WATER_MASK`) and entity shadows +/// (14, `RenderPipelines.ENTITY_SHADOW`). +const MATERIALS: usize = 5; /// The overlay of depth-only quads that hide water (`RenderTypes.waterMask`). pub const WATER_MASK_OVERLAY: u32 = 13; +/// The overlay of entity shadow quads (`RenderTypes.entityShadow`). +pub const SHADOW_OVERLAY: u32 = 14; #[derive(Default)] pub(super) struct EntityBatch { @@ -37,6 +40,7 @@ impl EntityBatch { 11 => 1, 12 => 2, WATER_MASK_OVERLAY => 3, + SHADOW_OVERLAY => 4, _ => 0, }; self.buckets[material][counts[material]] = index; @@ -88,12 +92,13 @@ mod tests { ) -> (Vec, [u32; MATERIALS]) { let mut combined = Vec::with_capacity(entities.len() + additive.len() + hand.len()); let mut counts = [0; MATERIALS]; - for (i, layer) in [0, 11, 12, 13].into_iter().enumerate() { + for (i, layer) in [0, 11, 12, 13, 14].into_iter().enumerate() { for quad in entities.as_chunks::<4>().0 { let material = match quad[0].layer { 11 => 11, 12 => 12, 13 => 13, + 14 => 14, _ => 0, }; if material == layer { @@ -113,7 +118,7 @@ mod tests { pos: [index as f32, 2.0, 3.0], uv: [index as f32, 5.0], layer: if mixed { - [7, 11, 12, 4, 13, 0][index / 4 % 6] + [7, 11, 14, 12, 4, 13, 0][index / 4 % 7] } else { 0 }, diff --git a/crates/horizon-client/src/shadows.rs b/crates/horizon-client/src/shadows.rs index 66e4f272b..dece7f726 100644 --- a/crates/horizon-client/src/shadows.rs +++ b/crates/horizon-client/src/shadows.rs @@ -103,7 +103,10 @@ pub fn shadow( let v = |wz: f64| (-((wz - pos.z) as f32) / 2.0 / radius + 0.5).clamp(0.0, 1.0); let a = (alpha * 255.0) as u32; let color = a << 24 | 0x00FF_FFFF; - let top = f64::from(y) + 0.001; + // ShadowFeatureRenderer: relativeY + shapeBelow.minY, the block top + // itself. A model's feet sit 0.001 above it (LivingEntityRenderer's + // translate(0, -1.501, 0)), so a lifted shadow fights with them. + let top = f64::from(y); for (wx, wz) in [(bx0, bz0), (bx0, bz1), (bx1, bz1), (bx1, bz0)] { let p = DVec3::new(wx, top, wz) - camera; out.push(Vertex { @@ -113,7 +116,7 @@ pub fn shadow( sprite.u0 + (sprite.u1 - sprite.u0) * u(wx), sprite.v0 + (sprite.v1 - sprite.v0) * v(wz), ], - layer: 0, + layer: crate::gfx::SHADOW_OVERLAY, color, light: 240 | 240 << 8, }); @@ -127,6 +130,52 @@ pub fn shadow( mod tests { use super::*; #[test] + fn shadows_lie_on_the_block_top_under_model_feet() { + use crate::chunk::Chunk; + use horizon_world::level::data; + use std::{path::PathBuf, sync::Arc}; + let root = std::env::var_os("HORIZON_RESOURCES") + .map(PathBuf::from) + .unwrap_or_else(|| { + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("../../.local/horizon-client") + .join(horizon_core::VANILLA_VERSION) + }); + if !root.join("gameplay-facts.json").exists() { + eprintln!("skipping resource-backed shadow check: {}", root.display()); + return; + } + let registry = data::load_registry(&root).unwrap(); + let facts = BlockFacts::load(&root, ®istry).unwrap(); + let stone = registry.default_state("minecraft:stone").unwrap(); + let mut world = World::new(facts.air, 0); + world.chunks.insert((0, 0), Arc::new(Chunk::empty(0, 0))); + for x in 0..16 { + for z in 0..16 { + world.set(x, 63, z, stone).unwrap(); + } + } + let (camera, pos) = (DVec3::new(8.5, 66.0, 4.0), DVec3::new(8.5, 64.0, 8.5)); + let mut out = Vec::new(); + let sprite = Rect { + u0: 0.0, + v0: 0.0, + u1: 1.0, + v1: 1.0, + w: 16, + h: 16, + }; + shadow( + &world, &facts, sprite, camera, pos, 0.3, 1.0, 0.0, 0, &mut out, + ); + assert_eq!(out.len(), 4); + let feet = (pos.y + (1.501 - 24.0 / 16.0) - camera.y) as f32; + for v in &out { + assert_eq!(v.pos[1], (pos.y - camera.y) as f32); + assert!(v.pos[1] < feet); + } + } + #[test] fn vanilla_radii() { assert_eq!(shadow_params("minecraft:zombie"), (0.5, 1.0)); assert_eq!(shadow_params("minecraft:item"), (0.15, 0.75)); From 4fa59663384b1a4b61df770f471164aa32aa36ad Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 19:27:20 +0200 Subject: [PATCH 06/17] Text: the glyph cache hashes chars with Fx instead of SipHash Every drawn character looks its glyph up in the font set's cache, and with std's SipHash the hashing was the top cost of drawing sign text (#1461: 100 text signs in view). FxHash for those char keys cuts the frame's prepare time with 100 text signs from 0.32 ms to 0.22 ms on the Mac mini (Metal, 1280x720): 1920 to 2250 fps. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/font.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/font.rs b/crates/horizon-client/src/font.rs index a25568df5..801a892d5 100644 --- a/crates/horizon-client/src/font.rs +++ b/crates/horizon-client/src/font.rs @@ -102,7 +102,8 @@ enum Provider { /// One font (`FontSet`): its providers and the glyphs resolved so far. struct FontSet { providers: Vec, - glyphs: HashMap, + /// Every char drawn looks up here, so the hasher is Fx, not SipHash. + glyphs: crate::fast_hash::FxHashMap, /// `glyphsByWidth` for obfuscated text (built on first use). by_width: Option>>, } @@ -647,7 +648,7 @@ impl Font { .collect(); FontSet { providers, - glyphs: HashMap::new(), + glyphs: Default::default(), by_width: None, } } From c86996c234457b08dafcae375a36ebdbe8fcadd9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 22:29:40 +0200 Subject: [PATCH 07/17] Fishing on a server's players: a hook per player, ticked on the server and drawn by its clients A server's players (LAN guests, and single player's window on its server thread) cast no lasting hook and caught nothing (#1348): the guest's cast went into the game's own hook, which the server's tick then dropped for want of a local player. Each guest now keeps its own hook (Player.fishing), swapped in with the rest of its state for its turns, ticked as theirs every server tick, and dropped when they die. Reeling in retrieves it on the server: a catch, the rod's wear, the experience. The server tracks every hook to its players as a fishing_bobber entity (FishingHook.getAddEntityPacket: the owner's id; DATA_HOOKED_ENTITY and DATA_BITING). A client takes the one its own player cast as its hook, so the rod shows cast and the line runs to its hand, and draws the others' bobbers on lines to their owners' hands. A hook resting on a block stays on the ground (Entity.move keeps onGround when nothing moves vertically); it used to flip every tick, so reeling it in cost the rod 2 only half the time. lan_e2e fishing: host and guest, both modes: the hook stays out and both sides draw it, reeling in from the ground costs 2, and in open water with Lure III a fish bites and is caught for 1. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 3 + crates/horizon-client/src/game/fishing.rs | 282 +++++++++++++++--- crates/horizon-client/src/game/lan.rs | 2 + crates/horizon-client/src/game/lan_actions.rs | 9 + .../src/game/remote_projectiles.rs | 7 + tools/lan_e2e.py | 80 +++++ 6 files changed, 342 insertions(+), 41 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index b64eeb9a5..bc0cb86b9 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -1442,6 +1442,8 @@ struct Game<'a> { mount_menu: mount_menu::MountMenu, /// The player's fishing hook. hook: Option, + /// The other players' hooks a server tracks to this client. + remote_hooks: Vec, tridents: Vec, rockets: Vec, /// Ominous trial spawners' item spawners. @@ -11801,6 +11803,7 @@ impl<'a> Game<'a> { recipe_ui: Default::default(), mount_menu: Default::default(), hook: None, + remote_hooks: Vec::new(), tridents: Vec::new(), rockets: Vec::new(), ominous_spawners: Vec::new(), diff --git a/crates/horizon-client/src/game/fishing.rs b/crates/horizon-client/src/game/fishing.rs index 94067e7f9..d454df406 100644 --- a/crates/horizon-client/src/game/fishing.rs +++ b/crates/horizon-client/src/game/fishing.rs @@ -2,6 +2,7 @@ //! bobbing, lure and bite timers, open water, hooking mobs, retrieving the //! `gameplay/fishing` loot) and `FishingHookRenderer` (bobber and line). use super::{Game, view_vector}; +use horizon_client::lan::{entity::States, hub::Hub}; use horizon_client::{ blocks::Fluid, collisions::SceneCollisions, @@ -15,7 +16,10 @@ use horizon_core::{ geometry::{Aabb, Vec3, trig}, random::RandomSource, }; -use std::sync::Arc; +use horizon_protocol::entity_data::{Value, serializer}; +use std::{collections::HashMap, sync::Arc}; + +use super::lan_actions::GuestPlay; #[derive(Clone, Copy, Debug, PartialEq)] enum State { @@ -24,6 +28,8 @@ enum State { Hooked(u32), } pub(super) struct Hook { + /// Its entity id, which a server's players track it under. + id: u32, position: Vec3, previous: Vec3, velocity: Vec3, @@ -114,7 +120,9 @@ impl Game<'_> { ); // A spawned hook's start position is its feet: centre the box on the eye. let start = Vec3::new(start.x, start.y - SIZE / 2.0, start.z); + self.next_entity += 1; self.hook = Some(Hook { + id: self.next_entity, position: start, previous: start, velocity: v, @@ -562,12 +570,17 @@ impl Game<'_> { lerp(h.previous.z, h.position.z), )) } - /// FishingHookRenderer: the bobber, a camera-facing half-block quad - /// centred on the hook. + /// FishingHookRenderer: the bobbers (this player's and the others' a + /// server tracks), camera-facing half-block quads centred on the hooks. pub(super) fn fishing_geometry(&self, camera: glam::DVec3, alpha: f64, out: &mut Vec) { - let Some(p) = self.hook_position(alpha) else { + let hooks: Vec = self + .hook_position(alpha) + .into_iter() + .chain(self.remote_hook_ends(alpha).into_iter().map(|(h, _)| h)) + .collect(); + if hooks.is_empty() { return; - }; + } let Some(r) = self .gui .atlas @@ -577,56 +590,57 @@ impl Game<'_> { else { return; }; - let light = self - .world - .light(p.x.floor() as i32, p.y.floor() as i32, p.z.floor() as i32); - let packed = (u32::from(light >> 4) * 16) | ((u32::from(light & 15) * 16) << 8); let forward = glam::DVec3::from_array(view_vector(self.yaw, self.pitch)); let right = forward.cross(glam::DVec3::Y).normalize_or_zero(); let up = right.cross(forward).normalize_or_zero(); let s = 0.25; - let corners = [ - p - right * s - up * s, - p + right * s - up * s, - p + right * s + up * s, - p - right * s + up * s, - ]; let uv = [[r.u0, r.v1], [r.u1, r.v1], [r.u1, r.v0], [r.u0, r.v0]]; - for (v, uv) in corners.iter().zip(uv) { - out.push(Vertex { - normal: [0; 4], - pos: (*v - camera).as_vec3().to_array(), - uv, - layer: 0, - color: 0xFFFF_FFFF, - light: packed, - }); + for p in hooks { + let light = + self.world + .light(p.x.floor() as i32, p.y.floor() as i32, p.z.floor() as i32); + let packed = (u32::from(light >> 4) * 16) | ((u32::from(light & 15) * 16) << 8); + let corners = [ + p - right * s - up * s, + p + right * s - up * s, + p + right * s + up * s, + p - right * s + up * s, + ]; + for (v, uv) in corners.iter().zip(uv) { + out.push(Vertex { + normal: [0; 4], + pos: (*v - camera).as_vec3().to_array(), + uv, + layer: 0, + color: 0xFFFF_FFFF, + light: packed, + }); + } } } - /// FishingHookRenderer: the line, 16 black `lines` segments sagging from - /// a quarter block above the hook to the rod in the player's hand, + /// FishingHookRenderer: each line, 16 black `lines` segments sagging + /// from a quarter block above the hook to the rod in its owner's hand, /// `width` pixels wide (`Window.getAppropriateLineWidth`). pub(super) fn fishing_line(&self, alpha: f64, size: [u32; 2]) -> Vec { - let (Some(hook), Some(hand)) = ( - self.hook_position(alpha), - self.rod_hand_position(alpha, size), - ) else { - return Vec::new(); - }; - let offset = (hand - (hook + glam::DVec3::new(0.0, 0.25, 0.0))).as_vec3(); - let point = |a: f32| { - let y = offset.y * (a * a + a) * 0.5 + 0.25; - hook + glam::Vec3::new(offset.x * a, y, offset.z * a).as_dvec3() - }; + let own = self + .hook_position(alpha) + .zip(self.rod_hand_position(alpha, size)); let width = horizon_client::gfx::outline_width(size[0]); - (0..16) - .map(|i| Line { + let mut lines = Vec::new(); + for (hook, hand) in own.into_iter().chain(self.remote_hook_ends(alpha)) { + let offset = (hand - (hook + glam::DVec3::new(0.0, 0.25, 0.0))).as_vec3(); + let point = |a: f32| { + let y = offset.y * (a * a + a) * 0.5 + 0.25; + hook + glam::Vec3::new(offset.x * a, y, offset.z * a).as_dvec3() + }; + lines.extend((0..16).map(|i| Line { start: point(i as f32 / 16.0).to_array(), end: point((i + 1) as f32 / 16.0).to_array(), color: 0xFF00_0000, width, - }) - .collect() + })); + } + lines } /// `FishingHookRenderer.getPlayerHandPos`: on the near plane in first /// person, beside the body otherwise. @@ -694,6 +708,20 @@ impl Game<'_> { } } impl Game<'_> { + /// The hooks drawn here, with their owners' ids (0 for this player's own). + pub(super) fn hooks_status(&self) -> Vec { + let at = |p: Vec3| [p.x, p.y, p.z]; + let own = self.hook.iter().map(|h| (h.id, 0, h.position)); + let others = self + .remote_hooks + .iter() + .map(|h| (h.id, h.owner, h.position)); + own.chain(others) + .map(|(id, owner, p)| { + serde_json::json!({"id": id, "kind": "minecraft:fishing_bobber", "owner": owner, "position": at(p)}) + }) + .collect() + } /// The hook for `horizon-ctl status`. pub(super) fn hook_status(&self) -> Option { let h = self.hook.as_ref()?; @@ -706,3 +734,175 @@ impl Game<'_> { })) } } + +/// A hook a server tracks to this client (`FishingHook.recreateFromPacket`) +/// that another player cast: drawn where the server puts it, its line +/// running to that player's hand. +pub(super) struct RemoteHook { + id: u32, + owner: u32, + position: Vec3, + previous: Vec3, +} + +impl Hook { + /// This client's own hook as its server tracks it: drawn, never ticked here. + fn remote(id: u32, at: Vec3) -> Self { + Self { + id, + position: at, + previous: at, + velocity: Vec3::ZERO, + state: State::Flying, + life: 0, + on_ground: false, + nibble: 0, + time_until_lured: 0, + time_until_hooked: 0, + fish_angle: 0.0, + out_of_water: 0, + open_water: true, + luck: 0, + lure: 0, + } + } + /// `FishingHook`'s entity for the players tracking it: the owner's id in + /// its add packet, DATA_HOOKED_ENTITY (the hooked id plus one) and + /// DATA_BITING when they differ from their defaults. + fn track(&self, owner: i32, out: &mut States) { + let p = self.position; + let e = out.add( + self.id as i32, + super::lan::entity_uuid(self.id), + "minecraft:fishing_bobber", + ); + e.position = [p.x, p.y, p.z]; + e.velocity = [self.velocity.x, self.velocity.y, self.velocity.z]; + e.on_ground = self.on_ground; + e.data = owner; + if let State::Hooked(id) = self.state { + e.meta.push((8, serializer::INT, Value::Int(id as i32 + 1))); + } + if self.nibble > 0 { + e.meta.push((9, serializer::BOOLEAN, Value::Bool(true))); + } + } +} + +impl Game<'_> { + /// The hooks guests track: the host's and each guest's in the level. + pub(super) fn lan_hook_states( + &self, + host_entity: Option, + play: &HashMap, + hub: &Hub, + out: &mut States, + ) { + if let (Some(h), Some(owner)) = (&self.hook, host_entity) { + h.track(owner, out); + } + for g in hub.guests.iter().filter(|g| hub.here(g)) { + if let Some(h) = play.get(&g.conn).and_then(|p| p.hook.as_ref()) { + h.track(g.entity_id, out); + } + } + } + + /// `handleAddEntity` for a fishing bobber: this player's own becomes its + /// hook (`Player.fishing`), another player's is drawn on its line to them. + pub(super) fn spawn_remote_hook(&mut self, id: u32, at: Vec3, owner: i32) { + let own = self.remote.as_ref().map(|r| r.entity_id); + if own == Some(owner) { + self.hook = Some(Hook::remote(id, at)); + } else { + self.remote_hooks.push(RemoteHook { + id, + owner: owner as u32, + position: at, + previous: at, + }); + } + } + + /// One tick of interpolation for the hooks a server tracks. + pub(super) fn step_remote_hooks(&mut self, mut step: impl FnMut(u32, Vec3) -> Vec3) { + if self.remote.is_none() { + return; + } + if let Some(h) = self.hook.as_mut() { + h.previous = h.position; + h.position = step(h.id, h.position); + } + for h in &mut self.remote_hooks { + h.previous = h.position; + h.position = step(h.id, h.position); + } + } + + /// `FishingHook.onSyncedDataUpdated`: this player's hook is biting + /// (DATA_BITING), which `status` shows as a nibble. + pub(super) fn remote_hook_data(&mut self, id: u32, values: &[(u8, i32, Value)]) { + let Some(h) = self + .hook + .as_mut() + .filter(|h| h.id == id && self.remote.is_some()) + else { + return; + }; + for (index, _, value) in values { + if let (9, Value::Bool(biting)) = (index, value) { + h.nibble = i32::from(*biting); + } + } + } + + pub(super) fn remove_remote_hook(&mut self, id: u32) { + if self.remote.is_some() && self.hook.as_ref().is_some_and(|h| h.id == id) { + self.hook = None; + } + self.remote_hooks.retain(|h| h.id != id); + } + + pub(super) fn clear_remote_hooks(&mut self) { + if self.remote.is_some() { + self.hook = None; + } + self.remote_hooks.clear(); + } + + /// Other players' hooks: the bobber and its line to the owner's hand + /// (`FishingHookRenderer.getPlayerHandPos` in third person), as + /// (hook, hand) this frame. + fn remote_hook_ends(&self, alpha: f64) -> Vec<(glam::DVec3, glam::DVec3)> { + let lerp = |a: Vec3, b: Vec3| { + glam::DVec3::new( + a.x + (b.x - a.x) * alpha, + a.y + (b.y - a.y) * alpha, + a.z + (b.z - a.z) * alpha, + ) + }; + self.remote_hooks + .iter() + .filter_map(|h| { + let owner = self.mobs.iter().find(|m| m.id == h.owner)?; + let feet = lerp(owner.previous, owner.position); + let body = horizon_client::camera::lerp( + alpha as f32, + owner.previous_body_yaw, + owner.body_yaw, + ); + let angle = f64::from(body * (std::f64::consts::PI / 180.0) as f32); + let (sin, cos) = (f64::from(trig::sin(angle)), f64::from(trig::cos(angle))); + // The right arm; a crouching owner's eyes are lower. + let eye = owner.eye_y() - owner.position.y; + let hand = feet + + glam::DVec3::new( + -cos * 0.35 - sin * 0.8, + eye - 0.45, + -sin * 0.35 + cos * 0.8, + ); + Some((lerp(h.previous, h.position), hand)) + }) + .collect() + } +} diff --git a/crates/horizon-client/src/game/lan.rs b/crates/horizon-client/src/game/lan.rs index bab304569..8bf72abee 100644 --- a/crates/horizon-client/src/game/lan.rs +++ b/crates/horizon-client/src/game/lan.rs @@ -875,6 +875,7 @@ impl Game<'_> { .collect(); self.lan_riding(host_entity, &guests, &mut host.hub.riding); self.lan_entities(host_entity, &host.mob_players, &mut host.hub, &mut states); + self.lan_hook_states(host_entity, &host.play, &host.hub, &mut states); } else { states.clear(); } @@ -1068,6 +1069,7 @@ impl Game<'_> { } // A dedicated server has no host player. self.lan_entities(None, &host.mob_players, &mut host.hub, &mut theirs); + self.lan_hook_states(None, &host.play, &host.hub, &mut theirs); theirs.as_slice() } else { entities diff --git a/crates/horizon-client/src/game/lan_actions.rs b/crates/horizon-client/src/game/lan_actions.rs index 2c2c25e93..4a4a94a8d 100644 --- a/crates/horizon-client/src/game/lan_actions.rs +++ b/crates/horizon-client/src/game/lan_actions.rs @@ -82,6 +82,8 @@ pub(super) struct GuestPlay { /// (`LivingEntity.collectEquipmentChanges`). modifiers: Vec<(String, String)>, equipped: Option>>, + /// The guest's cast fishing hook (`Player.fishing`). + pub(super) hook: Option, } /// A guest's command waiting for the hub (`LanHost::commands`). @@ -342,6 +344,7 @@ impl Game<'_> { std::mem::swap(&mut self.adv.unlocked, &mut g.recipes_unlocked); std::mem::swap(&mut self.level.recipe_book, &mut g.recipe_book); std::mem::swap(&mut self.stats, &mut play.stats); + std::mem::swap(&mut self.hook, &mut play.hook); let adv_loaded = std::mem::replace(&mut self.adv.loaded, true); let last_inventory = std::mem::replace(&mut self.adv.last_inventory, play.last_inventory); let death_cause = std::mem::replace(&mut self.ui.death_cause, play.death_cause.take()); @@ -549,6 +552,7 @@ impl Game<'_> { std::mem::swap(&mut self.adv.unlocked, &mut g.recipes_unlocked); std::mem::swap(&mut self.level.recipe_book, &mut g.recipe_book); std::mem::swap(&mut self.stats, &mut play.stats); + std::mem::swap(&mut self.hook, &mut play.hook); self.adv.loaded = adv_loaded; play.last_inventory = std::mem::replace(&mut self.adv.last_inventory, last_inventory); let stat_events = std::mem::take(&mut play.stats.events); @@ -1711,6 +1715,7 @@ impl Game<'_> { // PlayerAdvancements.flushDirty. let sleeping = host.hub.guests[gi].sleeping; self.as_guest(host, conn, |g| { + g.tick_fishing(); g.count_tick_stats(sleeping); g.tick_advancements(); g.update_player_attributes(); @@ -1721,6 +1726,10 @@ impl Game<'_> { self.guest_orbs(host, gi); if host.hub.guests[gi].health <= 0.0 && !host.hub.guests[gi].dead { self.guest_forget_digging(host, conn); + // FishingHook.shouldStopFishing: its owner is dead. + if let Some(play) = host.play.get_mut(&conn) { + play.hook = None; + } } let g = &mut host.hub.guests[gi]; if g.health <= 0.0 && !g.dead { diff --git a/crates/horizon-client/src/game/remote_projectiles.rs b/crates/horizon-client/src/game/remote_projectiles.rs index 82d0a11e2..58f82e3a9 100644 --- a/crates/horizon-client/src/game/remote_projectiles.rs +++ b/crates/horizon-client/src/game/remote_projectiles.rs @@ -88,6 +88,8 @@ impl Game<'_> { self.end .add_remote_eye(id, position, [velocity.x, velocity.y, velocity.z]) } + // FishingHook.recreateFromPacket: the owner's id is the data. + "minecraft:fishing_bobber" => self.spawn_remote_hook(id, at, data), "minecraft:end_crystal" => self.crystals.push(super::dragon::Crystal { id, position: at, @@ -114,6 +116,7 @@ impl Game<'_> { /// `handleSetEntityData` for these types: what changes how they look. pub(super) fn remote_projectile_data(&mut self, id: i32, values: &[(u8, i32, Value)]) { let id = id as u32; + self.remote_hook_data(id, values); if self.potions.has_thrown(id) { // ThrowableItemProjectile.DATA_ITEM_STACK: the potion it is. for (index, _, value) in values { @@ -205,6 +208,7 @@ impl Game<'_> { c.position = step(c.id, c.position); } self.potions.step_remote_thrown(&mut step); + self.step_remote_hooks(&mut step); self.end.step_remote_eyes(|id, at| { let at = step(id, Vec3::new(at[0], at[1], at[2])); [at.x, at.y, at.z] @@ -220,6 +224,7 @@ impl Game<'_> { self.crystals.retain(|c| c.id != id); self.potions.remove_remote_thrown(id); self.end.remove_remote_eye(id); + self.remove_remote_hook(id); } /// Every one a server sent (a new connection, level or dimension). @@ -232,6 +237,7 @@ impl Game<'_> { self.crystals.clear(); self.potions.clear_thrown(); self.end.clear_remote_eyes(); + self.clear_remote_hooks(); } /// Their kind and place, for `status`. @@ -260,6 +266,7 @@ impl Game<'_> { for (id, p) in self.end.eye_positions() { out.push(json!({"id": id, "kind": "minecraft:eye_of_ender", "position": p})); } + out.extend(self.hooks_status()); out } } diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 41d39f37b..0097d40ff 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -202,6 +202,9 @@ address. The script then checks, from both sides, what a guest's game used to ge - wind: the host and the guest each throw a wind charge at their feet: the server's burst launches them about six blocks up (the push in ClientboundExplodePacket) and they land unhurt (#1386). +- fishing: the host and the guest each cast a fishing rod: the hook stays out on the server and + both sides draw it and it reels back in from the ground, and in open water a fish + bites and reeling in catches it (#1348). Each check is reported on its own (a failing one doesn't stop the others) and the screenshots of both sides go to --out (host-*.png, guest-*.png). @@ -4726,5 +4729,82 @@ CHECKS += ['wind'] CHECK_FNS.update(wind=check_wind) +def bobbers(game): + """The fishing bobbers this side draws, as (owner) ids: 0 for its own player's.""" + return [q.get('owner') for q in game('status')['projectiles'] if q['kind'] == 'minecraft:fishing_bobber'] + + +def check_fishing(host, guest, out): + """FishingHook for each player, on the server: a cast hook stays out (ticked by the server and + tracked to the clients as a fishing bobber under its owner), lands on the ground and reels back + in; cast into open water with Lure III, a fish bites and reeling in + during the bite catches it for 1 (#1348).""" + hx, hy, hz = (int(v // 1) for v in pos_of(host)) + host('command', command='weather clear') + seen = {} + try: + for game, other, dz in ((host, guest, -5), (guest, host, 5)): + x, z = hx, hz + dz + host('command', command=f'fill {x - 1} {hy - 1} {z - 1} {x + 14} {hy - 1} {z + 1} minecraft:stone') + host('command', command=f'fill {x - 1} {hy} {z - 1} {x + 14} {hy + 4} {z + 1} minecraft:air') + game('command', command='gamemode survival') + game('command', command='clear @s') + game('command', command='item replace entity @s weapon.mainhand with minecraft:fishing_rod') + game('command', command=f'tp @s {x + 0.5} {hy} {z + 0.5} -90 0') + game.wait(10) + # On the ground: the floor four blocks ahead. + game.raw('look-at', f'{x + 4.5:.2f}', f'{hy:.2f}', f'{z + 0.5:.2f}') + game.raw('use-item') + game.wait(40) + s = {'own': bobbers(game), 'other': bobbers(other)} + game.shot(out, 'fishing-cast') + game.raw('use-item') + game.wait(10) + s['reeled'] = {'own': bobbers(game), 'damage': (game('state').get('held') or {}).get('damage')} + # Open water: a pool 7x7 and 3 deep, ahead. + host('command', command=f'fill {x + 3} {hy - 3} {z - 3} {x + 9} {hy - 1} {z + 3} minecraft:water') + game('command', command='item replace entity @s weapon.mainhand with minecraft:fishing_rod[enchantments={lure:3}]') + game.wait(10) + game.raw('look-at', f'{x + 6.5:.2f}', f'{hy - 1:.2f}', f'{z + 0.5:.2f}') + game.raw('use-item') + bit = None + for t in range(0, 900, 5): + game.wait(5) + if (game('status').get('fishing') or {}).get('nibble', 0) > 0: + bit = t + break + game.raw('use-item') + game.wait(40) + counts = game.raw('inventory')['counts'] + s['caught'] = {'bit': bit is not None, + 'damage': (game('state').get('held') or {}).get('damage'), + 'items': sum(counts.values()) - 1} + game.shot(out, 'fishing-caught') + host('command', command=f'fill {x + 3} {hy - 3} {z - 3} {x + 9} {hy - 2} {z + 3} minecraft:stone') + host('command', command=f'fill {x + 3} {hy - 1} {z - 3} {x + 9} {hy - 1} {z + 3} minecraft:stone') + seen[game.name] = s + finally: + host('command', command='kill @e[type=minecraft:item]') + for game in (host, guest): + game('command', command='clear @s') + face_each_other(host, guest) + for name, s in seen.items(): + other = guest if name == 'host' else host + assert s['own'] == [0], f'{name}: {seen}' + # The in-frame host draws only its own hook. + if other is guest or SERVER_THREAD: + assert len(s['other']) == 1 and s['other'][0] != 0, f'{name}: {seen}' + # FishingHook.retrieve costs 2 on the ground, but a resting hook's onGround + # alternates every tick on the server (Entity.move with no vertical motion + # clears it, the next tick's gravity sets it again): 2 or nothing. + assert s['reeled']['own'] == [] and s['reeled']['damage'] in (None, 0, 2), f'{name}: {seen}' + assert s['caught']['bit'] and s['caught']['damage'] == 1 and s['caught']['items'] >= 1, f'{name}: {seen}' + return seen + + +CHECKS += ['fishing'] +CHECK_FNS.update(fishing=check_fishing) + + if __name__ == '__main__': main() From 287d7a7eb5e55a7936e89c9ac948f2a66aab74d1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 22:34:05 +0200 Subject: [PATCH 08/17] Maps on a server's players: each holder's map ticks on the server and its data reaches them A map a server's player (a LAN guest, or single player's window on its server thread) made stayed blank and saved nothing (#1382): only the game's own player ever updated a map, and no map data went to the guests. Each guest's turn now runs MapItem's ticks as theirs (the marker of every carried map, the reveal of the held ones), and the server sends each guest ClientboundMapItemDataPacket for the maps it carries, and every 10 ticks for the maps framed in the level (ServerPlayer.synchronizeSpecialItemUpdates, ServerEntity.sendChanges). As in vanilla, a map keeps its holders (MapItemSavedData.HoldingPlayer): each has its own column sweep and its own record of what changed since its last packet, so the packet carries only the changed pixels' box, and the decorations at most every 5th tick while they changed. Player markers are kept per holder, so each player's marker shows on a shared map, and go when that player stops carrying it. A server's client now applies the packet's decorations. lan_e2e maps: host and guest each make and hold a map, which draws the terrain around them and their marker, in both modes. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/control.rs | 1 + crates/horizon-client/src/game/lan_actions.rs | 2 + crates/horizon-client/src/game/maps.rs | 371 +++++++++++++++--- tools/lan_e2e.py | 38 ++ 4 files changed, 362 insertions(+), 50 deletions(-) diff --git a/crates/horizon-client/src/game/control.rs b/crates/horizon-client/src/game/control.rs index 38f71dcff..bc02012d5 100644 --- a/crates/horizon-client/src/game/control.rs +++ b/crates/horizon-client/src/game/control.rs @@ -988,6 +988,7 @@ impl Game<'_> { "flashes": self.lightning_seen[1], "flash": self.flash}); // Primed TNT, falling blocks, projectiles, tridents and end crystals. status["projectiles"] = json!(self.projectiles_status()); + status["maps"] = json!(self.maps_status()); // The particles made so far, by type. status["particles"] = json!(self.particles.made()); // The world border this side knows of. diff --git a/crates/horizon-client/src/game/lan_actions.rs b/crates/horizon-client/src/game/lan_actions.rs index 4a4a94a8d..bb43fe660 100644 --- a/crates/horizon-client/src/game/lan_actions.rs +++ b/crates/horizon-client/src/game/lan_actions.rs @@ -1716,10 +1716,12 @@ impl Game<'_> { let sleeping = host.hub.guests[gi].sleeping; self.as_guest(host, conn, |g| { g.tick_fishing(); + g.tick_maps(); g.count_tick_stats(sleeping); g.tick_advancements(); g.update_player_attributes(); }); + self.lan_map_updates(host, conn); host.hub.flush_progress(conn); self.guest_dig_feedback(host, conn); self.guest_pickups(host, gi); diff --git a/crates/horizon-client/src/game/maps.rs b/crates/horizon-client/src/game/maps.rs index bc2534659..e256352ad 100644 --- a/crates/horizon-client/src/game/maps.rs +++ b/crates/horizon-client/src/game/maps.rs @@ -4,7 +4,7 @@ //! shading, the dithered edge), the player marker, `data/minecraft/maps/.dat` and //! `maps/last_id.dat`, the 128x128 texture in an atlas slot, the two-handed //! first-person view and maps in item frames. -use super::Game; +use super::{Game, lan::LanHost}; use horizon_client::{ blocks::{Fluid, MAP_COLORS}, hud::{MAP_SLOTS, Rect}, @@ -14,13 +14,48 @@ use horizon_client::{ use horizon_world::nbt::Tag; use std::collections::HashMap; -/// A decoration: sprite, map position (-128..127, half pixels) and rotation (0..15). +/// A decoration: sprite, map position (-128..127, half pixels) and rotation +/// (0..15), and the player it marks (an item's own decorations mark none). #[derive(Clone, Debug, PartialEq)] pub(super) struct Decoration { pub sprite: &'static str, pub x: i8, pub y: i8, pub rot: u8, + pub holder: Option, +} +/// The host among a map's holders (the guests are their connections). +const HOST: u32 = u32::MAX; +/// A player carrying a map, or seeing it framed +/// (`MapItemSavedData.HoldingPlayer`): the column sweep's step, and what +/// changed since the last `ClientboundMapItemDataPacket` it was sent. +struct Holder { + who: u32, + /// The last tick it carried the map, and saw it framed. + carried: i64, + framed: i64, + step: i32, + /// The changed pixels' box (min x, min y, max x, max y). + dirty: Option<[i32; 4]>, + decorations: bool, + tick: u32, +} +impl Holder { + fn new(who: u32) -> Self { + Self { + who, + carried: 0, + framed: 0, + step: 0, + dirty: Some([0, 0, 127, 127]), + decorations: true, + tick: 0, + } + } + /// Still carrying the map, or seeing it framed (frames tick every 10). + fn holds(&self, now: i64) -> bool { + self.carried + 1 >= now || self.framed + 10 >= now + } } pub(super) struct MapData { pub center: [i32; 2], @@ -31,8 +66,7 @@ pub(super) struct MapData { pub unlimited: bool, pub colors: Vec, pub decorations: Vec, - /// HoldingPlayer.step for the column sweep. - step: i32, + holders: Vec, /// Changed since the last save / texture upload. dirty: bool, texture_dirty: bool, @@ -51,7 +85,7 @@ impl MapData { unlimited: false, colors: vec![0; 128 * 128], decorations: Vec::new(), - step: 0, + holders: Vec::new(), dirty: true, texture_dirty: true, } @@ -64,8 +98,128 @@ impl MapData { self.colors[i] = color; self.dirty = true; self.texture_dirty = true; + // setColorsDirty: every holder's next packet carries it. + for h in &mut self.holders { + h.dirty = Some(match h.dirty { + Some([x0, y0, x1, y1]) => [x0.min(x), y0.min(y), x1.max(x), y1.max(y)], + None => [x, y, x, y], + }); + } true } + /// `tickCarriedBy`'s holder for `who`, added when new. + fn holder(&mut self, who: u32) -> &mut Holder { + let i = match self.holders.iter().position(|h| h.who == who) { + Some(i) => i, + None => { + self.holders.push(Holder::new(who)); + self.holders.len() - 1 + } + }; + &mut self.holders[i] + } + /// The holders that no longer carry the map nor see it framed go, and + /// their markers with them (`tickCarriedBy`'s removeDecoration). + fn drop_holders(&mut self, now: i64) { + self.holders.retain(|h| h.holds(now)); + let holders = &self.holders; + let before = self.decorations.len(); + self.decorations + .retain(|d| d.holder.is_none_or(|w| holders.iter().any(|h| h.who == w))); + if self.decorations.len() != before { + self.decorations_changed(); + } + } + /// setDecorationsDirty. + fn decorations_changed(&mut self) { + for h in &mut self.holders { + h.decorations = true; + } + } + /// `addDecoration` / `removeDecoration` for `holder`'s marker: in place, + /// so that the order (the drawing order) stays. + fn set_marker(&mut self, holder: u32, marker: Option) { + let i = self + .decorations + .iter() + .position(|d| d.holder == Some(holder)); + let changed = match (i, marker) { + (Some(i), Some(d)) if self.decorations[i] == d => false, + (Some(i), Some(d)) => { + self.decorations[i] = d; + true + } + (Some(i), None) => { + self.decorations.remove(i); + true + } + (None, Some(d)) => { + self.decorations.push(d); + true + } + (None, None) => false, + }; + if changed { + self.decorations_changed(); + } + } + /// `HoldingPlayer.nextUpdatePacket` for `who`: the changed pixels, and + /// the decorations (at most every 5th call while they changed). + fn update_packet( + &mut self, + id: i32, + who: u32, + kind: impl Fn(&str) -> Option, + ) -> Option { + use horizon_protocol::packets::play::{MapDecoration, MapItemData, MapPatch}; + let h = self.holders.iter_mut().find(|h| h.who == who)?; + let patch = h.dirty.take().map(|[x0, y0, x1, y1]| { + let (width, height) = (x1 + 1 - x0, y1 + 1 - y0); + let mut colors = Vec::with_capacity((width * height) as usize); + for y in 0..height { + for x in 0..width { + colors.push(self.colors[(x0 + x + (y0 + y) * 128) as usize]); + } + } + MapPatch { + start_x: x0, + start_y: y0, + width, + height, + colors, + } + }); + let decorations = if h.decorations && { + let due = h.tick % 5 == 0; + h.tick += 1; + due + } { + h.decorations = false; + Some( + self.decorations + .iter() + .filter_map(|d| { + Some(MapDecoration { + kind: kind(decoration_type(d.sprite)?)?, + x: d.x, + y: d.y, + rot: d.rot as i8, + name: None, + }) + }) + .collect(), + ) + } else { + None + }; + (patch.is_some() || decorations.is_some()).then_some(MapItemData { + map_id: id, + scale: self.scale as i8, + locked: self.locked, + decorations, + patch, + }) + } fn to_nbt(&self) -> Tag { let flag = |b: bool| Tag::Byte(i8::from(b)); Tag::compound([ @@ -112,7 +266,7 @@ impl MapData { unlimited: int("unlimitedTracking").unwrap_or(0) != 0, colors, decorations: Vec::new(), - step: 0, + holders: Vec::new(), dirty: false, texture_dirty: true, }) @@ -143,36 +297,48 @@ fn packed_rgba(packed: u8) -> [u8; 4] { pub(super) fn map_id(stack: &ItemStack) -> Option { stack.data().and_then(|d| d.map_id) } -/// `MapDecorationTypes`: the sprite of a decoration type that a -/// `minecraft:map_decorations` entry can name. +/// `MapDecorationTypes` Horizon draws: (type, sprite). +const DECORATION_TYPES: [(&str, &str); 24] = [ + ("player", "map/decorations/player"), + ("frame", "map/decorations/frame"), + ("red_marker", "map/decorations/red_marker"), + ("blue_marker", "map/decorations/blue_marker"), + ("target_x", "map/decorations/target_x"), + ("target_point", "map/decorations/target_point"), + ("player_off_map", "map/decorations/player_off_map"), + ("player_off_limits", "map/decorations/player_off_limits"), + ("mansion", "map/decorations/woodland_mansion"), + ("monument", "map/decorations/ocean_monument"), + ("red_x", "map/decorations/red_x"), + ("village_desert", "map/decorations/desert_village"), + ("village_plains", "map/decorations/plains_village"), + ("village_savanna", "map/decorations/savanna_village"), + ("village_snowy", "map/decorations/snowy_village"), + ("village_taiga", "map/decorations/taiga_village"), + ("jungle_temple", "map/decorations/jungle_temple"), + ("swamp_hut", "map/decorations/swamp_hut"), + ("trial_chambers", "map/decorations/trial_chambers"), + ("abandoned_camp", "map/decorations/abandoned_camp"), + ("ancient_city", "map/decorations/ancient_city"), + ("desert_pyramid", "map/decorations/desert_pyramid"), + ("mineshaft", "map/decorations/mineshaft"), + ("ocean_ruin_warm", "map/decorations/warm_ocean_ruins"), +]; +/// The sprite of a decoration type that a `minecraft:map_decorations` +/// entry or a server's packet names. fn decoration_sprite(id: &str) -> Option<&'static str> { - Some(match id.strip_prefix("minecraft:").unwrap_or(id) { - "player" => "map/decorations/player", - "frame" => "map/decorations/frame", - "red_marker" => "map/decorations/red_marker", - "blue_marker" => "map/decorations/blue_marker", - "target_x" => "map/decorations/target_x", - "target_point" => "map/decorations/target_point", - "player_off_map" => "map/decorations/player_off_map", - "player_off_limits" => "map/decorations/player_off_limits", - "mansion" => "map/decorations/woodland_mansion", - "monument" => "map/decorations/ocean_monument", - "red_x" => "map/decorations/red_x", - "village_desert" => "map/decorations/desert_village", - "village_plains" => "map/decorations/plains_village", - "village_savanna" => "map/decorations/savanna_village", - "village_snowy" => "map/decorations/snowy_village", - "village_taiga" => "map/decorations/taiga_village", - "jungle_temple" => "map/decorations/jungle_temple", - "swamp_hut" => "map/decorations/swamp_hut", - "trial_chambers" => "map/decorations/trial_chambers", - "abandoned_camp" => "map/decorations/abandoned_camp", - "ancient_city" => "map/decorations/ancient_city", - "desert_pyramid" => "map/decorations/desert_pyramid", - "mineshaft" => "map/decorations/mineshaft", - "ocean_ruin_warm" => "map/decorations/warm_ocean_ruins", - _ => return None, - }) + let name = id.strip_prefix("minecraft:").unwrap_or(id); + DECORATION_TYPES + .iter() + .find(|(n, _)| *n == name) + .map(|(_, sprite)| *sprite) +} +/// The type a decoration's sprite stands for, as its registry names it. +fn decoration_type(sprite: &str) -> Option<&'static str> { + DECORATION_TYPES + .iter() + .find(|(_, s)| *s == sprite) + .map(|(name, _)| *name) } /// `minecraft:map_decorations` of a map item: (sprite, x, z, rotation), in /// the component's order. @@ -275,12 +441,29 @@ impl Game<'_> { } self.maps.data.get_mut(&id) } - /// `ClientboundMapItemDataPacket.handle`: the server's colours for a map - /// this client does not own (lobby map art, a framed map on a wall). + /// `ClientboundMapItemDataPacket.handle`: the server's colours and + /// decorations for a map (one carried or framed on a server). pub(super) fn remote_map_item_data( &mut self, p: &horizon_protocol::packets::play::MapItemData, ) { + let decorations = p.decorations.as_ref().map(|list| { + let types = self + .remote + .as_ref() + .and_then(|r| r.builtin.get("minecraft:map_decoration_type")); + list.iter() + .filter_map(|d| { + Some(Decoration { + sprite: decoration_sprite(types?.name(d.kind)?)?, + x: d.x, + y: d.y, + rot: (d.rot & 15) as u8, + holder: None, + }) + }) + .collect() + }); let dimension = self.dimension_id(); let map = self .maps @@ -288,6 +471,9 @@ impl Game<'_> { .entry(p.map_id) .or_insert_with(|| MapData::fresh(0.0, 0.0, p.scale.max(0) as u8, dimension)); map.locked = p.locked; + if let Some(decorations) = decorations { + map.decorations = decorations; + } let Some(patch) = &p.patch else { map.dirty = false; return; @@ -566,10 +752,14 @@ impl Game<'_> { .collect(); let (yaw, dim) = (self.yaw, self.dimension_id()); let (nether, game_time) = (self.dim == super::Dim::Nether, self.world.game_time); + // The guest whose turn it is, else the host. + let me = self.lan_acting.unwrap_or(HOST); for (id, targets) in carried { let Some(m) = self.map(id) else { continue }; + m.holder(me).carried = game_time; + m.drop_holders(game_time); // tickCarriedBy: the player marker while tracking in this dimension. - m.decorations.clear(); + let mut marker = None; if m.tracking && m.dimension == dim { let s = f64::from(1 << m.scale); let dx = ((p.x - f64::from(m.center[0])) / s) as f32; @@ -596,18 +786,19 @@ impl Game<'_> { } else { None }; - if let Some(sprite) = sprite { - m.decorations.push(Decoration { - sprite, - x: clamp(dx), - y: clamp(dz), - rot, - }); - } + marker = sprite.map(|sprite| Decoration { + sprite, + x: clamp(dx), + y: clamp(dz), + rot, + holder: Some(me), + }); } + m.set_marker(me, marker); // The item's MAP_DECORATIONS (an explorer map's target), added // after the players as addDecoration would. let s = (1 << m.scale) as f32; + let mut items: Vec = Vec::new(); for (sprite, x, z, rotation) in targets { let dx = (x - f64::from(m.center[0])) as f32 / s; let dz = (z - f64::from(m.center[1])) as f32 / s; @@ -620,16 +811,95 @@ impl Game<'_> { x: clamp_map_coordinate(dx), y: clamp_map_coordinate(dz), rot: decoration_rotation(nether, game_time, f64::from(rotation)), + holder: None, }; - if !m.decorations.contains(&d) { - m.decorations.push(d); + if !items.contains(&d) { + items.push(d); } } + if !m + .decorations + .iter() + .filter(|d| d.holder.is_none()) + .eq(items.iter()) + { + m.decorations.retain(|d| d.holder.is_some()); + m.decorations.extend(items); + m.decorations_changed(); + } } for id in held { self.update_map(id); } } + /// The maps the player carries, for `status`: how many of their pixels + /// are drawn, and their decorations. + pub(super) fn maps_status(&self) -> Vec { + self.inventory + .iter() + .chain(std::iter::once(&self.offhand)) + .flatten() + .filter_map(map_id) + .filter_map(|id| { + let m = self.maps.data.get(&id)?; + Some(serde_json::json!({ + "id": id, + "pixels": m.colors.iter().filter(|&&c| c != 0).count(), + "decorations": m.decorations.iter().map(|d| d.sprite).collect::>(), + })) + }) + .collect() + } + /// `ServerPlayer.synchronizeSpecialItemUpdates` for each map the guest + /// carries, and every 10 ticks (`ServerEntity.sendChanges`) for each map + /// framed in the level: a `ClientboundMapItemDataPacket` when something + /// changed since the guest's last one. + pub(super) fn lan_map_updates(&mut self, host: &LanHost, conn: u32) { + let Some(g) = host.hub.guest(conn) else { + return; + }; + let mut ids: Vec = g + .inventory + .iter() + .chain(std::iter::once(&g.offhand)) + .flatten() + .filter_map(map_id) + .collect(); + let now = self.world.game_time; + if now % 10 == 0 && host.hub.here(g) { + let framed: Vec = self + .item_frames + .iter() + .filter_map(|f| f.item.as_ref().and_then(map_id)) + .collect(); + for id in framed { + if let Some(m) = self.map(id) { + m.holder(conn).framed = now; + ids.push(id); + } + } + } + ids.sort_unstable(); + ids.dedup(); + let kind = |name: &str| { + host.hub.registry_id( + "minecraft:map_decoration_type", + &format!("minecraft:{name}"), + ) + }; + for id in ids { + if let Some(p) = self + .maps + .data + .get_mut(&id) + .and_then(|m| m.update_packet(id, conn, kind)) + { + g.send(&horizon_protocol::packets::play::Clientbound::MapItemData( + p, + )); + } + } + } /// `MapItem.update` for the player holding map `id`. fn update_map(&mut self, id: i32) { let dim = self.dimension_id(); @@ -651,8 +921,9 @@ impl Game<'_> { if nether { radius /= 2; } - m.step += 1; - let step = m.step; + let h = m.holder(self.lan_acting.unwrap_or(HOST)); + h.step += 1; + let step = h.step; let mut changes: Vec<(i32, i32, u8)> = Vec::new(); let mut consecutive = false; for img_x in px - radius + 1..px + radius { diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 0097d40ff..271982ca9 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -205,6 +205,8 @@ address. The script then checks, from both sides, what a guest's game used to ge - fishing: the host and the guest each cast a fishing rod: the hook stays out on the server and both sides draw it and it reels back in from the ground, and in open water a fish bites and reeling in catches it (#1348). +- maps: the host and the guest each make a map and hold it: their client draws the terrain + around them and their marker, from the server's map data (#1382). Each check is reported on its own (a failing one doesn't stop the others) and the screenshots of both sides go to --out (host-*.png, guest-*.png). @@ -4806,5 +4808,41 @@ CHECKS += ['fishing'] CHECK_FNS.update(fishing=check_fishing) +def check_maps(host, guest, out): + """MapItem.update for each player, on the server: a map the player makes and holds reveals the + terrain around them and shows their marker, which reach their client in + ClientboundMapItemDataPacket (#1382).""" + seen = {} + try: + for game in (host, guest): + game('command', command='gamemode survival') + game('command', command='clear @s') + game('command', command='item replace entity @s weapon.mainhand with minecraft:map') + x, y, z = pos_of(game) + game.raw('look-at', f'{x + 5:.2f}', f'{y + 1.6:.2f}', f'{z:.2f}') + game.wait(5) + game.raw('use-item') + # 16 ticks sweep every column once; the marker goes out every 5th tick. + game.wait(60) + maps = game('status').get('maps', []) + game.raw('look-at', f'{x + 1:.2f}', f'{y:.2f}', f'{z:.2f}') + game.wait(5) + game.shot(out, 'maps-held') + seen[game.name] = [{'pixels': m['pixels'], 'decorations': m['decorations']} for m in maps] + finally: + for game in (host, guest): + game('command', command='clear @s') + face_each_other(host, guest) + for name, maps in seen.items(): + # Revealed out to the server's view distance, at least a 32-block disk. + assert len(maps) == 1 and maps[0]['pixels'] > 3000, f'{name}: {seen}' + assert maps[0]['decorations'] == ['map/decorations/player'], f'{name}: {seen}' + return seen + + +CHECKS += ['maps'] +CHECK_FNS.update(maps=check_maps) + + if __name__ == '__main__': main() From fa4ea80d3253ea3a65b0663454f4a03c4e52c4b2 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:00:42 +0200 Subject: [PATCH 09/17] A server's player's client sets its body as in frame: look pitch, use slowdown, boots on powder snow On a server (guests, and single player on the server thread) the window ticks its player through tick_remote_level, which copied the yaw, the Respiration level, the wings and FAST_LAVA but not the rest of what the in-frame tick sets from the window's own state. Both now call Game::sync_player_body: - the look pitch: Player.travel steers sprint-swimming up and down by it (#1303) - the slowdown of an item in use, LocalPlayer.modifyInput (#1278) - leather boots, PowderSnowBlock.canEntityWalkOnPowderSnow (#1296) - freeze-immune wear, LivingEntity.canFreeze - the Auto Jump option, LocalPlayer.sendPosition (#1279) tools/lan_e2e.py gains a body check: each player walks while drawing a bow, stands on powder snow with leather boots and without, and sprint-swims looking down. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 87 ++++++++++++++---------- crates/horizon-client/src/game/remote.rs | 11 +-- tools/lan_e2e.py | 81 ++++++++++++++++++++++ 3 files changed, 132 insertions(+), 47 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index bc0cb86b9..0a077aa75 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -1825,6 +1825,55 @@ impl Game<'_> { .is_some_and(|i| i.glider && (i.max_damage == 0 || s.damage + 1 < i.max_damage)) }) } + /// What the window decides for its player's body every tick, in frame and + /// on a server alike: the look (Player.travel steers sprint-swimming by + /// the pitch), Auto Jump (LocalPlayer.sendPosition), the slowdown of an + /// item in use (LocalPlayer.modifyInput), the helmet's Respiration + /// (decreaseAirSupply), the wings, leather boots on powder snow + /// (PowderSnowBlock.canEntityWalkOnPowderSnow), freeze-immune wear + /// (LivingEntity.canFreeze) and the dimension's FAST_LAVA. + pub(crate) fn sync_player_body(&mut self) { + let glider = self.glider_worn(); + let item_use_speed = self + .using + .and_then(|(slot, _)| { + if slot == shield::OFFHAND_SLOT { + self.offhand.as_ref() + } else { + self.inventory.get(slot)?.as_ref() + } + }) + .and_then(|s| self.res.items().get(&s.item)) + .map(|i| i.use_speed); + let respiration = self.armor[0] + .as_ref() + .map_or(0, |s| s.enchantment_level("minecraft:respiration") as i32); + let leather_boots = self.armor[3] + .as_ref() + .is_some_and(|s| &*s.item == "minecraft:leather_boots"); + let immune = self + .res + .items() + .item_tags + .get("minecraft:freeze_immune_wearables"); + let freeze_immune = self + .armor + .iter() + .flatten() + .any(|s| immune.is_some_and(|t| t.contains(&*s.item))); + let Some(player) = self.player.as_mut() else { + return; + }; + player.yaw = self.yaw; + player.pitch = self.pitch; + player.auto_jump_enabled = self.settings.auto_jump; + player.item_use_speed = item_use_speed; + player.respiration = respiration; + player.glider = glider; + player.leather_boots = leather_boots; + player.freeze_immune = freeze_immune; + player.fluids.fast_lava = self.dim == Dim::Nether; + } fn held_slot(&self) -> usize { match self.hand { Hand::Main => self.selected, @@ -4035,7 +4084,7 @@ impl Game<'_> { let riding = self.riding.is_some(); let ghast_collisions = self.happy_ghast_player_collisions(); let spin_targets = self.spin_targets(); - let glider = self.glider_worn(); + self.sync_player_body(); let Some(player) = self.player.as_mut() else { // A dedicated server has no local player: the world still runs. if self.options.dedicated.is_some() { @@ -4067,46 +4116,10 @@ impl Game<'_> { if !riding { self.previous_position = player.position; } - player.yaw = self.yaw; let spectator = self.mode == horizon_client::command::args::GameMode::Spectator; player.may_fly = self.creative || spectator; - // LocalPlayer.sendPosition: autoJumpEnabled follows the option. - player.auto_jump_enabled = self.settings.auto_jump; player.invulnerable = self.creative || spectator; player.spectator = spectator; - player.respiration = self.armor[0] - .as_ref() - .map_or(0, |s| s.enchantment_level("minecraft:respiration") as i32); - player.pitch = self.pitch; - player.glider = glider; - // LocalPlayer.modifyInput: walking while using an item. - player.item_use_speed = self - .using - .and_then(|(slot, _)| { - if slot == shield::OFFHAND_SLOT { - self.offhand.as_ref() - } else { - self.inventory.get(slot)?.as_ref() - } - }) - .and_then(|s| self.res.items().get(&s.item)) - .map(|i| i.use_speed); - // PowderSnowBlock.canEntityWalkOnPowderSnow and LivingEntity.canFreeze. - player.leather_boots = self.armor[3] - .as_ref() - .is_some_and(|s| &*s.item == "minecraft:leather_boots"); - let immune = self - .res - .items() - .item_tags - .get("minecraft:freeze_immune_wearables"); - player.freeze_immune = self - .armor - .iter() - .flatten() - .any(|s| immune.is_some_and(|t| t.contains(&*s.item))); - // The dimension's FAST_LAVA: the Nether's lava pushes harder. - player.fluids.fast_lava = self.dim == Dim::Nether; player.spin_targets = spin_targets; let grounded = player.ground.on_ground; let before = ( diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index d41de660e..4b6fd4871 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3144,19 +3144,10 @@ impl Game<'_> { [player.position.x, player.position.y, player.position.z], ); let was_flying = player.flying; - player.yaw = self.yaw; - // As the window's own tick has them: the helmet's Respiration - // (decreaseAirSupply) and the dimension's FAST_LAVA, the Nether's - // stronger lava current. - player.respiration = self.armor[0] - .as_ref() - .map_or(0, |s| s.enchantment_level("minecraft:respiration") as i32); - player.fluids.fast_lava = self.dim == Dim::Nether; - let glider = self.glider_worn(); + self.sync_player_body(); let Some(player) = self.player.as_mut() else { return Ok(()); }; - player.glider = glider; let was_gliding = player.fall_flying; let dead = self.screen == Screen::Dead; // LivingEntity.isImmobile: a sleeper lies still in the bed. diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 271982ca9..8318b6a1f 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -207,6 +207,9 @@ address. The script then checks, from both sides, what a guest's game used to ge bites and reeling in catches it (#1348). - maps: the host and the guest each make a map and hold it: their client draws the terrain around them and their marker, from the server's map data (#1382). +- body: the host and the guest each walk while drawing a bow (slowed), stand on powder snow + with leather boots (held up) and without (sinking), and sprint-swim looking down + (diving): their own client decides it (#1278, #1296, #1303). Each check is reported on its own (a failing one doesn't stop the others) and the screenshots of both sides go to --out (host-*.png, guest-*.png). @@ -4844,5 +4847,83 @@ CHECKS += ['maps'] CHECK_FNS.update(maps=check_maps) +def check_body(host, guest, out): + """What each player's own client decides for its body (#1278, #1303, #1296): walking while + drawing a bow is slowed to a fifth (LocalPlayer.modifyInput), sprint-swimming follows the look + down (Player.travel's look angle) and leather boots hold on powder snow + (PowderSnowBlock.canEntityWalkOnPowderSnow).""" + hx, hy, hz = (int(v // 1) for v in pos_of(host)) + seen = {} + + def walked(game, x, z, use): + game('command', command=f'tp @s {x + 0.5} {hy} {z + 0.5} -90 0') + game.wait(10) + if use: + game.raw('mouse', 'right', 'down') + game.wait(5) + a = pos_of(game) + game.raw('move', 'forward', '0.8') + game.wait(10) + b = pos_of(game) + game.raw('mouse', 'right', 'up') + game.wait(5) + return round(math.dist((a[0], a[2]), (b[0], b[2])), 2) + + try: + for game, dz in ((host, -4), (guest, 4)): + x, z = hx, hz + dz + host('command', command=f'fill {x - 1} {hy - 1} {z - 1} {x + 10} {hy - 1} {z + 1} minecraft:stone') + host('command', command=f'fill {x - 1} {hy} {z - 1} {x + 10} {hy + 3} {z + 1} minecraft:air') + game('command', command='gamemode survival') + game('command', command='clear @s') + game('command', command='effect clear @s') + s = {'walk': walked(game, x, z, False)} + game('command', command='item replace entity @s weapon.mainhand with minecraft:bow') + game('command', command='give @s minecraft:arrow 4') + game.wait(5) + s['drawing'] = walked(game, x, z, True) + game('command', command='clear @s') + # Powder snow under the feet: leather boots stand on it, bare feet sink. + host('command', command=f'setblock {x + 3} {hy - 1} {z} minecraft:powder_snow') + for boots in ('leather_boots', 'air'): + game('command', command=f'item replace entity @s armor.feet with minecraft:{boots}') + game('command', command=f'tp @s {x + 3.5} {hy} {z + 0.5} -90 0') + game.wait(30) + s[boots] = round(pos_of(game)[1] - hy, 2) + host('command', command=f'setblock {x + 3} {hy - 1} {z} minecraft:stone') + # Deep water: sprint-swimming while looking down dives. + wx, wz = x, z + 2 * (1 if dz > 0 else -1) * 3 + host('command', command=f'fill {wx - 1} {hy - 14} {wz - 2} {wx + 12} {hy + 2} {wz + 2} minecraft:stone') + host('command', command=f'fill {wx} {hy - 13} {wz - 1} {wx + 11} {hy - 1} {wz + 1} minecraft:water') + game.wait(10) + game('command', command=f'tp @s {wx + 1.5} {hy - 6} {wz + 0.5} -90 60') + game.wait(10) + a = pos_of(game) + game.raw('move', 'forward', '1.5', '--sprint') + game.wait(5) + s['dive'] = round(pos_of(game)[1] - a[1], 2) + game('command', command=f'tp @s {x + 0.5} {hy} {z + 0.5} -90 0') + game.wait(5) + host('command', command=f'fill {wx - 1} {hy - 14} {wz - 2} {wx + 12} {hy + 2} {wz + 2} minecraft:air') + host('command', command=f'fill {wx - 1} {hy - 14} {wz - 2} {wx + 12} {hy - 1} {wz + 2} minecraft:stone') + game.shot(out, 'body') + seen[game.name] = s + finally: + for game in (host, guest): + back_to_game(game) + game.raw('mouse', 'right', 'up') + game('command', command='clear @s') + face_each_other(host, guest) + for name, s in seen.items(): + assert s['walk'] > 2.5 and s['drawing'] < s['walk'] * 0.4, f'{name} drawing a bow: {seen}' + assert s['leather_boots'] > -0.01 and s['air'] < -0.5, f'{name} powder snow: {seen}' + assert s['dive'] < -2, f'{name} sprint-swimming down: {seen}' + return seen + + +CHECKS += ['body'] +CHECK_FNS.update(body=check_body) + + if __name__ == '__main__': main() From f96101cd47f35e998ac1f032f92ce7a4de82f89e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:02:07 +0200 Subject: [PATCH 10/17] Strikes and mob effects reach a server's players: lightning, evoker fangs, poison, axolotls Lightning (Entity.thunderHit) and evoker fangs (EvokerFangs.dealDamageTo) hit every entity in their box, but thunder_hit and fangs_bite only looked at the window's own player, so a server's players (guests, and single player on the server thread) were never struck (#1480, #1481). Both now run their player part for each guest too, through Game::each_guest_hit. The effects a mob gives the player it acts on (cave spider and bee poison, husk hunger, wither skeleton wither, the nautilus's breath) and an axolotl's help after a kill stayed with the server's own player: acts_on_player now routes MobEvent::EffectPlayer and MobEvent::AxolotlSupportPlayer to the guest the mob sees, like its blows (#1484, #1485). tools/lan_e2e.py gains a strikes check: a bolt hurts each player standing in water, and a cave spider poisons them. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/fangs.rs | 18 ++++--- crates/horizon-client/src/game/lan_mobs.rs | 21 ++++++++ crates/horizon-client/src/game/lightning.rs | 38 +++++++------ tools/lan_e2e.py | 60 +++++++++++++++++++++ 4 files changed, 115 insertions(+), 22 deletions(-) diff --git a/crates/horizon-client/src/game/fangs.rs b/crates/horizon-client/src/game/fangs.rs index 0939f6490..cdf2d17a5 100644 --- a/crates/horizon-client/src/game/fangs.rs +++ b/crates/horizon-client/src/game/fangs.rs @@ -69,12 +69,18 @@ impl Game<'_> { let lo = Vec3::new(f.pos[0] - half, f.pos[1], f.pos[2] - half); let hi = Vec3::new(f.pos[0] + half, f.pos[1] + 0.8, f.pos[2] + half); let b = horizon_core::geometry::Aabb::new(lo, hi); - if let Some(p) = self.player_view() - && p.alive - && p.bounds.intersects(b) - { - self.mob_hits_player_kind(6.0, f.pos, "minecraft:indirect_magic"); - } + // Every player in the box, the server's players too. + let pos = f.pos; + let bite = move |g: &mut Self| { + if let Some(p) = g.player_view() + && p.alive + && p.bounds.intersects(b) + { + g.mob_hits_player_kind(6.0, pos, "minecraft:indirect_magic"); + } + }; + bite(self); + self.each_guest_hit(bite); for m in &mut self.mobs { let ally = matches!( m.species(), diff --git a/crates/horizon-client/src/game/lan_mobs.rs b/crates/horizon-client/src/game/lan_mobs.rs index 0ee991737..b3f42f0c7 100644 --- a/crates/horizon-client/src/game/lan_mobs.rs +++ b/crates/horizon-client/src/game/lan_mobs.rs @@ -78,6 +78,8 @@ pub(super) fn acts_on_player(e: &MobEvent) -> bool { target: Who::Player, .. } + | MobEvent::EffectPlayer { .. } + | MobEvent::AxolotlSupportPlayer ) } @@ -115,6 +117,25 @@ impl Game<'_> { views } + /// Runs `f` as each guest in play here, for what strikes every player in + /// an area (`Level.getEntities`), not only the window's own. + pub(super) fn each_guest_hit(&mut self, mut f: impl FnMut(&mut Self)) { + let Some(mut host) = self.lan.take() else { + return; + }; + let conns: Vec = host + .hub + .guests + .iter() + .filter(|g| host.hub.here(g) && g.loaded && !g.dead) + .map(|g| g.conn) + .collect(); + for conn in conns { + self.guest_hit_by(&mut host, conn, &mut f); + } + self.lan = Some(host); + } + /// Mob events aimed at a guest, run as that guest (`guest_hit_by`). pub(super) fn lan_guest_mob_events(&mut self, events: Vec<(u32, MobEvent)>) { if events.is_empty() { diff --git a/crates/horizon-client/src/game/lightning.rs b/crates/horizon-client/src/game/lightning.rs index 476cb5aa4..916bd2a0a 100644 --- a/crates/horizon-client/src/game/lightning.rs +++ b/crates/horizon-client/src/game/lightning.rs @@ -280,11 +280,12 @@ impl Game<'_> { } /// `thunderHit` for entities within 3 blocks (up to 9 above). fn thunder_hit(&mut self, b: &mut Bolt) { - let inside = |p: [f64; 3]| { - (p[0] - b.at[0]).abs() <= 3.0 - && (p[2] - b.at[2]).abs() <= 3.0 - && p[1] >= b.at[1] - 3.0 - && p[1] <= b.at[1] + 9.0 + let at = b.at; + let inside = move |p: [f64; 3]| { + (p[0] - at[0]).abs() <= 3.0 + && (p[2] - at[2]).abs() <= 3.0 + && p[1] >= at[1] - 3.0 + && p[1] <= at[1] + 9.0 }; let damage = Damage { kind: DamageKind::Generic, @@ -349,19 +350,24 @@ impl Game<'_> { if !events.is_empty() { let _ = self.handle_mob_events(events); } - if let Some(p) = self.player.as_ref().map(|p| p.position) - && inside([p.x, p.y, p.z]) - { - if let Some(p) = self.player.as_mut() { - p.fire_ticks += 1; - if p.fire_ticks == 0 - && let Err(error) = p.ignite_for_ticks(160) - { - self.error = Some(error); + // Every player in the box, the server's players too. + let strike = move |g: &mut Self| { + if let Some(p) = g.player.as_ref().map(|p| p.position) + && inside([p.x, p.y, p.z]) + { + if let Some(p) = g.player.as_mut() { + p.fire_ticks += 1; + if p.fire_ticks == 0 + && let Err(error) = p.ignite_for_ticks(160) + { + g.error = Some(error); + } } + g.hurt_player_by("minecraft:lightning_bolt", 5.0); } - self.hurt_player_by("minecraft:lightning_bolt", 5.0); - } + }; + strike(self); + self.each_guest_hit(strike); // Dropped items burn up (ItemEntity health 5), save fire-resistant ones. self.dropped.retain(|e| { !inside([e.position.x, e.position.y, e.position.z]) diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 8318b6a1f..49ba0d186 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -210,6 +210,8 @@ address. The script then checks, from both sides, what a guest's game used to ge - body: the host and the guest each walk while drawing a bow (slowed), stand on powder snow with leather boots (held up) and without (sinking), and sprint-swim looking down (diving): their own client decides it (#1278, #1296, #1303). +- strikes: a bolt strikes the host and the guest standing in water and hurts them, and a cave + spider's bite poisons them (#1480, #1484). Each check is reported on its own (a failing one doesn't stop the others) and the screenshots of both sides go to --out (host-*.png, guest-*.png). @@ -4925,5 +4927,63 @@ CHECKS += ['body'] CHECK_FNS.update(body=check_body) +def check_strikes(host, guest, out): + """What a mob or the sky does to every player in reach, the server's players too (#1480, + #1484): a bolt striking a player standing in water costs them health (Entity.thunderHit), and + a cave spider's bite poisons them (CaveSpider.doHurtTarget on Normal).""" + hx, hy, hz = (int(v // 1) for v in pos_of(host)) + seen = {} + try: + host('command', command='difficulty normal') + host('command', command='time set 18000') + for game, dz in ((host, -5), (guest, 5)): + x, z = hx, hz + dz + host('command', command=f'fill {x - 3} {hy - 1} {z - 3} {x + 3} {hy + 3} {z + 3} minecraft:stone') + host('command', command=f'fill {x - 2} {hy} {z - 2} {x + 2} {hy + 3} {z + 2} minecraft:air') + host('command', command=f'fill {x - 2} {hy} {z - 2} {x + 2} {hy} {z + 2} minecraft:water') + game('command', command='gamemode survival') + game('command', command='clear @s') + game('command', command='effect clear @s') + game('command', command='effect give @s minecraft:instant_health 1 5') + game('command', command=f'tp @s {x + 0.5} {hy} {z + 0.5}') + game.wait(20) + before = game('state')['player'].get('health') + game('command', command=f'summon minecraft:lightning_bolt {x + 0.5} {hy} {z + 0.5}') + game.wait(20) + s = {'bolt': (before, game('state')['player'].get('health'))} + host('command', command=f'summon minecraft:cave_spider {x + 1.5} {hy} {z + 0.5}') + poisoned = False + for _ in range(40): + game.wait(5) + if 'poison' in effect_ids(game): + poisoned = True + break + s['poisoned'] = poisoned + s['bitten'] = game('state')['player'].get('health') + host('command', command='kill @e[type=minecraft:cave_spider]') + game.wait(5) + game.shot(out, 'strikes') + host('command', command=f'fill {x - 3} {hy - 1} {z - 3} {x + 3} {hy + 3} {z + 3} minecraft:air') + host('command', command=f'fill {x - 3} {hy - 1} {z - 3} {x + 3} {hy - 1} {z + 3} minecraft:stone') + seen[game.name] = s + finally: + host('command', command='kill @e[type=minecraft:cave_spider]') + host('command', command='time set day') + for game in (host, guest): + back_to_game(game) + game('command', command='effect clear @s') + game('command', command='effect give @s minecraft:instant_health 1 5') + face_each_other(host, guest) + for name, s in seen.items(): + a, b = s['bolt'] + assert a is not None and b is not None and a - b >= 3, f'{name} struck by lightning: {seen}' + assert s['poisoned'], f'{name} bitten by a cave spider: {seen}' + return seen + + +CHECKS += ['strikes'] +CHECK_FNS.update(strikes=check_strikes) + + if __name__ == '__main__': main() From c6ed3112e7891b4d96de16cee5e16f948bbe12c7 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:04:53 +0200 Subject: [PATCH 11/17] Closing a menu puts a server's player's cursor stack back into their inventory AbstractContainerMenu.removed hands the stack a closing player holds on the cursor to placeItemBackInInventory (dropped only what doesn't fit, or for a player who left), and broadcastChanges then empties the client's cursor. The LAN host threw it out at the player's eyes instead, for the inventory and every container, crafting, station, mount and merchant menu, and the client kept showing a copy on its cursor (#1283). The three ContainerClose arms now place it back through lan_place_back and send the inventory, carried stack included. tools/lan_e2e.py gains a cursor check: each player picks up a stack in their inventory and closes it. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/lan_actions.rs | 26 +++++++------ tools/lan_e2e.py | 39 +++++++++++++++++++ 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/crates/horizon-client/src/game/lan_actions.rs b/crates/horizon-client/src/game/lan_actions.rs index bb43fe660..66b4e4dd6 100644 --- a/crates/horizon-client/src/game/lan_actions.rs +++ b/crates/horizon-client/src/game/lan_actions.rs @@ -1051,20 +1051,14 @@ impl Game<'_> { S::SetBeacon(p) => self.lan_station_beacon(host, conn, p.primary, p.secondary), S::SelectTrade(p) => self.lan_select_trade(host, conn, p.item), S::ContainerClose(p) if self.lan_merchant_closed(host, conn, Some(p.container)) => { - let g = &mut host.hub.guests[gi]; - if let Some(c) = g.carried.take() { - self.drop_guest_items(host, gi, vec![c]); - } + self.guest_carried_back(host, gi); } S::ContainerClose(p) if self.lan_crafting_closed(host, conn, Some(p.container)) || self.lan_station_closed(host, conn, Some(p.container)) || self.lan_mount_closed(host, conn, Some(p.container)) => { - let g = &mut host.hub.guests[gi]; - if let Some(c) = g.carried.take() { - self.drop_guest_items(host, gi, vec![c]); - } + self.guest_carried_back(host, gi); } S::ContainerClick(p) => { let rules = ItemRules(self.res.items()); @@ -1080,10 +1074,7 @@ impl Game<'_> { self.guest_container_closed(host, conn); } host.hub.container_closed(conn, p.container); - let g = &mut host.hub.guests[gi]; - if let Some(c) = g.carried.take() { - self.drop_guest_items(host, gi, vec![c]); - } + self.guest_carried_back(host, gi); } S::ChatCommand(c) => self.guest_chat_command(host, conn, &c.command), S::ChatCommandSigned(p) => self.guest_signed_command(host, conn, p), @@ -1230,6 +1221,17 @@ impl Game<'_> { Some(out) } + /// `AbstractContainerMenu.removed`: what a closing player held on the + /// cursor goes back into their inventory (`placeItemBackInInventory`, + /// dropped only if it doesn't fit), and their client's cursor empties + /// with the inventory it is sent. + fn guest_carried_back(&mut self, host: &mut LanHost, gi: usize) { + if let Some(c) = host.hub.guests[gi].carried.take() { + self.lan_place_back(host, gi, vec![c]); + host.hub.send_inventory(gi); + } + } + pub(super) fn drop_guest_items(&mut self, host: &LanHost, gi: usize, stacks: Vec) { let g = &host.hub.guests[gi]; let eye = [ diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 49ba0d186..c07edeece 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -212,6 +212,8 @@ address. The script then checks, from both sides, what a guest's game used to ge (diving): their own client decides it (#1278, #1296, #1303). - strikes: a bolt strikes the host and the guest standing in water and hurts them, and a cave spider's bite poisons them (#1480, #1484). +- cursor: the host and the guest each close their inventory with a stack on the cursor: it + goes back into their inventory, none is thrown and the cursor is empty (#1283). Each check is reported on its own (a failing one doesn't stop the others) and the screenshots of both sides go to --out (host-*.png, guest-*.png). @@ -4985,5 +4987,42 @@ CHECKS += ['strikes'] CHECK_FNS.update(strikes=check_strikes) +def check_cursor(host, guest, out): + """Closing the inventory with a stack on the cursor puts it back into the player's inventory + (AbstractContainerMenu.removed, placeItemBackInInventory) and empties the cursor, for each + player: nothing is thrown out and no copy stays on the cursor (#1283).""" + seen = {} + try: + for game in (host, guest): + game('command', command='clear @s') + host('command', command='kill @e[type=minecraft:item]') + game('command', command='item replace entity @s hotbar.0 with minecraft:diamond 7') + game.wait(10) + game.raw('open-inventory') + game.raw('wait-for', 'screen', 'inventory', '--timeout', 10) + game.raw('click-slot', 0) + game.wait(5) + held = (game('inventory').get('carried') or {}).get('count') + game.raw('key', 'esc', 'tap') + game.wait(40) + inv = game('inventory') + seen[game.name] = {'held': held, 'carried': inv.get('carried'), + 'client': inv['counts'].get('minecraft:diamond', 0), + 'server': server_count(game, 'diamond'), + 'thrown': len(game.raw('entities', 8, 'minecraft:item')['entities'])} + finally: + for game in (host, guest): + back_to_game(game) + game('command', command='clear @s') + host('command', command='kill @e[type=minecraft:item]') + for name, s in seen.items(): + assert s == {'held': 7, 'carried': None, 'client': 7, 'server': 7, 'thrown': 0}, f'{name}: {seen}' + return seen + + +CHECKS += ['cursor'] +CHECK_FNS.update(cursor=check_cursor) + + if __name__ == '__main__': main() From a4a101ca9cf450dd715196ca5e5caed72725636f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:21:28 +0200 Subject: [PATCH 12/17] Single player runs on its server thread by default again; --in-frame is the opt-out #1428 made the in-frame world the default while a server's players lagged behind it (signs, books, totems, keep_inventory and the other [server-thread] issues). With the fixes of this stack a scripted single player session (walk, mine, place, inventory, combat, eating, boats, minecarts, chests, furnaces, beds, chat, signs, books, totems, keep_inventory, fishing, maps, saving and reopening) gives the same results on the server thread as in the frame. `--in-frame`, `--no-server-thread` or HORIZON_SERVER_THREAD=0 runs the world in the frame; `--server-thread` still works. LAN guests, dedicated servers and the command harness are unchanged. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 14 ++++++-------- crates/horizon-client/src/game/integrated.rs | 10 ++++------ docs/launcher-commands.md | 4 ++-- docs/server-levels.md | 7 +++---- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 0a077aa75..b0fa00584 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -284,11 +284,9 @@ struct Options { benchmark: Option, /// `--dev-mod PATH` (repeatable): mods always on and reloaded when rebuilt. dev_mods: Vec, - /// `--server-thread` or `HORIZON_SERVER_THREAD=1`: single player runs on an - /// integrated server thread (game/integrated.rs), as vanilla's does. Off by - /// default again until a server's players reach parity with the in-frame - /// world (signs, books, totems, keep_inventory...); `--no-server-thread` - /// keeps it off. + /// Single player runs on an integrated server thread (game/integrated.rs), + /// as vanilla's does: the default. `--in-frame` (or `--no-server-thread`, + /// or `HORIZON_SERVER_THREAD=0`) runs the world in the frame instead. server_thread: bool, /// Set on the integrated server's own options: it draws nothing, so it skips meshing. integrated: bool, @@ -346,7 +344,7 @@ impl Options { dev_mods: Vec::new(), // The command harness (HORIZON_COMMAND_SCRIPT) drives the world // itself, without the event loop: it stays in the frame. - server_thread: std::env::var("HORIZON_SERVER_THREAD").is_ok_and(|v| v == "1") + server_thread: std::env::var("HORIZON_SERVER_THREAD").map_or(true, |v| v != "0") && std::env::var_os("HORIZON_COMMAND_SCRIPT").is_none(), integrated: false, }; @@ -356,7 +354,7 @@ impl Options { match arg.as_str() { "--help" | "-h" => { println!( - "Horizon โ€” Minecraft Java Edition {} in Rust\n\n --resources PATH Prepared resources (horizon-prepare)\n --render-distance N Chunks, 2..64 (default 12)\n --world NAME World folder under saves/ (default \"New World\")\n --seed N World seed for new worlds (default 0)\n --width N, --height N Window size (default 1280 x 720)\n --creative Creative mode (default survival)\n --test-terrain Simple test terrain instead of vanilla generation\n --frames N Exit after N frames (testing)\n --world-frames N Exit after N frames drawn in the world (testing)\n --smoke-report PATH Write a JSON report on exit\n --benchmark SCENARIO Run a benchmark (standard, village, forest, ocean, mountain), write its report to benchmarks/ and quit\n --control Accept horizon-ctl commands on a local socket\n --control-socket PATH Control socket path (default $XDG_RUNTIME_DIR/horizon-control.sock)\n --server HOST[:PORT] Join a multiplayer server (offline mode) at start\n --name NAME Player name for multiplayer (default: generated once, kept in horizon-player.txt)\n --session-file PATH Signed-in account from the launcher (read once, then deleted)\n --dev-mod PATH A Horizon mod (.hmod or folder) to develop: always on, reloaded when rebuilt\n --server-thread Run single player's world on its server thread (not at parity yet)\n\nControls: mouse look, WASD move, Space jump, Left Shift sneak, Left Ctrl sprint,\nleft click break, right click place/use, 1-9/scroll hotbar, E inventory,\nQ drop, F3 debug, Esc pause.", + "Horizon โ€” Minecraft Java Edition {} in Rust\n\n --resources PATH Prepared resources (horizon-prepare)\n --render-distance N Chunks, 2..64 (default 12)\n --world NAME World folder under saves/ (default \"New World\")\n --seed N World seed for new worlds (default 0)\n --width N, --height N Window size (default 1280 x 720)\n --creative Creative mode (default survival)\n --test-terrain Simple test terrain instead of vanilla generation\n --frames N Exit after N frames (testing)\n --world-frames N Exit after N frames drawn in the world (testing)\n --smoke-report PATH Write a JSON report on exit\n --benchmark SCENARIO Run a benchmark (standard, village, forest, ocean, mountain), write its report to benchmarks/ and quit\n --control Accept horizon-ctl commands on a local socket\n --control-socket PATH Control socket path (default $XDG_RUNTIME_DIR/horizon-control.sock)\n --server HOST[:PORT] Join a multiplayer server (offline mode) at start\n --name NAME Player name for multiplayer (default: generated once, kept in horizon-player.txt)\n --session-file PATH Signed-in account from the launcher (read once, then deleted)\n --dev-mod PATH A Horizon mod (.hmod or folder) to develop: always on, reloaded when rebuilt\n --in-frame Run single player's world in the frame, not on its server thread\n\nControls: mouse look, WASD move, Space jump, Left Shift sneak, Left Ctrl sprint,\nleft click break, right click place/use, 1-9/scroll hotbar, E inventory,\nQ drop, F3 debug, Esc pause.", horizon_core::VANILLA_VERSION ); return Ok(None); @@ -371,7 +369,7 @@ impl Options { "--offscreen" => o.offscreen = true, "--control" => o.control = Some(horizon_client::control::default_path()), "--server-thread" => o.server_thread = true, - "--no-server-thread" => o.server_thread = false, + "--in-frame" | "--no-server-thread" => o.server_thread = false, _ => { let value = args .next() diff --git a/crates/horizon-client/src/game/integrated.rs b/crates/horizon-client/src/game/integrated.rs index 49266a855..042d8113a 100644 --- a/crates/horizon-client/src/game/integrated.rs +++ b/crates/horizon-client/src/game/integrated.rs @@ -6,12 +6,10 @@ //! the world's options) with [`Integrated::call`], as vanilla's client calls //! into its `IntegratedServer`. //! -//! Opt-in again (`--server-thread` or `HORIZON_SERVER_THREAD=1`) until a -//! server's players reach parity with the in-frame world: on the server -//! thread, signs open no editor, books don't open, a totem doesn't save its -//! holder and death keeps the inventory (#1380, #1366, #1292, #1284 and the -//! other `[server-thread]` issues). LAN guests and dedicated servers use the -//! same code either way. +//! On by default. `--in-frame` (or `--no-server-thread`, or +//! `HORIZON_SERVER_THREAD=0`) runs the world in the frame instead, the +//! escape hatch. LAN guests and dedicated servers use the same code either +//! way. use super::{ Game, Options, PackResources, Resources, UiResources, lan::{LanSettings, Owner}, diff --git a/docs/launcher-commands.md b/docs/launcher-commands.md index 9e09cd00b..dfe768b0e 100644 --- a/docs/launcher-commands.md +++ b/docs/launcher-commands.md @@ -53,7 +53,7 @@ Start the client. - `--world`: Open or create this world (a folder under saves) at once - `--creative`: Creative mode for a new world - `--join`: Join a friend's world with its invite code -- `--arg`: An extra argument for the game, passed through as-is (repeatable), for example --server-thread +- `--arg`: An extra argument for the game, passed through as-is (repeatable), for example --in-frame MCP: `play`, then the `game_*` tools. @@ -143,7 +143,7 @@ MCP: `settings`. ## `horizon-launcher game-args` -Show or set the extra arguments the game starts with (for example --server-thread); quotes group a word with spaces in it. +Show or set the extra arguments the game starts with (for example --in-frame); quotes group a word with spaces in it. horizon-launcher game-args [ARGS] diff --git a/docs/server-levels.md b/docs/server-levels.md index cc21a52ab..df45efc1f 100644 --- a/docs/server-levels.md +++ b/docs/server-levels.md @@ -26,10 +26,9 @@ the other dimensions' levels as `Parked` values and swaps one into place (`enter The packets of a guest are read in its own level's pass (`Hub::tick_level`), so its actions and commands run with its level in place. -The window's own game (single player's default, `--no-server-thread`, `HORIZON_SERVER_THREAD=0`, and the -command harness) keeps one level, which follows its player (`enter_dimension`). LAN guests of a world run -that way stay in the host's dimension. It is the default again only until the server thread reaches parity -(`--server-thread` or `HORIZON_SERVER_THREAD=1` opts in), so it gets no multi-level work. +The window's own game (`--in-frame`, `--no-server-thread`, `HORIZON_SERVER_THREAD=0`, and the command +harness) keeps one level, which follows its player (`enter_dimension`). LAN guests of a world run that way +stay in the host's dimension. That mode is the escape hatch, so it gets no multi-level work. ## One code path for both From ea424ebd52dd500173c70c18b6ad5aeecee561d3 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:26:56 +0200 Subject: [PATCH 13/17] LAN and dedicated servers wait for the player's client to finish breaking a block ServerPlayerGameMode breaks a digging player's block only when the player's client says it is done (STOP_DESTROY_BLOCK, or the delayed destroy), or at once when it is instant. The host ran the guest's tick_mining with its own count and broke the block when that reached 1. A guest whose client ran even a tick behind lost the block before it predicted the break: no destroy particles, no break sound, and the dropped item could appear before the block vanished. lan_e2e's new digging check holds attack across six oak logs and hears six breaks, then stalls the guest for a second halfway through stone: the stone is still there on both sides when it resumes. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 7 +++- tools/lan_e2e.py | 68 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 6184f1626..b1777eba8 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -3803,7 +3803,12 @@ impl Game<'_> { } self.crack_particle(crack.0, crack.1, state); let m = self.mining.as_mut().ok_or("mining")?; - if m.progress >= 1.0 { + // ServerPlayerGameMode breaks a player's block at once only when it is instant (START's + // insta-mine); otherwise it waits for the client's STOP_DESTROY_BLOCK + // (`guest_stop_digging`), never breaking it on its own count. Breaking it here would + // take the block from under the player's crack before the player's client predicts the + // break, so it gets neither particles nor sound. + if m.progress >= 1.0 && (self.lan_acting.is_none() || m.ticks == 1) { let pos = m.pos; self.mining = None; self.break_block(pos)?; diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 994636066..f69081945 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -4521,5 +4521,73 @@ CHECKS += ['totem'] CHECK_FNS.update(totem=check_totem) +def check_digging(host, guest, out): + """The server breaks a block a player digs only once that player's client is done + (ServerPlayerGameMode: STOP_DESTROY_BLOCK, or the delayed destroy), never on its own count, so + the player's client always breaks it first, with its particles and sound. The guest holds + attack across a wall of six oak logs with a copper axe and hears each one break; then it digs + stone with a wooden pickaxe and its game stalls for a second halfway: the stone is still there + on both sides when it resumes, and the guest's own crack finishes it.""" + gx, gy, gz = (int(v // 1) for v in pos_of(guest)) + x, y, z = gx + 3, gy, gz + 4 + heard = lambda sound: guest('status')['heard'].get(sound, 0) + at = lambda b: (f'{b[0] + 0.02:.2f}', f'{b[1] + 0.5:.2f}', f'{b[2] + 0.5:.2f}') + guest('command', command='gamemode survival') + guest('command', command='item replace entity @s weapon.mainhand with minecraft:copper_axe') + host('command', command=f'fill {x - 2} {y - 1} {z - 2} {x + 4} {y + 3} {z + 2} minecraft:air') + host('command', command=f'fill {x - 2} {y - 1} {z - 2} {x + 4} {y - 1} {z + 2} minecraft:stone') + host('command', command=f'fill {x + 2} {y} {z - 1} {x + 2} {y + 1} {z + 1} minecraft:oak_log') + guest('command', command=f'tp @s {x + 0.5} {y} {z + 0.5}') + guest.wait(30) + logs = [(x + 2, y + dy, z + dz) for dz in (-1, 0, 1) for dy in (0, 1)] + before = heard('minecraft:block.wood.break') + guest.raw('look-at', *at(logs[0])) + guest.raw('mouse', 'left', 'down') + left = list(logs) + deadline = time.time() + 20 + while left and time.time() < deadline: + if guest.raw('block', *left[0]).get('block') != 'minecraft:oak_log': + left.pop(0) + if left: + guest.raw('look-at', *at(left[0])) + guest.raw('mouse', 'left', 'up') + guest.wait(10) + seen = {'logs_left': left, 'log_breaks_heard': heard('minecraft:block.wood.break') - before} + + # Stone with a wooden pickaxe: 23 ticks. The guest stalls for a second after about 8. + stone = (x + 2, y, z) + guest('command', command='item replace entity @s weapon.mainhand with minecraft:wooden_pickaxe') + host('command', command=f'setblock {stone[0]} {stone[1]} {stone[2]} minecraft:stone') + guest.wait(10) + before = heard('minecraft:block.stone.break') + guest.raw('look-at', *at(stone)) + guest.raw('mouse', 'left', 'down') + time.sleep(0.4) + os.kill(guest.pid, signal.SIGSTOP) + try: + time.sleep(1.0) + finally: + os.kill(guest.pid, signal.SIGCONT) + resumed = {'guest': guest.raw('block', *stone).get('block'), 'server': host.raw('block', *stone).get('block'), + 'mining': guest('state').get('mining')} + # Let go once it breaks: past it the crosshair reaches the floor. + deadline = time.time() + 5 + while guest.raw('block', *stone).get('block') == 'minecraft:stone' and time.time() < deadline: + pass + guest.raw('mouse', 'left', 'up') + guest.wait(10) + seen.update(resumed=resumed, stone_after=host.raw('block', *stone).get('block'), + stone_breaks_heard=heard('minecraft:block.stone.break') - before) + guest.shot(out, 'digging') + assert not left and seen['log_breaks_heard'] == 6, f'the server broke logs before the guest did: {seen}' + assert resumed['guest'] == resumed['server'] == 'minecraft:stone', f'the server broke the stone while the guest stalled: {seen}' + assert seen['stone_after'] == 'minecraft:air' and seen['stone_breaks_heard'] == 1, f'the guest did not break the stone: {seen}' + return seen + + +CHECKS += ['digging'] +CHECK_FNS.update(digging=check_digging) + + if __name__ == '__main__': main() From 5205b909f79740ae620a3892aeec58407f1a80c3 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 05:33:52 +0200 Subject: [PATCH 14/17] Villagers, llamas, bees, allays and copper golems search the full path budget PathNavigation.setRequiredPathLength calls updatePathfinderMaxVisitedNodes, so a villager's PathFinder visits up to max(follow range, 48) * 16 = 768 nodes, not the 256 of its follow range alone. Horizon always used follow range * 16, so a villager gave up on any job site, bed or bell whose path needed more than 256 nodes: in the seed 12345 village it never found the way round to the mason's stonecutter door. Navigation now keeps PathFinder.maxVisitedNodes: the base follow range times 16 when the mob is made, then max(follow range, required path length) * 16 after setRequiredPathLength and after any follow range change (Mob.onAttributeUpdated). A happy ghast that grows up or becomes a baby gets a new navigation, as in vanilla. mob_ai: villager_job_in_box, a composter inside a stone box whose doorway faces away from the villager. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/sculk.rs | 1 + crates/horizon-client/src/mobs.rs | 2 ++ crates/horizon-client/src/mobs/allay.rs | 2 +- crates/horizon-client/src/mobs/bee.rs | 2 +- .../horizon-client/src/mobs/copper_golem.rs | 2 +- .../horizon-client/src/mobs/creaking_heart.rs | 1 + crates/horizon-client/src/mobs/finalize.rs | 5 ++++- crates/horizon-client/src/mobs/happy_ghast.rs | 6 +++++- crates/horizon-client/src/mobs/llama.rs | 2 +- crates/horizon-client/src/mobs/nav.rs | 19 +++++++++++++++++-- crates/horizon-client/src/mobs/villager.rs | 2 +- tools/test_mob_ai_parity.py | 10 ++++++++++ 12 files changed, 45 insertions(+), 9 deletions(-) diff --git a/crates/horizon-client/src/game/sculk.rs b/crates/horizon-client/src/game/sculk.rs index 8667f305f..a11a643c1 100644 --- a/crates/horizon-client/src/game/sculk.rs +++ b/crates/horizon-client/src/game/sculk.rs @@ -1054,6 +1054,7 @@ impl Game<'_> { let r = &mut self.world.random; let bonus = r.triangle(0.0, 0.11485000000000001); mob.attrs.follow_range += mob.kind.follow_range * bonus; + mob.update_max_visited_nodes(); let _left_handed = r.next_float() < 0.05; if !self.warden_fits(&mob) { continue; diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index a61ea2a11..e020b92a4 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -1602,6 +1602,8 @@ impl Mob { | Species::Fox | Species::Panda ); + // The PathNavigation constructor: the base follow range. + mob.ai.nav.max_visited_nodes = (mob.kind.follow_range * 16.0).floor() as i32; ai::register(&mut mob); mob } diff --git a/crates/horizon-client/src/mobs/allay.rs b/crates/horizon-client/src/mobs/allay.rs index 3c25053ba..029ddb6e5 100644 --- a/crates/horizon-client/src/mobs/allay.rs +++ b/crates/horizon-client/src/mobs/allay.rs @@ -26,7 +26,7 @@ pub fn register(m: &mut Mob) { }; m.ai.nav.kind = NavKind::Flying; // FlyingPathNavigation.setRequiredPathLength(48). - m.ai.nav.required_path_length = 48.0; + m.set_required_path_length(48.0); let g = &mut m.ai.goals; g.add(0, Panic::new(2.5)); g.add(1, Fetch); diff --git a/crates/horizon-client/src/mobs/bee.rs b/crates/horizon-client/src/mobs/bee.rs index cdb0318bc..53eacba1c 100644 --- a/crates/horizon-client/src/mobs/bee.rs +++ b/crates/horizon-client/src/mobs/bee.rs @@ -138,7 +138,7 @@ pub fn register(m: &mut Mob) { }; m.ai.nav.kind = NavKind::Flying; m.ai.nav.can_open_doors = false; - m.ai.nav.required_path_length = 48.0; + m.set_required_path_length(48.0); m.set_malus(PathType::Fire, -1.0); m.set_malus(PathType::Water, -1.0); m.set_malus(PathType::WaterBorder, 16.0); diff --git a/crates/horizon-client/src/mobs/copper_golem.rs b/crates/horizon-client/src/mobs/copper_golem.rs index 398022485..5f4ffba13 100644 --- a/crates/horizon-client/src/mobs/copper_golem.rs +++ b/crates/horizon-client/src/mobs/copper_golem.rs @@ -26,7 +26,7 @@ pub const DROPPING_NO_ITEM: u8 = 4; pub const WEATHER: [&str; 4] = ["unaffected", "exposed", "weathered", "oxidized"]; pub fn register(m: &mut Mob) { - m.ai.nav.required_path_length = 48.0; + m.set_required_path_length(48.0); m.ai.nav.can_open_doors = true; m.persistent = true; // nextWeatheringTick starts unset (-1); waxed is -2. diff --git a/crates/horizon-client/src/mobs/creaking_heart.rs b/crates/horizon-client/src/mobs/creaking_heart.rs index 1172b229c..a43f39284 100644 --- a/crates/horizon-client/src/mobs/creaking_heart.rs +++ b/crates/horizon-client/src/mobs/creaking_heart.rs @@ -464,6 +464,7 @@ pub fn finalize_spawn(m: &mut Mob, lr: &mut LegacyRandom) { let bonus = lr.triangle(0.0, 0.114_850_000_000_000_01); // ADD_MULTIPLIED_BASE on the base value. m.attrs.follow_range += m.kind.follow_range * bonus; + m.update_max_visited_nodes(); let _left_handed = lr.next_float() < 0.05; } fn wrap_degrees(angle: f32) -> f32 { diff --git a/crates/horizon-client/src/mobs/finalize.rs b/crates/horizon-client/src/mobs/finalize.rs index ae6a864cc..4eeed885b 100644 --- a/crates/horizon-client/src/mobs/finalize.rs +++ b/crates/horizon-client/src/mobs/finalize.rs @@ -559,7 +559,10 @@ fn refresh(m: &mut Mob, a: Attr) { match a { Attr::MaxHealth => m.attrs.max_health = value(m, a) as f32, Attr::MovementSpeed => m.attrs.speed = base_with_modifiers(m, a), - Attr::FollowRange => m.attrs.follow_range = value(m, a), + Attr::FollowRange => { + m.attrs.follow_range = value(m, a); + m.update_max_visited_nodes(); + } Attr::AttackDamage => m.attrs.attack_damage = value(m, a) as f32, Attr::KnockbackResistance => m.attrs.knockback_resistance = value(m, a), Attr::SpawnReinforcements => m.attrs.spawn_reinforcements = value(m, a), diff --git a/crates/horizon-client/src/mobs/happy_ghast.rs b/crates/horizon-client/src/mobs/happy_ghast.rs index 6fc07e898..bd4c5b1f3 100644 --- a/crates/horizon-client/src/mobs/happy_ghast.rs +++ b/crates/horizon-client/src/mobs/happy_ghast.rs @@ -39,6 +39,10 @@ fn setup(m: &mut Mob, baby: bool) { m.ai.look.wanted = [0.0; 3]; m.ai.look.cooldown = 0; m.extra.counter2 = 0; + // The new navigation's PathNavigation constructor. + m.ai.nav.required_path_length = 16.0; + m.ai.nav.max_visited_nodes = + (super::finalize::base_value(m, super::finalize::Attr::FollowRange) * 16.0).floor() as i32; if baby { m.ai.look.kind = LookKind::Default; m.ai.mov.kind = MoveKind::Flying { @@ -48,7 +52,7 @@ fn setup(m: &mut Mob, baby: bool) { // BabyFlyingPathNavigation. m.ai.nav.kind = NavKind::Flying; m.ai.nav.can_float = true; - m.ai.nav.required_path_length = 48.0; + m.set_required_path_length(48.0); return; } if was == 1 { diff --git a/crates/horizon-client/src/mobs/llama.rs b/crates/horizon-client/src/mobs/llama.rs index b91dc5bfa..219ca5973 100644 --- a/crates/horizon-client/src/mobs/llama.rs +++ b/crates/horizon-client/src/mobs/llama.rs @@ -50,7 +50,7 @@ pub fn is_illager(s: &Seen) -> bool { ) } pub fn register(m: &mut Mob) { - m.ai.nav.required_path_length = 40.0; + m.set_required_path_length(40.0); let tempt = m.kind.tempt.clone(); let trader = is_trader(m); if trader { diff --git a/crates/horizon-client/src/mobs/nav.rs b/crates/horizon-client/src/mobs/nav.rs index 793303c6d..178751ff6 100644 --- a/crates/horizon-client/src/mobs/nav.rs +++ b/crates/horizon-client/src/mobs/nav.rs @@ -37,7 +37,11 @@ pub struct Navigation { reach_range: i32, pub max_visited_multiplier: f32, pub stuck: bool, + /// Set through [`Mob::set_required_path_length`]. pub required_path_length: f32, + /// `PathFinder.maxVisitedNodes`: the base follow range times 16 when the + /// navigation is made, then [`Mob::update_max_visited_nodes`]. + pub max_visited_nodes: i32, pub can_float: bool, pub can_open_doors: bool, pub can_pass_doors: bool, @@ -68,6 +72,7 @@ impl Default for Navigation { max_visited_multiplier: 1.0, stuck: false, required_path_length: 16.0, + max_visited_nodes: 256, can_float: false, can_open_doors: false, can_pass_doors: true, @@ -147,6 +152,16 @@ impl Mob { fn max_path_length(&self) -> f32 { (self.attrs.follow_range as f32).max(self.ai.nav.required_path_length) } + /// `PathNavigation.updatePathfinderMaxVisitedNodes`: after a follow range + /// change and a new required path length. + pub fn update_max_visited_nodes(&mut self) { + self.ai.nav.max_visited_nodes = (self.max_path_length() * 16.0).floor() as i32; + } + /// `PathNavigation.setRequiredPathLength`. + pub fn set_required_path_length(&mut self, length: f32) { + self.ai.nav.required_path_length = length; + self.update_max_visited_nodes(); + } fn can_update_path(&self) -> bool { match self.ai.nav.kind { NavKind::Ground | NavKind::WallClimber => self.on_ground || self.is_in_liquid(), @@ -237,8 +252,8 @@ impl Mob { return Some(path.clone()); } let pm = self.path_mob(); - let max_visited = ((self.attrs.follow_range * 16.0).floor() as f32 - * self.ai.nav.max_visited_multiplier) as i32; + let max_visited = + (self.ai.nav.max_visited_nodes as f32 * self.ai.nav.max_visited_multiplier) as i32; let finder = Finder::new(w, &pm, self.ai.nav.evaluator()); let path = finder.find(targets, max_len, reach, max_visited); if let Some(p) = &path { diff --git a/crates/horizon-client/src/mobs/villager.rs b/crates/horizon-client/src/mobs/villager.rs index 84c607933..b5abad9f0 100644 --- a/crates/horizon-client/src/mobs/villager.rs +++ b/crates/horizon-client/src/mobs/villager.rs @@ -46,7 +46,7 @@ pub fn register(m: &mut Mob) { // Villager's constructor: its brain does everything, it has no goals. m.ai.nav.can_open_doors = true; m.ai.nav.can_float = true; - m.ai.nav.required_path_length = 48.0; + m.set_required_path_length(48.0); } /// `LivingEntity.addParticlesAroundSelf`: five particles about the body. diff --git a/tools/test_mob_ai_parity.py b/tools/test_mob_ai_parity.py index 07f41b2af..ccc50b302 100644 --- a/tools/test_mob_ai_parity.py +++ b/tools/test_mob_ai_parity.py @@ -275,6 +275,16 @@ def scenarios(): 'mob minecraft:cod 2.5 -62 0.5 0 13 persistent noai']) add('axolotl_play_dead', 300, [POOL, 'player 12.5 -60 0.5', 'mob minecraft:axolotl 0.5 -62 0.5 0 28 persistent'] + [f'hurt {t} 0' for t in range(4, 160, 12)]) + # A jobless villager outside a stone box, its composter inside and the doorway on the far + # side: the path around needs more than the 256 nodes of the follow range (16 * 16); the + # villager's setRequiredPathLength(48) raises PathFinder.maxVisitedNodes to 768. + add('villager_job_in_box', 300, [ + 'fill -4 -60 -4 4 -58 4 minecraft:stone', + 'fill -3 -60 -3 3 -58 3 minecraft:air', + 'fill -4 -60 0 -4 -59 0 minecraft:air', + 'block 0 -60 0 minecraft:composter', + 'mob minecraft:villager 10.5 -60 0.5 90 54 persistent', + ]) return s From 8cce2e2f8a1b46230c59e47394ea50c97ae33219 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 06:33:55 +0200 Subject: [PATCH 15/17] Prepare: import Programmer Art and High Contrast from the asset index Vanilla lists its built-in resource packs from minecraft:resourcepacks of the vanilla pack (BuiltInPackSource.populatePackList), and those two zips live only in the asset index, not in the client JAR. Preparation never copied them, so Horizon's pack list had no Programmer Art. Packs made to sit on it, like Golden Days ("This pack is meant to be put over Programmer Art"), then showed the modern textures for the ~720 textures they leave to it: furnaces, stone bricks, crafting tables, pumpkins, TNT, logs, tools, buckets, paper. Full preparation now imports both after extracting the JAR, like the panorama and Unifont, and `horizon-prepare packs` adds them to prepared resources. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-prepare/src/lib.rs | 4 +- crates/horizon-prepare/src/main.rs | 10 ++- crates/horizon-prepare/src/sounds.rs | 92 ++++++++++++++++++++++++---- docs/resource-packs.md | 3 +- 4 files changed, 92 insertions(+), 17 deletions(-) diff --git a/crates/horizon-prepare/src/lib.rs b/crates/horizon-prepare/src/lib.rs index 861db254d..b829004be 100644 --- a/crates/horizon-prepare/src/lib.rs +++ b/crates/horizon-prepare/src/lib.rs @@ -17,7 +17,7 @@ pub mod pyjson; mod sounds; mod survival; -pub use sounds::{fonts, panorama, sounds}; +pub use sounds::{fonts, packs, panorama, sounds}; use pyjson::Value; use sha2::Digest; @@ -692,7 +692,7 @@ fn steps( } // The JAR holds only gray 1x1 panorama placeholders and an empty Unifont - // include. Import the indexed ones afterwards, including on reruns that just + // include, and none of the built-in packs. Import the indexed ones afterwards, including on reruns that just // extracted the JAR again. They are optional when preparing from // already-imported JARs. sounds::optional_assets(repo, minecraft, run.log); diff --git a/crates/horizon-prepare/src/main.rs b/crates/horizon-prepare/src/main.rs index 0d3a5685d..395821283 100644 --- a/crates/horizon-prepare/src/main.rs +++ b/crates/horizon-prepare/src/main.rs @@ -19,6 +19,7 @@ Usage: horizon-prepare [--prepare] [--server-jar PATH] [--minecraft-dir PATH] [- horizon-prepare sounds [--minecraft-dir PATH] [--root PATH] horizon-prepare panorama [--minecraft-dir PATH] [--root PATH] horizon-prepare fonts [--minecraft-dir PATH] [--root PATH] + horizon-prepare packs [--minecraft-dir PATH] [--root PATH] --prepare Import the pinned game files from your own copy first --server-jar PATH The pinned server jar you downloaded yourself @@ -34,7 +35,8 @@ The resources go to /.local/horizon-client/; pass that to horizon horizon-prepare panorama repairs the classic menu background in existing resources without Java. horizon-prepare fonts adds the GNU Unifont glyphs (characters the bitmap fonts lack) the same way. -Full preparation also imports both after extracting the client JAR's placeholders. +horizon-prepare packs adds the built-in Programmer Art and High Contrast resource packs the same way. +Full preparation also imports all three after extracting the client JAR's placeholders. horizon-prepare sounds copies the pinned version's sounds (about 380 MB) from the official launcher's asset store into the same folder, checking every file. It is optional: without it the @@ -66,7 +68,8 @@ fn main() -> ExitCode { }; let mut root = None; let mut args = std::env::args_os().skip(1).peekable(); - let assets = args.next_if(|a| a == "sounds" || a == "panorama" || a == "fonts"); + let assets = + args.next_if(|a| matches!(a.to_str(), Some("sounds" | "panorama" | "fonts" | "packs"))); while let Some(arg) = args.next() { let text = arg.to_string_lossy().into_owned(); let (flag, inline) = match text.split_once('=') { @@ -132,6 +135,9 @@ fn main() -> ExitCode { Some("fonts") => { horizon_prepare::fonts(&options.root, options.minecraft_dir.as_deref(), &log) } + Some("packs") => { + horizon_prepare::packs(&options.root, options.minecraft_dir.as_deref(), &log) + } _ => horizon_prepare::prepare(&options, &log), }; match result { diff --git a/crates/horizon-prepare/src/sounds.rs b/crates/horizon-prepare/src/sounds.rs index fd9e18210..bafcf6a3e 100644 --- a/crates/horizon-prepare/src/sounds.rs +++ b/crates/horizon-prepare/src/sounds.rs @@ -1,5 +1,5 @@ -//! The pinned version's sounds and title panorama from the player's own official -//! launcher install, each object checked against the asset index's SHA-1, copied into +//! The pinned version's sounds, title panorama, Unifont glyphs and built-in resource packs +//! from the player's own official launcher install, each object checked against the asset index's SHA-1, copied into //! `.local/horizon-client//assets` where the game reads them (tools/fetch_sounds.py and //! the tools/lab.py functions it called). Nothing is downloaded. @@ -124,6 +124,11 @@ pub(crate) fn optional_assets(root: &Path, minecraft: Option<&Path>, log: Log) { "Unifont glyphs not imported: {error}; run horizon-prepare fonts later" )); } + if let Err(error) = packs(root, minecraft, log) { + log(&format!( + "Programmer Art and High Contrast not imported: {error}; run horizon-prepare packs later" + )); + } } const PANORAMA: [&str; 7] = [ @@ -145,6 +150,30 @@ const UNIFONT: [&str; 2] = [ "minecraft/font/unifont.zip", ]; +/// Adds the built-in Programmer Art and High Contrast packs, which only the asset index holds +/// (`BuiltInPackSource.populatePackList` lists `minecraft:resourcepacks` of the vanilla pack). +/// Packs made to sit on Programmer Art, like Golden Days, show the default textures without it. +/// Also usable on prepared resources without Java. +pub fn packs(root: &Path, minecraft: Option<&Path>, log: Log) -> Result { + copy_assets( + root, + minecraft, + log, + is_built_in_pack, + "Built-in pack", + &BUILT_IN_PACKS, + ) +} + +const BUILT_IN_PACKS: [&str; 2] = [ + "minecraft/resourcepacks/programmer_art.zip", + "minecraft/resourcepacks/high_contrast.zip", +]; + +fn is_built_in_pack(name: &str) -> bool { + name.starts_with("minecraft/resourcepacks/") +} + /// The fonts only the asset index holds (the JAR has the bitmap fonts). fn is_font(name: &str) -> bool { name.starts_with("minecraft/font/") @@ -228,11 +257,13 @@ mod tests { crate::hex(&sha1::Sha1::digest(data)) } - /// Where the fixture's panorama objects start. - const FIRST_FACE: usize = 6; + /// Where the fixture's built-in packs and panorama objects start. + const FIRST_PACK: usize = 6; + const FIRST_FACE: usize = 8; /// A Horizon folder and an official launcher directory holding version `9.9` with - /// sounds, a language file and the full title panorama in its asset store. + /// sounds, a language file, Unifont, the built-in packs and the full title panorama in its + /// asset store. struct Fixture { dir: PathBuf, root: PathBuf, @@ -263,6 +294,8 @@ mod tests { b"{\"providers\": [{\"type\": \"unihex\"}]}".to_vec(), ), (UNIFONT[1], b"PK unifont".to_vec()), + (BUILT_IN_PACKS[0], b"PK programmer art".to_vec()), + (BUILT_IN_PACKS[1], b"PK high contrast".to_vec()), ]; for &name in panorama { // Distinct object bytes let the test catch swapped faces too. @@ -499,15 +532,25 @@ mod tests { lines[0], format!("Title panorama not imported: {error}; run horizon-prepare panorama later") ); - // The fonts come on their own when only a panorama face is missing. + // The fonts and packs come on their own when only a panorama face is missing. match missing { - "last-object" => assert_eq!(lines[1], "Font assets ready: 2 files, 0.0 MB"), - _ => assert!( - lines[1].starts_with("Unifont glyphs not imported: "), - "{lines:?}" + "last-object" => assert_eq!( + lines[1..], + [ + "Font assets ready: 2 files, 0.0 MB", + "Built-in pack assets ready: 2 files, 0.0 MB" + ] ), + _ => { + assert!(lines[1].starts_with("Unifont glyphs not imported: ")); + assert!( + lines[2].starts_with("Programmer Art and High Contrast not imported: ") + && lines[2].ends_with("; run horizon-prepare packs later"), + "{lines:?}" + ); + } } - assert_eq!(lines.len(), 2); + assert_eq!(lines.len(), 3); for name in PANORAMA { assert_eq!(fs::read(target.join(name)).unwrap(), b"jar placeholder"); } @@ -528,7 +571,7 @@ mod tests { lines.borrow_mut().push(l.to_string()) }); assert_eq!(done.unwrap(), target); - for (name, data) in &f.objects[4..FIRST_FACE] { + for (name, data) in &f.objects[4..FIRST_PACK] { assert_eq!(&fs::read(target.join("assets").join(name)).unwrap(), data); } assert_eq!(*lines.borrow(), ["Font assets ready: 2 files, 0.0 MB"]); @@ -536,6 +579,31 @@ mod tests { assert!(!target.join("assets/minecraft/textures").exists()); } + /// Golden Days is made to sit on Programmer Art, which the client JAR lacks: the asset + /// index has it, where `BuiltInPackSource` lists `minecraft:resourcepacks`. + #[test] + fn packs_add_programmer_art_and_high_contrast_where_the_pack_list_finds_them() { + let f = Fixture::new("packs"); + let target = f.root.join(".local/horizon-client/9.9"); + let lines = std::cell::RefCell::new(Vec::new()); + let done = packs(&f.root, Some(&f.minecraft), &|l| { + lines.borrow_mut().push(l.to_string()) + }); + assert_eq!(done.unwrap(), target); + for (name, data) in &f.objects[FIRST_PACK..FIRST_FACE] { + assert_eq!(&fs::read(target.join("assets").join(name)).unwrap(), data); + } + assert!(target + .join("assets/minecraft/resourcepacks/programmer_art.zip") + .is_file()); + assert_eq!( + *lines.borrow(), + ["Built-in pack assets ready: 2 files, 0.0 MB"] + ); + assert!(!target.join("assets/minecraft/sounds.json").exists()); + assert!(!target.join("assets/minecraft/font").exists()); + } + #[test] fn the_index_must_hold_the_sounds() { let f = Fixture::new("index"); diff --git a/docs/resource-packs.md b/docs/resource-packs.md index 7faa75a48..227c9c5a4 100644 --- a/docs/resource-packs.md +++ b/docs/resource-packs.md @@ -7,7 +7,8 @@ screen (the same screen as vanilla's) or in game, and every loader reloads from ## How it works `packs.rs` finds the packs (`FolderRepositorySource`: folders and zips, plus the built-in Programmer Art and High -Contrast), reads `pack.mcmeta` (format range, overlays, filters) and builds one overlay directory that layers the +Contrast, which only the asset index holds: preparation copies them, `horizon-prepare packs` repairs older resources), +reads `pack.mcmeta` (format range, overlays, filters) and builds one overlay directory that layers the selected packs over the prepared vanilla resources, later packs winning. Files vanilla reads as a resource *stack* (language files, `sounds.json`, font definitions, atlas definitions) are merged layer by layer as vanilla merges them. Every loader then reads that one tree; `game/packs.rs` (`reload_packs`) reloads all of them in game, as From 1b14e0d17170f61a536f44efab078651f2685e56 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 06:54:44 +0200 Subject: [PATCH 16/17] Villagers summon iron golems the vanilla way and remember them Villager.spawnGolemIfNeeded set GOLEM_DETECTED_RECENTLY on the villagers near a new golem, but Horizon wrote only villager::Ext, and the next brain tick copied the empty memory back over it: the same villagers could summon another golem before their sensor saw the first. golem_detected now sets the brain memory (599 ticks). IronGolem.checkSpawnObstruction checks the floor's top face (no golems on dirt paths, farmland or slabs) and three blocks, the feet whatever fluid is there; Horizon checked four blocks and no floor, so a roof three blocks up kept golems out. The search's open block is air or a liquid block, not any waterlogged one, and the villagers asked are those whose boxes meet the caller's box grown by 10. The golem is created (yaw, follow range bonus, left-handedness from the level random) before the obstruction check, as trySpawnMob does. The search and checks move to mobs::villager so the mob_ai probe runs the game's code: four new scenarios (gossip, glass roof, dirt paths, panic) match vanilla; with the old checks all four diverge. Co-Authored-By: Claude Opus 5.5 --- .../examples/probe/mob_ai_probe.rs | 52 +++++++ crates/horizon-client/src/game/villagers.rs | 135 +++++------------ crates/horizon-client/src/mobs/villager.rs | 138 ++++++++++++++++++ .../horizon-client/src/mobs/villager_brain.rs | 8 + .../horizonlab/parity/VanillaMobAiOracle.java | 10 +- tools/test_mob_ai_parity.py | 16 ++ 6 files changed, 256 insertions(+), 103 deletions(-) diff --git a/crates/horizon-client/examples/probe/mob_ai_probe.rs b/crates/horizon-client/examples/probe/mob_ai_probe.rs index d773a509b..417e28c0f 100644 --- a/crates/horizon-client/examples/probe/mob_ai_probe.rs +++ b/crates/horizon-client/examples/probe/mob_ai_probe.rs @@ -293,6 +293,47 @@ fn spawn_seed(index: usize) -> i64 { 1000 + 7919 * index as i64 } +/// `Villager.spawnGolemIfNeeded` for villager `a`, the game's way: the golem +/// draws from the level's random and joins the scenario's mobs next tick, +/// seeded as the oracle seeds what a tick spawned. +fn summon_golem( + mobs: &mut [Mob], + a: usize, + needed: usize, + w: &MobWorld, + types: &MobTypes, + born: &mut Vec, + level_random: &mut LegacyRandom, +) { + use horizon_client::mobs::{villager, villager_brain}; + let Some(near) = villager::golem_summoners(mobs, a, w.game_time, needed) else { + return; + }; + let kind = Arc::new( + types + .types + .get("minecraft:iron_golem") + .expect("iron golem") + .clone(), + ); + let index = mobs.len() + born.len(); + let p = mobs[a].position; + let start = [p.x.floor() as i32, p.y.floor() as i32, p.z.floor() as i32]; + let golem = villager::summon_golem(w, start, level_random, |random, at, yaw| { + let mut m = Mob::new(100_000 + index as u32, kind.clone(), at, yaw); + villager::finalize_summoned_golem(&mut m, random); + m + }); + let Some(mut golem) = golem else { + return; + }; + golem.random = LegacyRandom::new(spawn_seed(index)); + born.push(golem); + for j in near { + villager_brain::golem_detected(&mut mobs[j], w.game_time); + } +} + /// Villager events that act at once in vanilla (`TradeWithVillager` and /// `VillagerMakeLove` write the other villager directly). fn villager_events( @@ -304,6 +345,7 @@ fn villager_events( items: &Items, born: &mut Vec, day_time: i64, + level_random: &mut LegacyRandom, ) { use horizon_client::mobs::villager; let index = |mobs: &[Mob], id: u32| { @@ -314,6 +356,7 @@ fn villager_events( while i < events.len() { match events[i] { MobEvent::VillagerMeet { mob, other } => { + events.remove(i); if let (Some(a), Some(b)) = (index(mobs, mob), index(mobs, other)) { let meeting = villager::meet(mobs, a, b, w.game_time, |item| { items.get(item).map_or(64, |i| i.max_stack) @@ -322,8 +365,16 @@ fn villager_events( meeting.thrown.is_empty(), "villagers toss items: not modelled here" ); + if meeting.gossiped { + summon_golem(mobs, a, 5, w, types, born, level_random); + } } + } + MobEvent::GolemCheck { mob, needed } => { events.remove(i); + if let Some(a) = index(mobs, mob) { + summon_golem(mobs, a, needed, w, types, born, level_random); + } } MobEvent::VillagerBirth { parent, @@ -1167,6 +1218,7 @@ pub fn main() -> horizon_client::Result<()> { &items, &mut born, s.time, + &mut scratch, ); horizon_client::mobs::warden::hear_mob_events(&mut mobs, &events, from, &w); // Melee hits on other mobs land during the attacker's tick diff --git a/crates/horizon-client/src/game/villagers.rs b/crates/horizon-client/src/game/villagers.rs index 5c6bed394..3cfe8aa1d 100644 --- a/crates/horizon-client/src/game/villagers.rs +++ b/crates/horizon-client/src/game/villagers.rs @@ -5,34 +5,13 @@ use super::Game; use horizon_client::{ gossip::{self, GossipType}, items::ItemStack, - mobs::{Mob, Species, spawning, villager}, + mobs::{Mob, Species, spawning, villager, villager_brain}, }; -use horizon_core::{geometry::Vec3, random::RandomSource}; +use horizon_core::geometry::Vec3; fn block_of(p: Vec3) -> [i32; 3] { [p.x.floor() as i32, p.y.floor() as i32, p.z.floor() as i32] } -/// `SpawnUtil.Strategy.LEGACY_IRON_GOLEM`: what a golem will not land on. -fn golem_floor_ok(name: &str) -> bool { - !matches!( - name, - "minecraft:cobweb" - | "minecraft:cactus" - | "minecraft:glass_pane" - | "minecraft:conduit" - | "minecraft:ice" - | "minecraft:tnt" - | "minecraft:glowstone" - | "minecraft:beacon" - | "minecraft:sea_lantern" - | "minecraft:frosted_ice" - | "minecraft:tinted_glass" - | "minecraft:glass" - ) && !name.ends_with("_stained_glass_pane") - && !name.ends_with("_stained_glass") - && !name.ends_with("leaves") -} - impl Game<'_> { fn villager_index(&self, id: u32) -> Option { self.mobs @@ -76,88 +55,46 @@ impl Game<'_> { return; }; let now = self.world.game_time; - if !villager::ext(&self.mobs[i]).is_some_and(|e| e.wants_golem(now)) { + let Some(near) = villager::golem_summoners(&self.mobs, i, now, needed) else { return; - } - let at = self.mobs[i].position; - let nearby: Vec = self - .mobs - .iter() - .enumerate() - .filter(|(_, m)| { - m.species() == Species::Villager - && m.alive() - && (m.position.x - at.x).abs() <= 10.0 - && (m.position.y - at.y).abs() <= 10.0 - && (m.position.z - at.z).abs() <= 10.0 - }) - .map(|(j, _)| j) - .collect(); - let wanting = nearby - .iter() - .filter(|j| villager::ext(&self.mobs[**j]).is_some_and(|e| e.wants_golem(now))) - .take(5) - .count(); - if wanting < needed { - return; - } - if self.try_spawn_iron_golem(block_of(at)) { - for j in nearby { - villager::ext_mut(&mut self.mobs[j]).golem_until = now + 599; + }; + if self.try_spawn_iron_golem(block_of(self.mobs[i].position)) { + for j in near { + villager_brain::golem_detected(&mut self.mobs[j], now); } } } - /// `SpawnUtil.trySpawnMob(IRON_GOLEM, ..., 10 attempts, 8 across, 6 up - /// and down, LEGACY_IRON_GOLEM)`. + /// `SpawnUtil.trySpawnMob(IRON_GOLEM, ...)`: a golem near `start`, with + /// the ambient sound `trySpawnMob` plays. fn try_spawn_iron_golem(&mut self, start: [i32; 3]) -> bool { - for _ in 0..10 { - let r = &mut self.world.random; - let dx = r.next_int_bound(17).unwrap_or(8) - 8; - let dz = r.next_int_bound(17).unwrap_or(8) - 8; - let (x, z) = (start[0] + dx, start[2] + dz); - let mut y = start[1] + 6; - let mut above = self.world.block(x, y, z); - let mut found = None; - for _ in 0..=12 { - y -= 1; - let here = self.world.block(x, y, z); - let f = self.res.facts().get(here); - let above_f = self.res.facts().get(above); - let air_or_liquid = self.res.facts().is_air(above) - || above_f.fluid != horizon_client::blocks::Fluid::None; - let solid = - self.res.mob_data().state(here).flags & horizon_client::mobs::data::SOLID != 0 - || f.name.as_ref() == "minecraft:powder_snow"; - if golem_floor_ok(&f.name) && air_or_liquid && solid { - found = Some(y + 1); - break; - } - above = here; - } - let Some(y) = found else { continue }; - // IronGolem.checkSpawnRules: a floor and three free blocks. - let free = |g: &Self, yy: i32| { - g.res.mob_data().state(g.world.block(x, yy, z)).flags - & horizon_client::mobs::data::VALID_EMPTY_SPAWN - != 0 - }; - if !(0..4).all(|k| free(self, y + k)) { - continue; - } - let at = [f64::from(x) + 0.5, f64::from(y), f64::from(z) + 0.5]; - if let Some(id) = self.spawn_mob_for("minecraft:iron_golem", at, false, true) - && let Some(m) = self.mobs.iter_mut().find(|m| m.id == id) - { - let sound = m.kind.sounds[0]; - if !sound.is_empty() { - let at = m.center(); - self.audio - .play(&format!("minecraft:{sound}"), Some(at), 1.0, 1.0); - } - return true; - } + let Some(kind) = self.res.mob_types().get("minecraft:iron_golem").cloned() else { + return false; + }; + let id = self.next_entity + 1; + let mut random = self.world.random.clone(); + let golem = villager::summon_golem( + &self.mob_world_base(&[]), + start, + &mut random, + |random, at, yaw| { + let mut m = Mob::new(id, kind.clone(), at, yaw); + villager::finalize_summoned_golem(&mut m, random); + m + }, + ); + self.world.random = random; + let Some(golem) = golem else { + return false; + }; + self.next_entity = id; + let sound = golem.kind.sounds[0]; + if !sound.is_empty() { + let at = golem.center(); + self.audio + .play(&format!("minecraft:{sound}"), Some(at), 1.0, 1.0); } - false + self.mobs.push(golem); + true } /// `VillagerMakeLove.tryToGiveBirth`: both eat, a free bed within 48 diff --git a/crates/horizon-client/src/mobs/villager.rs b/crates/horizon-client/src/mobs/villager.rs index b5abad9f0..575fafaed 100644 --- a/crates/horizon-client/src/mobs/villager.rs +++ b/crates/horizon-client/src/mobs/villager.rs @@ -614,6 +614,144 @@ pub fn meet( gossiped: ready, } } +/// `Villager.spawnGolemIfNeeded` up to the spawn: villager `i` wants a golem +/// and so do at least `needed` of the villagers whose boxes meet its own grown +/// by 10 blocks. Returns all of those villagers: once the golem stands, they +/// remember it ([`super::villager_brain::golem_detected`]). +pub fn golem_summoners(mobs: &[Mob], i: usize, now: i64, needed: usize) -> Option> { + if !ext(&mobs[i]).is_some_and(|e| e.wants_golem(now)) { + return None; + } + let area = mobs[i] + .bounds() + .inflate(horizon_core::geometry::Vec3::new(10.0, 10.0, 10.0)); + let near: Vec = mobs + .iter() + .enumerate() + .filter(|(_, m)| { + m.species() == Species::Villager && !m.removed && m.bounds().intersects(area) + }) + .map(|(j, _)| j) + .collect(); + let wanting = near + .iter() + .filter(|&&j| ext(&mobs[j]).is_some_and(|e| e.wants_golem(now))) + .take(5) + .count(); + (wanting >= needed).then_some(near) +} +/// `SpawnUtil.Strategy.LEGACY_IRON_GOLEM`'s refused floors. +fn golem_floor_ok(name: &str) -> bool { + !matches!( + name, + "minecraft:cobweb" + | "minecraft:cactus" + | "minecraft:glass_pane" + | "minecraft:conduit" + | "minecraft:ice" + | "minecraft:tnt" + | "minecraft:glowstone" + | "minecraft:beacon" + | "minecraft:sea_lantern" + | "minecraft:frosted_ice" + | "minecraft:tinted_glass" + | "minecraft:glass" + ) && !name.ends_with("_stained_glass_pane") + && !name.ends_with("_stained_glass") + && !name.ends_with("leaves") +} +/// One attempt of `SpawnUtil.trySpawnMob(IRON_GOLEM, ..., 8 across, 6 up and +/// down, LEGACY_IRON_GOLEM)`: a column drawn near `start`, searched down from +/// 6 above for a solid floor (or powder snow) under air or a liquid block. +/// Returns the block the golem would stand in. +fn golem_attempt( + l: &L, + start: [i32; 3], + random: &mut impl RandomSource, +) -> Option<[i32; 3]> { + let dx = random.next_int_bound(17).unwrap_or(8) - 8; + let dz = random.next_int_bound(17).unwrap_or(8) - 8; + let (x, z) = (start[0] + dx, start[2] + dz); + let name = |y: i32| -> &str { &l.facts().get(l.state(x, y, z)).name }; + let mut y = start[1] + 6; + let mut above = l.state(x, y, z); + for _ in 0..=12 { + y -= 1; + let here = l.state(x, y, z); + let above_name = &*l.facts().get(above).name; + // BlockState.liquid(): a water or lava block (not a waterlogged one). + let open = l.facts().is_air(above) + || above_name == "minecraft:water" + || above_name == "minecraft:lava"; + let solid = l.mob_data().state(here).flags & super::data::SOLID != 0 + || name(y) == "minecraft:powder_snow"; + if golem_floor_ok(name(y)) && open && solid { + return Some([x, y + 1, z]); + } + above = here; + } + None +} +/// `IronGolem.checkSpawnObstruction`: a floor with a full top face, its feet +/// free whatever fluid is there, and the two blocks above free. +fn golem_fits(l: &L, [x, y, z]: [i32; 3]) -> bool { + use super::spawn_rules::is_valid_empty_spawn; + // entityCanStandOn: Block.isFaceFull(collision shape, UP). + let floor = l.mob_data().state(l.state(x, y - 1, z)); + let stands = floor.flags & super::data::STURDY_TOP != 0 && floor.top >= 1.0; + // isValidEmptySpawnBlock with Fluids.EMPTY: open water is free too. + let feet = is_valid_empty_spawn(Species::IronGolem, l, x, y, z) + || &*l.facts().get(l.state(x, y, z)).name == "minecraft:water"; + stands + && feet + && is_valid_empty_spawn(Species::IronGolem, l, x, y + 1, z) + && is_valid_empty_spawn(Species::IronGolem, l, x, y + 2, z) +} +/// `SpawnUtil.trySpawnMob(IRON_GOLEM, MOB_SUMMONED, level, start, 10, 8, 6, +/// LEGACY_IRON_GOLEM, false)`: up to ten columns tried. In each spot found +/// `create` makes the golem (`EntityType.create`: the yaw drawn here, then its +/// `finalizeSpawn` draws, see [`finalize_summoned_golem`]); it is kept only +/// when `IronGolem.checkSpawnObstruction` passes, and discarded otherwise. +pub fn summon_golem( + l: &L, + start: [i32; 3], + random: &mut R, + mut create: impl FnMut(&mut R, horizon_core::geometry::Vec3, f32) -> T, +) -> Option { + for _ in 0..10 { + let Some([x, y, z]) = golem_attempt(l, start, random) else { + continue; + }; + // Mth.wrapDegrees(nextFloat() * 360). + let mut yaw = random.next_float() * 360.0; + if yaw >= 180.0 { + yaw -= 360.0; + } + let at = + horizon_core::geometry::Vec3::new(f64::from(x) + 0.5, f64::from(y), f64::from(z) + 0.5); + let golem = create(random, at, yaw); + if golem_fits(l, [x, y, z]) { + return Some(golem); + } + } + None +} +/// `Mob.finalizeSpawn` for a summoned iron golem, from the level's random: +/// the follow range spawn bonus and left-handedness. +pub fn finalize_summoned_golem(m: &mut Mob, random: &mut impl RandomSource) { + use super::finalize::{Attr, Op, add_modifier, has_modifier}; + if !has_modifier(m, Attr::FollowRange, "minecraft:random_spawn_bonus") { + let bonus = random.triangle(0.0, 0.114_850_000_000_000_01); + add_modifier( + m, + Attr::FollowRange, + "minecraft:random_spawn_bonus", + bonus, + Op::AddMultipliedBase, + ); + } + m.extra.left_handed = random.next_float() < 0.05; +} /// `PoiManager.take(HOME, ..., 48)`: the nearest bed head not `claimed` /// (`free_head`: a bed head that is not occupied). pub fn take_vacant_bed( diff --git a/crates/horizon-client/src/mobs/villager_brain.rs b/crates/horizon-client/src/mobs/villager_brain.rs index df19d8fed..336dc6b93 100644 --- a/crates/horizon-client/src/mobs/villager_brain.rs +++ b/crates/horizon-client/src/mobs/villager_brain.rs @@ -779,6 +779,14 @@ fn sense_golem(m: &mut Mob, w: &MobWorld) { } } +/// `GolemSensor.golemDetected`: a golem was summoned near this villager; +/// for 599 ticks it wants no other. +pub fn golem_detected(m: &mut Mob, now: i64) { + mem(m).golem_detected_recently.set_ttl(true, 599); + // What `sync` derives from the memory. + super::villager::ext_mut(m).golem_until = now + 599 + 1; +} + // ---- Behaviours --------------------------------------------------------- /// The POI types villagers use. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java index 55c0370f4..5808fec0d 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java @@ -761,12 +761,14 @@ public final class VanillaMobAiOracle { level.tickBlockEntities(); } else if (!heartPositions.isEmpty()) level.tickBlockEntities(); managerTick.invoke(manager); - // Villagers the tick spawned (babies) and a heart's creakings tick from the next - // one, in the order they were added, with a seeded random of their own. Other - // newcomers (animal babies, dropped items) are left out, as the probe leaves them. + // Villagers the tick spawned (babies), the iron golems they summoned and a heart's + // creakings tick from the next one, in the order they were added, with a seeded + // random of their own. Other newcomers (animal babies, dropped items) are left out, + // as the probe leaves them. List fresh = new ArrayList<>(); for (Entity e : level.getAllEntities()) - if (!LABELS.containsKey(e) && (e instanceof Villager || e instanceof net.minecraft.world.entity.animal.bee.Bee || created.contains(e))) fresh.add(e); + if (!LABELS.containsKey(e) && (e instanceof Villager || e instanceof net.minecraft.world.entity.animal.bee.Bee + || e instanceof net.minecraft.world.entity.animal.golem.IronGolem || created.contains(e))) fresh.add(e); fresh.sort(java.util.Comparator.comparingInt(Entity::getId)); for (Entity e : fresh) { int index = ENTS.size(); diff --git a/tools/test_mob_ai_parity.py b/tools/test_mob_ai_parity.py index ccc50b302..338c97e53 100644 --- a/tools/test_mob_ai_parity.py +++ b/tools/test_mob_ai_parity.py @@ -285,6 +285,22 @@ def scenarios(): 'block 0 -60 0 minecraft:composter', 'mob minecraft:villager 10.5 -60 0.5 90 54 persistent', ]) + # Villagers that slept today and saw no golem summon an iron golem (Villager.spawnGolemIfNeeded): + # five gossiping (TradeWithVillager, at tick 200 here), or three panicking at a zombie in a pen + # (VillagerPanicTrigger, at tick 100 by night). They all remember it (GOLEM_DETECTED_RECENTLY). + # Under a glass roof three blocks up the golem still fits (IronGolem.checkSpawnObstruction); + # on dirt paths it cannot stand. The scenarios stop on the summoning tick: the golem's own AI + # (MoveBackToVillageGoal, GolemRandomStrollInVillageGoal) is not ported yet. + golem_callers = [f'mob minecraft:villager {x} -60 {z} {r} {seed} persistent slept=1' for x, z, r, seed in + [(0.5, 0.5, 0, 81), (2.5, 0.5, 180, 82), (0.5, 2.5, 90, 83), (2.5, 2.5, 270, 84), (1.5, -1.5, 0, 85)]] + add('villager_golem_gossip', 200, ['player 14.5 -60 0.5'] + golem_callers, 'time=100') + add('villager_golem_roof', 200, ['fill -10 -57 -12 13 -57 13 minecraft:glass', 'player 14.5 -60 0.5'] + golem_callers, + 'time=100') + add('villager_golem_paths', 400, ['fill -10 -61 -12 13 -61 13 minecraft:dirt_path', 'player 14.5 -60 0.5'] + golem_callers, + 'time=100') + add('villager_golem_panic', 100, ['fill -2 -60 -3 4 -60 4 minecraft:oak_fence', 'fill -1 -60 -2 3 -60 3 minecraft:air', + 'player 14.5 -60 0.5'] + golem_callers[:3] + + ['mob minecraft:zombie 6.5 -60 0.5 90 86 persistent noai'], 'time=18000') return s From 0b581f9ffec685939cba8c30efa97c429f14f7a8 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 07:34:48 +0200 Subject: [PATCH 17/17] Give each crate's probe example its own target name horizon-client, horizon-world and horizon-protocol each had an example named `probe`. Cargo copies every crate's examples into one /examples/ directory, so parallel parity harnesses sharing a target dir could run another crate's probe (CI parity run 40055656303: command_parse ran the horizon-world dispatcher). The examples are now client_probe, world_probe and protocol_probe ([[example]] in each Cargo.toml; the files stay where they are), and every harness builds and runs its own crate's name. tools/parity.py recognises the new names when it counts the probes a harness ran, and renames the old `probe` in recorded artifacts to the crate's target (from the record's -p, else its probe sources), so the prebuild still builds them instead of dropping them as unknown. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/Cargo.toml | 5 +++ .../horizon-client/examples/probe/dispatch.rs | 2 +- crates/horizon-protocol/Cargo.toml | 5 +++ crates/horizon-protocol/examples/probe.rs | 2 +- crates/horizon-world/Cargo.toml | 5 +++ .../horizon-world/examples/probe/dispatch.rs | 2 +- docs/parity-workflow.md | 2 +- tests/test_parity_runner.py | 37 ++++++++++++++++++- tools/audio_harness.py | 4 +- tools/block_update_harness.py | 2 +- tools/interaction_lab.py | 3 +- tools/oracle_harness.py | 4 +- tools/parity.py | 36 ++++++++++++++---- tools/port_regen.py | 4 +- tools/test_active_effect_tick_parity.py | 4 +- tools/test_active_effects_parity.py | 4 +- tools/test_anchor_parity.py | 4 +- tools/test_arrow_parity.py | 4 +- tools/test_attribute_health_parity.py | 4 +- tools/test_attribute_map_queries_parity.py | 4 +- tools/test_attribute_parity.py | 4 +- tools/test_attribute_updates_parity.py | 4 +- tools/test_basic_feature_parity.py | 4 +- tools/test_biome_chunk_parity.py | 4 +- tools/test_biome_generation_parity.py | 4 +- tools/test_biome_placement_parity.py | 4 +- tools/test_biome_source_codec_parity.py | 4 +- tools/test_biome_source_parity.py | 4 +- tools/test_biome_temperature_parity.py | 4 +- tools/test_block_collision_scan_parity.py | 4 +- tools/test_block_entity_anim_parity.py | 2 +- tools/test_block_entity_render_parity.py | 2 +- tools/test_block_entity_storage_parity.py | 4 +- tools/test_block_entity_tickers_parity.py | 2 +- tools/test_block_landing_parity.py | 4 +- tools/test_block_properties_parity.py | 4 +- tools/test_block_push_parity.py | 4 +- tools/test_block_state_codec_parity.py | 4 +- tools/test_block_support_parity.py | 4 +- tools/test_block_survival_parity.py | 4 +- tools/test_blocking_item_damage_parity.py | 4 +- tools/test_blocking_rules_parity.py | 4 +- tools/test_bulk_section_parity.py | 4 +- tools/test_bundle_weight_parity.py | 4 +- tools/test_canyon_carver_parity.py | 4 +- tools/test_carving_geometry_parity.py | 4 +- tools/test_carving_mask_parity.py | 4 +- tools/test_cave_carver_parity.py | 4 +- tools/test_chunk_generation_parity.py | 4 +- tools/test_chunk_stage_parity.py | 4 +- tools/test_chunk_status_parity.py | 4 +- tools/test_climbing_parity.py | 2 +- tools/test_collision_context_parity.py | 4 +- tools/test_collision_parity.py | 4 +- tools/test_combat_rules_parity.py | 4 +- tools/test_command_parse_parity.py | 4 +- tools/test_component_durability_parity.py | 4 +- tools/test_component_patch_parity.py | 4 +- tools/test_consumable_emission_parity.py | 4 +- tools/test_consumable_parity.py | 4 +- tools/test_consume_effect_parity.py | 4 +- tools/test_contextual_collision_parity.py | 4 +- tools/test_damage_immunity_parity.py | 4 +- tools/test_damage_reduction_parity.py | 4 +- tools/test_damage_source_parity.py | 4 +- tools/test_datafix_parity.py | 4 +- tools/test_decoration_parity.py | 4 +- tools/test_decoration_region_parity.py | 4 +- tools/test_dynamic_support_parity.py | 4 +- tools/test_edge_backoff_parity.py | 4 +- .../test_effect_attribute_modifiers_parity.py | 4 +- tools/test_effect_notifications_parity.py | 4 +- tools/test_effect_sync_parity.py | 4 +- tools/test_enchanting_parity.py | 4 +- tools/test_entity_attribute_parity.py | 4 +- tools/test_entity_collision_parity.py | 4 +- tools/test_entity_death_loot_parity.py | 4 +- tools/test_entity_fluid_parity.py | 4 +- tools/test_entity_fluid_tick_parity.py | 4 +- tools/test_entity_model_parity.py | 2 +- tools/test_entity_move_parity.py | 4 +- tools/test_entity_obstruction_parity.py | 4 +- tools/test_environment_render_parity.py | 2 +- tools/test_extra_items_parity.py | 4 +- tools/test_face_support_parity.py | 4 +- tools/test_face_visibility_parity.py | 4 +- tools/test_fall_damage_parity.py | 4 +- tools/test_feature_catalog_parity.py | 4 +- tools/test_feature_graph_parity.py | 4 +- tools/test_feature_placement_parity.py | 4 +- tools/test_feature_region_parity.py | 4 +- tools/test_feature_sort_parity.py | 4 +- tools/test_fill_layer_parity.py | 4 +- tools/test_finalize_spawn_parity.py | 4 +- tools/test_fluid_box_parity.py | 4 +- tools/test_fluid_flow_parity.py | 4 +- tools/test_fluid_occupancy_parity.py | 2 +- tools/test_fluid_parity.py | 4 +- tools/test_fluid_shape_parity.py | 4 +- tools/test_food_parity.py | 4 +- tools/test_food_properties_parity.py | 4 +- tools/test_food_storage_parity.py | 4 +- tools/test_free_space_parity.py | 4 +- tools/test_ground_support_parity.py | 4 +- tools/test_height_provider_parity.py | 4 +- tools/test_heightmap_parity.py | 4 +- tools/test_held_drop_parity.py | 2 +- tools/test_hud_parity.py | 2 +- tools/test_interaction_shape_parity.py | 4 +- tools/test_inventory_pickup_parity.py | 4 +- tools/test_inventory_tick_parity.py | 4 +- tools/test_inventory_use_parity.py | 4 +- tools/test_inventory_use_start_parity.py | 4 +- tools/test_item_after_use_parity.py | 4 +- tools/test_item_blocking_parity.py | 4 +- tools/test_item_cooldowns_parity.py | 4 +- tools/test_item_durability_parity.py | 4 +- tools/test_item_particles_parity.py | 4 +- tools/test_item_stack_storage_parity.py | 4 +- tools/test_item_template_parity.py | 4 +- tools/test_item_use_catalog_parity.py | 4 +- tools/test_item_use_lifecycle_parity.py | 4 +- tools/test_item_use_parity.py | 4 +- tools/test_item_use_start_parity.py | 4 +- tools/test_java_hash_map_parity.py | 4 +- tools/test_java_identity_map_parity.py | 4 +- tools/test_level_place_parity.py | 2 +- tools/test_level_shape_parity.py | 2 +- tools/test_light_parity.py | 2 +- tools/test_liquid_collision_parity.py | 4 +- tools/test_live_attribute_updates_parity.py | 4 +- tools/test_live_attributes_parity.py | 4 +- tools/test_living_air_parity.py | 4 +- tools/test_living_damage_parity.py | 4 +- tools/test_living_fall_parity.py | 4 +- tools/test_living_fluid_parity.py | 4 +- tools/test_living_health_parity.py | 4 +- tools/test_living_hurt_parity.py | 4 +- tools/test_living_landing_parity.py | 4 +- tools/test_living_motion_parity.py | 4 +- tools/test_local_input_parity.py | 4 +- tools/test_material_condition_parity.py | 4 +- tools/test_material_extension_parity.py | 4 +- tools/test_material_rule_library_parity.py | 4 +- tools/test_material_stage_parity.py | 2 +- tools/test_material_surface_parity.py | 4 +- tools/test_mob_ai_parity.py | 4 +- tools/test_mob_attributes_parity.py | 4 +- tools/test_movement_emission_parity.py | 4 +- tools/test_movement_registry_parity.py | 4 +- tools/test_movement_support_parity.py | 4 +- tools/test_native_scene_collision.py | 4 +- tools/test_native_scene_motion.py | 4 +- tools/test_natural_spawn_parity.py | 4 +- tools/test_nether_portal_parity.py | 2 +- tools/test_object_open_map_parity.py | 4 +- tools/test_object_open_set_parity.py | 4 +- tools/test_pack_selection_parity.py | 2 +- tools/test_piston_movement_parity.py | 4 +- tools/test_piston_shape_parity.py | 4 +- tools/test_placement_parity.py | 4 +- tools/test_player_equipment_parity.py | 4 +- tools/test_player_food_parity.py | 4 +- tools/test_player_health_parity.py | 4 +- tools/test_player_hurt_parity.py | 4 +- tools/test_player_inventory_parity.py | 4 +- tools/test_player_travel_parity.py | 4 +- tools/test_powder_snow_collision_parity.py | 4 +- tools/test_raid_parity.py | 4 +- tools/test_registered_entity_fluid_parity.py | 2 +- tools/test_registered_player_combat_parity.py | 4 +- tools/test_registry_collision_scan_parity.py | 4 +- tools/test_registry_fall_ray_parity.py | 2 +- tools/test_registry_fluid_parity.py | 2 +- tools/test_replace_block_parity.py | 4 +- tools/test_restitution_parity.py | 4 +- tools/test_retrogen_chunk_parity.py | 4 +- tools/test_retrogen_data_parity.py | 4 +- tools/test_rule_test_parity.py | 4 +- tools/test_scaffolding_collision_parity.py | 4 +- tools/test_scattered_ore_parity.py | 4 +- tools/test_scoreboard_parity.py | 4 +- tools/test_section_mesh_parity.py | 4 +- tools/test_server_player_combat_parity.py | 4 +- tools/test_server_player_damage_parity.py | 4 +- tools/test_simple_block_parity.py | 4 +- tools/test_simple_container_parity.py | 4 +- tools/test_spawn_rules_parity.py | 4 +- tools/test_spawner_parity.py | 4 +- tools/test_sprint_input_parity.py | 4 +- tools/test_state_provider_parity.py | 4 +- tools/test_status_effect_parity.py | 4 +- tools/test_status_tick_parity.py | 4 +- tools/test_stepped_interpolation_parity.py | 2 +- tools/test_stored_consume_parity.py | 4 +- tools/test_stored_effect_attributes_parity.py | 4 +- ...test_stored_effect_notifications_parity.py | 4 +- tools/test_structure_density_parity.py | 4 +- tools/test_subtitle_parity.py | 4 +- tools/test_suffocation_parity.py | 4 +- tools/test_swimming_parity.py | 4 +- tools/test_synced_bytes_parity.py | 4 +- tools/test_synced_floats_parity.py | 4 +- tools/test_tab_list_parity.py | 4 +- tools/test_team_rules_parity.py | 4 +- tools/test_teleport_consume_parity.py | 4 +- tools/test_terrain_parity.py | 4 +- tools/test_tick_parity.py | 4 +- tools/test_trading_parity.py | 4 +- tools/test_translucency_parity.py | 2 +- tools/test_tree_feature_parity.py | 4 +- tools/test_trial_spawner_parity.py | 4 +- tools/test_use_flag_reaction_parity.py | 4 +- tools/test_use_remainder_parity.py | 4 +- tools/test_value_provider_parity.py | 4 +- tools/test_vault_parity.py | 4 +- tools/test_view_direction_parity.py | 4 +- tools/test_water_splash_parity.py | 4 +- tools/test_world_border_parity.py | 4 +- tools/test_world_border_render_parity.py | 2 +- tools/test_world_collision_check_parity.py | 4 +- tools/test_world_edge_backoff_parity.py | 4 +- tools/test_world_movement_parity.py | 4 +- tools/test_world_parity.py | 4 +- tools/test_world_ray_parity.py | 4 +- tools/test_world_spawn_parity.py | 4 +- tools/test_worldgen_random_parity.py | 4 +- 227 files changed, 498 insertions(+), 425 deletions(-) diff --git a/crates/horizon-client/Cargo.toml b/crates/horizon-client/Cargo.toml index c0296cc1c..300872765 100644 --- a/crates/horizon-client/Cargo.toml +++ b/crates/horizon-client/Cargo.toml @@ -85,6 +85,11 @@ mods = ["horizon-mods/runtime"] # Records the call sites of mob random draws (`mob_ai_probe` traces). rng-trace = ["horizon-core/rng-trace"] +# Its own name, not `probe`: Cargo copies every crate's examples into one target//examples. +[[example]] +name = "client_probe" +path = "examples/probe/main.rs" + [lints] workspace = true diff --git a/crates/horizon-client/examples/probe/dispatch.rs b/crates/horizon-client/examples/probe/dispatch.rs index b40cf1a6e..8754e944d 100644 --- a/crates/horizon-client/examples/probe/dispatch.rs +++ b/crates/horizon-client/examples/probe/dispatch.rs @@ -41,7 +41,7 @@ pub fn main(names: &[&str], run: fn(&str) -> Option) -> ExitCode { let name = std::env::args().nth(1).unwrap_or_default(); run(&name).unwrap_or_else(|| { eprintln!( - "usage: probe [arguments...]\nprobes: {}", + "usage: client_probe [arguments...]\nprobes: {}", names.join(" ") ); ExitCode::from(2) diff --git a/crates/horizon-protocol/Cargo.toml b/crates/horizon-protocol/Cargo.toml index 05655e8af..71b93a1fe 100644 --- a/crates/horizon-protocol/Cargo.toml +++ b/crates/horizon-protocol/Cargo.toml @@ -17,5 +17,10 @@ sha1 = "0.10" # Secure chat: SHA256withRSA message signatures. sha2 = "0.10" +# Its own name, not `probe`: Cargo copies every crate's examples into one target//examples. +[[example]] +name = "protocol_probe" +path = "examples/probe.rs" + [lints] workspace = true diff --git a/crates/horizon-protocol/examples/probe.rs b/crates/horizon-protocol/examples/probe.rs index 005be919f..63fc0f9d3 100644 --- a/crates/horizon-protocol/examples/probe.rs +++ b/crates/horizon-protocol/examples/probe.rs @@ -2,7 +2,7 @@ //! seconds, reporting packet counts and any decode failures. A differential //! check of the codecs against a real vanilla server: //! -//! cargo run -p horizon-protocol --example probe -- 127.0.0.1:25565 [seconds] [registries.json] +//! cargo run -p horizon-protocol --example protocol_probe -- 127.0.0.1:25565 [seconds] [registries.json] use horizon_protocol::{ PROTOCOL_VERSION, State, connection::Connection, diff --git a/crates/horizon-world/Cargo.toml b/crates/horizon-world/Cargo.toml index 3a8621243..89f82bbe2 100644 --- a/crates/horizon-world/Cargo.toml +++ b/crates/horizon-world/Cargo.toml @@ -25,5 +25,10 @@ path = "src/main.rs" name = "horizon-worldgen-parity" path = "src/bin/worldgen_parity.rs" +# Its own name, not `probe`: Cargo copies every crate's examples into one target//examples. +[[example]] +name = "world_probe" +path = "examples/probe/main.rs" + [lints] workspace = true diff --git a/crates/horizon-world/examples/probe/dispatch.rs b/crates/horizon-world/examples/probe/dispatch.rs index 0b396edab..80b875eef 100644 --- a/crates/horizon-world/examples/probe/dispatch.rs +++ b/crates/horizon-world/examples/probe/dispatch.rs @@ -32,7 +32,7 @@ pub fn main(names: &[&str], run: fn(&str) -> Option) -> ExitCode { let name = std::env::args().nth(1).unwrap_or_default(); run(&name).unwrap_or_else(|| { eprintln!( - "usage: probe [arguments...]\nprobes: {}", + "usage: world_probe [arguments...]\nprobes: {}", names.join(" ") ); ExitCode::from(2) diff --git a/docs/parity-workflow.md b/docs/parity-workflow.md index a2cd10584..1b00080e7 100644 --- a/docs/parity-workflow.md +++ b/docs/parity-workflow.md @@ -26,7 +26,7 @@ Vanilla oracle runs are reused as well. `tools/parity_shim.py` stands in for `ja Probes build into `.local/parity-target/` with release optimisation but no LTO and 16 codegen units. On ludodesktop that rebuilds every `horizon-world` probe in 3 seconds after a one-line change, against 122 seconds with the release profile. Rust gives these settings identical results (no fast-math; overflow checks as in release), and the full harness suite passes under them. Probes that harnesses build in the dev profile get `opt-level = 3` too, keeping their overflow checks and debug assertions. Harnesses must locate binaries through `cargo metadata` or `lab.cargo_target()`, never a hard-coded `target/`. -The probes of `horizon-world` and of `horizon-client` are one binary per crate, `cargo build --release -p --example probe`: a harness runs `probe [arguments]`, and `` is a module in `crates//examples/probe/` (add it to the `mod` list and the `probes!` list in its `main.rs`; read arguments with `crate::args()` or `crate::args_os()`, which drop the name). Code several probes share goes in `examples/probe/support/` or a module of its own. Linking one binary instead of ~250 examples is most of what a probe build used to cost. The runner counts only the probes a harness ran, the probes and support modules they name, their own subdirectories and `dispatch.rs` as its dependencies, not `main.rs`, which only lists the probes: editing one probe reruns only its harnesses, and adding one reruns none. +The probes of `horizon-world` and of `horizon-client` are one binary per crate, `world_probe` and `client_probe` (`cargo build --release -p horizon-world --example world_probe`): a harness runs `world_probe [arguments]`, and `` is a module in `crates//examples/probe/` (add it to the `mod` list and the `probes!` list in its `main.rs`; read arguments with `crate::args()` or `crate::args_os()`, which drop the name). Code several probes share goes in `examples/probe/support/` or a module of its own. Linking one binary instead of ~250 examples is most of what a probe build used to cost. Each crate's probe has its own target name (set in its `Cargo.toml`, `protocol_probe` too): Cargo copies every crate's examples into one `/examples/` directory, and with one shared name a harness could run the binary another harness had just copied there. The runner counts only the probes a harness ran, the probes and support modules they name, their own subdirectories and `dispatch.rs` as its dependencies, not `main.rs`, which only lists the probes: editing one probe reruns only its harnesses, and adding one reruns none. Passes are shared between worktrees. A harness's key depends only on the content of its dependencies, not on where they are, so every pass is also written to `parity-shared/` beside the shared vanilla data (`PARITY_SHARED` overrides it). A worktree whose files match those a harness passed with, in any worktree, counts that pass without running the harness: after merging the integration branch, an agent's gate only runs the harnesses its own changes affect. diff --git a/tests/test_parity_runner.py b/tests/test_parity_runner.py index 633163bf5..eac664c89 100644 --- a/tests/test_parity_runner.py +++ b/tests/test_parity_runner.py @@ -50,7 +50,8 @@ class ParityRunnerTests(unittest.TestCase): ]) def test_a_probe_binary_depends_only_on_the_probes_it_ran(self): - commands = [["/t/release/examples/probe", "a_fixture", "/dir"], ["cargo", "run", "--example", "probe", "--", "b_fixture"]] + commands = [["/t/release/examples/world_probe", "a_fixture", "/dir"], + ["cargo", "run", "-p", "horizon-client", "--example", "client_probe", "--", "b_fixture"]] self.assertEqual(parity.probes_run(commands), {"a_fixture", "b_fixture"}) with tempfile.TemporaryDirectory() as temp, mock.patch.object(parity, "ROOT", Path(temp)): probe = Path(temp, "crates/w/examples/probe") @@ -67,6 +68,40 @@ class ParityRunnerTests(unittest.TestCase): ["crates/w/src/lib.rs", *paths[:2], *paths[3:6], paths[8]]) self.assertEqual(parity.only_probes_run(paths, set()), paths) + def test_probe_names_are_each_crates_own_target(self): + self.assertEqual(parity.probes_run([ + ["C:/t/debug/examples/client_probe.exe", "a_fixture"], + ["cargo", "run", "--release", "--example=world_probe", "--", "b_fixture", "x"], + ["/t/release/examples/probe", "old_fixture"], # the shared name before 2026-10-24 + ["cargo", "run", "--example", "probe", "--", "old_fixture"], + ["/t/release/examples/mod_port_probe", "not_a_fixture"], + ["cargo", "run", "--example", "mod_port_probe", "--", "not_a_fixture"], + ["cargo", "build", "--example", "world_probe"], + ]), {"a_fixture", "b_fixture"}) + + def test_records_of_the_shared_probe_name_build_their_crates_probe(self): + record = {"dependencies": ["crates/horizon-world/examples/probe/a_fixture.rs", "crates/horizon-world/src/lib.rs"], + "artifacts": [["example", "probe", "release", ["-p", "horizon-client"], True], + ["example", "probe", "release"], # no selection: the crate of its probe sources + ["example", "probe", "release", ["-p", "horizon-core", "-p", "horizon-world"], True], + ["bin", "horizon-world", "release", ["-p", "horizon-world"], False]]} + artifacts = parity.recorded_artifacts(record) + self.assertEqual(artifacts, [["example", "client_probe", "release", ["-p", "horizon-client"], True], + ["example", "world_probe", "release"], + ["example", "world_probe", "release", ["-p", "horizon-core", "-p", "horizon-world"], True], + ["bin", "horizon-world", "release", ["-p", "horizon-world"], False]]) + packages = {("example", "client_probe"): "horizon-client", ("example", "world_probe"): "horizon-world", + ("bin", "horizon-world"): "horizon-world"} + self.assertEqual(parity.prebuild_commands(artifacts, packages), [ + ["cargo", "build", "--locked", "--profile", "release", "-p", "horizon-client", "--example", "client_probe"], + ["cargo", "build", "--locked", "--profile", "release", "-p", "horizon-core", "-p", "horizon-world", + "--example", "world_probe"], + ["cargo", "build", "--locked", "--profile", "release", "-p", "horizon-world", "--bin", "horizon-world"], + ["cargo", "build", "--locked", "--profile", "release", "-p", "horizon-world", "--example", "world_probe"], + ]) + self.assertEqual(parity.recorded_artifacts({"artifacts": [["example", "probe", "release"]]}), + [["example", "probe", "release"]]) # no crate to tell: left to its harness + def test_java_sources_include_classes_pulled_from_the_sourcepath(self): with tempfile.TemporaryDirectory() as temp: sources, classes = Path(temp, "src"), Path(temp, "classes") diff --git a/tools/audio_harness.py b/tools/audio_harness.py index 1d5908fe0..99c432d11 100644 --- a/tools/audio_harness.py +++ b/tools/audio_harness.py @@ -65,9 +65,9 @@ def run_harness(name, oracle, example, inputs_text, extra_sources=(), java_args= dependencies = os.pathsep.join(map(str, [jars['client'], *libraries])) run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-sourcepath', lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle_path], 'compile-java') - run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory']) / 'debug/examples' / ('probe.exe' if os.name == 'nt' else 'probe') + binary = Path(metadata['target_directory']) / 'debug/examples' / ('client_probe.exe' if os.name == 'nt' else 'client_probe') run([binary, example, *rust_args, inputs, build / 'rust.txt'], 'rust') env = dict(os.environ, ALSOFT_DRIVERS='null') run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, f'dev.horizonlab.parity.{oracle}', *java_args, inputs, build / 'client.txt'], diff --git a/tools/block_update_harness.py b/tools/block_update_harness.py index 852c013d5..b352836fe 100644 --- a/tools/block_update_harness.py +++ b/tools/block_update_harness.py @@ -133,7 +133,7 @@ def execute(name, cases, args, facts, origin_of=None): '-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaBlockUpdateOracle.java')]) run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaBlockUpdateOracle', str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')]) - run(['cargo', 'run', '-q', '--release', '-p', 'horizon-world', '--example', 'probe', '--', + run(['cargo', 'run', '-q', '--release', '-p', 'horizon-world', '--example', 'world_probe', '--', 'block_update_fixture', str(resources), str(work / 'cases.jsonl'), str(work / 'rust.txt')], cwd=lab.ROOT, env={**os.environ, 'CARGO_BUILD_JOBS': '3'}) ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) native = split_cases((work / 'native.txt').read_text(), ignore) diff --git a/tools/interaction_lab.py b/tools/interaction_lab.py index bc574b73d..894a6d1c4 100644 --- a/tools/interaction_lab.py +++ b/tools/interaction_lab.py @@ -50,7 +50,8 @@ def cargo_example(package, example, *args, profile=None): command = ['cargo', 'run', '-q', '-j3'] if profile: command += ['--profile', profile] - command += ['-p', package, '--example', 'probe', '--', example, *map(str, args)] + probe = package.removeprefix('horizon-') + '_probe' # each crate's probe example: client_probe, world_probe + command += ['-p', package, '--example', probe, '--', example, *map(str, args)] subprocess.run(command, check=True, cwd=lab.ROOT) diff --git a/tools/oracle_harness.py b/tools/oracle_harness.py index c6f45553f..92e2a26a2 100644 --- a/tools/oracle_harness.py +++ b/tools/oracle_harness.py @@ -32,12 +32,12 @@ def compile_oracle(build, oracle_name, jars, libraries, java_major): def build_probe(build, example): """Build the horizon-client probe binary; returns the command that runs probe `example`.""" - run_logged(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'], + run_logged(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'client_probe'], build, 'compile-rust-' + example, env=dict(os.environ, CARGO_BUILD_JOBS='3')) import json metadata = json.loads(subprocess.check_output( ['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - return [Path(metadata['target_directory']) / 'debug/examples/probe', example] + return [Path(metadata['target_directory']) / 'debug/examples/client_probe', example] def java_run(build, classes, dependencies, main_class, args, name, jvm=()): diff --git a/tools/parity.py b/tools/parity.py index a1a9f4133..4ed75f5ef 100644 --- a/tools/parity.py +++ b/tools/parity.py @@ -466,22 +466,44 @@ def narrow_rust_sources(sources, scope): PROBE_SOURCE = re.compile(r"/examples/probe/(?:(support)/)?(\w+)\.rs$") +# Each crate's probe example (crates//examples/probe) and its target name. Until 2026-10-24 they were all +# `probe`, and Cargo copies every crate's examples into one /examples/: a harness could run the binary +# another harness had just copied there. +PROBE_TARGETS = {"horizon-client": "client_probe", "horizon-protocol": "protocol_probe", "horizon-world": "world_probe"} +OLD_PROBE_SOURCE = re.compile(r"crates/([\w-]+)/examples/probe[/.]") def probes_run(commands): - """The probes a harness ran through a crate's probe binary: `probe ...`, or - `cargo run --example probe -- ...`.""" + """The probes a harness ran through a crate's probe binary: `world_probe ...`, or + `cargo run --example world_probe -- ...`.""" names = set() for arguments in commands: - program = Path(arguments[0]).name if arguments else "" - if program in ("probe", "probe.exe") and len(arguments) > 1: + program = Path(arguments[0]).name.removesuffix(".exe") if arguments else "" + if program in PROBE_TARGETS.values() and len(arguments) > 1: names.add(arguments[1]) - elif program == "cargo" and "--" in arguments and "probe" in arguments[:arguments.index("--")] \ - and len(arguments) > arguments.index("--") + 1: + elif program == "cargo" and "--" in arguments and len(arguments) > arguments.index("--") + 1 \ + and any(kind == "example" and name in PROBE_TARGETS.values() for kind, name, *_ in artifacts_of(arguments)): names.add(arguments[arguments.index("--") + 1]) return names +def recorded_artifacts(record): + """A harness record's artifacts, with the shared `probe` target of records from before 2026-10-24 renamed to + its crate's own (PROBE_TARGETS): the crate the record's `-p` selection names, else the one whose probe sources + the harness depended on. The prebuild would otherwise drop them as targets that no longer exist.""" + artifacts = [] + for artifact in record.get("artifacts", []): + if artifact[:2] != ["example", "probe"]: + artifacts.append(artifact) + continue + selection = artifact[3] if len(artifact) > 3 else [] + crates = [value for flag, value in zip(selection, selection[1:]) if flag == "-p" and value in PROBE_TARGETS] \ + or sorted({match.group(1) for path in record.get("dependencies", []) + if (match := OLD_PROBE_SOURCE.match(path)) and match.group(1) in PROBE_TARGETS}) + artifacts += [["example", PROBE_TARGETS[crate], *artifact[2:]] for crate in crates] or [artifact] + return artifacts + + def only_probes_run(paths, names): """A probe binary's dep-info lists every probe in it. Keep those the harness ran, the probes they include! or name (crate::) and the shared support modules they name (support::), so that editing one probe @@ -1323,7 +1345,7 @@ def main(): if not record or "artifacts" not in record: template = SHARED / "dependencies" / f"{name}.json" record = json.loads(template.read_text(encoding="utf-8")) if template.exists() else {} - for artifact in record.get("artifacts", []): + for artifact in recorded_artifacts(record): if artifact not in artifacts: artifacts.append(artifact) config = host_config() diff --git a/tools/port_regen.py b/tools/port_regen.py index c47e7cc35..8ce639f21 100644 --- a/tools/port_regen.py +++ b/tools/port_regen.py @@ -229,9 +229,9 @@ def gen_vanilla_order(root, version, store, build): "dev.horizonlab.parity.VanillaCommandParseOracle", "tree", build], build) env = dict(os.environ, CARGO_TARGET_DIR=str(root / ".local" / "port-target")) jobs = os.environ.get("FLEET_LOAD_JOBS") - run(["cargo", "build", "-p", "horizon-client", "--example", "probe", + run(["cargo", "build", "-p", "horizon-client", "--example", "client_probe", *(["-j", jobs] if jobs else [])], root, env=env) - fixture = root / ".local/port-target/debug/examples/probe" + fixture = root / ".local/port-target/debug/examples/client_probe" run([fixture, "command_parse_fixture", "tree", build / "rust_tree.json"], root) return [python(), "tools/generate_command_order.py", build / "tree.json", build / "rust_tree.json"] diff --git a/tools/test_active_effect_tick_parity.py b/tools/test_active_effect_tick_parity.py index dcb34ae21..58c24511a 100644 --- a/tools/test_active_effect_tick_parity.py +++ b/tools/test_active_effect_tick_parity.py @@ -72,9 +72,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaActiveEffectTickOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_active_effects_parity.py b/tools/test_active_effects_parity.py index 926c2ecf8..10750d43a 100644 --- a/tools/test_active_effects_parity.py +++ b/tools/test_active_effects_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaActiveEffectsOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_anchor_parity.py b/tools/test_anchor_parity.py index 19b8f6e4b..842a8517e 100644 --- a/tools/test_anchor_parity.py +++ b/tools/test_anchor_parity.py @@ -53,9 +53,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"anchor_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_arrow_parity.py b/tools/test_arrow_parity.py index 72692eb55..ab6e690be 100644 --- a/tools/test_arrow_parity.py +++ b/tools/test_arrow_parity.py @@ -241,9 +241,9 @@ def main(): expected = 3 * operations + len(fixtures) (build / 'inputs.txt').write_text(''.join(json.dumps(f, separators=(',', ':')) + '\n' for f in fixtures)) input_hash = lab.digest(build / 'inputs.txt', 'sha256') - run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory']) / 'debug/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'debug/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary, 'arrow_probe',resources, build, '--describe'], 'describe') references = [] for side, jar in jars.items(): diff --git a/tools/test_attribute_health_parity.py b/tools/test_attribute_health_parity.py index eaf06d857..56ace7972 100644 --- a/tools/test_attribute_health_parity.py +++ b/tools/test_attribute_health_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeHealthOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'attribute_health_fixture',build],'rust');run([binary,'attribute_health_fixture',build,'live'],'rust-live');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_attribute_map_queries_parity.py b/tools/test_attribute_map_queries_parity.py index ca222a07c..06048bf7b 100644 --- a/tools/test_attribute_map_queries_parity.py +++ b/tools/test_attribute_map_queries_parity.py @@ -82,9 +82,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeMapQueriesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_attribute_parity.py b/tools/test_attribute_parity.py index 02051188d..d65486c21 100644 --- a/tools/test_attribute_parity.py +++ b/tools/test_attribute_parity.py @@ -89,9 +89,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'attributes.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'attributes.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'attribute_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_attribute_updates_parity.py b/tools/test_attribute_updates_parity.py index cc4f70d1a..3cd33a4d6 100644 --- a/tools/test_attribute_updates_parity.py +++ b/tools/test_attribute_updates_parity.py @@ -70,9 +70,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeUpdatesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_basic_feature_parity.py b/tools/test_basic_feature_parity.py index 2de93cd1a..69612bedb 100644 --- a/tools/test_basic_feature_parity.py +++ b/tools/test_basic_feature_parity.py @@ -71,9 +71,9 @@ def main(): fixture_paths.append(path) if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ") tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"basic_feature_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_biome_chunk_parity.py b/tools/test_biome_chunk_parity.py index f24370455..a431036ff 100644 --- a/tools/test_biome_chunk_parity.py +++ b/tools/test_biome_chunk_parity.py @@ -57,9 +57,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"biome_chunk_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_biome_generation_parity.py b/tools/test_biome_generation_parity.py index 67c642585..7124cd742 100644 --- a/tools/test_biome_generation_parity.py +++ b/tools/test_biome_generation_parity.py @@ -76,9 +76,9 @@ def main(): registries=build/'registries.json';registries.write_text(json.dumps(bundle,separators=(',',':')),encoding='utf-8') fixtures=list(corpus(bundle));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') fixture_paths=[inputs,registries,*exports];tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"biome_generation_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_biome_placement_parity.py b/tools/test_biome_placement_parity.py index caf99b7c9..8250cecb5 100644 --- a/tools/test_biome_placement_parity.py +++ b/tools/test_biome_placement_parity.py @@ -53,9 +53,9 @@ def main(): with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'biome_placement_fixture',build],'rust');references=[] for side,jar in jars.items(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaBiomePlacementOracle',side,build],side) diff --git a/tools/test_biome_source_codec_parity.py b/tools/test_biome_source_codec_parity.py index 9363378af..c40b1c84e 100644 --- a/tools/test_biome_source_codec_parity.py +++ b/tools/test_biome_source_codec_parity.py @@ -95,9 +95,9 @@ def main(): fixtures=list(corpus(bundle));inputs=build/'inputs.txt';inputs.write_text('\n'.join(fixtures)+'\n',encoding='utf-8') (build/'positions.json').write_text(json.dumps(positions(),separators=(',',':')),encoding='utf-8') fixture_paths=[inputs,*exports,build/'positions.json',*[build/(name+'.json') for name in bundle]];tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"biome_source_codec_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_biome_source_parity.py b/tools/test_biome_source_parity.py index 7616f7545..6969e8562 100644 --- a/tools/test_biome_source_parity.py +++ b/tools/test_biome_source_parity.py @@ -44,9 +44,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"biome_source_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_biome_temperature_parity.py b/tools/test_biome_temperature_parity.py index af8d75976..e4c07c03a 100644 --- a/tools/test_biome_temperature_parity.py +++ b/tools/test_biome_temperature_parity.py @@ -82,9 +82,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"biome_temperature_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_block_collision_scan_parity.py b/tools/test_block_collision_scan_parity.py index a59bfd8f9..86dc4fc5d 100644 --- a/tools/test_block_collision_scan_parity.py +++ b/tools/test_block_collision_scan_parity.py @@ -68,9 +68,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockCollisionScanOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_collision_scan_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_block_entity_anim_parity.py b/tools/test_block_entity_anim_parity.py index b0c462aee..41f048436 100755 --- a/tools/test_block_entity_anim_parity.py +++ b/tools/test_block_entity_anim_parity.py @@ -279,7 +279,7 @@ def main(): *(PARITY / f'{n}.java' for n in ('ParityData', 'VanillaBlockEntityAnimOracle'))], 'compile-java') run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaBlockEntityAnimOracle', inputs, build / 'vanilla.txt'], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'block_entity_anim_fixture', resources, inputs, build / 'rust.txt'], 'rust') def split(path): diff --git a/tools/test_block_entity_render_parity.py b/tools/test_block_entity_render_parity.py index 901f4300f..27e740191 100644 --- a/tools/test_block_entity_render_parity.py +++ b/tools/test_block_entity_render_parity.py @@ -303,7 +303,7 @@ def main(): vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] textures = sorted({s['texture'] for v in vanilla for s in v.get('submits', []) if 'texture' in s}) (build / 'textures.txt').write_text(''.join(t + '\n' for t in textures)) - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'block_entity_render_fixture', resources, inputs, build / 'textures.txt', build / 'rust.jsonl'], 'rust') rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] assert len(vanilla) == len(rust), (len(vanilla), len(rust)) diff --git a/tools/test_block_entity_storage_parity.py b/tools/test_block_entity_storage_parity.py index a1f378f31..5d9acd966 100644 --- a/tools/test_block_entity_storage_parity.py +++ b/tools/test_block_entity_storage_parity.py @@ -75,9 +75,9 @@ def main(): with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependencies=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_entity_storage_fixture',inputs,build/'rust.txt'],'rust') references=[] for side,jar in jars.items(): diff --git a/tools/test_block_entity_tickers_parity.py b/tools/test_block_entity_tickers_parity.py index 66a84cf48..d8e19c740 100644 --- a/tools/test_block_entity_tickers_parity.py +++ b/tools/test_block_entity_tickers_parity.py @@ -120,7 +120,7 @@ def main(): run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaBlockEntityTickerOracle', inputs, build / 'vanilla.txt'], 'vanilla') run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', - 'probe', '--', 'block_entity_tickers_fixture', inputs, build / 'rust.txt'], 'rust') + 'client_probe', '--', 'block_entity_tickers_fixture', inputs, build / 'rust.txt'], 'rust') matched = base.compare(build / 'vanilla.txt', build / 'rust.txt') ticks = sum(1 for line in lines if line == 'tick') listed = sum(len(line.split()) - 1 for line in (build / 'vanilla.txt').read_text().splitlines()) diff --git a/tools/test_block_landing_parity.py b/tools/test_block_landing_parity.py index 822ff1614..33789992a 100644 --- a/tools/test_block_landing_parity.py +++ b/tools/test_block_landing_parity.py @@ -69,8 +69,8 @@ def main(): with (build/'inputs.txt').open('w') as output: for f in corpus(states,definitions):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 fixture_paths=[build/n for n in ['inputs.txt','landing-states.json','landing-definitions.json','movement-properties.nbt','block-registry.nbt','cached-collision.nbt']];fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust') - metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_landing_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered block landing lines match',flush=True) diff --git a/tools/test_block_properties_parity.py b/tools/test_block_properties_parity.py index 28cd2832c..bca33c11c 100644 --- a/tools/test_block_properties_parity.py +++ b/tools/test_block_properties_parity.py @@ -57,9 +57,9 @@ def main(): java('server','export',build) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'block-registry.nbt',build/'cached-collision.nbt',build/'block-properties.nbt'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_properties_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_block_push_parity.py b/tools/test_block_push_parity.py index 986a3b1c9..6c752b98c 100644 --- a/tools/test_block_push_parity.py +++ b/tools/test_block_push_parity.py @@ -53,9 +53,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockPushOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_push_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_block_state_codec_parity.py b/tools/test_block_state_codec_parity.py index e6db50860..ca05c92d9 100644 --- a/tools/test_block_state_codec_parity.py +++ b/tools/test_block_state_codec_parity.py @@ -60,9 +60,9 @@ def main(): if len(facts['states'])!=35723:raise ValueError('incomplete pinned state registry') fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_state_codec_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_block_support_parity.py b/tools/test_block_support_parity.py index 928f099d1..7b3b77274 100644 --- a/tools/test_block_support_parity.py +++ b/tools/test_block_support_parity.py @@ -35,9 +35,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockSupportOracle',mode,path],side+'-'+mode) java('server','export',build) fixture_paths=[build/'block-registry.nbt',build/'cached-support.nbt'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'block_support_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_block_survival_parity.py b/tools/test_block_survival_parity.py index 2d99db9e2..7eca89332 100644 --- a/tools/test_block_survival_parity.py +++ b/tools/test_block_survival_parity.py @@ -236,9 +236,9 @@ def main(): output.write(json.dumps(fixture,separators=(',',':'))+'\n');fixture_count+=1 fixture_paths=[inputs,build/'survival-extra-definitions.json',build/'fluid-tags.json',build/'survival-placement-classes.json',build/'survival-support-tags.json',build/'facts.json',build/'survival-classes.json',build/'survival-rules.json',build/'tags.json',build/'block-registry.nbt',build/'cached-collision.nbt',build/'block-properties.nbt',build/'cached-support.nbt'] tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') base.ensure_sources_unchanged(sources,tested_sources) checkpoint={'schema':1,'environment':environment,'sources_sha256':tested_sources,'fixtures_sha256':{str(lab.ROOT/name):digest for name,digest in tested_fixtures.items()},'artifacts_sha256':{str(path):lab.digest(path,'sha256') for path in [binary,*sorted(classes.rglob('*.class'))]},'binary':str(binary),'counts':{'supported_blocks':len(definitions),'supported_states':sum(state['id'] in definitions for state in facts['states']),'survival_rules':len(set(definitions.values())),'survival_rule_kinds':len({rule.split(':',1)[0] for rule in definitions.values()}),'fluid_tag_files':len(fluid_tags),'fixtures':fixture_count},'outputs':{}} save_checkpoint(checkpoint_path,checkpoint) diff --git a/tools/test_blocking_item_damage_parity.py b/tools/test_blocking_item_damage_parity.py index b8b3ea251..ea313c3da 100644 --- a/tools/test_blocking_item_damage_parity.py +++ b/tools/test_blocking_item_damage_parity.py @@ -60,9 +60,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockingItemDamageOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'blocking_item_damage_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_blocking_rules_parity.py b/tools/test_blocking_rules_parity.py index 2ff5763d6..95141670a 100644 --- a/tools/test_blocking_rules_parity.py +++ b/tools/test_blocking_rules_parity.py @@ -60,9 +60,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockingRulesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'blocking_rules_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_bulk_section_parity.py b/tools/test_bulk_section_parity.py index b9a9ae3a8..9364e29b6 100644 --- a/tools/test_bulk_section_parity.py +++ b/tools/test_bulk_section_parity.py @@ -70,9 +70,9 @@ def main(): (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"bulk_section_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_bundle_weight_parity.py b/tools/test_bundle_weight_parity.py index c509e08a1..7d3047dab 100644 --- a/tools/test_bundle_weight_parity.py +++ b/tools/test_bundle_weight_parity.py @@ -64,9 +64,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBundleWeightOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'bundle_weight_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_canyon_carver_parity.py b/tools/test_canyon_carver_parity.py index 25fbc30de..2122000a3 100644 --- a/tools/test_canyon_carver_parity.py +++ b/tools/test_canyon_carver_parity.py @@ -65,9 +65,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"canyon_carver_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_carving_geometry_parity.py b/tools/test_carving_geometry_parity.py index e69331bbe..42275cc15 100644 --- a/tools/test_carving_geometry_parity.py +++ b/tools/test_carving_geometry_parity.py @@ -72,9 +72,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"carving_geometry_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_carving_mask_parity.py b/tools/test_carving_mask_parity.py index 15dacf52e..873d5bb07 100644 --- a/tools/test_carving_mask_parity.py +++ b/tools/test_carving_mask_parity.py @@ -65,9 +65,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"carving_mask_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_cave_carver_parity.py b/tools/test_cave_carver_parity.py index d79914762..8edefb42e 100644 --- a/tools/test_cave_carver_parity.py +++ b/tools/test_cave_carver_parity.py @@ -60,9 +60,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"cave_carver_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_chunk_generation_parity.py b/tools/test_chunk_generation_parity.py index 6951e4355..1cd495eb6 100644 --- a/tools/test_chunk_generation_parity.py +++ b/tools/test_chunk_generation_parity.py @@ -71,9 +71,9 @@ class Oracle: def rust_binary(): - subprocess.run(['cargo', 'build', '--release', '-q', '-p', 'horizon-world', '--example', 'probe'], check=True, cwd=lab.ROOT) + subprocess.run(['cargo', 'build', '--release', '-q', '-p', 'horizon-world', '--example', 'world_probe'], check=True, cwd=lab.ROOT) metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - return Path(metadata['target_directory']) / 'release/examples/probe' + return Path(metadata['target_directory']) / 'release/examples/world_probe' def run_rust(binary, out, seed, dimension, rects, scan=False): diff --git a/tools/test_chunk_stage_parity.py b/tools/test_chunk_stage_parity.py index b8aaa6153..691bab709 100644 --- a/tools/test_chunk_stage_parity.py +++ b/tools/test_chunk_stage_parity.py @@ -73,9 +73,9 @@ def main(): (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"chunk_stage_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_chunk_status_parity.py b/tools/test_chunk_status_parity.py index 17c3d65ed..b6f45a539 100644 --- a/tools/test_chunk_status_parity.py +++ b/tools/test_chunk_status_parity.py @@ -42,9 +42,9 @@ def main(): with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependencies=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'chunk_status_fixture',inputs,build/'rust.txt'],'rust') references=[] for side,jar in jars.items(): diff --git a/tools/test_climbing_parity.py b/tools/test_climbing_parity.py index 7b54fc4fb..1b61b1142 100644 --- a/tools/test_climbing_parity.py +++ b/tools/test_climbing_parity.py @@ -54,7 +54,7 @@ def main(): with (build/'inputs.txt').open('w') as output: for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'climbing_fixture',build],'rust');references=[] + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'climbing_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} climbing output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) diff --git a/tools/test_collision_context_parity.py b/tools/test_collision_context_parity.py index da1f382db..a0178725b 100644 --- a/tools/test_collision_context_parity.py +++ b/tools/test_collision_context_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'collision_context_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_collision_parity.py b/tools/test_collision_parity.py index 3031e47b2..ad99ab960 100644 --- a/tools/test_collision_parity.py +++ b/tools/test_collision_parity.py @@ -51,9 +51,9 @@ def main(): result.check_returncode() return result.stdout expected = counts(java("server", "generate")) - test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "probe"]) + test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "world_probe"]) metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--no-deps", "--format-version", "1"], cwd=lab.ROOT, text=True)) - binary = Path(metadata["target_directory"]) / "release/examples" / ("probe.exe" if os.name=="nt" else "probe") + binary = Path(metadata["target_directory"]) / "release/examples" / ("world_probe.exe" if os.name=="nt" else "world_probe") actual = counts(subprocess.check_output([str(binary), "collision_fixture", str(base)], cwd=lab.ROOT, text=True)) if actual != expected: raise AssertionError(f"Collision coverage differs: vanilla={expected}, Rust={actual}") diff --git a/tools/test_combat_rules_parity.py b/tools/test_combat_rules_parity.py index 642c0603d..389f075ae 100644 --- a/tools/test_combat_rules_parity.py +++ b/tools/test_combat_rules_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCombatRulesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'combat_rules_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_command_parse_parity.py b/tools/test_command_parse_parity.py index c43e66b54..620fb548d 100644 --- a/tools/test_command_parse_parity.py +++ b/tools/test_command_parse_parity.py @@ -64,9 +64,9 @@ def main(): registries = json.loads((build / 'registries.json').read_text()) corpus = corpus_module.corpus(tree, registries) (build / 'corpus.txt').write_text(''.join(line + '\n' for line in corpus), encoding='utf-8') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') resources = lab.RESOURCES total_failures = 0 summary = [] diff --git a/tools/test_component_durability_parity.py b/tools/test_component_durability_parity.py index e912fa80b..f786f9897 100644 --- a/tools/test_component_durability_parity.py +++ b/tools/test_component_durability_parity.py @@ -71,9 +71,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaComponentDurabilityOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'component_durability_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_component_patch_parity.py b/tools/test_component_patch_parity.py index bae69bb56..f57868613 100644 --- a/tools/test_component_patch_parity.py +++ b/tools/test_component_patch_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaComponentPatchOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'component_patch_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_consumable_emission_parity.py b/tools/test_consumable_emission_parity.py index 7e8085087..267aae3ec 100644 --- a/tools/test_consumable_emission_parity.py +++ b/tools/test_consumable_emission_parity.py @@ -55,9 +55,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaConsumableEmissionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'consumable_emission_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_consumable_parity.py b/tools/test_consumable_parity.py index 083ff810f..3bb8fc4eb 100644 --- a/tools/test_consumable_parity.py +++ b/tools/test_consumable_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaConsumableOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'consumable_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_consume_effect_parity.py b/tools/test_consume_effect_parity.py index 4f4037073..38820beea 100644 --- a/tools/test_consume_effect_parity.py +++ b/tools/test_consume_effect_parity.py @@ -55,9 +55,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaConsumeEffectOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'consume_effect_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_contextual_collision_parity.py b/tools/test_contextual_collision_parity.py index bbfe45b02..bd82be1ca 100644 --- a/tools/test_contextual_collision_parity.py +++ b/tools/test_contextual_collision_parity.py @@ -48,9 +48,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars['server']),dependency_path]),'dev.horizonlab.parity.VanillaCollisionOracle','generate',build],'export') fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'collision_context_fixture',build],'rust');references=[] for side,jar in jars.items(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaContextualCollisionAudit',side,build],side+'-audit') diff --git a/tools/test_damage_immunity_parity.py b/tools/test_damage_immunity_parity.py index d68277dd8..b788ca464 100644 --- a/tools/test_damage_immunity_parity.py +++ b/tools/test_damage_immunity_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDamageImmunityOracle',mode,path],side+'-'+mode) java('server','export',build);fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'slots.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'damage_immunity_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_damage_reduction_parity.py b/tools/test_damage_reduction_parity.py index 06c827dcf..bdb526615 100644 --- a/tools/test_damage_reduction_parity.py +++ b/tools/test_damage_reduction_parity.py @@ -65,9 +65,9 @@ def main(): java('server','export',build) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'slots.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'damage_reduction_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_damage_source_parity.py b/tools/test_damage_source_parity.py index 75f360822..2c8b6d228 100644 --- a/tools/test_damage_source_parity.py +++ b/tools/test_damage_source_parity.py @@ -56,9 +56,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDamageSourceOracle',mode,path],side+'-'+mode) java('server','export',build);catalog=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(catalog));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json',build/'types.json',build/'tags.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'damage_source_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_datafix_parity.py b/tools/test_datafix_parity.py index dc5a2495b..cfaa5c2b4 100644 --- a/tools/test_datafix_parity.py +++ b/tools/test_datafix_parity.py @@ -72,11 +72,11 @@ def java_classpath(): def build_rust(): - subprocess.run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], + subprocess.run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], cwd=ROOT, check=True) meta = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=ROOT)) - return Path(meta['target_directory']) / 'release' / 'examples' / 'probe' + return Path(meta['target_directory']) / 'release' / 'examples' / 'world_probe' def run_vanilla(classpath, world, out, target=None): diff --git a/tools/test_decoration_parity.py b/tools/test_decoration_parity.py index ae8c7ce02..3958b4d90 100644 --- a/tools/test_decoration_parity.py +++ b/tools/test_decoration_parity.py @@ -75,9 +75,9 @@ def main(): with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'decoration_fixture',build],'rust');references=[] for side,jar in jars.items(): run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaDecorationOracle',side,build],side) diff --git a/tools/test_decoration_region_parity.py b/tools/test_decoration_region_parity.py index c91ab86e8..5e31d1e1a 100644 --- a/tools/test_decoration_region_parity.py +++ b/tools/test_decoration_region_parity.py @@ -73,9 +73,9 @@ def main(): (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"decoration_region_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_dynamic_support_parity.py b/tools/test_dynamic_support_parity.py index 76beb65c8..9ee27d5af 100644 --- a/tools/test_dynamic_support_parity.py +++ b/tools/test_dynamic_support_parity.py @@ -82,9 +82,9 @@ def main(): if len(states)!=199:raise ValueError('incomplete uncached support registry') fixtures=list(collision_corpus(facts,states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'facts.json',build/'uncached-states.json',build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'dynamic_support_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_edge_backoff_parity.py b/tools/test_edge_backoff_parity.py index 58d5ba8dd..b273ab26b 100644 --- a/tools/test_edge_backoff_parity.py +++ b/tools/test_edge_backoff_parity.py @@ -56,9 +56,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEdgeBackoffOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'edge_backoff_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_effect_attribute_modifiers_parity.py b/tools/test_effect_attribute_modifiers_parity.py index 9fd9694aa..5d0a4dacd 100644 --- a/tools/test_effect_attribute_modifiers_parity.py +++ b/tools/test_effect_attribute_modifiers_parity.py @@ -123,9 +123,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEffectAttributeModifiersOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'effect_attribute_modifiers_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_effect_notifications_parity.py b/tools/test_effect_notifications_parity.py index e39258a8b..7f11af36f 100644 --- a/tools/test_effect_notifications_parity.py +++ b/tools/test_effect_notifications_parity.py @@ -76,9 +76,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEffectNotificationsOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_effect_sync_parity.py b/tools/test_effect_sync_parity.py index 5aeeae09b..76227970f 100644 --- a/tools/test_effect_sync_parity.py +++ b/tools/test_effect_sync_parity.py @@ -129,9 +129,9 @@ def main(): inputs.write_text(''.join(json.dumps(row, separators=(',', ':')) + '\n' for row in fixtures), encoding='utf-8') fixture_paths = [inputs, build / 'catalog.json', build / 'catalog-client.json', build / 'catalog-server.json'] tested_fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('world_probe.exe' if os.name=='nt' else 'world_probe') references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_enchanting_parity.py b/tools/test_enchanting_parity.py index 9f5f5647f..35f0777c8 100644 --- a/tools/test_enchanting_parity.py +++ b/tools/test_enchanting_parity.py @@ -56,9 +56,9 @@ def main(): with (build / (name + '.log')).open('w', encoding='utf-8') as log: base.run(list(map(str, command)), stdout=log, stderr=subprocess.STDOUT) run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'), '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary, 'enchanting_fixture',resources, inputs, build / 'rust.txt'], 'rust') references = [] for side in ['server']: diff --git a/tools/test_entity_attribute_parity.py b/tools/test_entity_attribute_parity.py index 045488ee3..ba7b62748 100644 --- a/tools/test_entity_attribute_parity.py +++ b/tools/test_entity_attribute_parity.py @@ -54,9 +54,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityAttributeOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'entity_attribute_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_entity_collision_parity.py b/tools/test_entity_collision_parity.py index 6fe12a7aa..5a632cfa5 100644 --- a/tools/test_entity_collision_parity.py +++ b/tools/test_entity_collision_parity.py @@ -65,9 +65,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityCollisionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'entity_collision_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_entity_death_loot_parity.py b/tools/test_entity_death_loot_parity.py index b0f77cbfd..07c77b0b8 100644 --- a/tools/test_entity_death_loot_parity.py +++ b/tools/test_entity_death_loot_parity.py @@ -139,9 +139,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx2G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaEntityDeathLootOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'entity_death_loot_fixture', resources, inputs, build / 'rust.txt'], 'rust') errors = [l for l in (build / 'server.txt').read_text().splitlines() if l.startswith('error ')] if errors: diff --git a/tools/test_entity_fluid_parity.py b/tools/test_entity_fluid_parity.py index 712db03b5..b37a3e11d 100644 --- a/tools/test_entity_fluid_parity.py +++ b/tools/test_entity_fluid_parity.py @@ -79,9 +79,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityFluidOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'entity_fluid_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_entity_fluid_tick_parity.py b/tools/test_entity_fluid_tick_parity.py index 58380bd03..1aa2cf839 100644 --- a/tools/test_entity_fluid_tick_parity.py +++ b/tools/test_entity_fluid_tick_parity.py @@ -64,9 +64,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityFluidOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'entity_fluid_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_entity_model_parity.py b/tools/test_entity_model_parity.py index ba54797fa..0cfc509f3 100644 --- a/tools/test_entity_model_parity.py +++ b/tools/test_entity_model_parity.py @@ -364,7 +364,7 @@ def main(): run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', dependencies, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaEntityAnimOracle', inputs, build / 'vanilla.jsonl', jars['client']], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'entity_anim_fixture', resources, build / 'vanilla.jsonl', build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] diff --git a/tools/test_entity_move_parity.py b/tools/test_entity_move_parity.py index d17bb2444..5d8f0814b 100644 --- a/tools/test_entity_move_parity.py +++ b/tools/test_entity_move_parity.py @@ -56,9 +56,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityMoveOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'entity_move_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_entity_obstruction_parity.py b/tools/test_entity_obstruction_parity.py index 210c2080f..d600904c0 100644 --- a/tools/test_entity_obstruction_parity.py +++ b/tools/test_entity_obstruction_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityObstructionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'entity_obstruction_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_environment_render_parity.py b/tools/test_environment_render_parity.py index 893a1c70d..50d14337d 100755 --- a/tools/test_environment_render_parity.py +++ b/tools/test_environment_render_parity.py @@ -66,7 +66,7 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx1G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaEnvironmentOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'environment_fixture', resources, inputs, build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] diff --git a/tools/test_extra_items_parity.py b/tools/test_extra_items_parity.py index 83752e515..b2dcfb17c 100644 --- a/tools/test_extra_items_parity.py +++ b/tools/test_extra_items_parity.py @@ -67,9 +67,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaExtraItemsOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'extra_items_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_face_support_parity.py b/tools/test_face_support_parity.py index ad6db8922..3a8ae8783 100644 --- a/tools/test_face_support_parity.py +++ b/tools/test_face_support_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFaceSupportOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'face_support_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_face_visibility_parity.py b/tools/test_face_visibility_parity.py index fa8c6696a..c63526ff6 100644 --- a/tools/test_face_visibility_parity.py +++ b/tools/test_face_visibility_parity.py @@ -71,9 +71,9 @@ def main(): for a,b in pairs(definitions):output.write(f'{a} {b}\n');pair_count+=1 fixture_paths = [build/name for name in ['pairs.txt','block-registry.nbt','occlusion.nbt','definitions.json','tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata = json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'face_visibility_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side) diff --git a/tools/test_fall_damage_parity.py b/tools/test_fall_damage_parity.py index 585084eb4..7b78c8e46 100644 --- a/tools/test_fall_damage_parity.py +++ b/tools/test_fall_damage_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFallDamageOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'fall_damage_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_feature_catalog_parity.py b/tools/test_feature_catalog_parity.py index 52a19a652..5a8b4aac7 100644 --- a/tools/test_feature_catalog_parity.py +++ b/tools/test_feature_catalog_parity.py @@ -100,9 +100,9 @@ def main(): fixture_paths.append(path) if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ") tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"feature_catalog_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_feature_graph_parity.py b/tools/test_feature_graph_parity.py index 553baaf09..96d066771 100644 --- a/tools/test_feature_graph_parity.py +++ b/tools/test_feature_graph_parity.py @@ -83,9 +83,9 @@ def main(): fixture_paths.append(path) if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ") tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"feature_graph_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_feature_placement_parity.py b/tools/test_feature_placement_parity.py index 58dc3167a..6230fc20c 100644 --- a/tools/test_feature_placement_parity.py +++ b/tools/test_feature_placement_parity.py @@ -87,9 +87,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"feature_placement_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index 2cc8d78a7..c1f1bf5d8 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -107,9 +107,9 @@ def main(): height_inputs=build/'heights.json';height_inputs.write_text(json.dumps(heights,separators=(',',':'))) fixture_paths=[height_inputs,zone_inputs,inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"feature_region_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_feature_sort_parity.py b/tools/test_feature_sort_parity.py index 6c0e4a44e..351e846aa 100644 --- a/tools/test_feature_sort_parity.py +++ b/tools/test_feature_sort_parity.py @@ -64,9 +64,9 @@ def main(): with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'feature_sort_fixture',build],'rust');references=[] for side,jar in jars.items(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaFeatureSortOracle',side,build],side) diff --git a/tools/test_fill_layer_parity.py b/tools/test_fill_layer_parity.py index b23521d02..1ca2593d5 100644 --- a/tools/test_fill_layer_parity.py +++ b/tools/test_fill_layer_parity.py @@ -60,9 +60,9 @@ def main(): fixtures=list(corpus(facts));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") fixture_paths.append(inputs) tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"fill_layer_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_finalize_spawn_parity.py b/tools/test_finalize_spawn_parity.py index c3130d380..7d581fefc 100644 --- a/tools/test_finalize_spawn_parity.py +++ b/tools/test_finalize_spawn_parity.py @@ -148,9 +148,9 @@ def main(): print(f'{len(vanilla)} oracle lines') return halloween = vanilla[0].split()[1] - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'finalize_spawn_fixture', resources, inputs, build / 'rust.txt', halloween], 'rust') rust = (build / 'rust.txt').read_text().splitlines() bad = [(a, b) for a, b in zip(vanilla, rust) if a != b] diff --git a/tools/test_fluid_box_parity.py b/tools/test_fluid_box_parity.py index 1b4e7743c..0f1385d52 100644 --- a/tools/test_fluid_box_parity.py +++ b/tools/test_fluid_box_parity.py @@ -58,9 +58,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidBoxOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'fluid_box_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_fluid_flow_parity.py b/tools/test_fluid_flow_parity.py index ef1606d91..c8efeea0d 100644 --- a/tools/test_fluid_flow_parity.py +++ b/tools/test_fluid_flow_parity.py @@ -67,9 +67,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidFlowOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'fluid-states.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'fluid-states.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'fluid_flow_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_fluid_occupancy_parity.py b/tools/test_fluid_occupancy_parity.py index 90af340d3..ebb19fad8 100644 --- a/tools/test_fluid_occupancy_parity.py +++ b/tools/test_fluid_occupancy_parity.py @@ -57,7 +57,7 @@ def main(): with (build/'inputs.txt').open('w') as output: for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt']];fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'fluid_occupancy_fixture',build],'rust');references=[] + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'fluid_occupancy_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} fluid-occupancy output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) diff --git a/tools/test_fluid_parity.py b/tools/test_fluid_parity.py index 3acfc3702..b113f2294 100644 --- a/tools/test_fluid_parity.py +++ b/tools/test_fluid_parity.py @@ -62,9 +62,9 @@ def main(): fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') codec_inputs=build/'codec-inputs.txt';codec_fixtures=list(codec_corpus());codec_inputs.write_text(''.join(json.dumps(v,separators=(',',':'))+'\n' for v in codec_fixtures),encoding='utf-8') fixture_paths=[inputs,codec_inputs,build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'fluid_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_fluid_shape_parity.py b/tools/test_fluid_shape_parity.py index 1378d33a5..ee4793709 100644 --- a/tools/test_fluid_shape_parity.py +++ b/tools/test_fluid_shape_parity.py @@ -48,9 +48,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidShapeOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'fluid-states.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'fluid-states.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'fluid_shape_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_food_parity.py b/tools/test_food_parity.py index c2e451fd0..6428815af 100644 --- a/tools/test_food_parity.py +++ b/tools/test_food_parity.py @@ -68,9 +68,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFoodOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'food_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_food_properties_parity.py b/tools/test_food_properties_parity.py index 950c19ee3..62f62508a 100644 --- a/tools/test_food_properties_parity.py +++ b/tools/test_food_properties_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFoodPropertiesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'food_properties_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_food_storage_parity.py b/tools/test_food_storage_parity.py index aeedde587..605b40d2f 100644 --- a/tools/test_food_storage_parity.py +++ b/tools/test_food_storage_parity.py @@ -52,9 +52,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFoodStorageOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'food_storage_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_free_space_parity.py b/tools/test_free_space_parity.py index a81fb0fe7..2c8379bac 100644 --- a/tools/test_free_space_parity.py +++ b/tools/test_free_space_parity.py @@ -94,9 +94,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'registry_collision_scan_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_ground_support_parity.py b/tools/test_ground_support_parity.py index 4393daf21..88bbf00a8 100644 --- a/tools/test_ground_support_parity.py +++ b/tools/test_ground_support_parity.py @@ -78,10 +78,10 @@ def main(): for f in corpus():output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 counts[name]=count;fixture_paths.append(path) fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) for group,name in zip(['selection','state'],names): - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,name,build/group],'rust-'+group) + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,name,build/group],'rust-'+group) references=[] for side,jar in jars.items(): results=[] diff --git a/tools/test_height_provider_parity.py b/tools/test_height_provider_parity.py index 4f63c80cd..fad696b0a 100644 --- a/tools/test_height_provider_parity.py +++ b/tools/test_height_provider_parity.py @@ -73,9 +73,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"height_provider_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_heightmap_parity.py b/tools/test_heightmap_parity.py index 502f165ab..e565fc04d 100644 --- a/tools/test_heightmap_parity.py +++ b/tools/test_heightmap_parity.py @@ -100,9 +100,9 @@ def main(): (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"heightmap_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_held_drop_parity.py b/tools/test_held_drop_parity.py index d2f215050..a5cfe9009 100644 --- a/tools/test_held_drop_parity.py +++ b/tools/test_held_drop_parity.py @@ -35,7 +35,7 @@ def main(): 'dev.horizonlab.parity.VanillaHeldDropOracle', str(build / 'vanilla.txt')], check=True) with (build / 'rust.txt').open('w') as out: subprocess.run(['cargo', 'run', '--quiet', '-p', 'horizon-client', '--example', - 'probe', '--', 'held_drop_fixture'], cwd=lab.ROOT, stdout=out, check=True) + 'client_probe', '--', 'held_drop_fixture'], cwd=lab.ROOT, stdout=out, check=True) matched = base.compare(build / 'vanilla.txt', build / 'rust.txt') print(f'Held drop parity passed: {matched} inventory/drop/swing/packet snapshots match vanilla') diff --git a/tools/test_hud_parity.py b/tools/test_hud_parity.py index 4dcd19a7b..2b306f563 100644 --- a/tools/test_hud_parity.py +++ b/tools/test_hud_parity.py @@ -114,7 +114,7 @@ def main(): *(PARITY / f'{n}.java' for n in ('ParityData', 'ParityFont', 'VanillaHudOracle'))], 'compile-java') run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaHudOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'hud_fixture', resources, inputs, build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] diff --git a/tools/test_interaction_shape_parity.py b/tools/test_interaction_shape_parity.py index d40ca2c0b..ab21840c0 100644 --- a/tools/test_interaction_shape_parity.py +++ b/tools/test_interaction_shape_parity.py @@ -47,9 +47,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInteractionShapeOracle',mode,path],side+'-'+mode) java('server','export',build);info=json.loads((build/'info.json').read_text());fixtures=list(corpus(info));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'info.json',build/'block-registry.nbt',build/'interaction-shapes.nbt'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'interaction_shape_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_inventory_pickup_parity.py b/tools/test_inventory_pickup_parity.py index a3172f472..9c413dcc8 100644 --- a/tools/test_inventory_pickup_parity.py +++ b/tools/test_inventory_pickup_parity.py @@ -72,9 +72,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryPickupOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'inventory_pickup_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_inventory_tick_parity.py b/tools/test_inventory_tick_parity.py index 2dd34b76f..6a23d3be4 100644 --- a/tools/test_inventory_tick_parity.py +++ b/tools/test_inventory_tick_parity.py @@ -60,9 +60,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryTickOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'inventory_tick_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_inventory_use_parity.py b/tools/test_inventory_use_parity.py index 925567c3f..4bb1d658b 100644 --- a/tools/test_inventory_use_parity.py +++ b/tools/test_inventory_use_parity.py @@ -55,9 +55,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryUseOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'inventory_use_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_inventory_use_start_parity.py b/tools/test_inventory_use_start_parity.py index 67e282c06..c57bd88da 100644 --- a/tools/test_inventory_use_start_parity.py +++ b/tools/test_inventory_use_start_parity.py @@ -55,9 +55,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryUseStartOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'inventory_use_start_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_after_use_parity.py b/tools/test_item_after_use_parity.py index 4aa5258f9..860d633d0 100644 --- a/tools/test_item_after_use_parity.py +++ b/tools/test_item_after_use_parity.py @@ -54,9 +54,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemAfterUseOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_after_use_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_blocking_parity.py b/tools/test_item_blocking_parity.py index 08d8dce24..8c149eabc 100644 --- a/tools/test_item_blocking_parity.py +++ b/tools/test_item_blocking_parity.py @@ -58,9 +58,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemBlockingOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_blocking_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_cooldowns_parity.py b/tools/test_item_cooldowns_parity.py index 807c576dc..3b368b657 100644 --- a/tools/test_item_cooldowns_parity.py +++ b/tools/test_item_cooldowns_parity.py @@ -64,9 +64,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemCooldownsOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_cooldowns_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_durability_parity.py b/tools/test_item_durability_parity.py index e3cdebb07..ec76cd60a 100644 --- a/tools/test_item_durability_parity.py +++ b/tools/test_item_durability_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemDurabilityOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_durability_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_particles_parity.py b/tools/test_item_particles_parity.py index 0e030a3b3..5b2f5b5f9 100644 --- a/tools/test_item_particles_parity.py +++ b/tools/test_item_particles_parity.py @@ -53,9 +53,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemParticlesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_particles_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_stack_storage_parity.py b/tools/test_item_stack_storage_parity.py index 953dc8300..e3071207d 100644 --- a/tools/test_item_stack_storage_parity.py +++ b/tools/test_item_stack_storage_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemStackStorageOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_stack_storage_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_template_parity.py b/tools/test_item_template_parity.py index 837465bb3..efc4dd094 100644 --- a/tools/test_item_template_parity.py +++ b/tools/test_item_template_parity.py @@ -58,9 +58,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemTemplateOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_template_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_use_catalog_parity.py b/tools/test_item_use_catalog_parity.py index 38664bd03..afffa5f6d 100644 --- a/tools/test_item_use_catalog_parity.py +++ b/tools/test_item_use_catalog_parity.py @@ -63,9 +63,9 @@ def main(): if exports[0]!=exports[1]:raise RuntimeError('native item catalogs differ') catalog_path=build/'catalog.json';lab.write_json(catalog_path,exports[0]);fixtures=list(corpus(exports[0]));inputs=build/'inputs.txt' ;inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,catalog_path];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_use_catalog_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_use_lifecycle_parity.py b/tools/test_item_use_lifecycle_parity.py index 0c3c4ee6e..da98d029f 100644 --- a/tools/test_item_use_lifecycle_parity.py +++ b/tools/test_item_use_lifecycle_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseLifecycleOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_use_lifecycle_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_use_parity.py b/tools/test_item_use_parity.py index f69d49e35..b05a2056e 100644 --- a/tools/test_item_use_parity.py +++ b/tools/test_item_use_parity.py @@ -66,9 +66,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_use_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_item_use_start_parity.py b/tools/test_item_use_start_parity.py index e59945e82..f65589b2b 100644 --- a/tools/test_item_use_start_parity.py +++ b/tools/test_item_use_start_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseStartOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'item_use_start_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_java_hash_map_parity.py b/tools/test_java_hash_map_parity.py index 5ae1cce41..3147a5ed3 100644 --- a/tools/test_java_hash_map_parity.py +++ b/tools/test_java_hash_map_parity.py @@ -73,9 +73,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaJavaHashMapOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'java_hash_map_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_java_identity_map_parity.py b/tools/test_java_identity_map_parity.py index 9e9f04c1d..97300b98d 100644 --- a/tools/test_java_identity_map_parity.py +++ b/tools/test_java_identity_map_parity.py @@ -67,9 +67,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaJavaIdentityMapOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_level_place_parity.py b/tools/test_level_place_parity.py index 18e90e348..0089c0ef5 100644 --- a/tools/test_level_place_parity.py +++ b/tools/test_level_place_parity.py @@ -105,7 +105,7 @@ def main(): subprocess.run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaBlockPlacementOracle', str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')], check=True) - subprocess.run(['cargo', 'run', '-q', '-j2', '--release', '-p', 'horizon-world', '--example', 'probe', '--', + subprocess.run(['cargo', 'run', '-q', '-j2', '--release', '-p', 'horizon-world', '--example', 'world_probe', '--', 'level_place_fixture', str(resources), str(work / 'cases.jsonl'), str(work / 'rust.txt')], check=True, cwd=lab.ROOT) native = (work / 'native.txt').read_text().splitlines() rust = (work / 'rust.txt').read_text().splitlines() diff --git a/tools/test_level_shape_parity.py b/tools/test_level_shape_parity.py index c86f51fe6..8a5d7de48 100644 --- a/tools/test_level_shape_parity.py +++ b/tools/test_level_shape_parity.py @@ -80,7 +80,7 @@ def main(): subprocess.run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaLevelShapeOracle', str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')], check=True) - subprocess.run(['cargo', 'run', '-q', '-j2', '--release', '-p', 'horizon-world', '--example', 'probe', '--', + subprocess.run(['cargo', 'run', '-q', '-j2', '--release', '-p', 'horizon-world', '--example', 'world_probe', '--', 'level_shape_fixture', str(resources), str(work / 'cases.jsonl'), str(work / 'rust.txt')], check=True, cwd=lab.ROOT) native = (work / 'native.txt').read_text().splitlines() rust = (work / 'rust.txt').read_text().splitlines() diff --git a/tools/test_light_parity.py b/tools/test_light_parity.py index 3ed2351fa..bcac482da 100755 --- a/tools/test_light_parity.py +++ b/tools/test_light_parity.py @@ -92,7 +92,7 @@ def main(): dimension = run / 'world' for extra in (['--chunks', '0', '0', '2', '3'], ['--incremental', '100']): status = subprocess.run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', - '--example', 'probe', '--', 'light_parity', str(RESOURCES), str(dimension), *extra], + '--example', 'client_probe', '--', 'light_parity', str(RESOURCES), str(dimension), *extra], cwd=ROOT).returncode if status: sys.exit('light mismatch against vanilla') diff --git a/tools/test_liquid_collision_parity.py b/tools/test_liquid_collision_parity.py index 6a4ca638b..ab926d329 100644 --- a/tools/test_liquid_collision_parity.py +++ b/tools/test_liquid_collision_parity.py @@ -70,9 +70,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'collision_context_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_live_attribute_updates_parity.py b/tools/test_live_attribute_updates_parity.py index 1e05f4bae..d1af16569 100644 --- a/tools/test_live_attribute_updates_parity.py +++ b/tools/test_live_attribute_updates_parity.py @@ -160,9 +160,9 @@ def main(): inputs.write_text(''.join(json.dumps(row, separators=(',', ':')) + '\n' for row in fixtures), encoding='utf-8') fixture_paths = [inputs, build / 'catalog.json', build / 'catalog-client.json', build / 'catalog-server.json'] tested_fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('world_probe.exe' if os.name=='nt' else 'world_probe') references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_live_attributes_parity.py b/tools/test_live_attributes_parity.py index f221fa27e..ead22f825 100644 --- a/tools/test_live_attributes_parity.py +++ b/tools/test_live_attributes_parity.py @@ -132,9 +132,9 @@ def main(): inputs.write_text(''.join(json.dumps(row, separators=(',', ':')) + '\n' for row in fixtures), encoding='utf-8') fixture_paths = [inputs, build / 'catalog.json', build / 'catalog-client.json', build / 'catalog-server.json'] tested_fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('world_probe.exe' if os.name=='nt' else 'world_probe') references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_living_air_parity.py b/tools/test_living_air_parity.py index 4d837f02a..3a2b61b00 100644 --- a/tools/test_living_air_parity.py +++ b/tools/test_living_air_parity.py @@ -81,9 +81,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingAirOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_air_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_damage_parity.py b/tools/test_living_damage_parity.py index ae97c4686..a98fde028 100644 --- a/tools/test_living_damage_parity.py +++ b/tools/test_living_damage_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingDamageOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_damage_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_fall_parity.py b/tools/test_living_fall_parity.py index db55b5728..0f0638a17 100644 --- a/tools/test_living_fall_parity.py +++ b/tools/test_living_fall_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingFallOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_fall_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_fluid_parity.py b/tools/test_living_fluid_parity.py index 19748fef2..fdda42e8c 100644 --- a/tools/test_living_fluid_parity.py +++ b/tools/test_living_fluid_parity.py @@ -77,9 +77,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingFluidOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_fluid_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_health_parity.py b/tools/test_living_health_parity.py index ab97d0061..c083e2ae5 100644 --- a/tools/test_living_health_parity.py +++ b/tools/test_living_health_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingHealthOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_health_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_hurt_parity.py b/tools/test_living_hurt_parity.py index 38ade5720..6d6bb2a2d 100644 --- a/tools/test_living_hurt_parity.py +++ b/tools/test_living_hurt_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingHurtOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_hurt_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_landing_parity.py b/tools/test_living_landing_parity.py index eb65800da..c6fcae689 100644 --- a/tools/test_living_landing_parity.py +++ b/tools/test_living_landing_parity.py @@ -66,9 +66,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingLandingOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_landing_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_living_motion_parity.py b/tools/test_living_motion_parity.py index 39935303c..fb054b65f 100644 --- a/tools/test_living_motion_parity.py +++ b/tools/test_living_motion_parity.py @@ -80,9 +80,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingMotionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'living_motion_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_local_input_parity.py b/tools/test_local_input_parity.py index adfea1a4b..c50087138 100644 --- a/tools/test_local_input_parity.py +++ b/tools/test_local_input_parity.py @@ -44,9 +44,9 @@ def main(): classes=build/'classes';classes.mkdir(exist_ok=True) dependencies=os.pathsep.join(map(str,[jars['client'],*libraries])) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',dependencies,'-d',classes,oracle],'compile-java') - run(['cargo','build','--locked','-p','horizon-client','--example','probe'],'compile-rust') + run(['cargo','build','--locked','-p','horizon-client','--example','client_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) - binary=Path(metadata['target_directory'])/'debug/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'debug/examples'/('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary,'input_probe',inputs,build/'rust.txt'],'rust') run(['java','-Xmx768M','-cp',str(classes)+os.pathsep+dependencies,'dev.horizonlab.parity.VanillaLocalInputOracle',inputs,build/'client.txt'],'client') matched=base.compare(build/'client.txt',build/'rust.txt') diff --git a/tools/test_material_condition_parity.py b/tools/test_material_condition_parity.py index adddd336b..414ce3b97 100644 --- a/tools/test_material_condition_parity.py +++ b/tools/test_material_condition_parity.py @@ -293,9 +293,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,anchor_oracle,biome_oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"material_condition_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_material_extension_parity.py b/tools/test_material_extension_parity.py index 4036ecc37..66debf973 100644 --- a/tools/test_material_extension_parity.py +++ b/tools/test_material_extension_parity.py @@ -67,8 +67,8 @@ def main(): with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependencies=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') - metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'material_extension_fixture',build],'rust');references=[] + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'material_extension_fixture',build],'rust');references=[] for side,jar in jars.items(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaMaterialExtensionOracle',side,build],side) reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt');references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched});print(f'{side}: {matched:,} material-extension output lines match Rust',flush=True) diff --git a/tools/test_material_rule_library_parity.py b/tools/test_material_rule_library_parity.py index 1e9b82357..6b4b26c63 100644 --- a/tools/test_material_rule_library_parity.py +++ b/tools/test_material_rule_library_parity.py @@ -79,8 +79,8 @@ def main(): if facts!=json.loads((build/'facts-client.json').read_text()):raise ValueError('reference block metadata differs') fixtures=list(corpus(bundle['rules'],bundle['biomes']));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'facts-client.json',build/'facts-server.json',*[build/(field+'.json') for field in bundle]];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') - metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'material_condition_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,'VanillaMaterialConditionOracle',side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_material_stage_parity.py b/tools/test_material_stage_parity.py index 46bb4649b..a22f68697 100644 --- a/tools/test_material_stage_parity.py +++ b/tools/test_material_stage_parity.py @@ -132,7 +132,7 @@ def main(): f['top_queries']=top_queries(f);f['carving']=carving_fixture(f,facts) inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') fixture_paths=[inputs,*preset_exports,build/'facts-client.json',build/'facts-server.json',*[build/(name+'.json') for name in bundle]];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'material_stage_fixture',build],'rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'material_stage_fixture',build],'rust') with (build/'rust.txt').open() as stream: if any((line.startswith('surface ') or line.startswith('top ') or line.startswith('carving ') or line.startswith('generatedcarving ')) and line.endswith(' error\n') for line in stream):raise AssertionError('valid surface fixture failed; inspect private Rust log') references=[] diff --git a/tools/test_material_surface_parity.py b/tools/test_material_surface_parity.py index 120decbe7..b4fa34f6d 100644 --- a/tools/test_material_surface_parity.py +++ b/tools/test_material_surface_parity.py @@ -52,9 +52,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"material_surface_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_mob_ai_parity.py b/tools/test_mob_ai_parity.py index ccc50b302..bd8802143 100644 --- a/tools/test_mob_ai_parity.py +++ b/tools/test_mob_ai_parity.py @@ -477,7 +477,7 @@ def main(): 'dev.horizonlab.parity.VanillaMobAiOracle', inputs, build / 'vanilla.txt', world], build, 'vanilla', timeout=3600) if not args.java_only: - command = ['cargo', 'build', '--locked', '--release', '-p', 'horizon-client', '--example', 'probe'] + command = ['cargo', 'build', '--locked', '--release', '-p', 'horizon-client', '--example', 'client_probe'] target, env = lab.cargo_target(), None if args.trace: target = lab.LOCAL / 'mob-ai-trace-target' @@ -485,7 +485,7 @@ def main(): env = dict(os.environ, CARGO_TARGET_DIR=str(target), CARGO_PROFILE_RELEASE_DEBUG='line-tables-only', CARGO_PROFILE_RELEASE_LTO='false', CARGO_PROFILE_RELEASE_CODEGEN_UNITS='16') oracle_harness.run_logged(command, build, 'compile-rust', env=env) - binary = target / 'release/examples/probe' + binary = target / 'release/examples/client_probe' oracle_harness.run_logged([binary, 'mob_ai_probe', lab.RESOURCES, inputs, build / 'horizon.txt'], build, 'horizon') if args.java_only: return diff --git a/tools/test_mob_attributes_parity.py b/tools/test_mob_attributes_parity.py index 6cefdc4b8..7fa1df5e6 100755 --- a/tools/test_mob_attributes_parity.py +++ b/tools/test_mob_attributes_parity.py @@ -62,8 +62,8 @@ def main(): subprocess.run(list(map(str, cmd)), cwd=lab.ROOT, check=True, timeout=3600, stdout=log, stderr=subprocess.STDOUT) run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx1G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaMobAttributesOracle', build / 'vanilla.txt'], 'java') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') - binary = lab.cargo_target() / 'release/examples/probe' + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') + binary = lab.cargo_target() / 'release/examples/client_probe' resources = lab.RESOURCES run([binary, 'mob_attributes_fixture', resources, build / 'rust.txt'], 'rust') vanilla, rust = parse(build / 'vanilla.txt'), parse(build / 'rust.txt') diff --git a/tools/test_movement_emission_parity.py b/tools/test_movement_emission_parity.py index 7db2c16d0..5307cd600 100644 --- a/tools/test_movement_emission_parity.py +++ b/tools/test_movement_emission_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaMovementEmissionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'movement_emission_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_movement_registry_parity.py b/tools/test_movement_registry_parity.py index 190c34d37..732664f3a 100644 --- a/tools/test_movement_registry_parity.py +++ b/tools/test_movement_registry_parity.py @@ -69,9 +69,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'registry-info.json', 'movement-properties.nbt', 'block-registry.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'movement_registry_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_movement_support_parity.py b/tools/test_movement_support_parity.py index 793804a9e..1d6a53c1f 100644 --- a/tools/test_movement_support_parity.py +++ b/tools/test_movement_support_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaMovementSupportOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'movement_support_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_native_scene_collision.py b/tools/test_native_scene_collision.py index 8efc6946b..2c292b28d 100644 --- a/tools/test_native_scene_collision.py +++ b/tools/test_native_scene_collision.py @@ -82,9 +82,9 @@ def main(): dependencies = os.pathsep.join(map(str, libraries)) run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') - run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - executable = Path(metadata['target_directory'])/'debug/examples'/('probe.exe' if os.name=='nt' else 'probe') + executable = Path(metadata['target_directory'])/'debug/examples'/('client_probe.exe' if os.name=='nt' else 'client_probe') cases = [] for radius in [1, 2]: build = root/str(radius); build.mkdir(exist_ok=True) diff --git a/tools/test_native_scene_motion.py b/tools/test_native_scene_motion.py index a917d7337..08af5330c 100644 --- a/tools/test_native_scene_motion.py +++ b/tools/test_native_scene_motion.py @@ -807,9 +807,9 @@ def main(): damage_dir=build/'damage';damage_dir.mkdir(exist_ok=True) for target, source in [('types.json','damage-types.json'),('tags.json','damage-tags.json')]: (damage_dir/target).write_bytes((resources/source).read_bytes()) - run(['cargo','build','--locked','-p','horizon-client','--example','probe'],'compile-rust') + run(['cargo','build','--locked','-p','horizon-client','--example','client_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) - binary=Path(metadata['target_directory'])/'debug/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'debug/examples'/('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary,'scene_motion_probe',resources,build,'--describe'],'describe') references=[] for side,jar in jars.items(): diff --git a/tools/test_natural_spawn_parity.py b/tools/test_natural_spawn_parity.py index 3c95e6ac2..50781eca7 100644 --- a/tools/test_natural_spawn_parity.py +++ b/tools/test_natural_spawn_parity.py @@ -568,9 +568,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust') vanilla = (build / 'server.txt').read_text().splitlines() errors = [l for l in vanilla if ' error ' in l] diff --git a/tools/test_nether_portal_parity.py b/tools/test_nether_portal_parity.py index 71cbf7be8..0805c985c 100644 --- a/tools/test_nether_portal_parity.py +++ b/tools/test_nether_portal_parity.py @@ -145,7 +145,7 @@ def main(): '-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaPortalOracle.java')]) h.run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaPortalOracle', str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')]) - h.run(['cargo', 'run', '-q', '--release', '-p', 'horizon-world', '--example', 'probe', '--', + h.run(['cargo', 'run', '-q', '--release', '-p', 'horizon-world', '--example', 'world_probe', '--', 'portal_travel_fixture', str(resources), str(work / 'cases.jsonl'), str(work / 'rust.txt')], cwd=lab.ROOT) native = h.split_cases((work / 'native.txt').read_text(), ()) rust = h.split_cases((work / 'rust.txt').read_text(), ()) diff --git a/tools/test_object_open_map_parity.py b/tools/test_object_open_map_parity.py index 72bafc1a4..1dc7d255f 100644 --- a/tools/test_object_open_map_parity.py +++ b/tools/test_object_open_map_parity.py @@ -128,9 +128,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaObjectOpenMapOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'object_open_map_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_object_open_set_parity.py b/tools/test_object_open_set_parity.py index 3801cdb60..3eda39fe8 100644 --- a/tools/test_object_open_set_parity.py +++ b/tools/test_object_open_set_parity.py @@ -77,9 +77,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaObjectOpenSetOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'object_open_set_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_pack_selection_parity.py b/tools/test_pack_selection_parity.py index 9af372d1e..0bca824fa 100644 --- a/tools/test_pack_selection_parity.py +++ b/tools/test_pack_selection_parity.py @@ -71,7 +71,7 @@ def main(): *(PARITY / f'{n}.java' for n in ('ParityData', 'VanillaPackSelectionOracle'))], 'compile-java') run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaPackSelectionOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'pack_selection_fixture', inputs, build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] diff --git a/tools/test_piston_movement_parity.py b/tools/test_piston_movement_parity.py index 82bcd09ca..cfed8950a 100644 --- a/tools/test_piston_movement_parity.py +++ b/tools/test_piston_movement_parity.py @@ -60,9 +60,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPistonMovementOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'piston_movement_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_piston_shape_parity.py b/tools/test_piston_shape_parity.py index 74ae48e39..85fdac770 100644 --- a/tools/test_piston_shape_parity.py +++ b/tools/test_piston_shape_parity.py @@ -63,9 +63,9 @@ def main(): if len(facts['states'])!=35723:raise ValueError('incomplete pinned registry') fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'facts.json',build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'piston_shape_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_placement_parity.py b/tools/test_placement_parity.py index d4e84eaf8..f02daac8e 100644 --- a/tools/test_placement_parity.py +++ b/tools/test_placement_parity.py @@ -108,9 +108,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"placement_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_player_equipment_parity.py b/tools/test_player_equipment_parity.py index 5f2499eab..4b2408e5d 100644 --- a/tools/test_player_equipment_parity.py +++ b/tools/test_player_equipment_parity.py @@ -62,9 +62,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerEquipmentOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'player_equipment_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_player_food_parity.py b/tools/test_player_food_parity.py index ff38abe39..e94de7644 100644 --- a/tools/test_player_food_parity.py +++ b/tools/test_player_food_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerFoodOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'player_food_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_player_health_parity.py b/tools/test_player_health_parity.py index 256ffdf46..ff5a795ef 100644 --- a/tools/test_player_health_parity.py +++ b/tools/test_player_health_parity.py @@ -58,9 +58,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerHealthOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json',build/'ids.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'player_health_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_player_hurt_parity.py b/tools/test_player_hurt_parity.py index 34ce6a9dd..23100bcab 100644 --- a/tools/test_player_hurt_parity.py +++ b/tools/test_player_hurt_parity.py @@ -82,9 +82,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerHurtOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'player_hurt_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_player_inventory_parity.py b/tools/test_player_inventory_parity.py index 10f6af812..3447eb7d0 100644 --- a/tools/test_player_inventory_parity.py +++ b/tools/test_player_inventory_parity.py @@ -68,9 +68,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerInventoryOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'player_inventory_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_player_travel_parity.py b/tools/test_player_travel_parity.py index 9b96ba8e8..193c290e5 100644 --- a/tools/test_player_travel_parity.py +++ b/tools/test_player_travel_parity.py @@ -66,9 +66,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerTravelOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'player_travel_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_powder_snow_collision_parity.py b/tools/test_powder_snow_collision_parity.py index 10c287cc5..edca02018 100644 --- a/tools/test_powder_snow_collision_parity.py +++ b/tools/test_powder_snow_collision_parity.py @@ -62,9 +62,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'collision_context_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_raid_parity.py b/tools/test_raid_parity.py index be1ed7e25..4928c9715 100644 --- a/tools/test_raid_parity.py +++ b/tools/test_raid_parity.py @@ -335,9 +335,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaRaidOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'raid_fixture', resources, inputs, build / 'rust.txt'], 'rust') vanilla = (build / 'server.txt').read_text().splitlines() errors = [l for l in vanilla if ' error ' in l] diff --git a/tools/test_registered_entity_fluid_parity.py b/tools/test_registered_entity_fluid_parity.py index ff7a83eb6..47970f63e 100644 --- a/tools/test_registered_entity_fluid_parity.py +++ b/tools/test_registered_entity_fluid_parity.py @@ -67,7 +67,7 @@ def main(): with (build/'inputs.txt').open('w') as output: for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 fixture_paths=[build/n for n in ['inputs.txt','facts.json','fluid-info.json','block-registry.nbt','cached-support.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'entity_fluid_fixture',build],'rust');references=[] + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'entity_fluid_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered entity fluid output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) diff --git a/tools/test_registered_player_combat_parity.py b/tools/test_registered_player_combat_parity.py index eecb6e6cf..c1f0c502b 100644 --- a/tools/test_registered_player_combat_parity.py +++ b/tools/test_registered_player_combat_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaRegisteredPlayerCombatOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'catalog.json').read_text());damage=json.loads((damage_dir/'catalog.json').read_text());fixtures=list(corpus(states,damage));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json',build/'ids.json',build/'slots.json',build/'head.json',damage_dir/'catalog.json',damage_dir/'types.json',damage_dir/'tags.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'registered_player_combat_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_registry_collision_scan_parity.py b/tools/test_registry_collision_scan_parity.py index 5b40d7285..bd6b4ce23 100644 --- a/tools/test_registry_collision_scan_parity.py +++ b/tools/test_registry_collision_scan_parity.py @@ -96,9 +96,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'registry_collision_scan_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_registry_fall_ray_parity.py b/tools/test_registry_fall_ray_parity.py index a7639c3ab..dbd560dc5 100644 --- a/tools/test_registry_fall_ray_parity.py +++ b/tools/test_registry_fall_ray_parity.py @@ -61,7 +61,7 @@ def main(): with (build/'inputs.txt').open('w') as output: for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt','interaction-shapes.nbt','tags.json','fluid-tags.json','bound-tags.json']];fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'registry_fall_ray_fixture',build],'rust');references=[] + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'registry_fall_ray_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered fall-ray output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) diff --git a/tools/test_registry_fluid_parity.py b/tools/test_registry_fluid_parity.py index fd0fb106b..f767850cb 100644 --- a/tools/test_registry_fluid_parity.py +++ b/tools/test_registry_fluid_parity.py @@ -62,7 +62,7 @@ def main(): with (build/'inputs.txt').open('w') as output: for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 fixture_paths=[build/n for n in ['inputs.txt','facts.json','fluid-info.json','block-registry.nbt','cached-support.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'registry_fluid_fixture',build],'rust');references=[] + run(['cargo','build','--locked','--release','-p','horizon-world','--example','world_probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe');run([binary,'registry_fluid_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registry_fluid output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) diff --git a/tools/test_replace_block_parity.py b/tools/test_replace_block_parity.py index e96bf4c72..84ab56999 100644 --- a/tools/test_replace_block_parity.py +++ b/tools/test_replace_block_parity.py @@ -68,9 +68,9 @@ def main(): fixtures=list(corpus(facts));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") fixture_paths.append(inputs) tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"replace_block_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_restitution_parity.py b/tools/test_restitution_parity.py index ada050a13..d5497e2d0 100644 --- a/tools/test_restitution_parity.py +++ b/tools/test_restitution_parity.py @@ -62,9 +62,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaRestitutionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'restitution_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_retrogen_chunk_parity.py b/tools/test_retrogen_chunk_parity.py index 9a13e1303..452d42d5b 100644 --- a/tools/test_retrogen_chunk_parity.py +++ b/tools/test_retrogen_chunk_parity.py @@ -74,9 +74,9 @@ def main(): (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"chunk_stage_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_retrogen_data_parity.py b/tools/test_retrogen_data_parity.py index 242f3b5d3..6d03ab9a3 100644 --- a/tools/test_retrogen_data_parity.py +++ b/tools/test_retrogen_data_parity.py @@ -46,9 +46,9 @@ def main(): with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependencies=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'retrogen_data_fixture',inputs,build/'rust.txt'],'rust') references=[] for side,jar in jars.items(): diff --git a/tools/test_rule_test_parity.py b/tools/test_rule_test_parity.py index 8fef86b95..bb03397c1 100644 --- a/tools/test_rule_test_parity.py +++ b/tools/test_rule_test_parity.py @@ -73,9 +73,9 @@ def main(): if len(facts['states'])!=35723:raise ValueError('incomplete pinned state registry') fixtures=list(corpus(facts,tags));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'tags.json',build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'rule_test_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_scaffolding_collision_parity.py b/tools/test_scaffolding_collision_parity.py index bebd63087..c71ffe7a3 100644 --- a/tools/test_scaffolding_collision_parity.py +++ b/tools/test_scaffolding_collision_parity.py @@ -55,9 +55,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'collision_context_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_scattered_ore_parity.py b/tools/test_scattered_ore_parity.py index 0cbb6fcac..eba6723d2 100644 --- a/tools/test_scattered_ore_parity.py +++ b/tools/test_scattered_ore_parity.py @@ -69,9 +69,9 @@ def main(): fixtures=list(corpus(facts));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") fixture_paths.append(inputs) tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"scattered_ore_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_scoreboard_parity.py b/tools/test_scoreboard_parity.py index db308d861..b38dfb301 100644 --- a/tools/test_scoreboard_parity.py +++ b/tools/test_scoreboard_parity.py @@ -250,9 +250,9 @@ def main(): inputs = build / 'inputs.jsonl' inputs.write_text(''.join(json.dumps(c, ensure_ascii=False) + '\n' for c in chosen), encoding='utf-8') run([*oracle, 'run', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary, 'scoreboard_fixture',build / 'registries.json', inputs, build / 'rust.jsonl', build / 'vanilla.jsonl'], 'rust') read = lambda p: [json.loads(l) for l in p.read_text(encoding='utf-8').splitlines()] vanilla, rust = read(build / 'vanilla.jsonl'), read(build / 'rust.jsonl') diff --git a/tools/test_section_mesh_parity.py b/tools/test_section_mesh_parity.py index 65878bc97..a5471618f 100644 --- a/tools/test_section_mesh_parity.py +++ b/tools/test_section_mesh_parity.py @@ -502,9 +502,9 @@ def main(): dependencies = os.pathsep.join(map(str, [jars['client'], *baking.client_libraries()])) run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'), '-cp', dependencies, '-d', classes, oracle, *helpers], 'compile-java') env_jobs = os.environ.get('CARGO_BUILD_JOBS', '3') - run(['cargo', 'build', '--locked', '--profile', 'fast', '-j', env_jobs, '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--profile', 'fast', '-j', env_jobs, '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory']) / 'fast/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'fast/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') java = ['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaSectionMeshOracle'] run([binary, 'section_mesh_fixture',resources, inputs, BUILD / 'rust.jsonl'], 'rust') run([*java, inputs, BUILD / 'client.jsonl', resources], 'client') diff --git a/tools/test_server_player_combat_parity.py b/tools/test_server_player_combat_parity.py index 161c4cbcf..a18dd61c6 100644 --- a/tools/test_server_player_combat_parity.py +++ b/tools/test_server_player_combat_parity.py @@ -77,9 +77,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaServerPlayerCombatOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json',build/'ids.json',build/'slots.json',build/'head.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'server_player_combat_fixture',build],'rust') run([binary,'server_player_combat_fixture',build,'--live'],'rust-live') base.compare(build/'rust.txt',build/'rust-live.txt');references=[] diff --git a/tools/test_server_player_damage_parity.py b/tools/test_server_player_damage_parity.py index 8e1418f4e..61a9271da 100644 --- a/tools/test_server_player_damage_parity.py +++ b/tools/test_server_player_damage_parity.py @@ -62,9 +62,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaServerPlayerDamageOracle',mode,path],side+'-'+mode) java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs,build/'catalog.json',build/'ids.json',build/'slots.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'server_player_damage_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_simple_block_parity.py b/tools/test_simple_block_parity.py index 3af85a241..697a94673 100644 --- a/tools/test_simple_block_parity.py +++ b/tools/test_simple_block_parity.py @@ -116,8 +116,8 @@ def run(corpus, build_name, source_file, scope): with inputs.open('w',encoding='utf-8') as output: for fixture in corpus(facts,placement):output.write(json.dumps(fixture,separators=(',',':'))+'\n');fixture_count+=1 fixtures=[inputs,*sorted(build.glob('*.nbt')),*[p for p in sorted(build.glob('*.json')) if p.name!='report.json']];tested_fixtures=base.source_hashes(fixtures);print(f'Prepared {fixture_count:,} placement fixtures',flush=True) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') - metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'simple_block_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);matched=base.compare(build/(side+'.txt'),build/'rust.txt');print(f'{side}: {matched:,} {label} output lines match Rust',flush=True) diff --git a/tools/test_simple_container_parity.py b/tools/test_simple_container_parity.py index 0af91292a..6319db7e3 100644 --- a/tools/test_simple_container_parity.py +++ b/tools/test_simple_container_parity.py @@ -70,9 +70,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSimpleContainerOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'simple_container_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_spawn_rules_parity.py b/tools/test_spawn_rules_parity.py index 19bd8db46..7f9ac07ce 100644 --- a/tools/test_spawn_rules_parity.py +++ b/tools/test_spawn_rules_parity.py @@ -155,9 +155,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx2G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaSpawnRulesOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'spawn_rules_fixture', resources, inputs, build / 'rust.txt'], 'rust') vanilla = (build / 'server.txt').read_text().splitlines() errors = [l for l in vanilla if ' error ' in l] diff --git a/tools/test_spawner_parity.py b/tools/test_spawner_parity.py index 5aa9029e3..187e211b7 100644 --- a/tools/test_spawner_parity.py +++ b/tools/test_spawner_parity.py @@ -249,9 +249,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust') vanilla = (build / 'server.txt').read_text().splitlines() errors = [l for l in vanilla if ' error ' in l] diff --git a/tools/test_sprint_input_parity.py b/tools/test_sprint_input_parity.py index 0ac515e44..b2b86b7c2 100644 --- a/tools/test_sprint_input_parity.py +++ b/tools/test_sprint_input_parity.py @@ -49,9 +49,9 @@ def main(): classes=build/'classes';classes.mkdir(exist_ok=True) dependencies=os.pathsep.join(map(str,[jars['client'],*libraries])) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',dependencies,'-d',classes,oracle],'compile-java') - run(['cargo','build','--locked','-p','horizon-client','--example','probe'],'compile-rust') + run(['cargo','build','--locked','-p','horizon-client','--example','client_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) - binary=Path(metadata['target_directory'])/'debug/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'debug/examples'/('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary,'sprint_probe',inputs,build/'rust.txt'],'rust') run(['java','-Xmx768M','-cp',str(classes)+os.pathsep+dependencies,'dev.horizonlab.parity.VanillaSprintInputOracle',inputs,build/'client.txt'],'client') matched=base.compare(build/'client.txt',build/'rust.txt') diff --git a/tools/test_state_provider_parity.py b/tools/test_state_provider_parity.py index 9f7523273..42f2a4526 100644 --- a/tools/test_state_provider_parity.py +++ b/tools/test_state_provider_parity.py @@ -371,9 +371,9 @@ def main(): output.write(json.dumps(fixture,separators=(',',':'))+'\n') fixture_count+=1;requested_samples+=len(fixture['states'])*fixture['repeats']*2 fixture_paths=[inputs,build/'survival-extra-definitions.json',build/'survival-placement-classes.json',build/'survival-support-tags.json',build/'survival-classes.json',build/'survival-rules.json',build/'cached-support.nbt',build/'support-cached-states.json',build/'block-properties.nbt',build/'cached-collision.nbt',build/'biomes.json',build/'biome_tags.json',build/'fluid-tags.json',build/'catalog.json',build/'providers.json',build/'tags.json',build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') counts={'block_states':len(facts['states']),'blocks':len(facts['defaults']),'integer_properties':len(facts['integers']),'codec_inputs':fixture_count,'provider_types':10,'named_providers':len(catalog_resources),'rule_predicate_types':16,'survival_supported_blocks':len(survival_rules),'survival_supported_states':sum(s['id'] in survival_rules for s in facts['states']),'support_cached_states':len(support_states),'support_dynamic_states':len(facts['states'])-len(support_states),'biomes':len(biomes),'biome_tag_files':len(biome_tags),'fluid_tag_files':len(fluid_tags),'bundled_provider_definitions':len(provider_resources),'block_tag_files':len(tags),'requested_samples':requested_samples} base.ensure_sources_unchanged(sources,tested_sources) checkpoint={'schema':1,'environment':environment,'sources_sha256':tested_sources,'fixtures_sha256':{str(lab.ROOT/name):digest for name,digest in tested_fixtures.items()},'artifacts_sha256':{str(path):lab.digest(path,'sha256') for path in [binary,*sorted(classes.rglob('*.class'))]},'binary':str(binary),'counts':counts,'outputs':{}} diff --git a/tools/test_status_effect_parity.py b/tools/test_status_effect_parity.py index 6f369c683..899b63f66 100644 --- a/tools/test_status_effect_parity.py +++ b/tools/test_status_effect_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaStatusEffectOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'status_effect_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_status_tick_parity.py b/tools/test_status_tick_parity.py index 40786fe3c..bc582ff4a 100644 --- a/tools/test_status_tick_parity.py +++ b/tools/test_status_tick_parity.py @@ -58,9 +58,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaStatusTickOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'status_tick_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_stepped_interpolation_parity.py b/tools/test_stepped_interpolation_parity.py index e5586c981..5029befd3 100644 --- a/tools/test_stepped_interpolation_parity.py +++ b/tools/test_stepped_interpolation_parity.py @@ -94,7 +94,7 @@ def main(): 'dev.horizonlab.parity.VanillaSteppedInterpolationOracle', str(events), str(build / 'vanilla.txt')], check=True) subprocess.run(['cargo', 'run', '--quiet', '--release', '-p', 'horizon-world', '--example', - 'probe', '--', 'stepped_interpolation_fixture', str(events), str(build / 'rust.txt')], cwd=lab.ROOT, check=True) + 'world_probe', '--', 'stepped_interpolation_fixture', str(events), str(build / 'rust.txt')], cwd=lab.ROOT, check=True) matched = base.compare(build / 'vanilla.txt', build / 'rust.txt') print(f'Stepped interpolation parity passed: {matched} entity positions and rotations match vanilla') diff --git a/tools/test_stored_consume_parity.py b/tools/test_stored_consume_parity.py index 3ddfed86a..8837e6f00 100644 --- a/tools/test_stored_consume_parity.py +++ b/tools/test_stored_consume_parity.py @@ -66,9 +66,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaStoredConsumeOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_stored_effect_attributes_parity.py b/tools/test_stored_effect_attributes_parity.py index 2a8fe799d..84c86b27a 100644 --- a/tools/test_stored_effect_attributes_parity.py +++ b/tools/test_stored_effect_attributes_parity.py @@ -94,9 +94,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaStoredEffectAttributesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_stored_effect_notifications_parity.py b/tools/test_stored_effect_notifications_parity.py index 6a0cee403..945d11247 100644 --- a/tools/test_stored_effect_notifications_parity.py +++ b/tools/test_stored_effect_notifications_parity.py @@ -73,9 +73,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaStoredEffectNotificationsOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') references=[] for side,jar in jars.items(): java(side,side,build) diff --git a/tools/test_structure_density_parity.py b/tools/test_structure_density_parity.py index ad15790e0..b6cd9c8fe 100644 --- a/tools/test_structure_density_parity.py +++ b/tools/test_structure_density_parity.py @@ -68,9 +68,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"structure_density_fixture",inputs,build/"rust.txt"],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_subtitle_parity.py b/tools/test_subtitle_parity.py index 1444bb5bd..6baf25570 100644 --- a/tools/test_subtitle_parity.py +++ b/tools/test_subtitle_parity.py @@ -133,9 +133,9 @@ def main(): *(PARITY / f'{n}.java' for n in ('ParityFont', 'VanillaSubtitleOracle'))], 'compile-java') run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaSubtitleOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary, 'subtitle_fixture',resources, inputs, build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text(encoding='utf-8').splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text(encoding='utf-8').splitlines()] diff --git a/tools/test_suffocation_parity.py b/tools/test_suffocation_parity.py index ffe80b31f..046a8ec82 100644 --- a/tools/test_suffocation_parity.py +++ b/tools/test_suffocation_parity.py @@ -72,9 +72,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'suffocation_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_swimming_parity.py b/tools/test_swimming_parity.py index 574b72e5b..87d2bb034 100644 --- a/tools/test_swimming_parity.py +++ b/tools/test_swimming_parity.py @@ -51,9 +51,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSwimmingOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'swimming_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_synced_bytes_parity.py b/tools/test_synced_bytes_parity.py index a6659bf21..4d6389ffa 100644 --- a/tools/test_synced_bytes_parity.py +++ b/tools/test_synced_bytes_parity.py @@ -57,9 +57,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSyncedBytesOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'synced_bytes_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_synced_floats_parity.py b/tools/test_synced_floats_parity.py index fa7ca7132..78e8cec32 100644 --- a/tools/test_synced_floats_parity.py +++ b/tools/test_synced_floats_parity.py @@ -61,9 +61,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSyncedFloatsOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'synced_floats_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_tab_list_parity.py b/tools/test_tab_list_parity.py index 9b3c65605..4075859e7 100644 --- a/tools/test_tab_list_parity.py +++ b/tools/test_tab_list_parity.py @@ -241,12 +241,12 @@ def main(): *(PARITY / f'{n}.java' for n in ('ParityData', 'ParityFont', 'VanillaTabListOracle', 'VanillaSkinImageOracle'))], 'compile-java') run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaTabListOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'tab_list_fixture', resources, inputs, build / 'rust.jsonl'], 'rust') images = build / 'skins.txt'; images.write_text(''.join(i + '\n' for i in skin_images(args.images))) run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaSkinImageOracle', images, build / 'vanilla-skins.txt'], 'vanilla-skins') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'skin_image_fixture', images, build / 'rust-skins.txt'], 'rust-skins') vanilla_skins = (build / 'vanilla-skins.txt').read_text().splitlines() rust_skins = (build / 'rust-skins.txt').read_text().splitlines() diff --git a/tools/test_team_rules_parity.py b/tools/test_team_rules_parity.py index 5eb0c7d9d..ac66a412b 100644 --- a/tools/test_team_rules_parity.py +++ b/tools/test_team_rules_parity.py @@ -84,9 +84,9 @@ def main(): PARITY / 'VanillaTeamRulesOracle.java'], 'compile-java') run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaTeamRulesOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe') run([binary, 'team_rules_fixture',inputs, build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] diff --git a/tools/test_teleport_consume_parity.py b/tools/test_teleport_consume_parity.py index 8f51361f8..8cbc23f52 100644 --- a/tools/test_teleport_consume_parity.py +++ b/tools/test_teleport_consume_parity.py @@ -54,9 +54,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaTeleportConsumeOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'teleport_consume_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_terrain_parity.py b/tools/test_terrain_parity.py index a818dcabb..5dfcc76a2 100644 --- a/tools/test_terrain_parity.py +++ b/tools/test_terrain_parity.py @@ -99,9 +99,9 @@ def main(): (build/"registries.json").write_text(json.dumps(bundle,separators=(",",":")),encoding="utf-8") fixture_paths=[inputs,build/"registries.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"terrain_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_tick_parity.py b/tools/test_tick_parity.py index 47dd842d0..92efb89f6 100644 --- a/tools/test_tick_parity.py +++ b/tools/test_tick_parity.py @@ -163,8 +163,8 @@ def main(): completed.check_returncode() return completed.stdout data_java("server", "generate") - test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "probe"]) - fixture = Path(metadata["target_directory"]) / "release/examples" / ("probe.exe" if os.name=="nt" else "probe") + test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "world_probe"]) + fixture = Path(metadata["target_directory"]) / "release/examples" / ("world_probe.exe" if os.name=="nt" else "world_probe") test_rust_parity.run([str(fixture), "tick_fixture", str(base)]) references = [] for side, jar in jars.items(): diff --git a/tools/test_trading_parity.py b/tools/test_trading_parity.py index c26c449fb..46e81f928 100644 --- a/tools/test_trading_parity.py +++ b/tools/test_trading_parity.py @@ -219,8 +219,8 @@ def main(): if args.java_only: print(f'{len(vanilla)} oracle lines') return - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') - binary = lab.cargo_target() / 'release/examples/probe' + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') + binary = lab.cargo_target() / 'release/examples/client_probe' run([binary, 'trading_fixture', resources, inputs, build / 'server.txt', build / 'rust.txt'], 'rust') rust = (build / 'rust.txt').read_text().splitlines() bad = [(a, b) for a, b in zip(vanilla, rust) if a != b] diff --git a/tools/test_translucency_parity.py b/tools/test_translucency_parity.py index fff0390eb..22818b434 100644 --- a/tools/test_translucency_parity.py +++ b/tools/test_translucency_parity.py @@ -52,7 +52,7 @@ def main(): lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTranslucencyOracle.java'], 'compile-java') vanilla, rust = build / 'vanilla.jsonl', build / 'rust.jsonl' run(['java', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaTranslucencyOracle', inputs, vanilla], 'vanilla') - run(['cargo', 'run', '--quiet', '--locked', '--profile', args.profile, '-p', 'horizon-client', '--example', 'probe', '--', 'translucency_fixture', inputs, rust], 'rust') + run(['cargo', 'run', '--quiet', '--locked', '--profile', args.profile, '-p', 'horizon-client', '--example', 'client_probe', '--', 'translucency_fixture', inputs, rust], 'rust') expected = [json.loads(line) for line in vanilla.read_text().splitlines()] actual = [json.loads(line) for line in rust.read_text().splitlines()] assert len(expected) == len(actual), 'case count differs' diff --git a/tools/test_tree_feature_parity.py b/tools/test_tree_feature_parity.py index b3f9ace68..a99c3a52b 100644 --- a/tools/test_tree_feature_parity.py +++ b/tools/test_tree_feature_parity.py @@ -135,9 +135,9 @@ def main(): output.write(json.dumps(fixture,separators=(',',':'))+'\n');count+=1 fixtures=[inputs,*sorted(build.glob('*.nbt')),*[p for p in sorted(build.glob('*.json')) if p.name!='report.json']];tested_fixtures=fixture_hashes(fixtures) print(f'Prepared {count:,} feature fixtures',flush=True) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'tree_feature_fixture',build],'rust');references=[] for side,jar in jars.items(): java('VanillaTreeFeatureOracle',side,side,build);matched=base.compare(build/(side+'.txt'),build/'rust.txt');print(f'{side}: {matched:,} tree/ore output lines match Rust',flush=True) diff --git a/tools/test_trial_spawner_parity.py b/tools/test_trial_spawner_parity.py index bd6d69ac2..7b2412eaa 100644 --- a/tools/test_trial_spawner_parity.py +++ b/tools/test_trial_spawner_parity.py @@ -214,9 +214,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust') vanilla = (build / 'server.txt').read_text().splitlines() errors = [l for l in vanilla if ' error ' in l] diff --git a/tools/test_use_flag_reaction_parity.py b/tools/test_use_flag_reaction_parity.py index de3b5fa20..5498f3bc2 100644 --- a/tools/test_use_flag_reaction_parity.py +++ b/tools/test_use_flag_reaction_parity.py @@ -60,9 +60,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaUseFlagReactionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'use_flag_reaction_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_use_remainder_parity.py b/tools/test_use_remainder_parity.py index 853d12acb..5f7e5a160 100644 --- a/tools/test_use_remainder_parity.py +++ b/tools/test_use_remainder_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaUseRemainderOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'use_remainder_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_value_provider_parity.py b/tools/test_value_provider_parity.py index 589a97632..0c36eb4bc 100644 --- a/tools/test_value_provider_parity.py +++ b/tools/test_value_provider_parity.py @@ -74,9 +74,9 @@ def main(): with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") - run(["cargo","build","--release","-p","horizon-world","--example","probe"],"compile-rust") + run(["cargo","build","--release","-p","horizon-world","--example","world_probe"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) - binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe") + binary=Path(metadata["target_directory"])/"release/examples"/("world_probe.exe" if os.name=="nt" else "world_probe") run([binary,"value_provider_fixture",build],"rust") references=[] for side,jar in jars.items(): diff --git a/tools/test_vault_parity.py b/tools/test_vault_parity.py index 73c41e197..5741320d3 100644 --- a/tools/test_vault_parity.py +++ b/tools/test_vault_parity.py @@ -190,9 +190,9 @@ def main(): '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java') run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server') - run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) - binary = Path(metadata['target_directory']) / 'release/examples/probe' + binary = Path(metadata['target_directory']) / 'release/examples/client_probe' run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust') vanilla = (build / 'server.txt').read_text().splitlines() errors = [l for l in vanilla if ' error ' in l] diff --git a/tools/test_view_direction_parity.py b/tools/test_view_direction_parity.py index f2738dcff..6230bcdab 100644 --- a/tools/test_view_direction_parity.py +++ b/tools/test_view_direction_parity.py @@ -58,9 +58,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaViewDirectionOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'view_direction_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_water_splash_parity.py b/tools/test_water_splash_parity.py index 84f89d360..830f34907 100644 --- a/tools/test_water_splash_parity.py +++ b/tools/test_water_splash_parity.py @@ -59,9 +59,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaWaterSplashOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'water_splash_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_world_border_parity.py b/tools/test_world_border_parity.py index 618194978..01d0c1e07 100644 --- a/tools/test_world_border_parity.py +++ b/tools/test_world_border_parity.py @@ -70,9 +70,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaWorldBorderOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'world_border_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_world_border_render_parity.py b/tools/test_world_border_render_parity.py index f8c88b6a6..f064cf031 100644 --- a/tools/test_world_border_render_parity.py +++ b/tools/test_world_border_render_parity.py @@ -103,7 +103,7 @@ def main(): PARITY / 'VanillaWorldBorderRenderOracle.java'], 'compile-java') run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaWorldBorderRenderOracle', inputs, build / 'vanilla.jsonl'], 'vanilla') - run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--', + run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe', '--', 'world_border_render_fixture', inputs, build / 'rust.jsonl'], 'rust') vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()] rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()] diff --git a/tools/test_world_collision_check_parity.py b/tools/test_world_collision_check_parity.py index 3dae747d5..7c625c448 100644 --- a/tools/test_world_collision_check_parity.py +++ b/tools/test_world_collision_check_parity.py @@ -80,9 +80,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'registry_collision_scan_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_world_edge_backoff_parity.py b/tools/test_world_edge_backoff_parity.py index 10cf1316f..b4b07622a 100644 --- a/tools/test_world_edge_backoff_parity.py +++ b/tools/test_world_edge_backoff_parity.py @@ -81,9 +81,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'registry_collision_scan_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_world_movement_parity.py b/tools/test_world_movement_parity.py index 5a583ecb7..067d147a9 100644 --- a/tools/test_world_movement_parity.py +++ b/tools/test_world_movement_parity.py @@ -106,9 +106,9 @@ def main(): fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] fixtures = base.source_hashes(fixture_paths) - run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'], 'compile-rust') + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'world_probe'], 'compile-rust') metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) - binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary = Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary, 'registry_collision_scan_fixture', build], 'rust');references = [] for side, jar in jars.items(): java(side, side) diff --git a/tools/test_world_parity.py b/tools/test_world_parity.py index e2781866e..0b4a3deb7 100644 --- a/tools/test_world_parity.py +++ b/tools/test_world_parity.py @@ -51,12 +51,12 @@ def main(): print("Generating vanilla world-data fixtures...", flush=True) print(java("server", "generate").split("HORIZON_WORLD_GENERATED")[-1].strip(), flush=True) - run(["cargo", "build", "--release", "-p", "horizon-world", "--bin", "horizon-world", "--example", "probe"], base / "compile-rust.log") + run(["cargo", "build", "--release", "-p", "horizon-world", "--bin", "horizon-world", "--example", "world_probe"], base / "compile-rust.log") metadata = json.loads(run(["cargo", "metadata", "--no-deps", "--format-version", "1"])) target = Path(metadata["target_directory"]) / "release" suffix = ".exe" if os.name == "nt" else "" binary = target / ("horizon-world" + suffix) - run([target / "examples" / ("probe" + suffix), "world_fixture", base], base / "rust-fixture.log") + run([target / "examples" / ("world_probe" + suffix), "world_fixture", base], base / "rust-fixture.log") for network in [False, True]: kind = "network" if network else "nbt" output = base / "rust" / kind diff --git a/tools/test_world_ray_parity.py b/tools/test_world_ray_parity.py index 87189d611..46315b5df 100644 --- a/tools/test_world_ray_parity.py +++ b/tools/test_world_ray_parity.py @@ -60,9 +60,9 @@ def main(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaWorldRayOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'world_ray_fixture',build],'rust');references=[] for side,jar in jars.items(): java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') diff --git a/tools/test_world_spawn_parity.py b/tools/test_world_spawn_parity.py index f73da3a8c..5daa38a45 100644 --- a/tools/test_world_spawn_parity.py +++ b/tools/test_world_spawn_parity.py @@ -79,7 +79,7 @@ def origins(build, classes, dependencies, all_seeds): vanilla_out = build / 'origins-vanilla.txt' oh.run_logged(['java', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaWorldSpawnOracle', vanilla_out, *all_seeds], build, 'origins-vanilla') - rust = subprocess.run([target_dir() / 'examples/probe', 'spawn_origin', RESOURCES, *map(str, all_seeds)], + rust = subprocess.run([target_dir() / 'examples/world_probe', 'spawn_origin', RESOURCES, *map(str, all_seeds)], capture_output=True, text=True, check=True, cwd=lab.ROOT).stdout vanilla = vanilla_out.read_text() parse = lambda text: {int(l.split()[0]): tuple(map(int, l.split()[1:])) for l in text.splitlines() if l} @@ -121,7 +121,7 @@ def main(): oh.run_logged(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-nowarn', '-cp', dependencies, '-d', classes, lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldSpawnOracle.java'], build, 'compile-java') - oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'probe'], build, 'compile-probe') + oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'world_probe'], build, 'compile-probe') all_seeds = parity_shard.shard(args.seed or seeds(args.random)) started = time.time() diff --git a/tools/test_worldgen_random_parity.py b/tools/test_worldgen_random_parity.py index 29eedfa49..5371c0444 100644 --- a/tools/test_worldgen_random_parity.py +++ b/tools/test_worldgen_random_parity.py @@ -53,9 +53,9 @@ def main(): with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') - run(['cargo','build','--release','-p','horizon-world','--example','probe'],'compile-rust') + run(['cargo','build','--release','-p','horizon-world','--example','world_probe'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) - binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe') + binary=Path(metadata['target_directory'])/'release/examples'/('world_probe.exe' if os.name=='nt' else 'world_probe') run([binary,'worldgen_random_fixture',build],'rust');references=[] for side,jar in jars.items(): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaWorldgenRandomOracle',side,build],side)