mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 17:21:49 -10:00
redstone ore: a right-click lights it, as RedStoneOreBlock.useItemOn does
Fixes #3044.
This commit is contained in:
1 parent
56f968e11c
commit
e06134f71a
2 files changed
+28
No files matched your search
@@ -4233,6 +4233,10 @@ impl Game<'_> {
|
||||
self.swing_arm();
|
||||
return Ok(true);
|
||||
}
|
||||
if self.use_redstone_ore(hit.pos, held.as_ref())? {
|
||||
self.swing_arm();
|
||||
return Ok(true);
|
||||
}
|
||||
match self.use_respawn_anchor(hit.pos, held.as_ref())? {
|
||||
respawn_anchor::AnchorUse::Charged => {
|
||||
self.swing_arm();
|
||||
|
||||
@@ -1577,6 +1577,30 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// `RedStoneOreBlock.useItemOn`: a right-click lights the ore whatever the
|
||||
/// hand holds. False (PASS) when the hand holds a block item, which goes on
|
||||
/// to be placed; true (SUCCESS) otherwise.
|
||||
pub(super) fn use_redstone_ore(
|
||||
&mut self,
|
||||
pos: [i32; 3],
|
||||
held: Option<&horizon_client::items::ItemStack>,
|
||||
) -> Result<bool> {
|
||||
if !matches!(
|
||||
&*self.block_name(pos),
|
||||
"minecraft:redstone_ore" | "minecraft:deepslate_redstone_ore"
|
||||
) {
|
||||
return Ok(false);
|
||||
}
|
||||
self.attack_block(pos)?;
|
||||
let block_item = held.is_some_and(|s| {
|
||||
self.res
|
||||
.items()
|
||||
.get(&s.item)
|
||||
.is_some_and(|i| i.block.is_some())
|
||||
});
|
||||
Ok(!block_item)
|
||||
}
|
||||
|
||||
fn tick_mob_sculk_events(&mut self) {
|
||||
let snapshot: Vec<(u32, [f64; 3], bool, bool, Species, Option<i64>)> = self
|
||||
.mobs
|
||||
|
||||
Reference in new issue
Block a user