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


    @bergerkiller Thank you! single minecarts pass corners fine now.
    Please tell is trigger sign and signlink behavior changed ? because i did as in tutorial video - no success, but %time% %date% works fine but i cant display time from trigger.
  3. Offline


    Yes the train spawner crashes there is one mine-cart in the ground and then it say out of stream.

    I will try getting the new cb

    your tip to update date my server turned out to be very effective i understand now how it works and it is so easy.


    regards Tobsy4inc

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


    @MechanID Yes it got changed, it now is:
    Trigger name: mytrigger
    Time remaining: %mytriggerT%
    Destination of train: %mytriggerD%
    Train name: %mytriggerN%
    It's now possible to show the train name that will arrive shortly as well, same for the destination of this train.
    I might add some sort of description node as well, but not sure how to set it at stations.

    @Tobsy4inc glad you figured it out :)
  5. Offline


    put powered carts in front and end
  6. Offline


    @bergerkiller is this working feature - that train with powered carts in front and end dont slowdown as usual train with powered minecart ?
  7. Offline


    @bergerkiller something broke again :| The spawner started acting very weird, and now it just... spawns in the wrong direction and then if it spawns in a wall, it just stops and does nothing D:

    EDIT: Stations aren't centering their trains! D:
  8. Offline


    new errors, one of my players get wolfs on the tracks and train crashed
    2012-01-07 13:24:36 [SEVERE] Could not pass event VEHICLE_COLLISION_ENTITY to Train Carts
    java.lang.NoClassDefFoundError: com/bergerkiller/bukkit/tc/API/GroupLinkEvent
    at org.bukkit.plugin.RegisteredListener.callEvent(
    at org.bukkit.plugin.SimplePluginManager.callEvent(
    at net.minecraft.server.EntityMinecart.collide(
    at net.minecraft.server.World.entityJoinedWorld(
    at net.minecraft.server.WorldServer.entityJoinedWorld(
    at net.minecraft.server.World.playerJoinedWorld(
    at net.minecraft.server.World.tickEntities(
    at net.minecraft.server.MinecraftServer.w(
  9. Offline


    @MechanID Had that same error as well, working on a fix for it.

    Also, I'll look at the train spawning feature. Couldn't spot any weird station-centring issues though...
  10. Offline


    I've been struggling to get property state set on certain sections of track. Specifically I'm setting slow>false with signs, but even via command the property states seem to be ignored. If I create an identical section of track, property values function as expected, except destinations.

    Also, stations are not centering trains, as robxu9 observed. (Edit: this may be desirable for some station layouts).

    Running beta6.
  11. Offline


    I appreciate your work the idea is great and i really know how much effort it takes to make such a plugin i have found a lot of bugs in it while using it.

    First of all let me present you my server if you check it you will see there is currently a lot of work going on to complete the 60 KM long railroad we are planning to build there. For the railroad to work we need minecarts to stop at stations and to keep moving even if a obstacle is on the rail.

    To test traincarts on the server we have 4 tracks each about 1.5 Km long. each is a complete loop with no strange loops or curves. every track contains at most 10 curves. And every track has a detector rail followed by a powered rail ever 40 blocks.

    We only put the [train] station 10 left sign at 8 places one at each stop. and we spawned about 50 train carts.
    IT looked fun but we found some bugs with carts not departing/ going into the ground at the station. Players who couldnt leave the cart even when they disconnected and rejoined.

    Anyways in the past week i found my server hanging at 100% cpu at random times. I found out that traincarts had generated a 30 Megabyte file with about 50000 train definitions in it. And that while we only placed about 200 carts.
    It was lagging like hell, to the point players were disconnecting so i removed the traincart plugin but the server continued to hang the next days. Untill i found out that all the minecarts where gathered inside each other at a small piece of the rail below the rail and were causing some sort of lag hole there completely taking the main thread for several minutes. (i have proof i have the file the map and the garbage collector debug log.) it was not a crappy computer but one with 16 Gb mem 5GHZ core i7 and ssd

    Anyways all i could do was open the world op in mcedit. And even mcedit lagged at that place with all those minecarts. i removed all entities and the mcedit and the lag in minecraft stopped.

    this are some errors i found after 5 days of logging and crashes:

    I use the recommended build for craftbukkit 1.0.1 (build 1557)

    2012-01-05 03:41:27 [SEVERE] Could not pass event CHUNK_LOAD to Train Carts
        at java.util.ArrayList$Itr.checkForComodification(
        at java.util.ArrayList$Itr.remove(
        at org.bukkit.plugin.RegisteredListener.callEvent(
        at org.bukkit.plugin.SimplePluginManager.callEvent(
        at net.minecraft.server.ChunkProviderServer.getChunkAt(
        at net.minecraft.server.PlayerInstance.<init>(
        at net.minecraft.server.PlayerManager.a(
        at net.minecraft.server.PlayerManager.movePlayer(
        at net.minecraft.server.ServerConfigurationManager.d(
        at net.minecraft.server.NetServerHandler.a(
        at org.getspout.spout.SpoutNetServerHandler.a(
        at net.minecraft.server.Packet10Flying.a(SourceFile:126)
        at net.minecraft.server.NetworkManager.b(
        at net.minecraft.server.NetServerHandler.a(
        at org.getspout.spout.SpoutNetServerHandler.a(
        at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
        at net.minecraft.server.MinecraftServer.w(
    2012-01-05 04:00:41 [SEVERE] [TrainCarts] Failed to perform physics on train 'train188':
    2012-01-05 04:00:41 [SEVERE] java.lang.NullPointerException
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-05 04:00:41 [SEVERE]     at net.minecraft.server.World.entityJoinedWorld(
    2012-01-05 04:00:41 [SEVERE]     at net.minecraft.server.WorldServer.entityJoinedWorld(
    2012-01-05 04:00:41 [SEVERE]     at net.minecraft.server.World.playerJoinedWorld(
    2012-01-05 04:00:41 [SEVERE]     at net.minecraft.server.World.tickEntities(
    2012-01-05 04:00:41 [SEVERE]     at net.minecraft.server.MinecraftServer.w(
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-05 04:00:41 [SEVERE]     at
    2012-01-06 15:54:18 [SEVERE] [TrainCarts] Failed to perform physics on train 'train376':
    2012-01-06 15:54:18 [SEVERE] java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    2012-01-06 15:54:18 [SEVERE]     at java.util.ArrayList.rangeCheck(
    2012-01-06 15:54:18 [SEVERE]     at java.util.ArrayList.get(
    2012-01-06 15:54:18 [SEVERE]     at
    2012-01-06 15:54:18 [SEVERE]     at
    2012-01-06 15:54:18 [SEVERE]     at
    2012-01-06 15:54:18 [SEVERE]     at net.minecraft.server.World.entityJoinedWorld(
    2012-01-06 15:54:18 [SEVERE]     at net.minecraft.server.WorldServer.entityJoinedWorld(
    2012-01-06 15:54:18 [SEVERE]     at net.minecraft.server.World.playerJoinedWorld(
    2012-01-06 15:54:18 [SEVERE]     at net.minecraft.server.World.tickEntities(
    2012-01-06 15:54:18 [SEVERE]     at net.minecraft.server.MinecraftServer.w(
    2012-01-06 15:54:18 [SEVERE]     at
    2012-01-06 15:54:18 [SEVERE]     at
    I hope the reporting of this errors helps anyone :)

    Im really curious about how placing 100 traincarts can generate a file with 50000 trains.
  12. Offline


    1. I find this harsh. The more it's improved, the more it gets better. If there's a bug you report it and it gets fixed! Not criticize.
    2. I have never had your issue o3o TrainCarts does store all the trains IIRC. But our server reboots once a day to ensure stability, and removes all minecarts to make sure that a pileup like that never happens ;)

    EDIT: by not criticize, I exclude constructive criticism. That is always a good thing ;)
  13. Offline


    @robxu you are right. I was just a bit tired after a week of trying to find the cause of the constant crashed/ hanging of the server. But i also know we are all just trying to improve, and i as a server admin know how annoying whiners can be who only whine but never help :) But im posting here to maybe help improve this plugin. Therefore i have edited my post to make it less `harsh` and to include some errors from the log i found.

    If you want to see the error im sure i can reproduce it on my test server. I still have backuped the world state and the plugins like they were when the faulty situation occured

    How do you remove all minecarts from your server do you do this automatically?
  14. Offline


    We use a plugin called RollingMinecarts. It provides a handy /removeminecarts command as well as forcing all minecarts to move at the same speed regardless of user occupation.

    As for your errors, it seems something is interfering with TrainCarts by trying to modify something at the same time. And that probably causes the physics to fail somehow.

    EDIT: Yup, it's done automatically. The plugin ConsoleScheduler that still works does this every time the server reboots.
  15. hey having a little bit of problems the plugin works fine minus the fact that it will not push entitys out of the way my yaml is in json format can yuo explain to me please why nothing gets pushed out of the way and the train stops.

    I have uploaded a txt version for you to look at hopefully you can help ???

    { "breakCombinedCarts": false, "normal": { "cartDistance": 1.5, "cartDistanceForcer": 0.10000000000000001 }, "turned": { "cartDistance": 1.6000000000000001, "cartDistanceForcer": 0.20000000000000001 }, "use": true, "useCoalFromStorageCart": false, "pushAwayForce": 0.20000000000000001, "pushAwayIgnoreGlobalOwners": true, "launchForce": 10, "pushAwayIgnoreOwners": true, "exitOffset": { "y": 0.0, "x": 0.0, "z": 0.0 }, "nearCartDistanceFactor": 1.2, "spawnItemDrops": true, "maxCartDistance": 4.0, "setOwnerOnPlacement": true, "removeDerailedCarts": false, "keepChunksLoadedOnlyWhenMoving": false, "poweredCartBoost": 0.10000000000000001 }
  16. Offline


    If you're the owner of the train, you don't get pushed.
    If you didn't set default owners, then nobody gets pushed.
  17. Offline


    Did you try to modify DefaultTrainProperties.yml ?
    There is pushAway option.
  18. no i have put in a different format this is what i suspected i have tried deleting the config but i never seem to get that option if you would be willing to give me a config with it in all json is is aa different way of formatting it just as valid as the original format
  19. Offline


    Just delete "Train Carts" folder and let plugin re create it
  20. I have already tried that everytime i get a config with only those options i converted into json cause
    it was a mess to look at but by converting it i made it easier to look at functionality wise changed nothing
  21. Offline


    I'll look at the train duping issue. Also, you can use /train destroyall to get rid of all possible minecarts on the server, which is probably simpler than using MCEdit. Not sure where to look...

    @wiigor Are you using the latest beta version or 1.54? (I should make the beta a real version, but I can't do that while a lot of bugs are still existent)
  22. Offline


    Can I make a train and then power it so it pulls carts along?

    If so, what be good now is an intergrated timer so the train part only leaves at a certain time or something, so you can make a giant loop around a city, add a few carts so it keeps going around in a curcuit picking up and dropping people off.
  23. Offline


    @kyle939 you can set station wait times to make trains stop a specific time in seconds. It does not use actual times though. (depart at x:xx:xx)


    Sigh I made a bit too many mistakes in the launch coding. Not only did I swap the target distance with the target velocity, the direction was inverted and it didn't update the target distance either...
  24. Offline


    so you made the config json?
    I'm confused by what you're trying to say o3o
  25. dont worry im currently in personal conversation with the plugin maker and he does understand ;D
  26. Offline


    Huray for me, Rail detectors are now 100% working. It took me pretty long to make an API around it, but it is now possible for other plugins (including TrainCarts itself) to hook into a (self-created) region, which will be stored to disk. It uses an unique ID other plugins can use to obtain the region after creation.

    Other plugins can implement an interface which act just like a regular listener, listening for member/group enter/leave of a region and when the object is registered to a region. The DetectorRegion keeps track of all members on the region, and fires leave/enter events appropriately.

    The sign detector is a separate implementation that hooks into this event system, handling levers based on the active members and groups on the region it defined. It now listens for EVERY possible member/group enter/leave event, so it's not needed to connect the detector with a redstone loop of some sort. As soon a player places a minecart on the tracks, the region is automatically notified of this, therefore notifying all registered listeners.

    It's pretty complicated, and it has to be, since this truly involves complicated logic. Expect an update real soon, now checking for any possible bug that may still be present.
    robxu9 likes this.
  27. Offline


    I Recently Got This Plugin And Am Loving It.
    But I Am Having One Problem. I Cannot Seem To Use Property Signs.
    I Can Use Every Other Sign Just Fine. I Have Also Tried To Give Full Permissions To Use It But The Sign Still Will Not Be Created
  28. Offline


    @demenius What Version Are You Using?

    note: English is a lot better without all words starting with capitals, when reading it I read every word as the start of a new sentence. (It's weird how used you get to having lower-case-starting words all the time...)
  29. Offline


    @bergerkiller I Am Using Version 1.54 With bPermissions.

    Note: Capital Letters Do Not Denote A New Sentence, If That Were So Then You Would Have A New Sentence Every Time You Were Talking About A Person Or Place. That Would Be Just Weird. And The Period Would Be Out Of A Job.
  30. Offline


    @demenius true, but you get my point, right? Let's just say you put emphasis on every possible word, causing the reader to stop at every possible word looking for a special meaning.

    Also, uploaded BETA version 7 of 1.6. It adds [train] and [cart] detector signs to the mix. Create two signs facing towards each other and it creates a region in between, and any train that enters/leaves that region is detected. It is very similar to track switcher signs otherwise, difference is that it only toggles attached levers.

    If you have issues with 1.54, I recommend using 1.6 beta, as it fixes a lot of issues 1.54 had.

    Why it is still a beta: When reloading the server (or restarting) it does not properly fire member/group enter sign events, which causes strange glitches with all sorts of sign systems.

    The launching bugs (station) and most of the teleporter duping bugs (it still appears to leave empty groups behind, not very bad, but it's not really clean)
  31. Offline


    Err... Does this still work? I decided to go ahead and play with it, and it toggles the lever, but no redstone current is sent.

    Fixed? :D

Share This Page