Merge pull request #1883 from ludovic111/fix/copper-golem-statue-poses

🤖 Agent: merged after verify (bugs-dezerx-1's fix for a player's bug list, self-checked with pr_ready); harnesses run on main by parity-main, which gates releases.
This commit is contained in:
Ludovic Marie
2026-10-26 02:22:56 +01:00
committed by GitHub
3 changed files with 76 additions and 2 deletions
+10
View File
@@ -8407,6 +8407,8 @@ impl Game<'_> {
1.0,
1.0,
);
// ItemStack.useOn: a use that acted counts as one of the item.
self.stats.add("used", &stack.item, 1);
self.damage_held(damage);
self.post_block_game_event("minecraft:block_change", pos, self.sculk_actor(), Some(new));
Ok(true)
@@ -8611,6 +8613,14 @@ impl Game<'_> {
1.0,
1.0,
);
// HoneycombItem.useOn's game event, and ItemStack.useOn's used statistic.
self.post_block_game_event(
"minecraft:block_change",
hit.pos,
self.sculk_actor(),
Some(state),
);
self.stats.add("used", &stack.item, 1);
if !self.creative {
self.consume_held();
}
@@ -592,6 +592,37 @@ impl Behaviours {
{
return InteractionResult::Pass;
}
if self.data(state).chain.contains(&Class::CopperGolemStatue) {
return self.turn_statue(level, ticks, pos, state, item);
}
self.use_without_item(level, ticks, pos, face, hit, player)
}
/// `CopperGolemStatueBlock.useItemOn` (and its weathering subclass's): anything but an axe
/// (`#minecraft:axes`, every one named `*_axe`), even an empty hand, turns the statue to its
/// next pose; honeycomb waxes a statue that still weathers instead.
fn turn_statue<L: LevelAccess + ?Sized>(
&self,
level: &mut L,
ticks: &mut Ticks,
pos: BlockPos,
state: BlockStateId,
item: Option<&str>,
) -> InteractionResult {
let item = item.unwrap_or("minecraft:air");
let waxed = self.table.name(state).starts_with("minecraft:waxed_");
if item.ends_with("_axe") || (item == "minecraft:honeycomb" && !waxed) {
return InteractionResult::Pass;
}
let mut sim = self.sim(level, ticks);
sim.sound(
pos,
&"minecraft:entity.copper_golem_become_statue".into(),
1.0,
1.0,
);
sim.set_block_and_update(pos, self.table.cycle(state, self.props.copper_golem_pose));
sim.game_event(pos, "minecraft:block_change");
InteractionResult::Success
}
}