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

    bergerkiller

    [​IMG]

    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. :)

    Description:
    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.

    Media:

    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.

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

    Commenting

    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.

    Changelog

    Show your appreciation for my plugins by donating
    [​IMG]
     
  2. Offline

    Thyme676

    Weird I see traincarts.jar but when I click it nothing happens? I'll try it in another browser.

    Odd, it's working for me in FF but not chrome. Sorry, it must be on my end.

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

    MechanID

    I redownloaded jar file and try it.
    It seem it still doesmt work good with Minecart Mania, it ignore Obsidian block wih rails to stop at it, but it able to lauch train, and boosters/brakes on MM not affectong train (with single minecart all is ok)
    I am running on cb1000, maybe i need to update to cb1060 ?
     
  4. Offline

    bergerkiller

    @MechanID no you are right, I am currently adding *some* support for external plugins. The current version contains a 'force remainder', but this was not a good idea. External effects on the velocity had no effect. I fixed this by 'injecting' the group code in the middle of the minecart physics function. It also reduces some CPU usage. Now adding group load and saving support. (when a cart of a train enters an unloaded chunk the train is saved to file, stopped and unlinked.)

    It has become quite a project, but the newer version will resolve quite some bugs. :)
     
  5. Offline

    MechanID

    Thank you for answer, and for your work on this plugin. Ill wait for updates.
     
  6. Offline

    bergerkiller

    Just so you all know...the code is kiiiiiiinnnndaa getting so complicated even Einstein wouldn't understand it.

    Good news: I solved a MAJOR s. LOAD OF BUGS :D

    Solved:
    - Carts penetrating eachother
    - Groups are stored in a low-disk raw data type
    - Trains in unloaded chunks are automatically stored and disabled
    - Once a chunk gets loaded and an unloaded train was there, it is re-initialized
    - Trains can now collide with other trains without too much bugs
    - U-turn decreased; you can now make an U-turn with one straight track
    - Removed force remainder; it is now compatible with mods that change Minecart velocity
    - Powered tracks completely working, including sloped launch
    - All collision issues solved, no penetrating the ground, no passenger stopping the train
    - Cart bounciness greatly decreased, GREATLY xD
    - I basically rewrote the entire infrastructure, so expect an update to 1.2 and not 1.18
    - Made everything consume less CPU: group update only runs once
    - Yaw is now calculated through the tracks if it hadn't been set before (to prevent derailments)

    If you made a plugin that directly uses TrainCarts, compatibility is probably lost. This due to the fact that I turned a lot around. It now contains a 'NativeMinecartMember' class extending EntityMinecart. This class is similar to the MinecartFixer, only difference is that the code under m_ has been divided in two sections. MinecartMember now extends NativeMinecartMember (simply to hide all native mess) and contains the m_ function, in which the logic is done. It calls preupdate on all members, then the group update, then postupdate to move the Minecart.

    Also added a 'GroupManager' class. This is simply a data storage bank containing trains in unloaded chunks, and which manages the loading, saving, hiding and replacing of trains. I will post the data format structure later. :)

    Github has been updated, you can now download 1.2 :)

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

    F_Synchro

    Thanks alot for the update, been enjoying it...
     
  8. Offline

    Nemor

    whats the musik of the film latest
     
  9. Offline

    bergerkiller

    I always place the Music name in the description on YouTube. (That's why the link is present)
    As always made a video update for 1.2 to show off the capabilities, and it is pretty awesome. :)

    EDIT

    Ugh sure takes long to process it...
     
  10. Offline

    Nurgo

    Hi @bergerkiller, your plugin is awesome!
    It's the way carts should work since the beginning.
    I think that you should submit your work to Mojang for an integration in the official release, like it has been done for the Pistons plugin.
    What do you think about it?
     
  11. Offline

    bergerkiller

    The main difference here is that the pistons plugin was a client mod, not a server plugin. But yes, I could submit it, it can be inserted in the Minecraft code quite easily. Although, not sure if the Client and Server code differ too much for this...

    If people truly like this idea, spread the word and who knows, maybe a Mojang member will pick it up and build on it. :)

    (ffs YouTube, WHY U TAKE SO LONG)

    Finally YouTube finished to process it...took 3 hours ffs :eek:

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

    Astrae

    Hey @bergerkiller, great mod! I've been reading through the source, and I've been thinking of extending the logic of trainCarts and MinecartMania to create a subway mod that would continually run trains along a specified route. Once a player sets up a route with minecart mania using station blocks, switches, and whatnot, this mod would oversee a continuous schedule of trains to use along that route (say, having a new train run every 10 seconds along the line)

    The trouble I run into is that using a spawn block/end block mechanic doesn't work once the chunks become unloaded, so long subway lines over unloaded chunks would break the functionality. I've been thinking of setting up a list of chunks with listeners to determine where to begin spawning/despawning the trains, but that's an error-prone solution since any changes in the track configuration would cause the list to fall out of sync. Any thoughts on a more elegant solution?
     
  13. Offline

    bergerkiller

    I am already working on 1.21 where you can set mobs, players and items to be pushed away by a train, when it is moving at a certain velocity. This already works. Also added an 'exitOffset' setting so players end up on the side of the minecart when exiting. (it is relative to where the train/minecart is facing). I will add an option to keep chunks loaded near minecarts and/or minecart groups, it would be very nice. :)

    Ok guys updated to v1.21 adding (lots) of new features to it, including features that prevent players or mobs from harming your trains! :D

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

    Nemor

    it doesn`t work
    is that caused by mts
     
  15. Offline

    bergerkiller

    Always try to point out the exact error. If you got something around the terms of 'org.bukkit.World.getUID not found' you need to update craftbukkit to the latest build.

    EDIT

    Ugh did find *something*, if you meant you can't get the carts to move, I'm working on it...lol
     
  16. Offline

    minifatguy

    i used this plugin for my server to make a rollercoaster. and i saw a bug. sometimes when i join the two carts together and try to push em they wont move and then when i destroy em the 2nd cart gets destroyed but the 1 one just stays there but gives me the drop and i can only fix this by restarting the server. help.
     
  17. Offline

    bergerkiller

    Yup exact description of what I just noticed...must have to do with the 'MinecartMember.get(minecart, group) part, although still confused. Thanks for reporting or I might have ignored it. :)

    EDIT

    Ok tracked it down. The bukkit entity remained after I removed the net.minecraft entity...had to use remove() on the bukkit entity. *heavy unexpected fixing going on*

    EDIT 2

    Ok fixed. This weird bug was fixable by using this instead of the regular world.removeEntity:
    Code:
            if (toreplace instanceof MinecartMember) {
                toreplace.world.removeEntity(toreplace);
            } else {
                toreplace.getBukkitEntity().remove();
            }
    I'll update to v1.22
     
  18. Pff, latest update just screwed everything for me it seems, carts keep spazzing forward/backward and don't move.
    Also, when I destroy them, some of them remain as ghosts (but you can get in them) that only disappear if I restart the server :/

    The last version I tested worked amazingly smooth, this one just screwed everything up and I didn't back that up, can anyone give me a older version ?
     
  19. Offline

    bergerkiller

    See also 1.22, it should fix that.
    It was some minor flaw with the Minecart replacing bit. I combined two functions into one, but forgot to take into account that they differ in how they add the new cart to the world.
    (That is what I fixed from 1.21 to 1.22)

    EDIT

    AWWWWWW crap. xD
    Ok I accidentally uploaded TrainCarts to MyWorlds and forgot to upload MyWorlds...biggest FAIL EVER...sorry guys, I'll quickly upload 1.22 :'(

    NOW v1.22 is up in the correct section...if you had 1.21, QUICKLY update to v1.22 since v1.21 had some serious issues. (on every server reload the amount of trains/minecarts stored duplicated, ended up with 900 minecarts, lots of lag and a 70 kb groupdata file. If you have this right now, remove the trains.groupdata file before running!)
     
  20. Offline

    Nemor

    i live in germany and can<´t speak english so good
    the minecarts go to front but then they move back and to the front and back
     
  21. Offline

    Player225

    Hast du die letzte Version runtergeladen? Wie du an seinem Post vorher siehst hat er ja was
    falsches hochgeladen :) wenn du dein Problem genau erklärst kann ich es ja auf englisch für dich
    übersetzen

    English:
    Did you download the latest version? Read his last post :)
    If you explain it in german, I will translate it in english.
     
  22. Offline

    bergerkiller

    If you see v1.22 in the server log you got the latest version. I had assumed I uploaded v1.22 before, but had added it under the MyWorlds repository...that was my bad. Could be some people downloaded v1.21 (which was buggy) while the title said v1.22.

    I'll download from GitHub again to verify it is the correct version. :)

    EDIT

    Yup correct version is on GitHub, didn't notice any bugs with it. If you can't get a pair of minecarts to move, try moving the other cart. It could be they are 1 block apart and the collision is causing them to stop.
     
  23. Offline

    Celtic Minstrel

    I suppose there's the option of loading chunks as the trains pass through them, but that might not be more elegant than your proposal...
     
  24. Offline

    bergerkiller

    It loads chunks ahead, at full speed I noticed it loads around 5 chunks every time it changes a chunk, this is required or the trains will stop. I could go and build a complete automated map of where trains can ride, but I guess I can leave that to some other plugin. :)

    For this same reason you can toggle it on and off, if someone comes up with a plugin that can be used in conjunction, I will add the link to it in the main post and set it off by default.

    Status update:

    Scripted a working Pathfinding class for Minecarts. I can now work on spawning trains cart by cart on tracks by reading the tracks.
     
  25. Offline

    Astrae

    Minecart mania had something similar; the trouble with this solution is that when you get a large world with minecarts constantly running across it, you kill the server. Even with ~20-30 minecarts, we started to notice some pretty serious performance issues, and they were for carts that nobody could use or was even near. That's why I'm trying to spawn/despawn trains dynamically. This way, you can freely set up subway lines of arbitrary length without adversely affecting performance for everyone else

    @bergerkiller for this Pathfinding class.... could it read ahead of the tracks too? I'm thinking it would be cool to read the tracks ahead of the train to slowly accelerate/decelerate a train as it approaches a stop/wall similar to a real train
     
  26. Offline

    bergerkiller

    All possible. I currently have a full featured class. You can click on a piece of track, and using the angle you are looking at the tracks it sets all blocks above the tracks to glass. It perfectly followed the tracks, taking all track rules into account:
    - Take corners directly
    - Jump corners if not connected
    - South/west rule

    But not sure if it's a good idea to look ahead in time...it would lag a lot since it obtains the (track) blocks. I'd rather add a sort of break sign system which slowly deaccelerates a train as it drives over it. (custom factor?)

    Only have to be sure not to copy Minecart Mania too much, so first goal is spawning a train on the tracks. :)

    Of course possible to add a sign at the end of the tracks, and as trains drive towards it they lose speed until they reach the sign.

    EDIT

    I could develop some sort of mapping system where it stores the usage of various chunks, and it could keep those loaded for a certain amount of time. But, got to set priorities, and some 'keeping chunks loaded' plugins do exist, so I don't see any use in adding it yet.
     
  27. Offline

    Simanova

    Cant download it - Github wants to install a cloud plugin wtf?

    I downloaded it by going manually to developers github profile -> master -> traincarts -> download -> right click and save under ...
     
  28. Offline

    bergerkiller

    Doesn't happen when I click it though, but yes, the downloads of GitHub sit on a 'cloud', it's a sub-server section of GitHub. Could be you saw the source url of the download and not the name itself. :)
     
  29. Offline

    Marium0505

    :O

    I don't find out how I install the plugin on my server, where is the instructions??
     
  30. Offline

    bergerkiller

    Download TrainCarts.jar (main post, bottom) and place it in the 'plugins' folder created by the server. You do need CraftBukkit, of course.
     
  31. Offline

    Marium0505

    The hole map?

    It is not any .jar file in the zip folder..

    Well?

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

Share This Page