Inactive [MECH] TrainCarts v1.71.2 - Link minecarts of different types together to form trains [2222]

Discussion in 'Inactive/Unsupported Plugins' started by bergerkiller, Aug 3, 2011.

  1. Offline



    After a request from Marius A. Winsjansen I started to work on linked Minecarts. On the first day I already managed to make multiple carts move with the same speed, but a long list of bugs was to be expected. After fixing lots of bugs, adding lots of (complicated) Minecart handling functions and after hours of testing on my local server, this plugin is finally ready for a stable release! :D

    Also, special thanks go to @Shamebot for helping me out several times. :)

    For a lot of information about TrainCarts see the WIKI page!

    Configuration and permissions

    All configuration nodes can be found in config.yml and contains a description with it. Permissions can be found in PermissionDefaults.yml, combined with a description.


    Early development video (Photobucket)

    Video displaying version 0.6 of this plugin (YouTube)

    Video displaying version 1.0 of this plugin (YouTube)

    Video displaying version 1.1 of this plugin (YouTube)

    Video displaying version 1.2 of this plugin (holy...)

    A tutorial video in German explaining various sign-circuitry of TrainCarts

    PhotoBucket Sign system tutorial videos (also linked in the WIKI pages)
    Train spawner / Stations / Stations2 / Arrival signs / Train teleportation / Track switcher based on tags / Destinations / Blocker
    Video of how the switcher, station and destination signs work together

    Side information:

    It works best on straight lines with not too much elevation changes followed up by sharp corners. As long the cart gap can be adjusted, everything goes fine. It had some collision issues in the past, but I fixed all of that by manipulating the actual Minecraft server native code. I added links in the source where this was appropriate. Sharp 'U'-turns cause individual carts to lose perceptive of their direction. Keep at least one piece of track in between corner sections! Trains are stored on-disk when reloading and stopping the server, so expect trains to be there when you return.

    Important when updating: do one reload to save all trains, then replace traincarts.jar, and then do another reload. This next reload will probably cause a noClassDefFound exception (since the old jar got replaced), this is why a pre-reload is required. Replacing the jar without reloading is a very bad idea: it will cause a lot of runtime exceptions. Best is of course to stop the server and start again, but this is not always possible.

    This plugin is made compatible with Minecart Mania. If you notice a certain feature of Minecart Mania is not compatible with TrainCarts, notify me and I'll fix it. :)

    Known bugs:
    - None.

    - Train-sign message handling using SignLink (low priority)
    - Minecart use permissions (for individual carts?) such as Storage Minecarts


    If you encountered a bug, post exactly what you had done and in what order. Even a slight wobble can help fixing bugs. When posting (long) errors I recommend you to post everything, don't cut it off. I work with native methods, so in my case these lines are important. For comments on the media content see YouTube, it also contains a description with the music name when music is used.

    Bug reporting (extend)

    1. Post the Craftbukkit version you are using (the first info message in the console)
    2. Post the log from where the first plugin gets enabled to the 'done'.
    3. Post possible errors in this log too (don't cut them short)
    4. No error? Still post the log. Also explain how I can reproduce it, you can use screenshots
    5. Before reporting, remove ALL plugins other than TrainCarts and try again. If it works then, find out what plugin is interfering and post that here. I can add support.
    6. ALWAYS use the latest recommended Craftbukkit build with this, or my methods may just fail because of renamed functions.

    Important links:

    Request thread
    TrainCarts on BukkitDev for download and more
    TrainCarts source and more on GitHub
    TrainCartsBlocks add-on source and more on GitHub
    SignLink Bukkit page (required to use Arrival signs)
    MyWorlds Bukkit page (required to use Portal train teleportation)

    notice: try to keep SignLink/MyWorlds up-to-date to prevent compatibility issues.

    Installation for those that don't know how

    1. Download and install the latest craftbukkit version
    2. Download the latest TrainCarts version
    3. ^ Save the archive (zip file) to your computer
    4. ^ Open the archive you just downloaded
    5. In the folder your server sits in, create the plugins folder if it doesn't exist
    6. Open the plugins folder
    7. Move the TrainCarts.jar file found in the archive into the plugins folder
    8. Run your craftbukkit server and look in the console/log for possible errors, and/or if the plugin is enabled.


    Show your appreciation for my plugins by donating
  2. Offline


    Can you make so you can change the Powered minecarts speed?
  3. Offline


    Yes I can do that, good suggestion. :)
  4. Offline


    One Magor problem i have is i Can't Use minecart miania and you can not stop the train carts with the obsidion block witch is a Brake block<, And is there anyway you can make it that we can stop the train cuz im having a prolem hopfully u can add minecart mainai support Thanks Alot for this wonderful Plugin :D
  5. Offline


    I don't think this is compatible with Minecart Mania as they both manipulate the way the minecarts work. Although MC Mania support would be uber! Cause I heavily use sign controlled intersections, stations etc.
  6. Offline


    THANK YOU!!!! ^_^
  7. Offline


    I honestly don't know how Minecart Mania interacts with Minecarts, but any type of velocity controlled action is still possible through this plug-in. The brake could be a problem, since it stores a remainder. (So one velocity set to 0 command will not stop the train).

    Afraid it requires Minecart Mania itself to add support (check if the Minecart is of type 'MinecartFixer' and in that case perform force on the group instead on the individual cart).

    I obviously can't make one cart 'rule them all', it could cause the train to stop for no reason. I'll see if I can check for Minecart Mania to be present and react accordingly. :)
  8. Offline


    Built a test track and put a powered cart with a few empty carts in a group and let them run around my test area (~30x50). When I leave the area and come back all the carts are gone. Once they came back on their own after being missing for awhile, only to go missing again.
    One other user was testing and the same thing happened to him.
    No server reboot nor reload was done. It is possible the chunk got unloaded and reloaded ( unconfirmed ).
    Are unattended trains supposed to persist? Or do I need to remove them to avoid losing them?
  9. Offline


    Better to remove them, kinda busy atm when I have time I will add an automatic 'degrouper' for trains in unloaded chunks. That should solve that issue.


    Tested and works for build #1060. :)
  10. Offline


    How far youve gone with this, congratulations
  11. Offline


    if i want the minecarts to be about one block distance away from each other what do i change in the config file cuz i havent understood what u wrote about the config(talking hebrew)xD
  12. Offline


    Change the near cart distance, the turn distance and the cart distence and forcer up
  13. Offline


    Near cart distance factor is not required though. It is used to prevent carts from colliding into each other.
    It basically adds a "near normal distance forcer" and "near turned distance forcer", but for convenience I made it a factor. :)
  14. Offline


    Thank you heaps i hope you can try with minecart maina :D
  15. Offline


    OK this is weird! I looked through the source code again, and the f and g values appear to be the "PushX" and "PushZ" for powered minecarts (type == 2). So I looked further where this value was set...and this came up:
                this.f = this.locX - entityhuman.locX;
                this.g = this.locZ - entityhuman.locZ;
    Does the push power of the powered minecart differ upon how far you are from the cart? Heh? :confused:

    Updated to v1.17

    Important: Some settings have been removed from the configuration file. Best to remove the config.yml and make the plugin rewrite it. Linking: options removed, it now uses cart<>cart collision linking. (This to prevent carts penetrating other carts, still not completely fixed)

    Also: NOW (see update time in this post) you can download the plugin 1.17. Github was causing some issues, so if you downloaded a version before now, download again. :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 18, 2016
  16. Offline


    wouldn't that be more for the angle you are pushing from, as opposed to the power?

    i say this with no other looking through the code though, so ignore me if you like :D

    as i don't have much of a cart setup at the moment i'm not sure if this isn't already the case, but is it possible to have powered carts work like so:

    each powered cart has a 'pulling strength'. each non-powered cart has a certain 'weight' (players or mobs add to this)
    multiple powered carts add together their pulling strength, so you can add more to allow longer/heavier trains.

    another option (less realistic) would be to have multiple powered carts simply make a train faster.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 18, 2016
  17. Offline


    At the moment I leave the 'slow down physics' to Minecraft. :)
    All it does is read the total 'force' of the train (forward velocity) and divide this by the amount of trains. Then a force factor is set for each member of the train to adjust the gaps. Then the average force is applied to all carts again, equalizing their speed. The factors are used in the next 'get forward force' call to return the original force of the carts.

    It does slow down, but this had some 'physics' issues. Occupied carts slow down faster, and because of this they started to bump into their neighbours. Thus, I made empty carts the same weight as occupied carts.

    I could add a factor to return less forward force for occupied carts, to make these trains slow down faster. But for now, I keep it simple. :)
  18. Offline


    I have a suggestion
    you have to make it complicabel with craftbook/falsebook
  19. Offline


    It isn't?
  20. Offline


    Very good idea! ;)
    Bug: When using with FalseBook booster block cart with player in it exits the railway :(
  21. Offline


    Ok got to see that. :p
  22. Offline


    Additional: I set
    removeDerailedCarts: true
    all is ok for some time (bigger than previous :)) but cart with me derailed =(
  23. Offline


    Maybe off-topic, but why do 'brake' blocks speed up instead of slowing down? It didn't use my own Minecart type while testing, so it isn't Train Carts. :eek:
  24. Offline


    maybe use gold rails? :confused: should try

    still riding :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 18, 2016
  25. Offline


    Ok good news, I managed to 'insert' my Group managing code in the right place. In other words; group velocity changes are applied after all the individual minecart velocity updates, but before all the minecart location updates. This way everything is COMPLETELY synced. :D

    It did require me to pretty much chop up any ordered Minecraft native coding that survived my previous massacre, but it will definitely be worth it. :p
  26. Offline


    So will it be possiable to make this train stoppable :D ?
  27. Offline


    It already is, but it will probably be hard to make it 'stop' when riding over a certain block. Afraid mods/plugins need to add compatibility for me, else I probably end up rewriting their plugins. :)


    Nevermind, I think I found the main problem of incompatibility. A 'force remainder' is stored, and this is not a good idea in terms of compatibility. If you set the velocity to 0, the remainder persists and sets the velocity to full again. I need to find a way to fix it so brakes work well in other plugins as well. I guess I'll keep the velocity at full, but during physics I'll set a limit. :)
  28. Offline


    Any hope this is compatible with MM/Autocart module? Teehee...

    EDIT: Nvm looks like you're either looking into it or waiting on those guys to add compatibility. I believe Mons----(something), one of the Bukkit/community guys, is updating MM for while Af is on hiatus, FYI. Not sure if he will add any features though :D
  29. Offline


    Ow don't worry, I rewrote everything (again) and it is now compatible with external velocity changes. (yes, it is now 100% running in native Also fixed the ghost carts, powered track glitches (it is now all native again) and some other stuff. My plugin is now basically acting as a bridge between velocity input and velocity output, it worked out real nice.

    Now finetuning the configuration a bit more so you can (safely) travel in a train without causing the train to 'bump dead'. :)
  30. Offline


    Is the direct link broken?
  31. Offline


    Not from here, try the download link under 'Downloads' on the Github page. It links to there.

Share This Page