Format the block behaviour changes

This commit is contained in:
Kacpherek committed 2026-10-27 22:37:59 +01:00
1 parent 0d3ca74bd0
commit ffb6594600
3 files changed
+18 -12

No files matched your search

+8 -9
View File
@@ -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!(
+8 -2
View File
@@ -393,7 +393,12 @@ impl<L: LevelAccess + ?Sized> 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<L: LevelAccess + ?Sized> 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);
+2 -1
View File
@@ -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