Format the block behaviour changes
This commit is contained in:
@@ -3523,9 +3523,7 @@ impl Game<'_> {
|
|||||||
kind: "dispense",
|
kind: "dispense",
|
||||||
} => self.dispense_from(pos, state)?,
|
} => self.dispense_from(pos, state)?,
|
||||||
LevelEvent::BlockEvent {
|
LevelEvent::BlockEvent {
|
||||||
pos,
|
pos, kind: "golem", ..
|
||||||
kind: "golem",
|
|
||||||
..
|
|
||||||
} => self.check_golem_spawn([pos.x, pos.y, pos.z])?,
|
} => self.check_golem_spawn([pos.x, pos.y, pos.z])?,
|
||||||
LevelEvent::BlockEvent {
|
LevelEvent::BlockEvent {
|
||||||
pos,
|
pos,
|
||||||
@@ -4009,11 +4007,8 @@ impl Game<'_> {
|
|||||||
let at = pos.map(f64::from);
|
let at = pos.map(f64::from);
|
||||||
self.spawn_item(stack, at, dispenser::new_item_motion(), 10);
|
self.spawn_item(stack, at, dispenser::new_item_motion(), 10);
|
||||||
}
|
}
|
||||||
let correct_tool = !facts.requires_tool
|
let correct_tool =
|
||||||
|| self
|
!facts.requires_tool || self.res.items().correct_for_drops(self.held(), &facts.name);
|
||||||
.res
|
|
||||||
.items()
|
|
||||||
.correct_for_drops(self.held(), &facts.name);
|
|
||||||
let removed = self.with_level(|b, level, ticks| {
|
let removed = self.with_level(|b, level, ticks| {
|
||||||
b.player_destroy_block(
|
b.player_destroy_block(
|
||||||
level,
|
level,
|
||||||
@@ -4264,7 +4259,11 @@ impl Game<'_> {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|s| s.item.ends_with("_hanging_sign"))
|
.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_")
|
name.ends_with("_hanging_sign") && !name.contains("_wall_")
|
||||||
}
|
}
|
||||||
&& matches!(
|
&& matches!(
|
||||||
|
|||||||
@@ -393,7 +393,12 @@ impl<L: LevelAccess + ?Sized> Sim<'_, L> {
|
|||||||
|
|
||||||
/// `ServerPlayerGameMode.destroyBlock`: `playerWillDestroy` then
|
/// `ServerPlayerGameMode.destroyBlock`: `playerWillDestroy` then
|
||||||
/// `removeBlock`. Drops are the caller's (tool-dependent loot).
|
/// `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 b = self.b;
|
||||||
let p = b.props;
|
let p = b.props;
|
||||||
let state = self.state(pos);
|
let state = self.state(pos);
|
||||||
@@ -402,7 +407,8 @@ impl<L: LevelAccess + ?Sized> Sim<'_, L> {
|
|||||||
}
|
}
|
||||||
let data = b.data(state);
|
let data = b.data(state);
|
||||||
// DoorBlock also clears the bottom half when the tool would not drop it.
|
// 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"
|
&& b.table.text(state, p.half) == "upper"
|
||||||
{
|
{
|
||||||
let bottom = below(pos);
|
let bottom = below(pos);
|
||||||
|
|||||||
@@ -663,7 +663,8 @@ impl Behaviours {
|
|||||||
creative: bool,
|
creative: bool,
|
||||||
correct_tool: bool,
|
correct_tool: bool,
|
||||||
) -> 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
|
/// `IceBlock.playerDestroy` after the drops: mined ice melts into water
|
||||||
/// unless the tool prevents ice melting (silk touch). `destroyed` is the
|
/// unless the tool prevents ice melting (silk touch). `destroyed` is the
|
||||||
|
|||||||
Reference in New Issue
Block a user