How do I testfor/scoreboard a Player in a MinecartRideable (1.9)?

I am attempting to create a Minecart mechanic where once the player is in the Minecart it starts moving in a certain direction. I am not a beginner with command blocks, so in your answer you can talk technical with me. I am just not familiar with the new 1.9 tags.

I have attempted (on an active 20hz or repeating clock)

  • Minecraft Failed To Bind Port
  • How do I quickly create a safe shelter?
  • What is the difference between Technic and Tekkit?
  • Minecraft 1.10 Custom GameRules?
  • How to start a cart from inside it?
  • Are minecraft mobs … supposed to do this?
  • I.

    1. /scoreboard players set @a ridingCart 0
    2. /scoreboard players set @a ridingCart 1 {Passengers:[{id:"MinecartRideable"}]}
    

    II.

    1. /scoreboard players set @e[type=MinecartRideable] ridingCart 0
    2. /scoreboard players set @e[type=MinecartRideable] ridingCart 1 {Passengers:[{id:"Player"}]}
    

    Neither of these two separate attempts have worked. I am unsure if this is a bug with the game to where you cannot /testfor with the Passengers tag or if it is a mistake on my end. Thanks!

  • A more efficient mob pushing redstone circuit?
  • How to lightning-proof a structure?
  • Can I copy part of a Minecraft multi-player (SMP) map to a single-player map?
  • How do I change my Minecraft username during the 30-day restriction?
  • Setblock clock with scoreboard doesn't work in Minecraft
  • How can I apply an effect when a player left-clicks/right-clicks with an item in hand?
  • One Solution collect form web for “How do I testfor/scoreboard a Player in a MinecartRideable (1.9)?”

    When a player is a passenger to an entity, that player is not saved with the entity in the region files (side-note that Player is not a valid entity ID and is simply a feature of selector syntax).

    The entity is instead saved with the player via the RootVehicle compound in player files and is no longer saved within the chunk region files. Example structure within player.dat:

    {
        Sleeping:0b,
        Inventory:[],
        RootVehicle:{
            AttachLeast:1l,
            AttachMost:1l,
            Entity:{
                id:"MinecartRideable"
            }
        }
    }
    

    To detect when a player is riding anything, you’ll check the RootVehicle tag:

    /scoreboard players set @a ridingCart 1 {RootVehicle:{Entity:{id:"MinecartRideable"}}}
    

    The entity, when ridden by a player, will not have the Passengers tag containing the player and will not exist if only the player is riding it. If there are non-player entities riding the same vehicle as the player (such as a pig and player inside a boat), the Passengers tag will exist on the boat within RootVehicle but will only contain the pig.

    If the vehicle has non-player passengers but no player passenger, Passengers will exist like normal and the vehicle is stored within region files.

    If the vehicle itself is riding another entity (such as a boat riding an armor stand), and the player rides the vehicle, the AttachLeast and AttachMost will be the UUID of the vehicle the player is riding (the boat) while Entity starts with the bottom-most entity (the armor stand), complete with Passengers containing the boat.

    Note that thus far into 1.9 (15w47c), RootVehicle is only available on players, meaning you cannot detect what a non-player entity is a passenger of.

    We love Playing Games, especially Video Games.