mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-10-19 22:12:28 +00:00
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:
+5
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user