Minecraft Wiki
Advertisement

Are you sure?[]

Regarding this edit, are you sure the order matters? It doesn't seem to matter for me, can you show a video with the command in various orders where some work and some give an error? What error would it even give? Or at least give me two commands to test where one works and the other doesn't? LB(T|C) 03:14, 5 December 2013 (UTC)

Yes, I'm very sure. Try this: Place a dropper facing upwards. Put a Stone block in the first slot of the dropper (upper left). Stand on top of the dropper. Run this command: /testforblock ~ ~-1 ~ dropper 1 {Items:[Slot:0,id:1,Damage:0,Count:1]} An error message should come up saying something like "The block at [coordinates] did not have the required NBT keys" Then run this command: /testforblock ~ ~-1 ~ dropper 1 {Items:[Count:1,Slot:0,Damage:0,id:1]} This time, the command should succeed.
I haven't tried the correct order yet, but I tried the incorrect order and the command failed. BoxFigs (talk) 21:08, 5 December 2013 (UTC)
Both commands fail for me, even when I fix the syntax errors. LB(T|C) 22:21, 5 December 2013 (UTC)
Hmm. It could be a bug, then. Syntax errors? What is the correct syntax for those commands? As for the edit, just leave it as it is right now so the order of the tags would match the game's data files. BoxFigs (talk) 22:41, 5 December 2013 (UTC)
The syntax error is, unless I am misaken, that you are putting object entries in an array instead of an object.
As for "the order [in] the game's data files", you do realize that the game doesn't intentionally choose this order for any specific reason? It just happens that the data structures sort the keys that way because it's efficient for searching - the particular data structure in question is a Map, which uses a binary search tree. The order you see is just a binary search tree, the game honestly could care less about the order, and in fact doesn't care when loading the files back.
However, I am still curious if it actually matters for the command syntax - I still doubt it, since it's easier to compare keys than indicies with a map, but I wouldn't put it past them. LB(T|C) 00:26, 6 December 2013 (UTC)
Array instead of object? You mean the straight brackets in the Items tag (Items:[])? Straight brackets are not only used for arrays, but also for list tags (to distinguish between a list tag and a compound tag). I know for sure this is true because putting {Items:[]} as the dataTag in a /testforblock command succeeds when the container in empty. Same with the Lore tag (which is also a list tag) in /give; I tried using curly brackets in a command with that tag (Lore:{}) and the command failed. It worked when I put the straight brackets back in (Lore:[]) BoxFigs (talk) 21:25, 6 December 2013 (UTC)
No, I mean you had {Blah:[Meh:val,Meh:val]} instead of {Blah:[{Meh:val,Meh:val}]} - notice the extra set of curly braces between the square brackets. The arrays/lists contain objects, not key-value pairs. This allows you to do this: {Blah:[{Meh:val,Meh:val},{Meh:val,Meh:val},{Meh:val,Meh:val}]} LB(T|C) 18:07, 7 December 2013 (UTC)
OHHHHH, I see. But it still doesn't work the correct way ({Items:[{Count:1,Slot:0,Damage:0,id:1}]})? BoxFigs (talk) 21:49, 7 December 2013 (UTC)
Yeah, it doesn't work the correct way. I even tried with quotes just in case but Minecraft's modified JSON format count quotes as part of the names and not as identification for the start and end of strings like in the actual JSON format. LB(T|C) 18:09, 8 December 2013 (UTC)

Concerning Player.dat Format Edit[]

Refer to: http://minecraft.gamepedia.com/index.php?title=Player.dat_format&oldid=598286

The order of the individual tags does not matter in /testfor commands, but you must ensure that each element (item) within the Inventory/Items tag is in order by their Slot numbers. The change you made to the page itself is fine though, as that's the order items appear to be saved anyway (good for precision). Just wanted to clear up the /testfor(block) use:

For example, the /setblock command to be used:

/setblock ~ ~1 ~ chest 3 replace {Items:[{id:stone,Count:1}]}

To detect this, you need all four base commands in any order, while labeling their tag-types (and the "minecraft:" is required):

/testforblock ~ ~1 ~ chest 3 {Items:[{id:minecraft:stone,Damage:0s,Count:1b,Slot:0b}]}

Keep in mind that if there are any extra tags within the "tag" tag, they will have to be included in the test (along with every single item in the chest). The edit is fine though! –Preceding unsigned comment was added by Skylinerw (talkcontribs) at 20:55, 24 January 2014 (UTC). Please sign your posts with ~~~~

@BoxFigs: Please stop making changes only for the sake of order - order does not matter, we've been through this before. I even tested just now in 1.7.4 and 14w04b and confirmed that the order does not matter. The order the game saves them in is also not intentional by any means (as mentioned before) and the game does not care what order they are in when it loads them. Is it too much to ask to discuss it on the talk page first? LB(T|C) 05:35, 25 January 2014 (UTC)
It didn't occur to me to discuss it on the talk page. BoxFigs (talk) 23:48, 25 January 2014 (UTC)
Sorry if I sounded angry, I had a headache when I wrote that. I just don't want you to feel like we don't want you or something crazy. LB(T|C) 04:03, 26 January 2014 (UTC)
I tested it again just now, and the commands I did succeed no matter what the tag order is. Hm. I guess when I tested it before, I goofed something up in the out-of-order command. BoxFigs (talk) 23:48, 25 January 2014 (UTC)

Whay did you change the order here? LB(T|C) 16:44, 3 February 2014 (UTC)

That's the order of the tags in the game files. I know it doesn't matter, but I just did it anyway while I was adding some stuff about the generation tag. I guess I am being a little OCD about the order, though (I'm not sure if I actually have OCD or not). BoxFigs (talk) 01:11, 4 February 2014 (UTC)
It matters so little that even changing your version or implementation of Java could change the order ;) (though I don't know of any actual such cases, it is entirely possible). Just don't make a habit of it and I'll stop complaining - the order of the tags in the article is the order we as a community thought made logical sense to humans - we don't need to know the order that makes logical sense to computers. LB(T|C) 04:48, 4 February 2014 (UTC)
Advertisement