From ffb6594600275986d6a2a0ffc3cfe651bd205f6e Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:37:59 +0100 Subject: [PATCH] Format the block behaviour changes --- crates/horizon-client/src/game.rs | 17 ++++++++--------- crates/horizon-world/src/level/hooks.rs | 10 ++++++++-- crates/horizon-world/src/level/mod.rs | 3 ++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index bc1dec6e5..50b1d0be9 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -3523,9 +3523,7 @@ impl Game<'_> { kind: "dispense", } => self.dispense_from(pos, state)?, LevelEvent::BlockEvent { - pos, - kind: "golem", - .. + pos, kind: "golem", .. } => self.check_golem_spawn([pos.x, pos.y, pos.z])?, LevelEvent::BlockEvent { pos, @@ -4009,11 +4007,8 @@ impl Game<'_> { let at = pos.map(f64::from); self.spawn_item(stack, at, dispenser::new_item_motion(), 10); } - let correct_tool = !facts.requires_tool - || self - .res - .items() - .correct_for_drops(self.held(), &facts.name); + let correct_tool = + !facts.requires_tool || self.res.items().correct_for_drops(self.held(), &facts.name); let removed = self.with_level(|b, level, ticks| { b.player_destroy_block( level, @@ -4264,7 +4259,11 @@ impl Game<'_> { .as_ref() .is_some_and(|s| s.item.ends_with("_hanging_sign")) && { - let name = &self.res.facts().get(self.world.block(hit.pos[0], hit.pos[1], hit.pos[2])).name; + let name = &self + .res + .facts() + .get(self.world.block(hit.pos[0], hit.pos[1], hit.pos[2])) + .name; name.ends_with("_hanging_sign") && !name.contains("_wall_") } && matches!( diff --git a/crates/horizon-world/src/level/hooks.rs b/crates/horizon-world/src/level/hooks.rs index c5898b19c..f402e8e48 100644 --- a/crates/horizon-world/src/level/hooks.rs +++ b/crates/horizon-world/src/level/hooks.rs @@ -393,7 +393,12 @@ impl Sim<'_, L> { /// `ServerPlayerGameMode.destroyBlock`: `playerWillDestroy` then /// `removeBlock`. Drops are the caller's (tool-dependent loot). - pub(crate) fn player_destroy(&mut self, pos: BlockPos, creative: bool, correct_tool: bool) -> bool { + pub(crate) fn player_destroy( + &mut self, + pos: BlockPos, + creative: bool, + correct_tool: bool, + ) -> bool { let b = self.b; let p = b.props; let state = self.state(pos); @@ -402,7 +407,8 @@ impl Sim<'_, L> { } let data = b.data(state); // DoorBlock also clears the bottom half when the tool would not drop it. - if ((creative && data.is(Class::DoublePlant)) || (data.is(Class::Door) && (creative || !correct_tool))) + if ((creative && data.is(Class::DoublePlant)) + || (data.is(Class::Door) && (creative || !correct_tool))) && b.table.text(state, p.half) == "upper" { let bottom = below(pos); diff --git a/crates/horizon-world/src/level/mod.rs b/crates/horizon-world/src/level/mod.rs index 3c308b4f6..9ab4c1a8d 100644 --- a/crates/horizon-world/src/level/mod.rs +++ b/crates/horizon-world/src/level/mod.rs @@ -663,7 +663,8 @@ impl Behaviours { creative: bool, correct_tool: bool, ) -> bool { - self.sim(level, ticks).player_destroy(pos, creative, correct_tool) + self.sim(level, ticks) + .player_destroy(pos, creative, correct_tool) } /// `IceBlock.playerDestroy` after the drops: mined ice melts into water /// unless the tool prevents ice melting (silk touch). `destroyed` is the