mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-09 17:19:15 -10:00
Format the block behaviour changes
This commit is contained in:
1 parent
0d3ca74bd0
commit
ffb6594600
3 files changed
+18
-12
No files matched your search
@@ -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!(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user