Refresh redstone output when first creating a computer

This is an identical fix to 013f2e500f,
but for computers rather than redstone integrators.

I don't love the duplication — it might make more sense to move this
into RedstoneState.updateOutput and have an "initial tick" flag there
instead.

Fixes #2392.
This commit is contained in:
Jonathan Coates
2026-09-18 11:06:26 +01:00
parent 1a7f9ce995
commit 93e4ecd350
@@ -109,7 +109,6 @@ public abstract class AbstractComputerBlockEntity extends BlockEntity implements
computer.keepAlive();
fresh = false;
computerID = computer.getID();
// If the on state has changed, mark as dirty.
@@ -129,12 +128,15 @@ public abstract class AbstractComputerBlockEntity extends BlockEntity implements
// Update the block state if needed.
updateBlockState(computer.getState());
// Update redstone output if the computer is new or the computer's redstone output has changed.
var changes = computer.pollRedstoneChanges();
if (changes != 0) {
if (fresh || changes != 0) {
for (var direction : DirectionUtil.FACINGS) {
if ((changes & (1 << remapToLocalSide(direction).ordinal())) != 0) updateRedstoneTo(direction);
if (fresh || (changes & (1 << remapToLocalSide(direction).ordinal())) != 0) updateRedstoneTo(direction);
}
}
fresh = false;
}
protected abstract void updateBlockState(ComputerState newState);