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

    King_KYl3

    Hm delay not working for me im doing [train]
    station
    10
     
  3. Currently I am using Falsebook Carts for Minecart-Driving.
    Does TrainCarts work together with Falsebook Carts, especially with the stations?
    Or could TrainCarts completely replace the Falsebook Cart - Features?
    So with Falsebook Cart, Minecarts run over very long distance, even if the track goes uphill.

    I wouldnt have a problem if the user on my server has to wait for the next trainz, if TrainCarts Spawner can be configured to send a Trainz every x Minutes.
    If yes, will there be a way to configure Signs in Stations that show when ~ the next train will arrive? :p
     
  4. Offline

    bergerkiller

    @szoller honestly I think my station system is by FAR better than any other existing stations. It slows down trains, instead of abruptly stopping them, and it allows a smooth boost in both directions. By setting a station length you can change how fast it stops and launches. Setting it to 1 will boost it quite fast. :)

    Also, I guess a delay redstone circuit sign would fit better in your case, not sure if it exists. Then you can simply make a clock which fires a pulse every x seconds/minutes. Arrive times are possible too (use the current velocity of the minecart vs. the distance to go. I'll see what I can do. Will probably mean a countdown sign in combination with a detector sign. For example:
    I'll see what I can do. Is possible to read the tracks ahead and use that to find out the remaining time, but it would not be suitable for very large tracks. (and it could lag badly)

    @King_KYl3 Brake does not have delay. Only launching (one of the sides not powered) have a delay.
    Will make the train launch 'pretty' fast after a 3 seconds delay.
     
  5. Offline

    King_KYl3

    Ok mad join 121.214.135.122 test :D
     
  6. Offline

    bergerkiller

    @szoller good news: Arrival signs are now working. They activate when a train drives over them and if powered by redstone. You can use multiple triggers to trigger multiple display signs simultaneously. Now fixing a video for it, will also be as example vid for the feature later on.

    Also, by positioning a trigger you can change what direction a train has to drive to, to activate it. This way only trains driving towards the station can get detected easily.

    Video here
     
  7. Offline

    1337phreak

    I've got traincarts running on a bukkit-buildcraft server and I'm having problems with trains not leaving the stations sometimes. I've got a detector rail a distance away that turns off the signal to the station sign but sometimes the train there won't leave unless I walk over and push it. Any ideas?
     
  8. Offline

    bergerkiller

    Then you probably need a bit more delay. I believe the delay only works when a train is present once redstone current changes. Note that I am improving it a bit so you can set it to automatically launch with delay, so don't make a huge redstone circuit yet. :)
     
  9. Offline

    Aox

    Heya bergerkiller!

    So last nights test was fantastic, only had four crashes as opposed to 25+!!!!!

    Here is an example of the only crash we're having now. It seems to be caused by trains colliding with one another on the track, or even a train hitting a single minecart.

    Show Spoiler

    09:30:28 [SEVERE] java.util.ConcurrentModificationException
    09:30:28 [SEVERE] at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
    09:30:28 [SEVERE] at java.util.AbstractList$Itr.next(AbstractList.java:343)
    09:30:28 [SEVERE] at java.util.AbstractCollection.removeAll(AbstractCollection.java:336)
    09:30:28 [SEVERE] at net.minecraft.server.World.cleanUp(World.java:1079)
    09:30:28 [SEVERE] at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:456)
    09:30:28 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:369)
    09:30:28 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    09:30:28 [SEVERE] Unexpected exception
    java.util.ConcurrentModificationException
    at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
    at java.util.AbstractList$Itr.next(AbstractList.java:343)
    at java.util.AbstractCollection.removeAll(AbstractCollection.java:336)
    at net.minecraft.server.World.cleanUp(World.java:1079)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:456)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:369)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)


    Other than that, all is working fantastically! As for launching large large trains (40-70 carts), I had to build a very long "monostable circuit" to keep my launch button on for about 25 seconds to allow the large trains to clear the brakes before they came back on. If I didn't do this, the brakes would grab the end of the train and stop the whole thing. A "brake delay" would be awesome. And I cannot WAIT to test out the arrival time signs!!!!!!

    I'm going to make a vid of our very large train loop around our world, I'll post it here :D

    Loving this so much. Currently at work configuring rack UPS units while sitting on my world's train, travelling around it, picking up mob trap drops and dropping them off at "The Nexus", that holds our buildcraft/industrialcraft recyclers and sorters.

    AWESOME!

    -Aox
     
  10. Offline

    bergerkiller

    Haha I love to read these types of replies. :D

    Then have I got news for you... :p

    I am currently implementing a lot of changes. For one, I split the Util class up into five separate classes, one for Chunks, Blocks, Face, Entities and 'General'. This, to lower the amount of code. Next, I am going to turn the yaw value around. I have finally made up my mind and am going to use 'Block yaw': A yaw of 0 when looking north. This halves my 'face util' class and makes everything a lot easier to understand. Now for the real changes:

    - New station format. You can now use it as follows:
    The last option is new. When both sides are powered it will do what the last one says. For example:

    continue
    Stops the train, waits out the delay (if any) and continues train movement into the previous direction

    reverse
    Stops the train, waits out the delay (if any) and continues train movement into the opposite previous direction

    left
    Stops the train, waits out the delay (if any) and continues train movement left-side. (when seen from the sign text)

    right
    Stops the train, waits out the delay (if any) and continues train movement right-side. (when seen from the sign text)

    In the case of no delay, if set to continue nothing happens. Reverse/left/right, however, act as an 'all-time' change. If the last line is left empty (or different) it will act as a simple brake, and will only react to redstone changes as launch boost. It is pretty damn awesome! :D

    About the arrival signs

    I am still working out a nice way to display it. I think I will use the system described here
    Since I want to make it universal (usable by other plugins) this one will take a bit longer to make, due to lots of syntax rules on the signs. Eventually you'll be able to use %triggername% to display the remaining time ANY format you wish.
     
  11. Offline

    1337phreak

    I hope that by adding a delay and making the carts continue with the signs they will actually launch correctly from the stations every time now. Also, is there a way to make the Arrival sign be a departure sign that starts counting down when the train gets to the station so you can see how long before it leaves?

    Also, @ Aox, my friend & I just finished porting redstone pipes to bukkit, and are porting ExtraBuildcraftPipes as well, if you'd like a copy send me a PM. I'm going to upload them to http://www.minecraftforum.net/topic/382599-173-modloadermp-for-craftbukkit-and-canary/ when we get finished with ExtraBuildcraftPipes.
     
  12. Offline

    bergerkiller

    @1337phreak You can use the same sign system. Simply place it right before the station. They are directional, so you can make them only register one direction. I see this requires quite some tutorials...or one HUGE tutorial of 12 minutes long...lol

    Also, I will make the format configurable, and it will include an option to use these variables anywhere. So you could simple use:
    But before all this I need to clean my code up...BADLY. It contains so many functions that simply repeat other functions with a minor difference....
     
  13. Offline

    DomiStyle

    @bergerkiller
    Good work!
    We are building a rollercoaster at the moment. ;)
    Is there a way to reduce the speed of the train combined with Minecart Mania Autocart and signs?
    We tried using "max speed: 25" but trains don't react on the sign command.
    Normal minecarts work fine with it.
    Any way to do it?
     
  14. Offline

    bergerkiller

    Ugh..um..what features do you use of Minecart Mania? Because it seems more and more that MM is more of a pain than a help...

    Perhaps disable autocart? If you don't want to...what features of Autocart do you want to keep? :p
     
  15. Offline

    Aox

    NICE! Those insert pipes will be a MASSIVE boon to our Buildcrafty Science!

    -Aox

    Nice!!! That'll kill my need for a massive launch brake delay circuit.!!!!

    Nice... These arrival signs will make a few people VERY happy... "Aox, why won't you let us spawn another train, I don't know when the next one is getting here!!!!"

    -Aox

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

    DomiStyle

    I want the trains to go fullspeed all the time without using boosters or any other speed source, like Autocart does.
    And yes, Minecart Mania is quite a hell when it comes to compatibility with other Minecart related plugins. ;)

    Getting lots of these too by the way.
    Plugin still runs fine though.
    Can't quite say what exactly causes it since they appear randomly over time.
    Code:
    02:37:35 [SCHWERWIEGEND] java.lang.NullPointerException
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:37:35 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:37:35 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
    02:37:35 [SCHWERWIEGEND] java.lang.NullPointerException
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:37:35 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:37:35 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
    02:37:35 [SCHWERWIEGEND] java.lang.NullPointerException
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:37:35 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:37:35 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
    02:37:35 [SCHWERWIEGEND] java.lang.NullPointerException
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:37:35 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:37:35 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:37:35 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
    02:37:36 [SCHWERWIEGEND] java.lang.NullPointerException
    02:37:36 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:37:36 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:37:36 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:37:36 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
    02:37:36 [SCHWERWIEGEND] java.lang.NullPointerException
    02:37:36 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:37:36 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:37:36 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:37:36 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
    02:55:08 [SCHWERWIEGEND] java.lang.NullPointerException
    02:55:08 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.MinecartGroup.upda
    teGroups(MinecartGroup.java:31)
    02:55:08 [SCHWERWIEGEND]        at com.bergerkiller.bukkit.tc.TrainCarts$1.run(T
    rainCarts.java:156)
    02:55:08 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftWorker.
    run(CraftWorker.java:34)
    02:55:08 [SCHWERWIEGEND]        at java.lang.Thread.run(Unknown Source)
     
  17. This sounds amazing!
    Now I have to understand how it works, English isn't my native language (i'm German), so it's a bit complicated ;-)
    The displays look great, too! :)
    So you define in trigger the time until arrival and the trigger counts the time on the display down?
    But what about server performance?
    Minecart Mania I don't really understand, maybe also because of the language barrier,
    as far I know, there are no text tutorials for.
    I'll have a look and will try it at the weekend ;-)
     
  18. Offline

    JamEngulfer221

    This sounds exciting! But if it doesn't work with Autocart, then I think I might not use it :/
     
  19. Offline

    bergerkiller

    I can always add options to mimic autocart if you want...what are the features you want from Autocart? Constant speed is one (and is easily addable), something else?

    Also, I am now developing a *somewhat* similar API to what minecart mania is using to get the signs. If it is detected I will run them through MM, if not I will do the checking myself. This should bring the CPU usage down a bit...as long MM's sign coding is correct of course.
     
  20. Could there be station announcements (like in Falsebook):

    "Current Station: XXX"?
    Is it possible to add a sound at the end of the stop (delay) like a beep?
    What about my questions above? ;-)
     
  21. Offline

    bergerkiller

    @szoller easily possible, but I am currently developing a 'framework'.
    I finally have a good working sign framework: it will report members entering and moving, and groups entering. This is will surely easy my coding and allows for more advanced systems. :)

    ScreenShot1.png

    In other words: I can handle actual events now. Trains entering a certain sign, members entering a certain sign, etc. Now improving 'targetting' a bit more so it is at the group, instead of the member.

    Code:
        public static enum ActionType {REDSTONE_CHANGE, REDSTONE_ON, REDSTONE_OFF, MEMBER_ENTER, MEMBER_MOVE, GROUP_ENTER}
    
        public static void onSign(SignInfo info, ActionType actionType) {
            Util.broadcast(actionType.toString());
    
        }
    EDIT

    Finally, now THIS is understandable to others :D

    Code:
        public static void onSign(SignInfo info, ActionType actionType) {
            if (actionType == ActionType.REDSTONE_ON) {
                if (info.getLine(0).equalsIgnoreCase("[train]")) {
                    String secondline = info.getLine(1).toLowerCase();
                    if (secondline.startsWith("spawn")) {
                        spawnTrain(info);
                    }
                }
            } else if (actionType == ActionType.REDSTONE_CHANGE || actionType == ActionType.GROUP_ENTER) {
                if (info.getLine(0).equalsIgnoreCase("[train]")) {
                    if (info.getLine(1).toLowerCase().startsWith("station")) {
                        if (info.hasRails()) {
                            MinecartGroup group = info.getGroup();
                            if (group != null) {
                                handleStation(info);
                            }
                        }
                    }
                }
            }
            if (actionType == ActionType.REDSTONE_ON || actionType == ActionType.GROUP_ENTER) {
                if (info.getLine(0).equalsIgnoreCase("[train]")) {
                    if (info.getLine(1).toLowerCase().startsWith("trigger")) {
                        ArrivalSigns.trigger(info.getSign());
                    }
                }
            }
        }
     
  22. Offline

    DomiStyle

    Elevators (the one from Minecart Mania hurt you if you are on a train)
    Announcements
    Maximum Speed (Trains ignore these)
    Lock
    Unlock

    However, it would be fine if Trains just allow to set a autocart option too (Trains always go fullspeed) AND respect the Speed signs, that way you could still use MCM but disable the Autocart part.
    Like when there is a sign under the track the first minecart reduces the speed.
     
  23. Offline

    bergerkiller

    @DomiStyle I see it does require a bit work, although it is pretty easy with my new API. I'll see what I can do...
    First got to fix up the targetting functions. They are at the wrong place, wrongly built and I am wondering how I ever got them working. :D
     
  24. Offline

    JamEngulfer221

    Well, I really want pretty much everything from Autocart, especially the 'auto' function and ESPECIALLY the sign controls for speed.

    Could you have it so that all of the other mine carts behind the first cart have no physics whatsoever, so there are like weightless and physics less, just stuck to the first cart in the train, so that it works properly with everything like powered rails and possibly autocart
     
  25. Offline

    bergerkiller

    Yup that is basically what adding compatibility means. I only hope MM added sufficient events in the listener, or I won't be able to do a thing...

    I'll see what fires and what I can handle to change it. But again, targettiiing
    xd
     
  26. Offline

    JamEngulfer221

    @bergerkiller
    Sooo, were you talking to me? I'm not sure.
     
  27. Offline

    DomiStyle

    No problem, great plugin anyway. ;)
    And there is always a way to get things working....
     
  28. Offline

    bergerkiller

    Wow that is cool... ;)

    It wouldn't be too hard to add support, but for that I obviously need a server mod too. Better wait till this mod becomes available & playable using Spout, then I could and probably will add support for it. :)
     
  29. I dont know if it will ever be playable with bukkit, i did'nt read something like that :-s
     
  30. Offline

    bergerkiller

    Update: station signs (with automatic delay, continue, reverse, left, right, etc.) are 100% working. Now adding a final 'piece of the puzzle': I will make levers connected to the block, connected to the sign, turn on or off based if a train is in the station. Could be useful for stuff like noteblocks.

    Afterwards I am going to work on sign variables so you can basically show the arrival time anywhere any format you want. I will try to make it compatible with sign coloring plugins. :)

    EDIT

    @SergeantH Your issue with carts colliding with the sides of tunnels is solved. They passed the 'overkill' scenario 20x in a row. :)
    Also, thanks for reporting, or I wouldn't have noticed this bug...it thought the Minecart was turned but in theory it wasn't. Had to add some more checks to fix it.

    EDIT2

    @DomiStyle Also added a *possible* fix to the NPE, you never know if it works when you don't get those errors...

    <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 13, 2016

Share This Page