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. Use version 1.47 and do not use portals, the plugin works like a charm then :)
     
  3. Offline

    Dzejkob

    It now works for 1.0.0, but I have another problem (it's maybe also bug in Minecraft) - minecarts have problems with railways that are getting up, sometimes minecarts can't go, and they'll reverse their direction. This happens in both situations (if player's in minecart and also if minecart's empty).
     
  4. Offline

    ledhead900

  5. Offline

    bergerkiller

    @Dzejkob It rarely happens, can be avoided by having both a flat and a sloped part of powered rails. This way it won't go into reverse when going from normal to powered sloped rail, and ye, it's a MC bug.
     
  6. Offline

    dog.big

    could you please give me link of fixed TrainCarts (stable) for 1.0? Also could you write down, how to make trains unstoppable (push away every player, also owner, mobs and drops) - flags?

    Thank you, i hope we get working subway system again soon :)
     
  7. Offline

    bergerkiller

    @dog.big a working version for 1.00 is on the main page, Thulinma modified 1337 versions a bit so they work in 1.00, of which I give great thanks because I am busy enough as is :)

    After selecting the train to target, do the following:
    You can also set these properties in the defaultflags.yml file

    To push away owners, disable the 'ignorePushawayforowners' / global settings.
     
  8. How Do You Select? P.S. I'm A noob :)
     
  9. Offline

    bergerkiller

    @TheSuperNinjaBanana Left/right click a minecart using any item. Just-placed minecarts are also selected.
     
  10. Thanks

    My selection still will not work....It says pick a cart to edit.
    Even when I place one it will not let me.

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

    bergerkiller

    Ugh that bug again...thought I fixed it a long time ago...Java hates me lately lol
    I'll see what I can do
     
  12. Offline

    MechanID

    using cb 1550 and latest version (downloaded few hours ago) i have this problems
    1st - physisc bugs: trains flying and fall down very slow, solo minecart fall down slow but without moving forward.
    2nd - in any type of station huge trans 20+minecarts cant leave station
     
  13. Offline

    bergerkiller

    @MechanID you are using the 1.00 version? Any errors in the log?
     
  14. Offline

    MechanID

    @bergerkiller yes i using 1.00 version, and there is no errors in log,
    if you want look at this i can tell you my test server ip

    also where i can read about traincarts destination pathfinding logic ?
     
  15. Offline

    dog.big

    Please,
    develop WORKING version for 1.0.0. This temporary still has errors like memory leaks (try to spawn ten trains and use /train destroyall - it will show big numbers... really bad). Also we are experiencing with lot of lags and flag keepChunksLoaded DOES NOT work anymore, trains will stop in unloaded chunks also with keepChunksLoaded: true. It seems, that we will have to remove the whole subway system and switch to manual cart track system. How bad :(.

    defaultflags.yml
    Code:
      pushAway:
        mobs: true
        players: true
        misc: true
        keepChunksLoaded: true
    admin:
      pushAway:
        mobs: true
        players: true
        misc: true
        keepChunksLoaded: true
    station:
      pushAway:
        mobs: true
        players: true
        misc: true
        keepChunksLoaded: true
    config.yml
    Code:
    
    normal:
      cartDistance: 1.5
      cartDistanceForcer: 0.1
    turned:
      cartDistance: 1.6
      cartDistanceForcer: 0.2
    nearCartDistanceFactor: 1.2
    removeDerailedCarts: false
    maxCartDistance: 4.0
    breakCombinedCarts: false
    spawnItemDrops: true
    poweredCartBoost: 0.1
    keepChunksLoaded: true
    exitOffset:
      x: 0.0
      y: 0.0
      z: 0.0
    pushAwayForce: 0.8
    pushAwayIgnoreGlobalOwners: false
    pushAwayIgnoreOwners: false
    useCoalFromStorageCart: false
    setOwnerOnPlacement: true
    use: true
    
     
  16. Offline

    bergerkiller

    @MechanID You can ask @Thulinma , he technically wrote it mostly. :)
    It uses neighbouring and my TrackMap system to create connected nodes with a distance, using nodes + total distance it will find out the shortest route through A* pathfinding. Every node knows of all connected nodes, so the next time a train enters a switch it will know exactly where to go.

    @dog.big I'll switch to 1.00 on my project and work on it that way, bet I can find out what is going on...
     
  17. Offline

    liltman333333

    i Got linking to work and then the furnace minecart wont work, it just simply goes forward one piece of track every time i put coal in it....please fix it.
     
  18. Offline

    bergerkiller

    Just so you all know, I am currently fixing/debugging a 1.00 version. It had several issues, now dealing with it not keeping chunks loaded. (probably because of the gap between checks where it forgets to unload a train)

    If you have any sort of issue, feel free to post it here, I'll try to deal with all of them.

    @liltman333333 Will look at that issue, it's a 1.00 issue so you're lucky.
     
  19. Offline

    MechanID

    @bergerkiller
    i have following issues, CB version git-Bukkit-1.8.1-R4-83-g24cb05a-b1556jnks (MC: 1.0.1)
    and TrainCarts_for_1.0.0.jar redownloaded 2 hours ago. without any other plugins.
    issues:
    1. flying trains
    2. huge trains cannot leave station
    3. after removing destination and creating it again on some other end of rails, tag switchers still route to old pass even after server restart.
     
  20. Offline

    bergerkiller

    @MechanID Thanks for reporting. What do you mean with point 1 and 2? I did notice 'bugged' carts not wanting to fall down, if you mean that with point 1. Point 2 could be due to your station being too small (value after station).

    3. You need to use /train reroute if you changed destinations. It will then recalculate it automatically.

    EDIT

    Also found out what was causing the fuel issue. The 'e' variable (for fuel) had become private. Any attempt to alter this (when putting coal into the cart) is futile, as the 'e' variable existed two times. Now making a workaround.

    Ok people officially updated for CB 1550 (tested) MC server 1.00. A lot of fixes have been made, fixing 'keep chunks loaded', train replacement, loading and saving, powered minecart fix, sloped station stopping, general code-cleanup, LOTS of performance fixes - and improvements where possible.

    Trains should now properly keep chunks loaded. It is also possible to set if trains have to be moving to keep chunks loaded, default is false as of right now.

    EDIT

    Only issue I noticed so far, is that it fails to launch a minecart up a slope. It's fixable, I'll do that later.

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

    ledhead900

    Wonder if this fixes the my cart stop issue you saw on my test server, well was going to see. some reasons they stopped right after you left they phsycly disconnect from the group think this is why thy sto. Tho that is useless if they only work with keep chunks loaded as I don't want chunk loaded at all where ever possible.

    I cannot afford ram wise to have people running trains around with chunks being loaded I just want to damn trains to work like they did in 1.8 just before you made some changes to the system in 1.8 it was working for me. But every version since they stop after players leave and groups ^ . This is not good if it is going to happen when server restarts as every train anyone makes will just break on chunk unload or server stop its almost as if if it forgets its a group.

    So if this update does not fix that I'm going to start getting mad :p. Did my track look fine to you ? when you was on my server.

    Anyway, moving on

    Suggestion/Improvement

    ArrivalSigns
    • Once linked they could say "pending arrival" using the last 3 line spaces for this and then when the opposite end triggers the sign that you would normally place at the station it is heading to it could change from "pending arrival" to "00:xx:xx" displaying the countdown timer, instead of just showing a countdown of "00:00:00" until triggered as IMO its a bit awkward to leave a countdown up if train is tech not even leaving the station.
    Features That could be nice
    • Modular expansion addons for trains, similar to minecart mania but with less bulk, basically a module for each part such "Freight Module" that would take items on a sign as chests carts pass over and dump them into near by chests with deposit signs. Like wise chests would also have this ability to dump into nearby train chest carts.
    EDIT
    I am getting a Stackoverflow with latest version on shutdown
    Code:
    2011-12-05 15:41:28 [INFO] MC Server GUI: Stopping backup first to avoid world corruption.
    2011-12-05 15:41:36 [SEVERE] Could not pass event CHUNK_LOAD to Train Carts
    java.lang.StackOverflowError
    at org.yaml.snakeyaml.reader.StreamReader.prefixForward(StreamReader.java:170)
    at org.yaml.snakeyaml.scanner.ScannerImpl.scanPlain(ScannerImpl.java:1618)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchPlain(ScannerImpl.java:848)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:346)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:179)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:563)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:123)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)
    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)
    at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:59)
    at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:143)
    at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:109)
    at com.bergerkiller.bukkit.tc.Configuration.load(Configuration.java:45)
    at com.bergerkiller.bukkit.tc.TrainProperties.getDefaults(TrainProperties.java:278)
    at com.bergerkiller.bukkit.tc.TrainProperties.setDefault(TrainProperties.java:285)
    at com.bergerkiller.bukkit.tc.TrainProperties.setDefault(TrainProperties.java:282)
    at com.bergerkiller.bukkit.tc.TrainProperties.<init>(TrainProperties.java:180)
    at com.bergerkiller.bukkit.tc.TrainProperties.get(TrainProperties.java:21)
    at com.bergerkiller.bukkit.tc.MinecartGroup.getProperties(MinecartGroup.java:255)
    at com.bergerkiller.bukkit.tc.NativeMinecartMember.ignoreForces(NativeMinecartMember.java:95)
    at com.bergerkiller.bukkit.tc.NativeMinecartMember.preUpdate(NativeMinecartMember.java:302)
    at com.bergerkiller.bukkit.tc.MinecartGroup.create(MinecartGroup.java:50)
    at com.bergerkiller.bukkit.tc.MinecartGroup.create(MinecartGroup.java:43)
    at com.bergerkiller.bukkit.tc.GroupManager.restoreGroup(GroupManager.java:86)
    at com.bergerkiller.bukkit.tc.GroupManager.refresh(GroupManager.java:317) 
    I might be able to workaround this by increasing my servers stacksize in java params to 5mb to allow a little more overhead.

    Edit:
    I see why now LOL,
    Code:
    2011-12-05 15:47:24 [INFO] [TrainCarts] 27635 Trains have been loaded in 1 world. (27637 Minecarts)
    I only placed down 3. It appears some how its duplicating trains to oblivion.
    2011-12-05 15:47:24
     
  22. Offline

    MechanID

    @bergerkiller
    i feel myself stupid, but i need to ask:
    for trains formed from 22 minecarts what station valuse i need to use ? i tested 10 20 30 40
    with no success.

    it looks like after restart it dupes existing trains and launches them, they collide with each other, and dupes again

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 14, 2016
  23. Just to clarify for whoever is interested ( @MechanID ): it's not exactly A* pathfinding (A*, just like Dijkstra, requires knowledge of all existing nodes - this is simply not possible in MC, since some nodes may not be loaded yet). It works like this:
    • When passing over a tag sign with a destination set, it will always attempt to follow tracks in all 4 possible directions, if possible.
    • It notes the first tag sign or destination sign it encounters for each direction, updating its own internal cache with everything that encountered tag sign or destination sign knows (the internal cache for that sign, basically) as well as updating the encountered sign with the information the current sign has. They basically exchange what they know.
    • If the encountered sign doesn't have an internal cache yet, it will create one by attempting to follow tracks in all 4 possible directions (repeating all of these steps listed here).
    • It then sends the train off in the direction your destination is in according to its internal cache, or straight if the destination is unknown.
    Since this happens every time a train passes over a tag switcher, big rail networks will gradually get known to all possible switches and destinations (chunks, after all, load when players are near them, for example riding a cart). Smaller networks will instantly work because the entire track is most likely loaded when the first tag switcher is used, causing all tag switchers in the network to activate instantly.
    Additionally, the /train reroute command clears all the sign caches, causing all tag switches to recalculate routes.

    Hope that clears some things up :)
     
    MechanID likes this.
  24. Offline

    bergerkiller

    Mhh it still has some issues with train creation then, I'll check if everything is working correctly.
     
  25. Offline

    MechanID

    @Thulinma thank you for explanation :)
     
  26. Offline

    bergerkiller

    Updated it, several attempts have been made to prevent the train duping bug. Stations also push trains up slopes correctly, and it is easier to push trains up slopes in general.
     
  27. Offline

    MechanID

    @bergerkiller
    still have dupe trains bug with latest version, after stop command, when starting up something weird happens.
    was 1 train, after rstop start 25
    Code:
    00:25:32 [INFO] This server is running Craftbukkit version git-Bukkit-1.8.1-R4-83-g24cb05a-b1556jnks (MC: 1.0.1) (Implementing API version 1.0.0-R1-SNAPSHOT)
    00:25:32 [INFO] Preparing level "world"
    00:25:32 [INFO] Default game type: 0
    00:25:33 [INFO] Preparing start region for level 0 (Seed: 6530216146334317490)
    00:25:33 [INFO] Preparing start region for level 1 (Seed: 6530216146334317490)
    00:25:33 [INFO] Preparing start region for level 2 (Seed: 6530216146334317490)
    00:25:33 [INFO] [TrainCarts] 1 Train has been loaded in 1 world. (3 Minecarts)
    00:25:33 [INFO] [TrainCarts] version 1.51 is enabled!
    00:25:33 [INFO] Server permissions file permissions.yml is empty, ignoring it
    00:25:33 [INFO] Done (0.103s)! For help, type "help" or "?"
    >stop
    00:25:40 [INFO] CONSOLE: Stopping the server..
    00:25:40 [INFO] Stopping server
    00:25:40 [INFO] TrainCarts disabled!
    00:25:40 [INFO] Saving chunks
    >If you want to completely stop the server process now, press Ctrl+C before the time is up!
    Rebooting in:
    3...
    2...
    1...
    Rebooting now!
    174 recipes
    27 achievements
    00:25:48 [INFO] Starting minecraft server version 1.0.1
    00:25:48 [INFO] Loading properties
    00:25:48 [INFO] Starting Minecraft server on *:25565
    00:25:48 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
    00:25:48 [WARNING] The server will make no attempt to authenticate usernames. Beware.
    00:25:48 [WARNING] While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
    00:25:48 [WARNING] To change this, set "online-mode" to "true" in the server.properties file.
    00:25:48 [INFO] This server is running Craftbukkit version git-Bukkit-1.8.1-R4-83-g24cb05a-b1556jnks (MC: 1.0.1) (Implementing API version 1.0.0-R1-SNAPSHOT)
    00:25:48 [INFO] Preparing level "world"
    00:25:48 [INFO] Default game type: 0
    00:25:48 [INFO] Preparing start region for level 0 (Seed: 6530216146334317490)
    00:25:48 [INFO] Preparing start region for level 1 (Seed: 6530216146334317490)
    00:25:48 [INFO] Preparing start region for level 2 (Seed: 6530216146334317490)
    00:25:49 [INFO] [TrainCarts] 25 Trains have been loaded in 1 world. (27 Minecarts)
    00:25:49 [INFO] [TrainCarts] version 1.51 is enabled!
    00:25:49 [INFO] Server permissions file permissions.yml is empty, ignoring it
    00:25:49 [INFO] Done (0.103s)! For help, type "help" or "?"
     
  28. Offline

    bergerkiller

    @MechanID Question: first, destroy all trains. Then go to a location far from spawn and place a single minecart. Then leave the server and wait for the chunk to unload. (instant, if you use NoLagg or similar you have to wait out the unload delay). Now, stop the server and start again. Are there more than one minecart now, or not? If yes, then it is probably the same bug I've been fighting for hours now lol
     
  29. Offline

    MechanID

    @bergerkiller , i do as you ask, and leave server,
    1st stop start - 1train 1 minecart
    2nd stop start - 25 trains 25 minecarts
     
  30. Offline

    bergerkiller

    @MechanID Ok thanks, that scales it down to the replacement function in onDisable. I'll look into it.

    EDIT

    Couldn't locate a problem - no duping when I tried it. Any other plugins you run which could cause issues?
     
  31. Offline

    silentdojo

    @bergerkiller @MechanID Having same issues on CB 1550 Spout 583 and
    Show Spoiler
    CraftIRC, TeleConfirmLite, Spout, HeroChat, mcbans, RemoteToolkitPlugin, iHelp, WorldEdit, Multiverse-Core, FalseBookIC, PluginList, WebAuction, LogBlockQuestioner, FalseBookCore, WorldGuard, ColoredSigns, WorldInventories, FalseBookBlock, iConomy, Votifier, FoundDiamonds, Multiverse-Portals, xWarp, Questioner, CartDispense, DispNameChanger, CleanroomGenerator, CommandBook, RegrowingSheepcoat, FalseBookCart, PermissionsEx, War, Minequery, FalseBookExtra, NoCheat, Permissions, mcMMO, LogBlock, Modifyworld, NoLagg, VanishNoPacket, LWC, Register, MyHome, Towny


    As soon as someone loads the chunks where minecarts were last used the server hangs.
     

Share This Page