Read the click's changed slots for the machine's setChanged

The menu op already lists the slots the click changed; a container slot
among them is the Slot.setChanged that saves the block entity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-26 01:07:48 +01:00
parent bbc57aa838
commit bb3a289caa
@@ -293,7 +293,7 @@ impl Game<'_> {
}
// Slot.setChanged on a changed container slot: BlockEntity.setChanged,
// so the chunk is saved and comparators read the block again.
if (0..items.len()).any(|k| menu.slot(k) != items[k].as_ref()) {
if changed.iter().any(|&s| s < items.len()) {
self.container_changed(pos);
}
host.play.entry(conn).or_default().crafting.machine = Some((p.container, menu));