//Credits to:
Da4ThEdge
-create the code that made it possible to link a series of minecarts into caravans
(https://mcpedl.com/trains-addon)

Ps: I have modified all of them to work with my current addon.