Powder snow: sinking, freezing, leather boots, buckets and falling blocks
Powder snow was inert: the player's collision context never carried its
fall distance or boots, block-inside effects never ran for the player,
frozen ticks stayed 0 and the empty bucket only took fluids.
Player (PlayerMotion, LivingEntity.aiStep order):
- PowderSnowBlock.getCollisionShape gets the player's fall distance and
leather boots: it sinks through, walks on top in leather boots (sinks
when crouching), lands on the 0.9-high shape after a fall of more
than 2.5 blocks.
- Entity.applyEffectsFromBlocks over this tick's movement path (the
ported block sweep, StepBasedCollector steps): entityInside makes it
stuck (0.9, 1.5, 0.9) while its feet are in powder snow and sends the
server's snowflake from the level random; FREEZE sets isInPowderSnow
and adds a frozen tick per step; EXTINGUISH destroys the snow if the
player burns and puts the fire out. ServerPlayer.onInsideBlock fires
enter_block for every block entered (which also unlocks the boat
recipes in water, and the end gateway advancement).
- baseTick's wasInPowderSnow lets leather boots climb out (living_air).
- Server freezing: thawing 2 a tick, the powder_snow frost modifier
(-0.05 x percent frozen, not over air), freeze damage every 40 ticks
when fully frozen; leather armor (#freeze_immune_wearables) and
spectators don't freeze.
- HUD: the powder snow outline overlay and frozen hearts.
Items and blocks:
- BucketItem.use on powder snow: pickupBlock (2001), used statistic,
fill sound, FLUID_PICKUP, createFilledResult, filled_bucket trigger.
- SolidBucketItem: the empty_powder_snow place sound and an empty bucket
back in survival.
- Falling blocks land on powder snow, or end up inside it and break
after a fall of more than 2.5 blocks.
test_native_scene_motion gains powder snow fixtures ("snow_tick": the
oracle runs vanilla's real applyEffectsFromBlocks and freezing) and
prints frozen ticks, the snow flags and the stuck multiplier.
Fixes #62
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -360,6 +360,7 @@ fn can_spawn_on(b: &Blocks, pos: [i32; 3], state: BlockStateId, above: BlockStat
|
||||
let mut scene = SceneCollisions {
|
||||
world: b.w.world,
|
||||
binding: b.w.collision,
|
||||
subject: None,
|
||||
};
|
||||
let above_pos = [pos[0], pos[1] + 1, pos[2]];
|
||||
let above_empty =
|
||||
@@ -422,6 +423,7 @@ fn spawn_protector(
|
||||
let mut scene = SceneCollisions {
|
||||
world: w.world,
|
||||
binding: w.collision,
|
||||
subject: None,
|
||||
};
|
||||
if !scene.unobstructed(bounds).unwrap_or(false) {
|
||||
continue;
|
||||
|
||||
@@ -122,6 +122,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
let state = self.world.block(x, y, z);
|
||||
let at = horizon_core::position::BlockPos::new(x, y, z);
|
||||
@@ -168,6 +169,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
scene.unobstructed(b).unwrap_or(false)
|
||||
}
|
||||
@@ -311,6 +313,7 @@ impl Mob {
|
||||
let mut scene = SceneCollisions {
|
||||
world: w.world,
|
||||
binding: w.collision,
|
||||
subject: None,
|
||||
};
|
||||
let moved = scene
|
||||
.resolve(self.bounds(), wanted, step, self.on_ground)
|
||||
|
||||
@@ -62,6 +62,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
let result = traverse_blocks(from, to, 512, |p: BlockPos| {
|
||||
let state = self.world.block(p.x, p.y, p.z);
|
||||
@@ -86,6 +87,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
let full = horizon_core::geometry::Aabb::new(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0));
|
||||
let result = traverse_blocks(from, to, 512, |p: BlockPos| {
|
||||
@@ -117,6 +119,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
let result = traverse_blocks(from, to, 512, |p: BlockPos| {
|
||||
let state = self.world.block(p.x, p.y, p.z);
|
||||
@@ -137,6 +140,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
let result = traverse_blocks(from, to, 512, |p: BlockPos| {
|
||||
let state = self.world.block(p.x, p.y, p.z);
|
||||
@@ -156,6 +160,7 @@ impl MobWorld<'_> {
|
||||
let mut scene = SceneCollisions {
|
||||
world: self.world,
|
||||
binding: self.collision,
|
||||
subject: None,
|
||||
};
|
||||
let state = self.world.block(p[0], p[1], p[2]);
|
||||
self.collision
|
||||
|
||||
Reference in New Issue
Block a user