Railcraft

Railcraft

34M Downloads

Problems with rotations of trains

Allnorm opened this issue ยท 8 comments

commented

The bug is shown even on clean assemblies, unpredictable and I can not use the mod because of this. Locomotive for some reason is turned back on corners. Video attached: https://youtu.be/Xh2dh74IQPY Railcraft 9.12.2.0 and 9.12.2.1, but the bug was noticed long ago.

commented

I get this bug in the dev environment release as well on occasion.

commented

@Lilithvia You mean on 1.12.2?

commented

Correct.
Not often, but on occasion.

commented

Also I will move #657 here.

commented

From my observation in 1.7.10, this happens quiet often with trains being loaded only with anchor carts and no players around, which makes remote logistics with RC pretty difficult.
It didn't happen in 1.4.7 version of RC.

commented

For background purposes, Minecraft does not track orientation of minecarts correctly. You can see this by watching Chest Carts go around loops, they will reverse their orientation every other corner. To get around this Railcraft tries to track when a "reversal" happens using some fancy math that inspects the size of the orientation deviation every tick and un-reverses the cart when a reversal is detected. For unknown reasons its not perfect and we don't have direct access to the code that manages orientation.

At one point I spent a fair bit of time on this problem, even going to so far as to inspect the source of other cart mods to see how they handled the problem. I don't know why it doesn't work correctly sometimes and I don't know how to fix it either.

See #972 and b906144 for details.

commented

Additionally, the client and server track orientation separately and are only loosely coupled.

commented

due to mc's low tickrate (most other engines are 60+), there's likely a level of mathematical undefined behaviour when carts run at certain speeds, or at certain distances to certain track conditions.