9

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?

1
  • 1
    It might be easier to clone a bed instead. I'm sure it's possible to setblock a bed, but it will take at least two commands, and I don't know how to do it offhand.
    – MBraedley
    Commented Aug 8, 2015 at 16:06

2 Answers 2

9

You'll need to use two commands; one to set the foot part, one to set the head part. To setblock the head part of the bed, add 8 to the dataValue you used for the foot part.

For example, these two commands will create a bed facing north:

/setblock 0 64 0 bed 0
/setblock 0 64 1 bed 8

Or these two for a bed facing east:

/setblock 0 64 0 bed 3
/setblock 1 64 0 bed 11
1

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/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.