stfwi / redstonepen

Minecraft mod adding a pen to draw Redstone tracks in all directions, a PLC for Redstone, and relays.
MIT License
15 stars 2 forks source link

[Issue] Timers get stuck when tickrate == 1 #24

Closed Saftur closed 1 year ago

Saftur commented 1 year ago

For example, with this code:

tickrate = 1
r = ton1(1, 100)

TON1.ET will rapidly alternate between 0 and 1 indefinitely, and the timer will never complete. And as far as I've seen, it does the same with tof and tp. Is there some reason timers would be incompatible with tickrates of 1, or custom tickrates in general? They seem to work fine with tickrates greater than 1.

Minecraft version: 1.18.2 Forge version: 40.1.86 Redstone Pen version: 1.0.11

stfwi commented 1 year ago

Hi, aye I could reproduce it in my 1.19 ide. It's a "+1" race condition that comes from compensating from game tick (20Hz) to Redstone tick (10Hz). I'll quickly kick that and add timer deadlines, so that timers are accurate no matter what tickrate is specified. Let's see if this is quickly fixable or if it has a catch ;)

stfwi commented 1 year ago

Oky, can you retry with redstonepen-1.18.2-1.0.12.jar? IDE tests on my machine were ok. Cheers,-

Saftur commented 1 year ago

It appears to work just fine now. Thanks!