Place a complete bed using /setblock

I am setting up different means of transportation on our server. Right now I'm building an airship with four cabins. In each cabin is a bed. The idea is that each room has a different destination and when you sleep in the bed it teleports you to the same room in a duplicate of that airship at the destination area (to make it like you're really travelling in the ship).
I tried teleporting a sleeping player (using {Sleeping:1b}
) but the sleeping animation continued and then moved the player back to the original bed. I corrected this by destroying the bed before teleporting and that fixed it however now I have another issue resulting from that. I replace the bed with /setblock
and it only places the foot of the bed.
How can I use a command block to replace the bed so that both the foot and head of the bed are present?
Best Answer
This works for me in Minecraft 1.16.1:
/setblock -50 62 18 minecraft:cyan_bed[part=foot,facing=south]
/setblock -50 62 19 minecraft:cyan_bed[part=head,facing=south]
(this based partly on https://www.reddit.com/r/MinecraftCommands/comments/du596f/how_do_i_place_a_full_bed_with_setblock/)
Pictures about "Place a complete bed using /setblock"



How do you place a bed in Minecraft with commands?
How to Enter the CommandHow do you use the Setblock command?
To fill multiple blocks there are a few choices. First if you have a rectangular shaped area, use the fill command: /fill <x1> <y1> <z1> <x2> <y2> <z2> block . Second choice is to use command block mine carts stacked in a single block space each with an individual /setblock command in it.Using Commands in Minecraft: How to Use /setblock \u0026 /fill to Alter Terrain! | 1.11.2
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Karolina Grabowska, Kampus Production, Ivan Samkov, Tatiana Syrikova