Is there a way to change the way chests are facing in /summon?

I am creating an adventure map and players will need items every so often so I am using
/summon FallingSand 2140.5 9 -423.5 {TileID:54,Time:1,TileEntityData:{Items:[{id:diamond_helmet,Slot:0,Count:1},{id:diamond_chestplate,Slot:1,Count:1},{id:diamond_leggings,Slot:2,Count:1},{id:diamond_boots,Slot:3,Count:1},{id:diamond_sword,Slot:4,Count:1}]}}
To summon a chest with the items in it. When the chest spawns it auto-faces South, is there a way using datatags to make it face North?
Best Answer
The facing of a chest is determined by it's block data value, ranging from 2 to 5 (North, South, West, East). For Falling Sand Entities the data value of the block can be set by adding a Data
tag to the entity:
/summon FallingSand 2140.5 9 -423.5 {Block:minecraft:chest,Data:2,Time:1,TileEntityData:{Items:[{id:diamond_helmet,Slot:0,Count:1},{id:diamond_chestplate,Slot:1,Count:1},{id:diamond_leggings,Slot:2,Count:1},{id:diamond_boots,Slot:3,Count:1},{id:diamond_sword,Slot:4,Count:1}]}}
(I also replaced TileID
with the newer Block
. This doesn't exactly matter, but numerical IDs are being phased out gradually, and I expect TileID
to break in the future.)
However, as pointed out by MBraedley in the comments, summoning a chest with items can be done directly via setblock
, rather than using the old roundabout way of summoning falling sand.
The syntax is
/setblock <x> <y> <z> <TileName> [dataValue] [oldBlockHandling] [dataTag]
Here, the data value can be set directly. To set the data tag, you'll need to specify oldBlockHandling
, I suggest using the default value of replace
:
/setblock 2140 9 -423 minecraft:chest 2 replace {Items:[{id:diamond_helmet,Slot:0,Count:1},{id:diamond_chestplate,Slot:1,Count:1},{id:diamond_leggings,Slot:2,Count:1},{id:diamond_boots,Slot:3,Count:1},{id:diamond_sword,Slot:4,Count:1}]}
This command is not only shorter and easier to read, it also executes much faster than the summon version. That is because it doesn't need to create an entity, have it drop to the floor, determine collision, and then turn it into a block and remove the entity.
Pictures about "Is there a way to change the way chests are facing in /summon?"



How do you summon a chest with an item?
Minecarts with chests can be placed by using its item on any type of rail. Chest minecarts' contents can be accessed by pressing use item button on them.How do you summon a Minecart with chest in it?
Choose from either the /give or /setblock command. When you have finished adding items to your chest, click on the Generate Command button and then copy/paste the command into Minecraft. If the command is longer than 256 characters, you will need to paste the command into a command block.RIGHT TIME TO SUMMON? ALL SUMMONING EVENTS EXPLAINED | RAID SHADOW LEGENDS
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Andrea Piacquadio, Andrea Piacquadio, Andrea Piacquadio, Hadi Slash