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

    Qi Xiang

    whenever I restart the server, it says that it has loaded the trains. But in-game I dont see them. Is this like a bug or something? (using test ver.2)
  3. Offline


    Qi Xiang could be, I'll check if cart replacement is properly working tomorrow. I didn't have this issue when preparing the 1.3.1 version, but I can't be too sure about it.
  4. Offline


    Content with this plugin since I'm using it. However, train spawning per sign doesn't seem to work yet with the new 1.3.1 Test Version #2.
    Thank you Bergerkiller, this plugin was and still is awesome.
  5. Offline


    Spawning trains with signs? That works fine on Test version 2, I have a decent sized system going on with tons of spawn signs.

    Using Test version 2, I've not noticed any issues other than the same as before with the trains not syncing right and looking like they're derailed. I have blockers, detectors, switchers, and stations going and haven't had any problems with anything else other than the visual derailment stuff. Thanks for your work on this, building railways is my obsession in minecraft. :p
  6. Offline


    I won't be able to actually test this until Thursday, but I wanted to know, if you could display train tags on a sign (provided we're using SignLink).

    For example, if I have three trains, each running different routes. (Let's name these, U1, U2, and U3).
    I want them to go to just one track in a station, but I want people to be able to know which train is which. Could it be possible to display the tags onto a sign?

    So when the train pulls in, there's a sign next to it that says:

    Train leaving in: 00:00:10 seconds (timer, I usually do this)
    Train Route: <train tag>
    Next train in: (timer, I can do this as well)

    Thanks for letting me know!
  7. Offline


    alex4108 Actually, there is a 'display name' for trains already. When the train hits a trigger, this display name is applied to %triggernameN%. You can display that on the sign. These display names can be set using:
  8. Offline


    I'm currently running 1.3.1 MC and the latest as of today of TC.

    I need some help (or this maybe a feature request).

    So I have two trains tracks at every station (currently have 3 stations), this allows for multiple people to go to one when you choose a destination you have to choose homea (for track a at the home location) or homeb (for track b at the home location), and you have to hope the other train is not in that spot otherwise they collide, and you'll must likely be stuck in a loop.

    Basically my question is, can i create a sign at the home location that says something like

    FOR TRACK 1 at HOME location
    [train TRAIN1]

    FOR TRACK2 at HOME location
    [train TRAIN2]

    so that when your riding in TRAIN1, you set your destination to home, and ONLY train1 can enter onto those tracks (home1 - from above) at the home location? and when you ride TRAIN2 it can only enter on track2 at the home location...

    OR option #2 i could live with....

    Have a switcher right before track1 and track2 with a (waiter) if the sign detects a train on the homea station it will switch so the train can load into homeb tracks...(kind of like a waiter and switcher sign). and maybe if both homea and homeb are full then yes wait until either is empty.

    I can provide screenshots of how i'm currently doing this if needed to maybe clear up what i'm asking? sorry if it didn't make sense, but hopefully you have a solution?
  9. Offline


    r1rider01 yep, there is remote control that can do that:

    I believe the destination sign supports this too. The switcher sign is also possible, simply redirect the switcher output to a destination sign. (or property sign)
  10. Offline


    well maybe i'm doing it wrong...I was using

    [train TRAIN1]

    at the end of my 1st track on track 1 at the home location, but didn't seem to matter...did i do it wrong?

    found a issue, but can't replicate it, it seems to glitch a cart in random spots...the train will be going fine, then stop..i can delete all the carts but the one that is glitched...the only weird thing is, i can get in and out of the cart, but it won't move, can't delete it (unless i log out and back in then its gone).

    and it happens randomly and unless i relog, the glitched train will stop all others in that place. its happening more and more, so not sure if its traincarts, or minecraft in general.

    this was happening on 1.3.1 and i just updated to 1.3.2 still happens

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  11. Offline


    r1rider01 That bug is known to me, thought I fixed it but 'nooopee'. Seems unfixable...silly Minecraft logic. I'll upload test3 later, which will verify that the minecart it is colliding with actually exists on the world. It will slightly reduce performance, because well, checking a list for an Entity is slow. But it will at least rid it of this issue. Also changed the auto-sync time to 5 seconds instead of 20 seconds, to make that de-synching go away faster.

    About that: I failed to find out why it does this out-of-synch movement. All I could come up with, was that it failed to send some of the packets. This would be an internal CraftBukkit problem. Now testing the latest build to see if that makes a diff.
  12. Offline


    When you mean out of sync, do you mean when traveling on the train you appear to be off the track or inside blocks? sometimes i'm as much as 5-8 blocks off the track, mostly to the left or right of the track...if i wait about 10-15secs it will pop me back on the track, but only after I have stopped at a station. this happens i would say 8 out of 10 times i ride the train.

    btw, Great work on this! i know there bugs especially with the new version...thanks for working them out! I will test V3 as soon as its released.

    I think i found a solution for my train stations, i wasn't able to get the [train trainname] property tag thing to work, so i just used waiter signs and a loop track system.

    After testing V3, the out of sync issue has gotten worse i think, trains don't stay connected, they stack on top of each other, etc...

    Ive found that when i attach a chestcart to a cart, the train takes off on its own, or will stack up with other trains...stops obeying signs.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  13. Offline

    Qi Xiang

    Now its like every hour or so, my trains disappear.
    Console says: [TrainCarts] 9 carts of group "train2" are missing! (externally editted?)
    It happened to me when my server crashes only in the past.
    now, when the server is running fine, my trains keep disappearing.
  14. Offline


    OK got some strange issues. Lovwe the plugin but if it won't work consistently then it does not work well.
    I have built full rails that go from one map zone to another. Only way it works is if someone is in the train. If not it randomly stops somewhere to never return. Also have shuttle that uses power rails and has a station at each end. It randomly stops on power rails and then starts again. Also tried the station 0 continue along the rail and it still randonly just stops unless you are in the train. Any ideas here? Do we need a npc onboard to make it work correctly?
  15. Offline


    Using test version 3, and this was present in the other test versions as well, detector regions seem to set to true/on even when there are no trains or carts in the region. I have a railway system set up with sidings, so if a section of track is in use, the train waits in the siding until the other train comes by. It normally works, but upon a server restart, a lot of times some of the rail sections will always just stop the trains and wait forever for a train thats not even there. If I get out and flick the lever to off, the train will continue, and then upon riding the same rail in the reverse direction (going back to town, for example), it works and I can then ride either direction with the working siding system we have until the next restart, which normally starts it all over again with the blocking because of invisible trains. I have lanterns showing when rails are in use, and a lot of them are started ON after restarts, so it makes it easy to see if it is having a problem.
  16. Offline


    Is there a way to only have Switcher turn on a lever without switching the track? Not sure if "always switching track" was the default behavior in earlier versions. Using Test V3.
    Clarification: I'm trying to build a train destructor on a straight line for only the trains that do not contain a player, powering destructor through switcher.
  17. I have a detector that checks for empty carts leaving my stations, the white wool is the detector, the green wool is the station sign where the cart pauses to pick up passengers, if the detector is true then it will disable the destroy sign.

    items (add this if you are wanting to check the storage carts)

  18. Offline


    Thanks, it seems this solution works.

    But I also need to know if it is possible to power the destroyer with a single switcher nowadays (should take less space and less train checking). I remember seeing such setup somewhere and it worked back then.
  19. I have had a quick look at using the switcher to destroy a cart, this will destroy any train that does not have a storage cart with items in it, will need the logic changing to meet your needs

  20. Offline


    Thanks a lot, that's the thing. My problem was that the server's earlier switchers didn't use the directional prefix (f in this case) as they weren't introduced at that time yet, so switchers sometimes switched the track direction in addition to turning the lever. Making all sort of derailment accidents even on a straight track.
  21. Glad you asked the question, I am now in the process of changing most of my detector/destroy to switcher/destroy. Had been looking or a neater more usable solution for a while
  22. Hi. I am not sure if it is just me or an error but it is not loading properly. I am using CB 1.3.1 R 2.0.

    Here is what comes up from the beginning:

    12:45 PM [INFO] [CraftBukkitUpToDate] Loading CraftBukkitUpToDate v2.9.0
    12:45 PM [INFO] [BKCommonLib] Loading BKCommonLib v1.23
    12:45 PM [INFO] [My Worlds] Loading My Worlds v1.48
    12:45 PM [INFO] [SignLink] Loading SignLink v1.24
    12:45 PM [INFO] [Pail] Loading Pail v0.8
    12:45 PM [INFO] [TrainTickets] Loading TrainTickets v1.1
    12:45 PM [INFO] [PailPlus] Loading PailPlus v0.3
    12:45 PM [INFO] [Train Carts] Loading Train Carts v1.71.2
    12:45 PM [INFO] [Train Carts Blocks] Loading Train Carts Blocks v1.03
    12:45 PM [INFO] [BKCommonLib] Enabling BKCommonLib v1.23
    12:45 PM [INFO] BKCommonLib version 1.23 enabled!
    12:45 PM [INFO] [Pail] Enabling Pail v0.8
    12:45 PM [INFO] Preparing level "world"
    12:45 PM [INFO] Preparing start region for level 0 (Seed: -3443517573418734678)
    12:45 PM [INFO] Preparing spawn area: 65%
    12:45 PM [INFO] Preparing start region for level 1 (Seed: -3443517573418734678)
    12:45 PM [INFO] Preparing spawn area: 52%
    12:45 PM [INFO] Preparing start region for level 2 (Seed: -3443517573418734678)
    12:45 PM [INFO] Preparing spawn area: 52%
    12:45 PM [INFO] [CraftBukkitUpToDate] Enabling CraftBukkitUpToDate v2.9.0
    12:45 PM [INFO] CraftBukkitUpToDate version 2.9.0 is enabled!
    12:45 PM [INFO] [My Worlds] Enabling My Worlds v1.48
    12:45 PM [INFO] [My Worlds] Using build-in 'Bukkit SuperPerms' as permissions plugin!
    12:45 PM [INFO] [My Worlds] Successfully bound variable to region file cache.
    12:45 PM [INFO] [My Worlds] File references to unloaded worlds will be cleared!
    12:45 PM [INFO] My Worlds version 1.48 enabled!
    12:45 PM [INFO] [SignLink] Enabling SignLink v1.24
    12:45 PM [INFO] [SignLink] Using build-in 'Bukkit SuperPerms' as permissions plugin!
    12:45 PM [INFO] SignLink version 1.24 enabled!
    12:45 PM [INFO] [TrainTickets] Enabling TrainTickets v1.1
    12:45 PM [INFO] TrainTickets v1.1: Vault economy not found, switching to gold ingots!
    12:45 PM [INFO] TrainTickets v1.1 has finished loading the config file.
    12:45 PM [INFO] TrainTickets v1.1 by Cobalt loaded all events
    12:45 PM [INFO] [PailPlus] Enabling PailPlus v0.3
    12:45 PM [INFO] [Train Carts] Enabling Train Carts v1.71.2
    12:45 PM [INFO] CButD: CraftBukkit is up to Date
    12:45 PM [SEVERE] java.lang.Exception: Field 'a' does not exist in class file 'EntityTracker'!
    12:45 PM [SEVERE] at com.bergerkiller.bukkit.common.SafeField.<init>(
    12:45 PM [SEVERE] at
    12:45 PM [SEVERE] at
    12:45 PM [SEVERE] at com.bergerkiller.bukkit.common.PluginBase.onEnable(
    12:45 PM [SEVERE] at
    12:45 PM [SEVERE] at
    12:45 PM [SEVERE] at org.bukkit.plugin.SimplePluginManager.enablePlugin(
    12:45 PM [SEVERE] at org.bukkit.craftbukkit.CraftServer.loadPlugin(
    12:45 PM [SEVERE] at org.bukkit.craftbukkit.CraftServer.enablePlugins(
    12:45 PM [SEVERE] at net.minecraft.server.MinecraftServer.i(
    12:45 PM [SEVERE] at net.minecraft.server.MinecraftServer.d(
    12:45 PM [SEVERE] at net.minecraft.server.MinecraftServer.a(
    12:45 PM [SEVERE] at net.minecraft.server.DedicatedServer.init(
    12:45 PM [SEVERE] at
    12:45 PM [SEVERE] at
    12:45 PM [WARNING] [Train Carts] Failed to initialize the entity tracker replacement:
    12:45 PM [WARNING] [Train Carts] Train movement will not be smoothed!
    12:45 PM [INFO] [Train Carts] Loading chunks near trains...
    12:45 PM [INFO] [Train Carts] 0 detector rail regions loaded covering 0 blocks
    12:45 PM [INFO] [Train Carts] MyWorlds detected, support for portal sign train teleportation added!
    12:45 PM [INFO] [Train Carts] SignLink detected, support for arrival signs added!
    12:45 PM [INFO] Train Carts version 1.71.2 enabled!
    12:45 PM [INFO] [Train Carts Blocks] Enabling Train Carts Blocks v1.03
    12:45 PM [INFO] Train Carts Blocks version 1.03 enabled!
    12:45 PM [INFO] Server permissions file permissions.yml is empty, ignoring it
    12:45 PM [INFO] Done (4.704s)! For help, type "help" or "?"
    12:45 PM [WARNING] Task of 'Train Carts' generated an exception
    One of the things I can't do is link minecarts. I don't know about other things as I didn't try them yet.
  23. Offline


    marksc yeah, I am waiting for the next RB. That one has a lot of other changes as well, which require me to update all of my plugins. To prevent a lot of temporary versions being used, I don't support R 2.0. (Unless they really take long to update...)
  24. Offline


    I'm still running 1.3.1 R1.o with Test version 3

    i'm having the weirdest things still...the # feature for naming doesn't work, they all still name themselves i get 3 or 4 trains all the same name!

    also when using the [train train1] property destination station2

    if i only have one train it will send the train off correctly, if i have multiple trains it won't take the destination property anymore.

    Hopefully can get fixed soon
  25. Offline


    It's been my experience that the carts just stopping with a cart that can't be interacted with except for getting in and out is caused by a phantom cart. These seem to happen when a chunk is loaded with a minecart in it such as when a player enters the area or when the server first loads/reloads. This issue is still occurring as of 1.71.2.

    I'm afraid I must express my frustration at a few of these bugs still being around. The issue with logs not being used in a furnace, for example. I have posted exactly what lines of code to change and how as an example of how to fix the simple issue and opened a ticket for it, yet it remains.

    I still can't use vast minecart systems because the carts simply don't load properly. Any item in the cart has it's data value reset to zero while many carts stop moving and/or become phantoms. It's just not worth trying to maintain them all with these bugs.

    Is there any chance I'm just not up to date with the fixes? Will there be an updated to fix theses issues anytime soon? The players on my server are asking me to find a better train mod, but I like the features offered in this one if it just worked.
  26. Offline


    CommanderGizmo Well you see, most of those bugs are almost impossible to track back in the code, though I think I forgot to look at the log problem. The data wipe (?) seems to be related to item transferring in BKCommonLib, and seems to re-occur every single time. It is slightly annoying.

    I thought I fixed that damn ghost cart problem in 1.71.2 already, I especially spent 2 days debugging everything to prevent it all. It's an annoyance for me too.


    I see no data wiping going on, so not sure what you mean here? Placed all 4 types of logs in a storage minecart, stopped the server and started again. All 4 types still in there...

    I'll make sure that items that are both fuel and burnable are parsed differently.
    • item only fuel? Use as fuel
    • item only burnable? Use as burnable
    • item both fuel and burnable? If defined line 3, burnable, line 4, fuel.

    Ok that issue is fixed then. Together with the disturbing lack of item animations.
  27. Offline


    bergerkiller Wooooo!! It's really fixed?! That was fast! My apologies for my tone earlier. I loath spending hours resetting trains instead of using them, and had finally had enough.

    My server log shows I am running 1.71.3. Is that a test build? Can I download the update with the fuel fix? My whole industrial revolution depends on automated fuel production.

    The issue with the data wiping is most noticeable with dyes. Perhaps it only happens to certain items? If I put, for example, bonemeal or lapis into a cart and reload it turns into ink_sack. If I have charcoal in a cart, it turns to coal. Leaves also drop to 0. Normally they have 12 added to the data value of their type due to the counter (so oak leaves have a value of 12 when in your inventory).

    The phantom carts definitely seems to happen when loading a cart. I just had it happen 12 times last night. I finally set the default properties to keep chunks loaded and picked up all carts and placed them again. The phantoms occur at server load/reload or when a chunk is loaded from a player walking by.


    Also, the carts do not maintain speed when a chunk is loaded or on load/reload.
  28. Offline


    CommanderGizmo it's not the latest, that is for sure. I'll link you to the 1.71.5 test build I uploaded to dropbox:

    Check if the ghost cart problem and the data issue still exist. Don't forget that:
    • This build requires CraftBukkit 1.3.2 R0.1
    • It needs the BKCommonLib included in the Download (don't forget to update)
    I'm off now, I'll continue the good ol' ghost train testing tomorrow on my prepared test world. Hope I do get the server wrapper running on-time...
  29. Offline


    bergerkiller Thanks! I can finally smelt logs using my trains.

    However, the train appears to have put a full stack of logs in the furnace to be burnt when my sign reads "8 log;coal". Perhaps it is not seeing the number?

    Also, golden_apples still do not get picked up using transfer signs.
  30. Offline


    I'll have to check the transfer logic then. The golden apples problem could be related to the name -> material function in BKCommonLib. Do they get picked up when using an empty line? (which represents all items)

    I made the fuel times in BKCommonLib use the function of Minecraft itself (on all materials), to make sure possible fuel changes are automatically supported. I'll test further on the things you mentioned.
  31. Offline

    Qi Xiang

    Now... the console keeps saying that the entity "minecart" is at an invalid position... The carts did not link properly together,

Share This Page