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

    bttws

    Could you send a like to this stub, I cant seem to find it : )
    Thanks
     
  3. Offline

    bergerkiller

  4. Offline

    andrewpo

    Problem persists in the latest release 1.60 (non-beta) with bkcommonlib 1.18

    http://i.imgur.com/Eixkp.png
     
  5. Offline

    bergerkiller

    andrewpo I am not sure if powering it that way works; just in case; try if powering the sign directly works out. (repeater touching the sign)
     
  6. Offline

    epicfacecreeper

    I like trains :cool:
    This looks like a really cool plugin.
     
  7. Offline

    andrewpo

    Powering the sign directly works, but I thought you had made it so that it would check for power to the block below from all sources except levers (as levers cause problems with station signs??)

    It's an awesome plugin! ;D
     
  8. Offline

    bergerkiller

    andrewpo I thought too, but it is failing as I just tested. Fixing that in 1.61 (together with the bugged gravity...)

    *fixed
     
  9. Offline

    Happylosertempo

    Cart Flying who rail end :-(

    [​IMG]
     
  10. Offline

    andrewpo

    Confirmed glitch, release 1.60.

    Thanks :)
     
  11. Offline

    bergerkiller

    Yup, flying bug fixed in 1.61.
     
  12. Offline

    bergerkiller

    New version is up. It now adds: Action blocks. Because everyone seems to build their own plugin these days, I spent 2 hours writing my own implementation implementing TrainCarts.

    It currently supports the ejector and station blocks, complete with permissions, build messages, configuration and of course, a working system. If you want iron blocks to always eject trains, instead of only if they are powered, you can do this in the configuration. (powerInverted)

    TrainCartsBlocks' config is 'blocks.yml' in the same TrainCarts folder.

    If you need any other action blocks, just say so, I am willing to add those as well. A bit tired at all the 'please support this plugin becoz I need action blocks' messages, so this is my resolution. The default action materials right now are iron and obsidian, you can change 'em in the configuration. Now back to more important stuff :)
     
  13. Offline

    bttws

    Thanks for all your hard work. Nice to see platforms back. Did the Ignore path finding make it in the last update?

    -bttws
     
  14. Offline

    bergerkiller

    bttws if you mean changing destination == null to hasDestination(), then yes. :)
     
  15. Offline

    bttws

    I meant when you said this....
    Thanks
     
  16. Offline

    bergerkiller

    bttws Already in, yes. If any of the tags on the switcher sign match the cart or train, it won't enforce the destination path finding.
     
  17. alrighty, i experience an issue with train carts 1.62:

    i have a 4 cart train spawned and chest out 64 coal at a chest, then drive to a station block to wait 10 secs (for users to enter) then continue if passengers sitting to a pretty far away destination. now i was under the impression that the "psmmm" train which got the coal should be powered automatically but for some reason the train stops after a while without the powered cart pulling. if i exit the train and hit the powered cart the train starts to run powered...

    what is wrong there ?
     
  18. Offline

    bergerkiller

    g_BonE Mmh yeah powered minecart spawn unfueled; I'll have to make it auto-fuel the powered minecarts if a launch velocity is set.

    AFAIK it also lacks the ability to put coal in powered minecart by means of a transfer sign, maybe something worth adding too..
    Atm it only fueles the powered minecart using attached storage minecart once it loses fuel (> 0 to 0), not while first spawned. Something I should add too. ;)
     
  19. so... is there a way to work around this ? or just wait for a new [fixed] version ? i'd rather stay with a classic powered-by-coal train setup then switch to using those "cheat-blocks" ;)
     
  20. Offline

    bergerkiller

    g_BonE Yeah, you can wait for the fixed version. I will make sure it will put in coal whenever it becomes available in the train, instead of only when it goes from fueled to empty.
     
  21. Offline

    bttws

    oh.... Thank You! I don't want to be at work now, I want to get home and try this out!

    That would be awesome!

     
  22. Offline

    Newpoman

    so i set up a subway and made it so people cant destroy the train or get out so they cant screw up the oncoming trains. and also made it so they cant walk onto the track.. but they can get around this by placing their own cart on that track and it screws up everything. Is there a way to make it so people cant place trains on one certain track. like say, set the track to an owner and only the owner can place the train.
     
  23. Offline

    Noahsark

    Why my furnance cart can run forever without any coal? When I click the furnace cart it just run automatically.
    Is that a bug?
    I don't like this feature if it not a bug. Everything need fuel to run. Or can you make it configurable?
     
  24. Offline

    ledhead900

    bergerkiller
    Since your last release 61 I think trains have been stopping for no reason upon server restarts and generally if randomly on in my starting world, they just sorta go half way around the setup and appear to stop until owner pushes them again.

    I think it might when they go to load unloaded chunks.
     
  25. Offline

    bergerkiller

    Newpoman You will have to get a region protection plugin for that then, denying interaction in an area. Of course, you can also set all your trains to stop colliding and linking with other trains. Then it will move right through without noticing the odd carts.

    Noahsark A powered minecart can run an extra 3600 ticks (3 minutes) every time a new coal item is put into the minecart. So if you put 6 coal into the cart, you can make it run for 18 minutes. Which can be considered quite long really.

    ledhead900 I'll take another look at the unload and load behaviour of trains; it is a very sensitive system with lots of ways it could mess up.
     
  26. Offline

    Noahsark


    You misunderstand.
    I said that I made a new furnace car with no coal and it keep running when I pushed it on unpowered rail. It seems it will be running forever. You'd better test it on the latest Bukkit and check your code again.
    Thanks.
     
  27. bergerkiller: looking up at Noasharks post and your reply i figure the "coal powered" train is now working correctly ? is there a new version out ?
     
  28. Offline

    bergerkiller

    g_BonE it always was, but it didn't put the coal from attached storage carts in correctly. (which I am now fixing)

    Noahsark I am pretty much confident that the train will stop after a set time. It is seen back in the source code:
    Code:
            if (this.fuel > 0 && this.type == 2) {
                if (--this.fuel == 0) {
                    //TrainCarts - Actions to be done when empty
                    if (this.onCoalUsed()) {
                        this.fuel += 3600; //Refill
                    } else {
                        this.b = this.c = 0.0D;
                    }
                }
            }
            this.a(this.fuel > 0);
    Code:
                ItemStack itemstack = entityhuman.inventory.getItemInHand();
                if (itemstack != null && itemstack.id == Item.COAL.id) {
                    if (--itemstack.count == 0) {
                        entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
                    }
                    this.fuel += 3600;
                }
                this.b = this.locX - entityhuman.locX;
                this.c = this.locZ - entityhuman.locZ;    
                BlockFace dir = FaceUtil.getDirection(this.b, this.c, false);
                if (dir == this.member().getDirection().getOppositeFace()) {
                    this.group().reverse();
                }
    If it has fuel, it subtracts one from the fuel every tick, and once it reaches 0, it does some 'onCoalEmpty' routines.
     
  29. Offline

    Noahsark


    Finally I found where you are wrong.

    Look at this part:
    Code:
     
    if (this.fuel > 0 && this.type == 2) {
                  if (--this.fuel == 0) {
                  //TrainCarts - Actions to be done when empty
                              if (this.onCoalUsed()) {
                                      this.fuel += 3600; //Refill
                              } else {
                                      this.b = this.c = 0.0D;
                              }
                  }
    }
     
     
    
    What if fuel = 0 ?
    You only define b = c = 0 when fuel > 0.

    I changed it like this way:
    Code:
     
    if (this.fuel > 0 && this.type == 2) {
                  if (--this.fuel == 0) {
                  //TrainCarts - Actions to be done when empty
                                if (this.onCoalUsed()) {
                                              this.fuel += 3600; //Refill
                                } else {
                                              this.b = this.c = 0.0D;
                                }
                    }
    }else{
                  this.b = this.c = 0.0D;
    }
     
    
    Then I recompiled this plugin and it's OK in my server now.

    It seems you are too confident with your code to find any bug.
     
  30. Offline

    bergerkiller

    Noahsark Mhh got to admit, this time you are right :)

    Not the fact that that had to be done, the issue was elsewhere. I thought that, if the cart had no fuel, it wouldn't perform any of the powered cart power, but this wasn't the case. It was checking if the b/c was set...sigh. Changed it at both locations nevertheless.

    Code:
    from:
    if (fuelPower > 0) {
    to:
    if (this.hasFuel() && (fuelPower = MathUtil.length(this.b, this.c)) > 0) {
     
  31. How do you get it to toggle rails?

    Edit:

    How do you name stations?
     

Share This Page