redstone ore: a right-click lights it, as RedStoneOreBlock.useItemOn does
Fixes #3044.
This commit is contained in:
@@ -4233,6 +4233,10 @@ impl Game<'_> {
|
|||||||
self.swing_arm();
|
self.swing_arm();
|
||||||
return Ok(true);
|
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())? {
|
match self.use_respawn_anchor(hit.pos, held.as_ref())? {
|
||||||
respawn_anchor::AnchorUse::Charged => {
|
respawn_anchor::AnchorUse::Charged => {
|
||||||
self.swing_arm();
|
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) {
|
fn tick_mob_sculk_events(&mut self) {
|
||||||
let snapshot: Vec<(u32, [f64; 3], bool, bool, Species, Option<i64>)> = self
|
let snapshot: Vec<(u32, [f64; 3], bool, bool, Species, Option<i64>)> = self
|
||||||
.mobs
|
.mobs
|
||||||
|
|||||||
Reference in New Issue
Block a user