Save furnace, brewing stand and crafter edits made through a server menu
A server player's clicks in a furnace, brewing stand or crafter menu wrote the block entity's slots but never marked it changed, so the chunk was not saved: an idle furnace (nothing burning, so its own tick changes nothing) given or emptied through its menu rolled back on reopen or chunk unload, losing or duplicating the items. Comparators kept the old reading too. When the click changed the container's slots, call container_changed (BlockEntity.setChanged, reached through Slot.setChanged in vanilla's AbstractContainerMenu.doClick and quickMoveStack), as chest-like menus already do.
This commit is contained in:
@@ -291,6 +291,11 @@ impl Game<'_> {
|
||||
let at = host.hub.guests[gi].position;
|
||||
self.award_furnace_recipes(pos, at);
|
||||
}
|
||||
// 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()) {
|
||||
self.container_changed(pos);
|
||||
}
|
||||
host.play.entry(conn).or_default().crafting.machine = Some((p.container, menu));
|
||||
host.hub.inventory_clicked(conn, p, &self.world, &changed);
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user