ref:4bb0fdff794927e40939eb9a13f806eddcd347c5

Fix multi-block resize bug: extension placement now resizes controller

Bug: When block B was placed next to already-running block A, the rescanGroup() on B detected A as controller but never told A to resize its terminal to the combined dimensions. A kept running at 80x24 instead of resizing to the group size. Fix: The propagation loop now checks if a member is the controller with a running terminal and resizes it to match the new group. Added test: extensionResizesRunningController verifies that placing an extension next to a running controller updates its cols/rows. 35 GameTests + 52 Rust tests, all passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SHA: 4bb0fdff794927e40939eb9a13f806eddcd347c5
Author: Cole Christensen <cole.christensen@macmillan.com>
Date: 2026-03-20 08:11
Parents: b65660a
2 files changed +59 -2
Type
common/src/main/java/io/fangorn/alacrittymc/block/TerminalBlockEntity.java +24 −2
@@ -118,13 +118,35 @@
this.controllerPos = ctrlPos;
}
// Propagate group to all members
// Propagate group to all members and resize the controller if needed
int newCols = group.totalCols(COLS_PER_BLOCK);
int newRows = group.totalRows(ROWS_PER_BLOCK);
for (BlockPos memberPos : group.getMembers()) {
if (memberPos.equals(getBlockPos())) continue;
BlockEntity be = level.getBlockEntity(memberPos);
if (be instanceof TerminalBlockEntity memberBE) {
memberBE.screenGroup = group;
boolean isCtrl = ctrlPos.equals(memberPos);
memberBE.controllerPos = isCtrl ? null : ctrlPos;
memberBE.controllerPos = ctrlPos.equals(memberPos) ? null : ctrlPos;
// If this member is the controller and has a running terminal,
// resize it to match the new group dimensions
if (isCtrl && memberBE.terminalStarted && memberBE.terminal != null) {
if (memberBE.cols != newCols || memberBE.rows != newRows) {
memberBE.cols = newCols;
memberBE.rows = newRows;
memberBE.terminal.resize(newCols, newRows);
int[] dims = memberBE.terminal.getDimensions();
if (dims != null && dims.length >= 2) {
memberBE.pixelWidth = dims[0];
memberBE.pixelHeight = dims[1];
memberBE.pixelBuffer = ByteBuffer.allocateDirect(dims[0] * dims[1] * 4);
}
}
} else if (isCtrl) {
memberBE.cols = newCols;
memberBE.rows = newRows;
}
}
}
} else {