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

    Aox

    @bergerkiller

    You are indeed the man!

    I'll give SignLink the shakedown when you get it deployed, and glad you caught the pushaway lack. Just FYI, mobs can still enter carts from the sides and top when pushaway is enabled, just not from the front. Say you're going through a dark part of track at night, that's just below ground level, like in the "adventureland' portion of our world circuit. A creeper can still mosey over and fall into a cart, even when pushaway worked. And as long as your cart is at least 1 cart away from him, you're all good :D If you get next to him, boomtown. Our standard "AFK" train is now SMSMSMSMSMSMS so when we collect mobs we're still safe if AFK.

    The lack of pushaway has definitely turned cart1 into a mob collector/bouncer. It's about 50/50 whether we come to a stop and collect it, or just bounce off of it. For now, we've installed sections of track that turn the train around if it's going the wrong way from being bounced by a mob.

    -Aox
     
  3. Offline

    bergerkiller

    You can always use the MM system where mobs get 'killed'. :)

    And I may know how I can get max speed signs to work. I'll have to use the built-in max speed value, which MM changes, instead of my own value.

    Just so SignLink can be published; I am adding a ticker/message variable configuration:
    Code:
    variablename:
        - ticker = NONE/LEFT/RIGHT
        - tickerSpeed = 1/2/3/4 etc
        - value = "test message"
     
  4. Offline

    IronPython

    i am using 1.27 i didnt want to test out the new beta yet as the last train plugin i used crashed my server so i was not ready to jump in a beta release just yet lol
     
  5. Offline

    bergerkiller

    http://forums.bukkit.org/threads/me...ext-on-signs-based-on-keys.35021/#post-644737

    Well that's done. :)

    Now working at the TrainCarts project again, especially the speed limit of MM.

    EDIT

    Ok max speed setting is now being applied. It reads the max speed from the head of the train and applies this to all other carts. Teleport signs...wonder how far I can get with that...

    EDIT2

    Ok not far. Minecart Mania does not contain an event that fires upon teleport, so I can't handle it...

    Time to update to v1.28...

    Ok updated to v1.28 and also added an instructional video for the station to clear things up. :)

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

    mze9412

    Is there an easy way to destroy trains? :)
     
  7. Offline

    bergerkiller

    Yup, get a sword and cut away... :p

    You can disable droppings in the configuration if you dislike the cart items being dropped.
     
  8. Offline

    mze9412

    hm, no, manual destruction is not an option :\ Our subway network is using Chests to recover and spawn carts at the moment but with trains some kind of automatic destruction would be important.
     
  9. Offline

    bergerkiller

    You can add a lava pool and make them drive into that, it works pretty well. :)
     
  10. Offline

    mze9412

    Hey, that's a fun idea :D Would MinecartMania destruction blocks work? Or would they cause havoc with your trains logic?
     
  11. Offline

    bergerkiller

    It would work, but maybe some weird thing can happen. Could be it assumes the cart is still there, but that would only last for around 1/4th of a second. Then the 'garbage collector' automatically marks it as dead and removes the cart. Never really tried it though.. :)

    Also, adding a destroy and destroy all sign to it real quick. (for 1.28)
    Can't really be a problem I guess. :)
     
  12. Offline

    mze9412

    Thanks a lot! I will build a small evaluation line soon!
     
  13. Offline

    DomiStyle

    If you have MCM you can also use the Kill block (Default: Diamond ore).
    But lava pools work fine too.
     
  14. Offline

    bergerkiller

    While I'm at it, adding an eject and eject all as well. (ejects all passengers when powered and when the minecart drives over it when it's powered)
     
  15. Offline

    DomiStyle

    Speed signs work fine now.
    Stations can also be used as reverse signs now.
    And got no NPE errors so far.
    Great update. :)

    edit: Trains seem to "lag" alot when using speed signs though.

    edit2: More then 2 minecarts on a train seem to still ignore the station sign.
    They get slower but they don't reverse.
     
  16. Offline

    bergerkiller

    If you meant the powered tracks causing weird lag when run with MM, yeah, I noticed that, but I got no idea why. It can't be traced down to my plugin...

    Also, which two minecarts ignore the station sign? Could be they were not connected to a group...

    EDIT

    Ah it's minecart mania again...what a surprise... :rolleyes:

    Their 'keep carts running' is kinda preventing the station from ever getting the cart halted, nothing I can do there other than adding some support STOP command... *fixed*

    edit2

    GitHub is being a *beep* again...upload file...download it...still old version...rage...

    edit3

    Ok after waiting 1:30 hours it finally got uploaded...sigh...
    New features added: remove (all) and eject (all) sign command, and fixed a station issue with MM.
     
  17. Offline

    DomiStyle

    @bergerkiller
    The stations work fine and act as reverse blocks now, thanks.
    Gonna test the eject and remove all soon.
    However the spawner crashed my #1060 Bukkit:
    Code:
    2011-09-04 00:35:50 [SEVERE] java.lang.NullPointerException
    2011-09-04 00:35:50 [SEVERE]     at com.bergerkiller.bukkit.tc.VelocityTarget.update(VelocityTarget.java:47)
    2011-09-04 00:35:50 [SEVERE]     at com.bergerkiller.bukkit.tc.MinecartGroup.updateTarget(MinecartGroup.java:403)
    2011-09-04 00:35:50 [SEVERE]     at com.bergerkiller.bukkit.tc.MinecartMember.m_(MinecartMember.java:57)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.World.entityJoinedWorld(World.java:1212)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:48)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.World.playerJoinedWorld(World.java:1194)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.World.cleanUp(World.java:1110)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:450)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    2011-09-04 00:35:50 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    2011-09-04 00:35:50 [SEVERE] Unexpected exception
    java.lang.NullPointerException
        at com.bergerkiller.bukkit.tc.VelocityTarget.update(VelocityTarget.java:47)
        at com.bergerkiller.bukkit.tc.MinecartGroup.updateTarget(MinecartGroup.java:403)
        at com.bergerkiller.bukkit.tc.MinecartMember.m_(MinecartMember.java:57)
        at net.minecraft.server.World.entityJoinedWorld(World.java:1212)
        at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:48)
        at net.minecraft.server.World.playerJoinedWorld(World.java:1194)
        at net.minecraft.server.World.cleanUp(World.java:1110)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:450)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Hope that helps.
    It happend when I spawned 8 minecarts with a button:

    [train]
    spawn
    mmmmmmmm

    The spawner spawned more then 8 minecarts but I need to check it again.
     
  18. Offline

    bergerkiller

    Lol...unbelievable you forget one TINY little check to see if the member is in a group and you get an error to the face...lol :D

    Before:
    from.getGroup().limitSpeed();

    After:
    if (from.grouped()) from.getGroup().limitSpeed();
     
  19. Offline

    DomiStyle

    Another one when powering a spawner with a redstone torch (first redstone, then torch):
    Code:
    2011-09-04 00:47:54 [SEVERE] Could not pass event REDSTONE_CHANGE to Train Carts
    java.lang.ArrayIndexOutOfBoundsException: 0
        at com.bergerkiller.bukkit.tc.TrackMap.walk(TrackMap.java:154)
        at com.bergerkiller.bukkit.tc.TrackMap.walk(TrackMap.java:36)
        at com.bergerkiller.bukkit.tc.Listeners.CustomEvents.spawnTrain(CustomEvents.java:246)
        at com.bergerkiller.bukkit.tc.Listeners.CustomEvents.onSign(CustomEvents.java:265)
        at com.bergerkiller.bukkit.tc.Listeners.TCBlockListener.onBlockRedstoneChange(TCBlockListener.java:27)
        at org.bukkit.plugin.java.JavaPluginLoader$35.execute(JavaPluginLoader.java:483)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
        at net.minecraft.server.BlockSign.doPhysics(BlockSign.java:116)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:438)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:438)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:49)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:459)
        at net.minecraft.server.World.applyPhysics(World.java:434)
        at net.minecraft.server.World.update(World.java:407)
        at net.minecraft.server.World.setData(World.java:349)
        at net.minecraft.server.BlockTorch.c(SourceFile:74)
        at net.minecraft.server.BlockRedstoneTorch.c(BlockRedstoneTorch.java:51)
        at net.minecraft.server.Chunk.a(Chunk.java:265)
        at net.minecraft.server.World.setRawTypeIdAndData(World.java:297)
        at net.minecraft.server.ItemBlock.a(ItemBlock.java:84)
        at net.minecraft.server.ItemStack.placeItem(ItemStack.java:56)
        at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:223)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:573)
        at net.minecraft.server.Packet15Place.a(SourceFile:57)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:89)
        at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:478)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    edit: Nevermind.
    Was my fault for not writing the "mmmmmmmm" on the third line. ;)
     
  20. Offline

    bergerkiller

    That must be where you set zero minecarts to spawn...walking assumes to have at least one starting point to go with. Rval, however, is 0 so it ends up in an exception. Thanks for reporting. :)
     
  21. Offline

    DomiStyle

    It seems like trains that just spawned don't react to stations.
    If I push a train into the station it stops properly.
    If I spawn it a few blocks before it just drives over it.
     
  22. Offline

    bergerkiller

    The first minecart of the group has to enter the sign first, or it won't detect a 'group enter'. In that case nothing happens, simply how the logic is. If this happened after an error, it is probably a not-set Group property.

    Reuploading in 3..2..1..done (take the raw downlaod, not the one in a package, thats a sort of backup in-case)

    EDIT

    However, when I spawn a train right at the station it did work...odd
     
  23. Offline

    DomiStyle

    The first Minecart drives over the station just fine.
    No error at all, gonna restart it again and test out the new version once you uploaded it.
     
  24. Offline

    bergerkiller

    @DomiStyle already uploaded. :)
     
  25. Offline

    DomiStyle

    Same problem.
    Only if I build the train myself or tap the cart in the direction with Autocart it works.
     
  26. Offline

    bergerkiller

    Possible to include a screenshot with the setup used? If you can't reproduce it, you can't debug it...

    Also, if you used powered rails, this could be the cause. For some reason powered rails act funny with MM...no idea what the point of it is.
     
  27. Offline

    DomiStyle

    That is the reason I removed all powered rails and use Autocart cause Minecart Mania acts weird.
    Anyway, sent you a PM.
     
  28. Offline

    1337phreak

    Could you add an option (off by default) to toggle the player to be able to push the trains and interfere with their normal movement? I'm tired of running into a cart and pushing it out of the station or stopping it midway when hopping out of the cart. (I've got pushplayer & pushplayers set to true so if the player isnt moving the train will ignore them or push them out of the way, but not if the player is moving)
     
  29. Offline

    DomiStyle

    Just turn pushPlayers off?
    I don't understand your problem at all.
    If you would be able to push your cart there would be no sense in setting pushPlayers to true. :/
     
  30. Offline

    1337phreak

    I'm trying to get it so carts ignore players running into them and wont move if someone walks up and tries to push the cart down the track, and I'd like it to be able to be toggled on/off so if you need to push a newly placed cart to form a train you can.
     
  31. Offline

    bergerkiller

    You should be able to push carts even with pushAway enabled, it is only not possible to push the other way. And I noticed how MM can be a pain, since it keeps the carts at max speed. Try placing all carts on a block next to the other so they 'connect' on placement, it can make train-making easier.

    Also, the train spawner sign could be a solution.
     

Share This Page