Skip to content

Commit 00c83cb

Browse files
committed
Fixed DownCounter not resetting when input is high
1 parent c2d0038 commit 00c83cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/DownCounter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void trigger(ChipState chip) {
8080
int oldVal = curVal;
8181
try {
8282
// If clock input triggered
83-
if (chip.getInput(0)) {
83+
if (chip.getInput(0) && chip.isTriggered(0)) {
8484
if (curVal == 0) { // If we've gotten to 0, reset if infinite mode
8585
if (inf) {
8686
curVal = resetVal;
@@ -92,7 +92,7 @@ public void trigger(ChipState chip) {
9292
// Set output to high if we're at 0, otherwise low
9393
chip.setOutput(0, curVal == 0);
9494
// If reset input triggered, reset counter value
95-
} else if (chip.getInput(1)) {
95+
} else if (chip.getInput(1) && chip.isTriggered(1)) {
9696
curVal = resetVal;
9797
chip.setOutput(0, false);
9898
}

0 commit comments

Comments
 (0)