Merge pull request #2185 from kacpherek/fix/slime-block-step-slowdown
🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: `SlimeBlock.stepOn` slows a walker that isn't sneaking when `|dy| < 0.1`, by `0.4 + |dy| * 0.2`. Gate: this wave's 55 PRs merged on main in one tree: clippy `-D warnings` clean, 1186 horizon-client and 163 horizon-world tests pass, and of the 101 harnesses `parity.py --changed-files` picked, 100 pass (`block_removal` failed on one spawner case from #2199's orb merging, fixed there). `lan_e2e.py` passes 24 checks with the host on its server thread and in-frame (chest, xp, pvp, doors, villagers, beds, frames, projectiles, arrows, fishing, damage, mobs, blast, drops, elytra, breath, predict, cracks, barter, kills, hurt, contacts, underwater, plates), plus forced-levels on the server thread. Thanks @kacpherek!
This commit is contained in:
@@ -1083,7 +1083,7 @@ impl MotionWorld<'_, '_, '_> {
|
||||
/// `Entity.applyEffectsFromBlocks` for the blocks Horizon's player reacts
|
||||
/// to inside its movement path: powder snow (`PowderSnowBlock.entityInside`
|
||||
/// and the FREEZE / EXTINGUISH effects), cobwebs, sweet berry bushes,
|
||||
/// cactus and lit campfires, and the magma block it stands on
|
||||
/// cactus and lit campfires, and the magma and slime blocks it stands on
|
||||
/// (`stepOn`). Pressure plates, tripwires and rails are the world tick's
|
||||
/// scan.
|
||||
pub fn apply_effects_from_blocks(&mut self) -> Result<()> {
|
||||
@@ -1141,14 +1141,22 @@ impl MotionWorld<'_, '_, '_> {
|
||||
// MagmaBlock's hot floor hurts unless it steps carefully (sneaks).
|
||||
if self.player.ground.on_ground {
|
||||
let on = self.legacy_on_position()?;
|
||||
let magma = self
|
||||
.assets
|
||||
.registry
|
||||
.state(self.block(on))
|
||||
.is_some_and(|s| s.name == "minecraft:magma_block");
|
||||
let under = self.assets.registry.state(self.block(on));
|
||||
let magma = under.is_some_and(|s| s.name == "minecraft:magma_block");
|
||||
let slime = under.is_some_and(|s| s.name == "minecraft:slime_block");
|
||||
if magma && !self.player.shift_key_down {
|
||||
self.environment_hurt("minecraft:hot_floor", 1.0)?;
|
||||
}
|
||||
// SlimeBlock.stepOn: a slow walk on slime drags the horizontal
|
||||
// speed (the client moves its own player, so not the server's copy).
|
||||
if slime && !damage_only && !self.player.shift_key_down {
|
||||
let abs_delta_y = self.player.velocity.y.abs();
|
||||
if abs_delta_y < 0.1 {
|
||||
let scale = 0.4 + abs_delta_y * 0.2;
|
||||
self.player.velocity.x *= scale;
|
||||
self.player.velocity.z *= scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut visited = std::collections::HashSet::new();
|
||||
let mut entered = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user