1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-04 15:43:00 +00:00

Send block updates to the computer when updating redstone

Fixes #1520
This commit is contained in:
Jonathan Coates
2023-07-22 13:49:26 +01:00
parent 0ad399a528
commit 90ed0b24e7
4 changed files with 169 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ import net.minecraft.world.level.block.RedstoneLampBlock
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.lwjgl.glfw.GLFW
import kotlin.time.Duration.Companion.milliseconds
class Computer_Test {
/**
@@ -71,6 +72,24 @@ class Computer_Test {
thenExecute { context.assertBlockHas(lamp, RedstoneLampBlock.LIT, false, "Lamp should not be lit") }
}
/**
* Check computers pick up propagated redstone to surrounding blocks.
*
* @see [#1520](https://github.com/cc-tweaked/CC-Tweaked/issues/1520)
*/
@GameTest
fun Self_output_update(context: GameTestHelper) = context.sequence {
thenOnComputer {
getApi<RedstoneAPI>().setOutput(ComputerSide.BACK, true)
sleep(100.milliseconds)
assertEquals(true, getApi<RedstoneAPI>().getInput(ComputerSide.BACK), "Input should be on")
getApi<RedstoneAPI>().setOutput(ComputerSide.BACK, false)
sleep(100.milliseconds)
assertEquals(false, getApi<RedstoneAPI>().getInput(ComputerSide.BACK), "Input should be off")
}
}
/**
* Check computers and turtles expose peripherals.
*/