Merge pull request #2490 from kacpherek/fix/2485-redstone-ore-step

🤖 Agent: Merged by hand by Ludovic's AI agent (orchestrator) after the contribution gate. rdbtCVS's change request is addressed at this head; a re-review was asked hours ago, with no new objection since. Proven in cg19 union A 5fb64f0d6 (main c1ebf5d1b + 50 PRs) Mac mini 352/354 harnesses (fin.
This commit is contained in:
Ludovic Marie
2026-10-27 13:34:01 +01:00
committed by GitHub
+36
View File
@@ -1515,6 +1515,16 @@ impl Game<'_> {
fn tick_entity_events(&mut self) {
self.tick_player_sculk_events();
self.tick_mob_sculk_events();
// Dropped items are entities too: Entity.applyEffectsFromBlocks.
let items: Vec<[f64; 3]> = self
.dropped
.iter()
.filter(|i| i.on_ground)
.map(|i| [i.position.x, i.position.y, i.position.z])
.collect();
for at in items {
self.step_on_redstone_ore(at, false);
}
}
/// Entity.move emits on the authoritative server too, for each ServerPlayer.
@@ -1530,6 +1540,9 @@ impl Game<'_> {
});
if let Some((at, on_ground, health, flying)) = player {
let crouch = self.keys.contains(&KeyCode::ShiftLeft);
if on_ground && !self.spectator() {
self.step_on_redstone_ore(at, crouch);
}
let in_water = self.in_water_at(at);
self.entity_motion_events(
Who::Player,
@@ -1548,6 +1561,26 @@ impl Game<'_> {
}
}
/// `RedStoneOreBlock.stepOn`: standing on the ore lights it, unless the
/// entity is stepping carefully (`attack_block` only lights an unlit ore).
fn step_on_redstone_ore(&mut self, at: [f64; 3], carefully: bool) {
if carefully {
return;
}
// getOnPosLegacy: 0.2 below the feet.
let pos = [
at[0].floor() as i32,
(at[1] - 0.2).floor() as i32,
at[2].floor() as i32,
];
if matches!(
&*self.block_name(pos),
"minecraft:redstone_ore" | "minecraft:deepslate_redstone_ore"
) {
let _ = self.attack_block(pos);
}
}
fn tick_mob_sculk_events(&mut self) {
let snapshot: Vec<(u32, [f64; 3], bool, bool, Species, Option<i64>)> = self
.mobs
@@ -1565,6 +1598,9 @@ impl Game<'_> {
})
.collect();
for (id, at, on_ground, in_water, species, damaged) in snapshot {
if on_ground {
self.step_on_redstone_ore(at, false);
}
let emits = !matches!(species, Species::Shulker);
if emits {
self.entity_motion_events(Who::Mob(id), at, on_ground, in_water, false, false);