From 60d9bffc8682c8d4ebe12471b1de17c430db86ec Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 14 Oct 2026 22:04:45 +0200 Subject: [PATCH] Water cancels the player's fall damage (#180) The player's movement treated every fluid as empty: is_in_water was always false, LivingEntity.checkFallDamage's updateFluidInteraction was a no-op and Entity.move's fall-reset ray ignored water. A player landing in water (or a waterlogged block, a bubble column, kelp) still took the whole fall. Bind vanilla's Entity.updateFluidInteraction to the player over the existing horizon-world kernels (EntityFluidInteraction heights, eyes and currents, entity_fluid_tick, water_splash, fluid_flow): run it in the base tick and from checkFallDamage, read wasTouchingWater for isInWater, query the water's (first-query cached) shape in the FALLDAMAGE_RESETTING ray, halve the fall in lava after the first tick, and play the splash sound with bubble and splash particles. The scene motion harness gains water/lava fixtures (fluid_tick plus scripted falls through the real Entity.move) against the real vanilla updateFluidInteraction with the #water/#lava tags bound. Co-Authored-By: Claude Opus 5.5 --- .../examples/scene_motion_probe.rs | 40 ++- crates/horizon-client/src/game.rs | 31 ++ crates/horizon-client/src/landing.rs | 6 +- crates/horizon-client/src/motion.rs | 42 ++- crates/horizon-client/src/motion/fluids.rs | 330 ++++++++++++++++++ .../parity/VanillaSceneMotionOracle.java | 40 ++- tools/test_native_scene_motion.py | 119 ++++++- 7 files changed, 584 insertions(+), 24 deletions(-) create mode 100644 crates/horizon-client/src/motion/fluids.rs diff --git a/crates/horizon-client/examples/scene_motion_probe.rs b/crates/horizon-client/examples/scene_motion_probe.rs index b56da92fa..d5ef55d37 100644 --- a/crates/horizon-client/examples/scene_motion_probe.rs +++ b/crates/horizon-client/examples/scene_motion_probe.rs @@ -4,7 +4,7 @@ use horizon_client::{ Result, assets::Assets, collisions, - motion::{MotionEvent, MotionResources, MotionWorld, PlayerMotion}, + motion::{LAVA, MotionEvent, MotionResources, MotionWorld, PlayerMotion, WATER}, world::World, }; use horizon_core::geometry::Vec3; @@ -174,6 +174,31 @@ fn snapshot(out: &mut impl Write, player: &PlayerMotion) -> Result<()> { velocity.y.to_bits(), velocity.z.to_bits() )), + MotionEvent::Splash { + high_speed, + volume, + pitch, + } => Some(format!( + "sound {} entity {:08x} {:08x}", + if *high_speed { "splash-high" } else { "splash" }, + volume.to_bits(), + pitch.to_bits() + )), + MotionEvent::SplashParticle { + bubble, + position, + velocity, + } => Some(format!( + "splash-particle {} {:016x},{:016x},{:016x} {:016x},{:016x},{:016x}", + if *bubble { "bubble" } else { "splash" }, + position.x.to_bits(), + position.y.to_bits(), + position.z.to_bits(), + velocity.x.to_bits(), + velocity.y.to_bits(), + velocity.z.to_bits() + )), + MotionEvent::SplashEvent => Some("splash-event".into()), // The oracle marks every getAdvancements call (ENTER_BLOCK.trigger) so. MotionEvent::EnterBlock { .. } => Some("hurt-criterion".into()), MotionEvent::Waypoint { receiver, enabled } => Some(format!( @@ -415,6 +440,9 @@ fn main() -> Result<()> { p, )?; } + // Entity.baseTick's fluid phase alone (wasEyeInWater, + // updateFluidInteraction, lava fall halving, firstTick). + "fluid_tick" => world.fluid_base_tick()?, "travel" => world.travel_in_air(vector(&op["value"]))?, "tick" => { let v = vector(&op["value"]); @@ -541,14 +569,20 @@ fn main() -> Result<()> { let stuck = player.stuck_multiplier; writeln!( out, - "block {} frozen {} {} {} {:016x},{:016x},{:016x}", + "block {} frozen {} {} {} {:016x},{:016x},{:016x} fluid {} {} {} {} {:016x} {:016x}", check_block.0, player.ticks_frozen, player.in_powder_snow, player.was_in_powder_snow, stuck.x.to_bits(), stuck.y.to_bits(), - stuck.z.to_bits() + stuck.z.to_bits(), + player.fluids.was_touching_water, + player.fluids.was_eye_in_water, + player.is_eye_in_fluid(WATER), + player.fluids.first_tick, + player.fluid_height(WATER).to_bits(), + player.fluid_height(LAVA).to_bits() )?; writeln!( out, diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 88163e47c..44010d9aa 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -2852,6 +2852,8 @@ impl Game<'_> { .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; let grounded = player.ground.on_ground; let before = ( grounded, @@ -2943,6 +2945,35 @@ impl Game<'_> { position, fall_distance, } => self.smash_landing_particles(state, position, fall_distance), + MotionEvent::Splash { + high_speed, + volume, + pitch, + } => { + let name = if high_speed { + "minecraft:entity.player.splash.high_speed" + } else { + "minecraft:entity.player.splash" + }; + self.audio.play(name, Some(feet), volume, pitch); + } + MotionEvent::SplashParticle { + bubble, + position, + velocity, + } => { + use horizon_client::particles::{ParticleOptions, ParticleType}; + let kind = if bubble { + ParticleType::Bubble + } else { + ParticleType::Splash + }; + self.particles.add( + &ParticleOptions::simple(kind), + [position.x, position.y, position.z], + [velocity.x, velocity.y, velocity.z], + ); + } _ => {} } } diff --git a/crates/horizon-client/src/landing.rs b/crates/horizon-client/src/landing.rs index e0e510820..6fb1f7580 100644 --- a/crates/horizon-client/src/landing.rs +++ b/crates/horizon-client/src/landing.rs @@ -219,7 +219,7 @@ impl FallDamageWorld for MotionWorld<'_, '_, '_> { type Error = Box; type State = BlockStateId; fn is_in_water(&mut self) -> Result { - Ok(false) + Ok(self.player.fluids.was_touching_water) } fn fall_distance(&self) -> f64 { self.player.fall_distance @@ -253,8 +253,8 @@ impl FallDamageWorld for MotionWorld<'_, '_, '_> { } impl LivingLandingWorld for MotionWorld<'_, '_, '_> { fn update_fluid_interaction(&mut self) -> Result { - Ok(false) - } // dry scene + self.update_fluids() + } fn is_server_level(&self) -> bool { true } diff --git a/crates/horizon-client/src/motion.rs b/crates/horizon-client/src/motion.rs index 8830fb6f4..131aa0df5 100644 --- a/crates/horizon-client/src/motion.rs +++ b/crates/horizon-client/src/motion.rs @@ -43,6 +43,9 @@ use std::{ sync::Arc, }; +mod fluids; +pub use fluids::{FluidResources, LAVA, PlayerFluids, WATER}; + pub struct MotionResources { pub attributes: Arc, pub blocks: BoundMovementProperties, @@ -50,6 +53,7 @@ pub struct MotionResources { pub fall_reset: BTreeSet, pub landing: BlockLandingRegistry, pub health: crate::health::HealthResources, + pub fluids: FluidResources, } impl MotionResources { pub fn load(root: &Path, assets: &Assets) -> Result { @@ -86,6 +90,7 @@ impl MotionResources { Ok(Self { landing: crate::landing::load(root, &properties)?, health: crate::health::HealthResources::load(root)?, + fluids: FluidResources::load(root, assets)?, attributes, blocks: properties.bind(&MovementTags { fences: tag("minecraft:fences")?, @@ -150,6 +155,21 @@ pub enum MotionEvent { position: BlockPos, fall_distance: f64, }, + /// `Entity.doWaterSplashEffect`: the player's splash (or high-speed + /// splash) sound at its position... + Splash { + high_speed: bool, + volume: f32, + pitch: f32, + }, + /// ...its BUBBLE (else SPLASH) particles... + SplashParticle { + bubble: bool, + position: Vec3, + velocity: Vec3, + }, + /// ...and the SPLASH game event. + SplashEvent, } pub struct PlayerMotion { pub position: Vec3, @@ -213,6 +233,8 @@ pub struct PlayerMotion { pub health: crate::health::PlayerHealth, /// Status effects and armor protection seen by movement and damage. pub status: crate::effects::StatusFlags, + /// Water and lava around the player (`Entity.fluidInteraction`). + pub fluids: PlayerFluids, /// `Entity.isInPowderSnow` / `wasInPowderSnow`. pub in_powder_snow: bool, pub was_in_powder_snow: bool, @@ -313,6 +335,7 @@ impl PlayerMotion { sync_position: false, events: Vec::new(), attributes, + fluids: PlayerFluids::default(), in_powder_snow: false, was_in_powder_snow: false, ticks_frozen: 0, @@ -591,6 +614,7 @@ impl MotionWorld<'_, '_, '_> { // Entity.baseTick self.player.was_in_powder_snow = self.player.in_powder_snow; self.player.in_powder_snow = false; + self.fluid_base_tick()?; self.player.old_position = self.player.position; if self.player.jump_trigger_time > 0 { self.player.jump_trigger_time -= 1; @@ -1334,15 +1358,21 @@ impl EntityMoveWorld for MotionWorld<'_, '_, '_> { self.player.fall_distance } fn fall_reset_clip(&mut self, from: Vec3, to: Vec3) -> Result { - // Every fluid in this controlled scene is empty. Tagged reset blocks use - // a full block in ClipContext.FALLDAMAGE_RESETTING, not their collider. + // ClipContext.Block.FALLDAMAGE_RESETTING: tagged reset blocks are a full + // block, not their collider; ClipContext.Fluid.WATER: the water's shape. + // Both shapes are queried for every visited block (the water's first + // query fixes its cached shape), either one hitting ends the ray. let hit = traverse_blocks(from, to, 1_000_000, |p| { + let water = match self.water_clip(from, to, p) { + Ok(hit) => hit, + Err(e) => return Some(Err(e)), + }; let name = &self.assets.registry.state(self.block(p)).unwrap().name; - (self.resources.fall_reset.contains(name) - && VoxelShape::block().clip(from, to, p).is_some()) - .then_some(()) + let reset = self.resources.fall_reset.contains(name) + && VoxelShape::block().clip(from, to, p).is_some(); + (water || reset).then_some(Ok(())) })?; - Ok(hit.is_some()) + hit.transpose().map(|h| h.is_some()) } fn reset_fall_distance(&mut self) -> Result<()> { self.player.fall_distance = 0.0; diff --git a/crates/horizon-client/src/motion/fluids.rs b/crates/horizon-client/src/motion/fluids.rs new file mode 100644 index 000000000..ef4746eaa --- /dev/null +++ b/crates/horizon-client/src/motion/fluids.rs @@ -0,0 +1,330 @@ +//! The player's fluid immersion over the resident scene: `Entity.updateFluidInteraction` +//! (water, waterlogged blocks, bubble columns and lava, with their currents), the +//! water-entry splash and the fall resets that hinge on touching water. +use super::*; +use horizon_world::{ + entity_fluid::{ + CurrentTarget, EntityFluidInteraction, FluidInteractionWorld, FluidMembership, + FluidSections, FluidTagId, + }, + entity_fluid_tick::{self, EntityFluidTickWorld}, + fluid::{FluidHeightWorld, FluidKind, FluidState, FluidStateTable}, + fluid_flow::{FluidFlowWorld, flow_at}, + fluid_shape::FluidShapeCache, + water_splash::{self, SplashParticle, WaterSplashWorld}, +}; +use std::sync::Mutex; + +/// `FluidTags.WATER` and `FluidTags.LAVA`, the fluids with a current. +pub const WATER: FluidTagId = FluidTagId(0); +pub const LAVA: FluidTagId = FluidTagId(1); + +/// Per-state fluid facts the player's immersion and fall-reset rays read. +pub struct FluidResources { + states: FluidStateTable, + /// `isFaceSturdy(FULL)` per `Direction` (bit = ordinal). + sturdy: Vec, + /// `#minecraft:blocks_fluid_flow` membership. + blocks_flow: Vec, + /// `IceBlock` and its subclasses. + ice: Vec, + /// `FlowingFluid.shapes`: the shape of the first query of each fluid + /// state, kept for the whole process like the registered fluid's map. + pub shapes: Mutex, +} +impl FluidResources { + pub fn load(root: &Path, assets: &Assets) -> Result { + let facts = crate::blocks::BlockFacts::load(root, assets.registry)?; + Ok(Self { + states: FluidStateTable::new(assets.registry)?, + sturdy: facts.states.iter().map(|s| s.sturdy_full).collect(), + blocks_flow: facts + .states + .iter() + .map(|s| assets.blocks_fluid_flow.contains(&*s.name)) + .collect(), + ice: facts.states.iter().map(|s| s.has_class("IceBlock")).collect(), + shapes: Mutex::new(FluidShapeCache::default()), + }) + } + pub fn fluid(&self, state: BlockStateId) -> FluidState { + self.states.get(state).unwrap_or(FluidState::EMPTY) + } + fn sturdy(&self, state: BlockStateId, d: Direction) -> bool { + self.sturdy + .get(state.0 as usize) + .is_some_and(|s| s & 1 << d as u8 != 0) + } +} +/// The player's `EntityFluidInteraction` and the water flags around it. +pub struct PlayerFluids { + pub interaction: EntityFluidInteraction, + /// `Entity.wasTouchingWater` (`isInWater`). + pub was_touching_water: bool, + /// `Entity.wasEyeInWater`. + pub was_eye_in_water: bool, + /// `Entity.firstTick`: no splash, and no lava, until the first base tick ends. + pub first_tick: bool, + /// The dimension's `FAST_LAVA` (the Nether), set by the game. + pub fast_lava: bool, +} +impl Default for PlayerFluids { + fn default() -> Self { + Self { + interaction: EntityFluidInteraction::new([WATER, LAVA]), + was_touching_water: false, + was_eye_in_water: false, + first_tick: true, + fast_lava: false, + } + } +} +fn is_tagged(kind: FluidKind, tag: FluidTagId) -> bool { + if tag == WATER { + matches!(kind, FluidKind::Water | FluidKind::FlowingWater) + } else { + matches!(kind, FluidKind::Lava | FluidKind::FlowingLava) + } +} +impl PlayerMotion { + pub fn fluid_height(&self, tag: FluidTagId) -> f64 { + self.fluids.interaction.fluid_height(&Membership, tag) + } + pub fn is_eye_in_fluid(&self, tag: FluidTagId) -> bool { + self.fluids.interaction.is_eye_in_fluid(&Membership, tag) + } + /// `Entity.isInLava`. + pub fn is_in_lava(&self) -> bool { + !self.fluids.first_tick && self.fluids.interaction.is_in_fluid(&Membership, LAVA) + } +} +struct Membership; +impl FluidMembership for Membership { + fn fluid_in_tag(&self, kind: FluidKind, tag: FluidTagId) -> bool { + is_tagged(kind, tag) + } +} +impl MotionWorld<'_, '_, '_> { + fn fluid_at(&self, p: BlockPos) -> FluidState { + self.resources.fluids.fluid(self.block(p)) + } + /// `Entity.baseTick`'s fluid phase: `wasEyeInWater`, `updateFluidInteraction`, + /// the lava's fall halving, and the end of the first tick. + pub fn fluid_base_tick(&mut self) -> Result<()> { + self.player.fluids.was_eye_in_water = self.player.is_eye_in_fluid(WATER); + self.update_fluids()?; + if self.player.is_in_lava() { + self.player.fall_distance *= 0.5; + } + self.player.fluids.first_tick = false; + Ok(()) + } + /// `Entity.updateFluidInteraction`: immersion heights, then touching water + /// resets the fall and splashes on entry, then the currents push. + pub fn update_fluids(&mut self) -> Result { + let mut interaction = std::mem::take(&mut self.player.fluids.interaction); + let result = entity_fluid_tick::update(&mut interaction, self, WATER, LAVA, 1_000_000); + self.player.fluids.interaction = interaction; + result.map_err(|e| e.to_string().into()) + } + /// `ClipContext.Fluid.WATER` in a fall-reset ray: the water's shape. + pub(super) fn water_clip(&mut self, from: Vec3, to: Vec3, p: BlockPos) -> Result { + let fluid = self.fluid_at(p); + if !is_tagged(fluid.kind(), WATER) { + return Ok(false); + } + let resources = self.resources; + let shape = resources + .fluids + .shapes + .lock() + .map_err(|_| "fluid shape cache poisoned")? + .shape(self, fluid, p)?; + Ok(shape.clip(from, to, p).is_some()) + } +} +impl FluidMembership for MotionWorld<'_, '_, '_> { + fn fluid_in_tag(&self, kind: FluidKind, tag: FluidTagId) -> bool { + is_tagged(kind, tag) + } +} +impl CurrentTarget for MotionWorld<'_, '_, '_> { + type Error = Box; + fn is_player_class(&self) -> bool { + true + } + fn velocity(&mut self) -> Result { + Ok(self.player.velocity) + } + fn add_delta_movement(&mut self, delta: Vec3) -> Result<()> { + // Entity.addDeltaMovement and setDeltaMovement keep only finite values. + let v = self.player.velocity; + let sum = Vec3::new(v.x + delta.x, v.y + delta.y, v.z + delta.z); + if delta.is_finite() && sum.is_finite() { + self.player.velocity = sum; + } + Ok(()) + } +} +impl FluidInteractionWorld for MotionWorld<'_, '_, '_> { + type Error = Box; + type Chunk = (); + fn interaction_box(&mut self) -> Result> { + // Entity.getFluidInteractionBox (not riding). + Ok(Some( + self.player.bounds().deflate(Vec3::new(0.001, 0.001, 0.001)), + )) + } + fn loaded_chunk(&mut self, x: i32, z: i32) -> Result> { + Ok(self.scene.chunks.contains_key(&(x, z)).then_some(())) + } + fn chunk_sections(&mut self, _: ()) -> Result> { + // Resident sections keep no fluid count: scanning the box finds no + // fluid where a section without fluid would have skipped it. + static SECTIONS: [bool; crate::chunk::SECTIONS] = [true; crate::chunk::SECTIONS]; + Ok(FluidSections { + minimum_section_y: crate::chunk::MIN_Y >> 4, + has_fluid: &SECTIONS, + }) + } + fn bounding_box_min_y(&self) -> f64 { + self.player.bounds().min_position().y + } + fn block_x(&self) -> i32 { + self.player.position.x.floor() as i32 + } + fn eye_y(&mut self) -> Result { + Ok(self.player.position.y + f64::from(self.player.dimensions.eye_height)) + } + fn block_z(&self) -> i32 { + self.player.position.z.floor() as i32 + } + fn fluid_state(&mut self, p: BlockPos) -> Result { + Ok(self.fluid_at(p)) + } + fn fluid_height(&mut self, f: FluidState, p: BlockPos) -> Result { + f.height_at(self, [p.x, p.y, p.z]) + } + fn camera_height(&mut self, f: FluidState, p: BlockPos) -> Result { + f.camera_height_at(self, [p.x, p.y, p.z]) + } + fn flow(&mut self, f: FluidState, p: BlockPos) -> Result { + flow_at(self, f, p) + } +} +impl EntityFluidTickWorld for MotionWorld<'_, '_, '_> { + /// `Player.isPushedByFluid`: not while flying. + fn is_pushed_by_fluid(&mut self) -> Result { + Ok(!self.player.flying) + } + fn reset_fall_distance(&mut self) -> Result<()> { + self.player.fall_distance = 0.0; + Ok(()) + } + fn was_touching_water(&self) -> bool { + self.player.fluids.was_touching_water + } + fn first_tick(&self) -> bool { + self.player.fluids.first_tick + } + fn water_splash(&mut self) -> Result<()> { + water_splash::water_splash(self, 1_000_000).map_err(|e| e.to_string())?; + Ok(()) + } + fn set_was_touching_water(&mut self, value: bool) { + self.player.fluids.was_touching_water = value; + } + fn fast_lava(&mut self) -> Result { + Ok(self.player.fluids.fast_lava) + } +} +impl FluidHeightWorld for MotionWorld<'_, '_, '_> { + type Error = Box; + fn fluid(&mut self, p: [i32; 3]) -> Result { + Ok(self.fluid_at(BlockPos::new(p[0], p[1], p[2]))) + } + fn sturdy_down(&mut self, p: [i32; 3]) -> Result { + let state = MotionWorld::block(self, BlockPos::new(p[0], p[1], p[2])); + Ok(self.resources.fluids.sturdy(state, Direction::Down)) + } +} +impl FluidFlowWorld for MotionWorld<'_, '_, '_> { + type Error = Box; + type Block = BlockStateId; + fn fluid(&mut self, p: BlockPos) -> Result { + Ok(self.fluid_at(p)) + } + fn block(&mut self, p: BlockPos) -> Result { + Ok(MotionWorld::block(self, p)) + } + fn blocks_fluid_flow(&self, s: BlockStateId) -> bool { + self.resources + .fluids + .blocks_flow + .get(s.0 as usize) + .copied() + .unwrap_or(false) + } + fn is_ice_class(&self, s: BlockStateId) -> bool { + self.resources + .fluids + .ice + .get(s.0 as usize) + .copied() + .unwrap_or(false) + } + fn is_face_sturdy(&mut self, s: BlockStateId, _: BlockPos, d: Direction) -> Result { + Ok(self.resources.fluids.sturdy(s, d)) + } +} +/// `Entity.doWaterSplashEffect` for the player: the world random draws the +/// pitch and particle offsets. +impl WaterSplashWorld for MotionWorld<'_, '_, '_> { + type Error = Box; + type Entity = (); + /// `Player.getSwimHighSpeedSplashSound` when true, else `getSwimSplashSound`. + type Sound = bool; + fn this_entity(&self) {} + fn controlling_passenger(&mut self) -> Result> { + Ok(None) + } + fn velocity(&mut self, _: ()) -> Result { + Ok(self.player.velocity) + } + fn splash_sound(&mut self, high_speed: bool) -> Result { + Ok(high_speed) + } + fn random_float(&mut self) -> Result { + Ok(self.scene.random.next_float()) + } + fn random_double(&mut self) -> Result { + Ok(self.scene.random.next_double()) + } + fn play_sound(&mut self, high_speed: bool, volume: f32, pitch: f32) -> Result<()> { + self.player.events.push(MotionEvent::Splash { + high_speed, + volume, + pitch, + }); + Ok(()) + } + fn position(&self) -> Vec3 { + self.player.position + } + fn width(&self) -> f32 { + self.player.dimensions.width + } + fn particle(&mut self, kind: SplashParticle, position: Vec3, velocity: Vec3) -> Result<()> { + self.player.events.push(MotionEvent::SplashParticle { + bubble: matches!(kind, SplashParticle::Bubble), + position, + velocity, + }); + Ok(()) + } + fn splash_event(&mut self) -> Result<()> { + // The SPLASH game event: sculk listens to the player's moves itself. + self.player.events.push(MotionEvent::SplashEvent); + Ok(()) + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSceneMotionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSceneMotionOracle.java index de6e0aed1..9f1ea2af3 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSceneMotionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSceneMotionOracle.java @@ -33,7 +33,7 @@ import static dev.horizonlab.parity.VanillaRegistryCollisionScanOracle.*; * full death services remain controlled boundaries. Clock operations set up the * two damage-clock fields, not the complete enclosing native tick methods. */ public final class VanillaSceneMotionOracle { - static Field position,history,support,noBlocks,last,stuck,delay,trigger,attributeStorage,attributeDirty,attributeCached,impact,grace; + static Field blockPositionField,position,history,support,noBlocks,last,stuck,delay,trigger,attributeStorage,attributeDirty,attributeCached,impact,grace; static MethodHandle aiStep; static Method refreshAttributes; static EntityDataAccessor healthKey,absorptionKey; @@ -71,6 +71,7 @@ public final class VanillaSceneMotionOracle { static String vectorBits(Vec3 p){return String.format("%016x,%016x,%016x",Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z));} static String soundName(SoundEvent s){ if(s==SoundEvents.PLAYER_SMALL_FALL)return "small";if(s==SoundEvents.PLAYER_BIG_FALL)return "big"; + if(s==SoundEvents.PLAYER_SPLASH)return "splash";if(s==SoundEvents.PLAYER_SPLASH_HIGH_SPEED)return "splash-high"; return VanillaBlockLandingOracle.sound(s); } static final class Sources extends DamageSources { @@ -107,6 +108,15 @@ public final class VanillaSceneMotionOracle { @Override public BlockGetter getChunkForCollisions(int x,int z){return chunks.get(key(x,z));} @Override public BlockState getBlockState(BlockPos p){var c=chunks.get(key(p.getX()>>4,p.getZ()>>4));return c==null?Blocks.AIR.defaultBlockState():c.getBlockState(p);} @Override public FluidState getFluidState(BlockPos p){return getBlockState(p).getFluidState();} + // No dimension layers: FAST_LAVA keeps its default (the Overworld's slow lava). + static final net.minecraft.world.attribute.EnvironmentAttributeSystem ATTRIBUTES=net.minecraft.world.attribute.EnvironmentAttributeSystem.builder().build(); + @Override public net.minecraft.world.attribute.EnvironmentAttributeSystem environmentAttributes(){return ATTRIBUTES;} + // EntityFluidInteraction.hasFluidAndLoaded: resident chunks only. + @Override public net.minecraft.world.level.chunk.ChunkAccess getChunk(int x,int z,net.minecraft.world.level.chunk.status.ChunkStatus status,boolean load){return chunks.get(key(x,z));} + // Entity.doWaterSplashEffect's particles (a client level adds them). + @Override public void addParticle(net.minecraft.core.particles.ParticleOptions particle,double x,double y,double z,double xd,double yd,double zd){ + actor.events.add("splash-particle "+(particle==net.minecraft.core.particles.ParticleTypes.BUBBLE?"bubble":particle==net.minecraft.core.particles.ParticleTypes.SPLASH?"splash":"unknown")+" "+vectorBits(new Vec3(x,y,z))+" "+vectorBits(new Vec3(xd,yd,zd))); + } @Override public List getEntityCollisions(Entity e,AABB b){return List.of();} @Override public List getPushableEntities(Entity e,AABB b){return List.of();} @Override public List getEntities(Entity e,AABB b){return e!=actor&&b.intersects(actor.getBoundingBox())?List.of(actor):List.of();} @@ -162,7 +172,7 @@ public final class VanillaSceneMotionOracle { @Override public CombatTracker getCombatTracker(){return tracker;} @Override public net.minecraft.server.PlayerAdvancements getAdvancements(){events.add("hurt-criterion");return advancements;} @Override public void onSyncedDataUpdated(EntityDataAccessor key){if(key!=healthKey&&key!=absorptionKey)throw new AssertionError(key);events.add(String.format("updated %d %08x %s",key.id(),Float.floatToIntBits(getEntityData().get(key==healthKey?healthKey:absorptionKey)),getEntityData().isDirty()));} - @Override public void gameEvent(Holder event){if(event==GameEvent.ENTITY_DAMAGE)events.add("entity-damage");else super.gameEvent(event);} + @Override public void gameEvent(Holder event){if(event==GameEvent.ENTITY_DAMAGE)events.add("entity-damage");else if(event==GameEvent.SPLASH)events.add("splash-event");else super.gameEvent(event);} @Override public void die(DamageSource source){dead=true;events.add("death-request");} @Override protected void playHurtSound(DamageSource source){events.add("hurt-sound");} @Override protected SoundEvent getDeathSound(){return SoundEvents.PLAYER_DEATH;} @@ -171,20 +181,18 @@ public final class VanillaSceneMotionOracle { @Override public AttributeMap getAttributes(){return attrs;} @Override protected boolean getSharedFlag(int bit){return (flags&(1< tag){return statisticsFlags!=null&&statFlag(2);} - @Override public boolean isInWater(){return statisticsFlags!=null&&statFlag(3);} + @Override public boolean isEyeInFluid(net.minecraft.tags.TagKey tag){return statisticsFlags!=null?statFlag(2):super.isEyeInFluid(tag);} + @Override public boolean isInWater(){return statisticsFlags!=null?statFlag(3):super.isInWater();} @Override public boolean onClimbable(){return statisticsFlags!=null?statFlag(4):super.onClimbable();} @Override public boolean onGround(){return statisticsFlags!=null?statFlag(5):super.onGround();} @Override public boolean isSprinting(){return statisticsFlags!=null?statFlag(6):super.isSprinting();} @Override public boolean isCrouching(){return statisticsFlags!=null?statFlag(7):super.isCrouching();} - @Override public boolean isInLava(){return false;} - @Override public boolean isInLiquid(){return false;} @Override public boolean isFallFlying(){return statisticsFlags!=null&&statFlag(8);} @Override public boolean isAutoSpinAttack(){return false;} @Override public boolean isSpectator(){return false;} @@ -196,7 +204,6 @@ public final class VanillaSceneMotionOracle { @Override public MoveSimulationType getMoveSimulationType(){return MoveSimulationType.SERVER_AND_CLIENT;} @Override public boolean isClientAuthoritative(){return false;} @Override public void recordMovement(MoverType mover,Vec3 movement){} - @Override protected boolean updateFluidInteraction(){return false;} @Override public void playSound(SoundEvent sound,float volume,float pitch){events.add(String.format("sound %s entity %08x %08x",soundName(sound),Float.floatToIntBits(volume),Float.floatToIntBits(pitch)));} @Override protected void playBlockFallSound(){events.add("block-fall-sound");} @Override public void awardStat(net.minecraft.stats.Stat stat,int value){ @@ -213,7 +220,6 @@ public final class VanillaSceneMotionOracle { @Override protected void playStepSound(BlockPos p,BlockState state){} @Override public void gameEvent(Holder event,Entity source){} @Override public LivingEntity getControllingPassenger(){return null;} - @Override public double getFluidHeight(net.minecraft.tags.TagKey tag){return 0;} @Override public double getFluidJumpThreshold(){return .4;} // Block-inside effects and frozen ticks run only in "snow_tick" operations. boolean effects;int frozen;Vec3 tickStart; @@ -243,7 +249,12 @@ public final class VanillaSceneMotionOracle { } } void clock()throws Exception{sceneLevel.time++;tickCount++;if(cooldown.getInt(this)>0)cooldown.setInt(this,cooldown.getInt(this)-1);if(hurtTime>0)hurtTime--;} + // Entity.baseTick's fluid phase: wasEyeInWater, the real + // updateFluidInteraction, lava's fall halving and the first tick's end. + void fluidTick(){wasEyeInWater=isEyeInFluid(net.minecraft.tags.FluidTags.WATER);updateFluidInteraction();if(isInLava())fallDistance*=0.5;firstTick=false;} + String fluidState(){return wasTouchingWater+" "+wasEyeInWater+" "+isEyeInFluid(net.minecraft.tags.FluidTags.WATER)+" "+firstTick+String.format(" %016x %016x",Double.doubleToLongBits(getFluidHeight(net.minecraft.tags.FluidTags.WATER)),Double.doubleToLongBits(getFluidHeight(net.minecraft.tags.FluidTags.LAVA)));} void playerMovementTick(Vec3 input,boolean jumping){ + fluidTick(); preparedInput=true;xxa=(float)input.x;yya=0;zza=(float)input.z;setJumping(jumping); try{aiStep();}finally{preparedInput=false;} } @@ -271,7 +282,7 @@ public final class VanillaSceneMotionOracle { out.printf("%s %s %s %s %s %s %s %016x %s %s %s %08x %d %08x %d %d %s | %s%n",p.horizontalCollision,p.verticalCollision,p.verticalCollisionBelow,p.minorHorizontalCollision, p.onGround(),noBlocks.getBoolean(p),pos(support.get(p)),Double.doubleToLongBits(p.fallDistance),pos(last.get(p)),p.needsSync,p.syncPosition,Float.floatToIntBits(storedSpeed.getFloat(p)),delay.getInt(p),Float.floatToIntBits(p.yHeadRot),trigger.getInt(p),grace.getInt(p),impact.get(p)==null?"none":vectorBits((Vec3)impact.get(p)),String.join(";",attributes)); out.println("events "+String.join(" | ",p.events));p.events.clear(); - out.println("block "+Block.getId(p.level().getBlockState(new BlockPos(25,3,25)))+" frozen "+p.frozen+" "+p.isInPowderSnow+" "+p.wasInPowderSnow+" "+vectorBits((Vec3)stuck.get(p))); + out.println("block "+Block.getId(p.level().getBlockState(new BlockPos(25,3,25)))+" frozen "+p.frozen+" "+p.isInPowderSnow+" "+p.wasInPowderSnow+" "+vectorBits((Vec3)stuck.get(p))+" fluid "+p.fluidState()); var pp=p.portalProcess; out.println("portal "+p.getPortalCooldown()+" "+(pp==null?"none":pp.getEntryPosition().getX()+","+pp.getEntryPosition().getY()+","+pp.getEntryPosition().getZ()+" "+pp.getPortalTime()+" "+pp.isInsidePortalThisTick())+" "+(p.travel==null?"-":p.travel));p.travel=null; out.printf("health %08x %08x %08x %d %d %08x %d %d %s %d %s %s %s %s %s %d%n", @@ -285,8 +296,12 @@ public final class VanillaSceneMotionOracle { @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception{ net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(Path.of(args[2]).resolve("block-tags.json"))).getAsJsonObject()); + // The vanilla data pack's #water and #lava fluid tags. + net.minecraft.core.registries.BuiltInRegistries.FLUID.prepareTagReload(new net.minecraft.tags.TagLoader.LoadResult<>(net.minecraft.core.registries.Registries.FLUID,Map.of( + net.minecraft.tags.FluidTags.WATER,List.>of(net.minecraft.world.level.material.Fluids.FLOWING_WATER.builtInRegistryHolder(),net.minecraft.world.level.material.Fluids.WATER.builtInRegistryHolder()), + net.minecraft.tags.FluidTags.LAVA,List.>of(net.minecraft.world.level.material.Fluids.FLOWING_LAVA.builtInRegistryHolder(),net.minecraft.world.level.material.Fluids.LAVA.builtInRegistryHolder())))).apply(); var u=Class.forName("sun.misc.Unsafe");var f=u.getDeclaredField("theUnsafe");f.setAccessible(true);var unsafe=f.get(null);var allocate=u.getMethod("allocateInstance",Class.class); - position=field(Entity.class,"position");history=field(Entity.class,"movementThisTick");support=field(Entity.class,"mainSupportingBlockPos");noBlocks=field(Entity.class,"onGroundNoBlocks");last=field(LivingEntity.class,"lastClimbablePos");stuck=field(Entity.class,"stuckSpeedMultiplier"); + position=field(Entity.class,"position");blockPositionField=field(Entity.class,"blockPosition");history=field(Entity.class,"movementThisTick");support=field(Entity.class,"mainSupportingBlockPos");noBlocks=field(Entity.class,"onGroundNoBlocks");last=field(LivingEntity.class,"lastClimbablePos");stuck=field(Entity.class,"stuckSpeedMultiplier"); var abilities=field(Player.class,"abilities"); healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null);absorptionKey=(EntityDataAccessor)field(Player.class,"DATA_PLAYER_ABSORPTION_ID").get(null); healthDead=field(LivingEntity.class,"dead");cooldown=field(LivingEntity.class,"damageCooldownTime");lastHurt=field(LivingEntity.class,"lastHurt");noAction=field(LivingEntity.class,"noActionTime");lastDamage=field(LivingEntity.class,"lastDamageSource");lastStamp=field(LivingEntity.class,"lastDamageStamp");foodExhaustion=field(FoodData.class,"exhaustionLevel");foodTimer=field(FoodData.class,"tickTimer"); @@ -320,6 +335,8 @@ public final class VanillaSceneMotionOracle { p.attrs=new TrackedAttributes(VanillaEntityAttributeOracle.supplier(EntityTypes.PLAYER));write(field(LivingEntity.class,"attributes"),p,p.attrs); write(field(Entity.class,"finalMovementsThisTick"),p,new ArrayList<>());write(field(Entity.class,"visitedBlocks"),p,new it.unimi.dsi.fastutil.longs.LongOpenHashSet()); write(field(Entity.class,"insideEffectCollector"),p,new net.minecraft.world.entity.InsideBlockEffectApplier.StepBasedCollector()); + write(field(Entity.class,"fluidInteraction"),p,new net.minecraft.world.entity.EntityFluidInteraction(Set.of(net.minecraft.tags.FluidTags.WATER,net.minecraft.tags.FluidTags.LAVA))); + write(field(Entity.class,"random"),p,level.rng);field(Entity.class,"firstTick").setBoolean(p,true); write(history,p,new ArrayDeque<>());write(support,p,Optional.empty());write(last,p,Optional.empty());write(stuck,p,Vec3.ZERO);write(abilities,p,new Abilities()); write(field(ServerPlayer.class,"shoulderEntityLeft"),p,new net.minecraft.nbt.CompoundTag());write(field(ServerPlayer.class,"shoulderEntityRight"),p,new net.minecraft.nbt.CompoundTag()); p.connection=(Connection)allocate.invoke(unsafe,Connection.class); @@ -366,6 +383,7 @@ public final class VanillaSceneMotionOracle { case "impulse"->p.setIgnoreFallDamageFromCurrentImpulse(op.get("ignore").getAsBoolean(),op.get("value").isJsonNull()?null:VanillaSceneCollisionOracle.vector(op.get("value"))); case "block"->{var v=op.getAsJsonArray("position");var pos=new BlockPos(v.get(0).getAsInt(),v.get(1).getAsInt(),v.get(2).getAsInt());var state=VanillaSceneCollisionOracle.state(op.get("name").getAsString());if(op.has("properties"))for(var property:op.getAsJsonObject("properties").entrySet())state=VanillaSceneCollisionOracle.property(state,state.getBlock().getStateDefinition().getProperty(property.getKey()),property.getValue().getAsString());level.chunks.get(key(pos.getX()>>4,pos.getZ()>>4)).write(pos,Block.getId(state));} case "landing"->{var v=op.getAsJsonArray("position");p.land(number(op.get("value")),op.get("ground").getAsBoolean(),new BlockPos(v.get(0).getAsInt(),v.get(1).getAsInt(),v.get(2).getAsInt()));} + case "fluid_tick"->p.fluidTick(); case "travel"->p.travel(VanillaSceneCollisionOracle.vector(op.get("value"))); case "tick"->p.movementTick(VanillaSceneCollisionOracle.vector(op.get("value"))); case "player_tick"->p.playerMovementTick(VanillaSceneCollisionOracle.vector(op.get("value")),op.get("jumping").getAsBoolean()); diff --git a/tools/test_native_scene_motion.py b/tools/test_native_scene_motion.py index 8430b29a7..b1cb9bbeb 100644 --- a/tools/test_native_scene_motion.py +++ b/tools/test_native_scene_motion.py @@ -227,12 +227,129 @@ def portal_corpus(): ops += restore() yield dict(position=vec((25.5,4,25.5)),ops=ops) +def water_corpus(): + """Falls into water, waterlogged blocks, bubble columns, kelp/seagrass and + lava (#180). "fluid_tick" runs Entity.baseTick's fluid phase alone + (wasEyeInWater, the real updateFluidInteraction with its fall reset, + splash and currents, lava's fall halving, firstTick); scripted falling + velocities go through the real Entity.move (the FALLDAMAGE_RESETTING ray + with ClipContext.Fluid.WATER, then LivingEntity.checkFallDamage refreshing + the fluids before the fall is applied). No fluid travel: the player never + travels while touching a fluid here.""" + def place(name,positions,properties=None): + return [op('block',name='minecraft:'+name,position=list(p),**({'properties':properties} if properties else {})) for p in positions] + def restore(positions): + return [op('block',name='minecraft:air',position=list(p)) for p in positions] + def fall(start_y,steps,v=0.,settle=4): + # Vanilla's falling speeds (gravity 0.08, drag 0.98), applied by Entity.move. + ops=[] + for _ in range(steps): + ops += [op('fluid_tick'),op('velocity',vec((0,v,0))),op('move',vec((0,v,0)))] + v=(v-.08)*.98 + return ops+[op('fluid_tick') for _ in range(settle)] + def pool(y0,depth,x=range(23,28),z=range(23,28)): + return [(a,y,b) for a in x for y in range(y0,y0+depth) for b in z] + rng=random.Random(0x57415452) + starts=[(25.5,5.2),(25.7,6),(25.5,9),(24.2,16),(25.5,16.3),(26.9,28)] + # Pools of source, flowing and falling water, one to three deep (the + # #180 repro: a 1-deep pool 12 blocks below). + for depth in [1,2,3]: + for properties in [{'level':'0'}]+([{'level':str(l)} for l in (1,4,7,8,12)] if depth==1 else []): + for x,y in starts: + blocks=pool(4,depth) + ops=[op('seed',rng.randrange(1<<31))]+place('water',blocks,properties)+fall(y,45)+restore(blocks) + yield dict(position=vec((x,y,25.3)),ops=ops) + # The same falls with a preset fall distance and speed (teleported, then + # one move into the pool), and falls landing just beside the pool. + for preset,v in [(12,-.9),(3.5,-.5),(30,-3.2),(0,-.08)]: + for x in [25.5,22.9,22.7,27.6,28.31]: + blocks=pool(4,1) + ops=[op('seed',rng.randrange(1<<31))]+place('water',blocks)+[op('fall',bits(preset))]+fall(5.0-v,3,v)+restore(blocks) + yield dict(position=vec((x,5.0-v,25.5)),ops=ops) + # Waterlogged floors: the water's surface is under or above the feet. + for name,properties in [('oak_slab',{'type':'bottom'}),('oak_slab',{'type':'top'}),('oak_stairs',{'facing':'north'}), + ('oak_fence',{}),('oak_trapdoor',{'half':'bottom'}),('oak_trapdoor',{'half':'top','open':'true'}), + ('lantern',{}),('mangrove_roots',{}),('ladder',{'facing':'north'}),('copper_grate',{}),('iron_bars',{})]: + for logged in ['true','false']: + for x,y in [(25.5,9),(25.3,16)]: + blocks=pool(4,1,range(24,27),range(24,27)) + ops=place(name,blocks,dict(properties,waterlogged=logged))+fall(y,40)+restore(blocks) + yield dict(position=vec((x,y,25.5)),ops=ops) + # Bubble columns, kelp and seagrass are water too. + for name,properties in [('bubble_column',{'drag':'true'}),('bubble_column',{'drag':'false'}),('kelp',{'age':'3'}), + ('kelp_plant',{}),('seagrass',{}),('tall_seagrass',{'half':'lower'})]: + for depth in [1,3]: + blocks=pool(4,depth,range(24,27),range(24,27)) + ops=place(name,blocks,properties)+fall(16,45)+restore(blocks) + yield dict(position=vec((25.5,16,25.5)),ops=ops) + # Lava resets nothing but halves the fall every base tick after the first. + for depth in [1,2]: + for properties in [{'level':'0'},{'level':'3'}]: + for x,y in [(25.5,4.5),(25.5,9),(25.5,16)]: + blocks=pool(4,depth) + ops=[op('fall',bits(6))]+place('lava',blocks,properties)+fall(y,45)+restore(blocks) + yield dict(position=vec((x,y,25.5)),ops=ops) + # Water over lava, and a falling player passing a lava layer into water. + lava=pool(6,1,range(24,27),range(24,27));water=pool(4,2,range(24,27),range(24,27)) + ops=place('water',water)+place('lava',lava)+fall(14,40)+restore(lava+water) + yield dict(position=vec((25.5,14,25.5)),ops=ops) + # Fast falls through a hanging water layer: the fall-reset ray finds the + # water only at 1 block per tick or more (and the shape cached by the + # first query of each state). + for properties in [{'level':'0'},{'level':'2'},{'level':'7'},{'level':'8'}]: + for v in [-.99,-1.0,-1.6,-3.5,-9]: + for y in [20,21.3,23.95]: + layer=pool(12,1) + ops=[op('fall',bits(20))]+place('water',layer,properties) + ops += [op('velocity',vec((0,v,0))),op('move',vec((0,v,0))) ]*4+[op('fluid_tick')]+fall(8,12)+restore(layer) + yield dict(position=vec((25.5,y,25.5)),ops=ops) + # Flying players are not pushed but still lose their fall in water. + for flying in [False,True]: + for x,z in [(25.5,25.5),(24.1,26.8)]: + flow=[(25,4,25)] + ring=[(a,4,b) for a in range(23,28) for b in range(23,28) if (a,b)!=(25,25)] + ops=[op('flying',flying,may_fly=True)]+place('water',flow)+[op('block',name='minecraft:water',position=[a,4,b],properties={'level':str(min(7,max(abs(a-25),abs(b-25))))}) for a,_,b in ring] + ops += [op('fall',bits(9))]+[op('fluid_tick') for _ in range(12)]+[op('velocity',vec((0,0,0)))]+[op('fluid_tick') for _ in range(6)] + ops += restore(flow+ring) + yield dict(position=vec((x,4,z)),ops=ops) + # Currents of flowing water, small and large speeds, every cell position. + for i in range(24): + cells=[(a,4,b) for a in range(22,29) for b in range(22,29)] + levels={c:rng.choice(['0','1','2','3','5','7','8','9']) for c in cells} + ops=[op('block',name='minecraft:water',position=list(c),properties={'level':levels[c]}) for c in cells] + ops += [op('velocity',vec((rng.choice([0,.002,-.1]),0,rng.choice([0,.0029,.2]))))] + ops += [op('fluid_tick') for _ in range(8)] + ops += restore(cells) + yield dict(position=vec((rng.uniform(22.4,28.6),4,rng.uniform(22.4,28.6))),ops=ops) + # Eyes under water, splashes of every size: scale changes the eye height + # and the width that counts the particles. + for scale in [.25,.5,1,2.5]: + for start,v in [(10,-.2),(10,-1.2),(7,-.05),(4.3,0)]: + blocks=pool(4,3) + ops=[op('seed',rng.randrange(1<<31)),op('attribute',bits(scale),name='minecraft:scale'),op('refresh_dimensions')] + ops += place('water',blocks)+fall(start,30,v) + # Out of the water and back in: a second splash. + ops += [op('move',vec((0,6,0))),op('fluid_tick'),op('velocity',vec((0,-.6,0))),op('move',vec((0,-.6,0))),op('fluid_tick'),op('fluid_tick')] + ops += restore(blocks) + yield dict(position=vec((25.5,start,25.5)),ops=ops) + # LivingEntity.checkFallDamage on its own, landing with or without having + # touched the water this tick, and on the first tick (no splash). + for wet in [False,True]: + for ticked in [0,1,2]: + for dy in [-.5,-1.5,0]: + blocks=pool(4,1) + ops=([op('block',name='minecraft:water',position=list(b)) for b in blocks] if wet else [])+[op('fluid_tick') for _ in range(ticked)] + ops += [op('fall',bits(8)),op('landing',bits(dy),ground=True,position=[25,3,25]),op('fall',bits(8)),op('landing',bits(dy),ground=False,position=[25,3,25])] + ops += restore(blocks) + yield dict(position=vec((25.5,4,25.5)),ops=ops) + def corpus(): yield from attribute_corpus(False) yield from portal_corpus() yield from pose_corpus(False) yield from powder_snow_corpus() yield from stuck_corpus() + yield from water_corpus() def food(level=20,saturation=5,exhaustion=0,timer=0): return op('food',food=level,saturation=single(saturation),exhaustion=single(exhaustion),timer=timer) # Actual ServerPlayer.checkMovementStatistics with all query contexts. These @@ -560,7 +677,7 @@ def main(): 'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'fixtures':len(fixtures), 'operations':operations,'sources_sha256':tested,'resources':resource_hash,'input_sha256':input_hash, 'references':references, - 'scope':('Client sprint scene executes the real LocalPlayer.aiStep prefix through sprint decisions, stopping at the riding/parent movement boundary, followed by real LocalPlayer.modifyInput and the native server actor simulation. Sprint setters dispatch to that server actor, sharing its actual FoodData and collision conditions. Compares local sprint timer/input history and actual attribute changes, movement, distance exhaustion and hunger. Actual local crouch selection precedes new keyboard input; slowdown, sprint eligibility and pose-dependent dimensions share resident state. No effects, equipment, vehicles or fluid physics. Full client/server tick and networking remain unfinished. ' if args.sprint_input else '')+'Stored PlayerMotion binds resident client chunks and registered attributes/coefficients to air travel, jumping, Entity.move, step resolution, ground/support updates, restitution and speed factors. Repeated native Player.travel/jump/move and actual Player.aiStep / direct LivingEntity.aiStep compare position, velocity, bounds, collision/ground flags, support, climb state, fall-reset field, both sync flags, speed, head yaw, jump trigger and jump delay by exact bits. Prepared-local-input Player.aiStep paths verify the stored speed refresh after movement, with empty inventory and no nearby entities. Travel uses the actual Player.getSpeed movement-attribute query, independently of that stored base-living speed field; both getter and setter execute native bodies. Dry aiStep includes small-velocity cleanup, input damping, held/released jump timing and server frost-modifier removal. Snapshots also compare all allocated attribute instances, base/cache/dirty state, modifier values/operations/permanence and pending update/sync membership. Per-reference JVM holder/instance hashes are replayed so pending callback order and resulting ordered events also match. Dry resident scene with standing, crouching and crawling bounds, cached eye height, native pose-fit selection and ledge backoff; zero frozen ticks, empty equipment, no interpolation, fluids, vehicles, effects or other entities. The oracle controls pose storage and invokes actual native refreshDimensions on changes; full synchronized pose schema and network notifications remain separate. Actual pending attribute refresh runs after player movement and before pose selection in simulation operations, clamping health/absorption and rebuilding scale-dependent dimensions. Native ServerPlayer waypoint-receive and inherited transmit callbacks are compared as ordered requests; the waypoint manager and its network delivery remain controlled consumers. Direct refresh operations and the full enclosing tick remain separate boundaries. Actual LivingEntity.checkFallDamage, registered Block.fallOn/bounceOn and Player/LivingEntity.causeFallDamage are composed, including float-narrowed fall-distance accumulation, reset, last-climb clearing, safe-fall and damage-multiplier attributes, impulse exemptions and ordered landing particle/sound/statistic/hit-ground/damage requests. Farmland pushes the stored player and replaces actual chunk state; repeated turtle-egg changes preserve hatch. Block state at the landing fixture is compared after every operation. World RNG is a seeded native legacy stream. Actual ServerPlayer/Player/LivingEntity hurt dispatch now updates native synchronized health and player absorption, modified armor/toughness reduction, exhaustion, damage cooldown/last-source state and velocity synchronization. Native health storage and dirty flags are compared after every operation. Damage sources use actual decoded/tagged pinned damage registries. ServerPlayer jump statistics and exhaustion are included; dead-or-dying state disables movement input and jumping. Empty equipment/hands/effects, configurable difficulty and natural regeneration, damage gamerules enabled, loaded client and no spawn-extra fall particles define this scene domain. Ordered health/statistic/combat-record/broadcast/sound/criterion/death requests are compared; criterion argument payloads retain the separate combat gate. Actual health changes are applied, but audiovisual playback, persistent statistics, combat tracker internals, full death/drop/respawn services, block neighbor/drop/block-entity callbacks, movement emission, block-inside and networking remain controlled consumers. Actual FoodData.tick and ServerPlayer.tickRegeneration now share the same stored health, attributes, exhaustion and registered starvation damage. Snapshots compare food level, saturation, exhaustion, timer and tick count. Cases cover all four difficulties, regeneration rule changes, absorption during starvation, Peaceful recovery, timer overflow and nonfinite food values. Simulation operations compose clock setup, actual player movement and actual food ticking in their native order, including fall damage followed by regeneration in the same tick. Explicit clock operations establish cooldown/hurt-time/game-time/tick-count state; full enclosing native tick/doTick methods are not invoked by those setup operations. Input preparation has its own client comparison. ServerPlayer.checkMovementStatistics executes on accepted resident deltas after movement and before food ticking. Additional direct method fixtures cover all 512 overlapping passenger/swim/eye-water/water/climb/ground/sprint/crouch/glide flag combinations, invulnerable abilities, centimeter rounding, overflow, signed zero and nonfinite deltas. Those query contexts apply only to the statistics method; fluid/vehicle/glide physics remain unbound. ServerGamePacketListener packet acceptance/rejection and scheduling are not executed. Powder snow operations (snow_tick) run the clock, the powder snow flags and old position of baseTick, then actual aiStep with the real Entity.applyEffectsFromBlocks (movement-path block sweep, StepBasedCollector, PowderSnowBlock.entityInside: stuck multiplier, ALTERNATIVE snowflake particles from the level random, FREEZE/EXTINGUISH, ServerPlayer.onInsideBlock criteria; NetherPortalBlock.entityInside (setAsInsidePortal, with portal_tick running the cooldown and PortalProcessor of Entity.handlePortal without a destination), WebBlock.entityInside with and without Weaving and SweetBerryBushBlock.entityInside at every age through Player.makeStuckInBlock, with sweet_berry_bush damage on the known movement) and the server freezing phase (thaw, frost modifier, freeze damage every 40 ticks); leather boots are a component-less stack and #freeze_immune_wearables is emulated by them. Outside snow_tick block-inside effects stay disabled on both sides. No full Player.tick, consumable item-use lifecycle, local input lifecycle, nonempty inventory/equipment ticks, full freezing, complete death lifecycle or full gameplay parity claim.'}) + 'scope':('Client sprint scene executes the real LocalPlayer.aiStep prefix through sprint decisions, stopping at the riding/parent movement boundary, followed by real LocalPlayer.modifyInput and the native server actor simulation. Sprint setters dispatch to that server actor, sharing its actual FoodData and collision conditions. Compares local sprint timer/input history and actual attribute changes, movement, distance exhaustion and hunger. Actual local crouch selection precedes new keyboard input; slowdown, sprint eligibility and pose-dependent dimensions share resident state. No effects, equipment, vehicles or fluid physics. Full client/server tick and networking remain unfinished. ' if args.sprint_input else '')+'Stored PlayerMotion binds resident client chunks and registered attributes/coefficients to air travel, jumping, Entity.move, step resolution, ground/support updates, restitution and speed factors. Repeated native Player.travel/jump/move and actual Player.aiStep / direct LivingEntity.aiStep compare position, velocity, bounds, collision/ground flags, support, climb state, fall-reset field, both sync flags, speed, head yaw, jump trigger and jump delay by exact bits. Prepared-local-input Player.aiStep paths verify the stored speed refresh after movement, with empty inventory and no nearby entities. Travel uses the actual Player.getSpeed movement-attribute query, independently of that stored base-living speed field; both getter and setter execute native bodies. Dry aiStep includes small-velocity cleanup, input damping, held/released jump timing and server frost-modifier removal. Snapshots also compare all allocated attribute instances, base/cache/dirty state, modifier values/operations/permanence and pending update/sync membership. Per-reference JVM holder/instance hashes are replayed so pending callback order and resulting ordered events also match. Dry resident scene with standing, crouching and crawling bounds, cached eye height, native pose-fit selection and ledge backoff; zero frozen ticks, empty equipment, no interpolation, fluid travel, vehicles, effects or other entities. The oracle controls pose storage and invokes actual native refreshDimensions on changes; full synchronized pose schema and network notifications remain separate. Actual pending attribute refresh runs after player movement and before pose selection in simulation operations, clamping health/absorption and rebuilding scale-dependent dimensions. Native ServerPlayer waypoint-receive and inherited transmit callbacks are compared as ordered requests; the waypoint manager and its network delivery remain controlled consumers. Direct refresh operations and the full enclosing tick remain separate boundaries. Actual LivingEntity.checkFallDamage, registered Block.fallOn/bounceOn and Player/LivingEntity.causeFallDamage are composed, including float-narrowed fall-distance accumulation, reset, last-climb clearing, safe-fall and damage-multiplier attributes, impulse exemptions and ordered landing particle/sound/statistic/hit-ground/damage requests. Farmland pushes the stored player and replaces actual chunk state; repeated turtle-egg changes preserve hatch. Block state at the landing fixture is compared after every operation. World RNG is a seeded native legacy stream. Actual ServerPlayer/Player/LivingEntity hurt dispatch now updates native synchronized health and player absorption, modified armor/toughness reduction, exhaustion, damage cooldown/last-source state and velocity synchronization. Native health storage and dirty flags are compared after every operation. Damage sources use actual decoded/tagged pinned damage registries. ServerPlayer jump statistics and exhaustion are included; dead-or-dying state disables movement input and jumping. Empty equipment/hands/effects, configurable difficulty and natural regeneration, damage gamerules enabled, loaded client and no spawn-extra fall particles define this scene domain. Ordered health/statistic/combat-record/broadcast/sound/criterion/death requests are compared; criterion argument payloads retain the separate combat gate. Actual health changes are applied, but audiovisual playback, persistent statistics, combat tracker internals, full death/drop/respawn services, block neighbor/drop/block-entity callbacks, movement emission, block-inside and networking remain controlled consumers. Actual FoodData.tick and ServerPlayer.tickRegeneration now share the same stored health, attributes, exhaustion and registered starvation damage. Snapshots compare food level, saturation, exhaustion, timer and tick count. Cases cover all four difficulties, regeneration rule changes, absorption during starvation, Peaceful recovery, timer overflow and nonfinite food values. Simulation operations compose clock setup, actual player movement and actual food ticking in their native order, including fall damage followed by regeneration in the same tick. Explicit clock operations establish cooldown/hurt-time/game-time/tick-count state; full enclosing native tick/doTick methods are not invoked by those setup operations. Input preparation has its own client comparison. ServerPlayer.checkMovementStatistics executes on accepted resident deltas after movement and before food ticking. Additional direct method fixtures cover all 512 overlapping passenger/swim/eye-water/water/climb/ground/sprint/crouch/glide flag combinations, invulnerable abilities, centimeter rounding, overflow, signed zero and nonfinite deltas. Those query contexts apply only to the statistics method; fluid/vehicle/glide physics remain unbound. ServerGamePacketListener packet acceptance/rejection and scheduling are not executed. Powder snow operations (snow_tick) run the clock, the powder snow flags and old position of baseTick, then actual aiStep with the real Entity.applyEffectsFromBlocks (movement-path block sweep, StepBasedCollector, PowderSnowBlock.entityInside: stuck multiplier, ALTERNATIVE snowflake particles from the level random, FREEZE/EXTINGUISH, ServerPlayer.onInsideBlock criteria; NetherPortalBlock.entityInside (setAsInsidePortal, with portal_tick running the cooldown and PortalProcessor of Entity.handlePortal without a destination), WebBlock.entityInside with and without Weaving and SweetBerryBushBlock.entityInside at every age through Player.makeStuckInBlock, with sweet_berry_bush damage on the known movement) and the server freezing phase (thaw, frost modifier, freeze damage every 40 ticks); leather boots are a component-less stack and #freeze_immune_wearables is emulated by them. Outside snow_tick block-inside effects stay disabled on both sides. Water operations (fluid_tick) run Entity.baseTick's fluid phase alone with the real updateFluidInteraction over the vanilla #water/#lava fluid tags (EntityFluidInteraction heights, eyes, currents with Player.isPushedByFluid, fall reset, Entity.doWaterSplashEffect sound/BUBBLE/SPLASH particles/SPLASH game event from the level random, firstTick) and lava's fall halving; every player tick runs that phase first. Scripted falls through the real Entity.move cover the FALLDAMAGE_RESETTING ray with ClipContext.Fluid.WATER (first-query fluid shape cache) and LivingEntity.checkFallDamage refreshing the fluids before applying the fall: source, flowing and falling water, waterlogged slabs/stairs/fences/trapdoors/lanterns/roots/ladders/grates/bars, bubble columns, kelp, seagrass and lava. The player never travels while touching a fluid (no water travel/swimming here). No full Player.tick, consumable item-use lifecycle, local input lifecycle, nonempty inventory/equipment ticks, full freezing, complete death lifecycle or full gameplay parity claim.'}) print(f'Scoped scene motion parity passed: {report}',flush=True) if __name__=='__main__':main()