4

Ok, basically, I can't run mods too well on my computer and would prefer using command blocks. There is a mod I want to semi replicate where on a random night, it will tell the player "This is not a normal Night...", and if the player tries to sleep, they will sleep for a second then be forced out of their bed, where some over powered zombies will spawn. I know how to spawn the zombies and how to test if the player is sleeping, but apart from killing them I don't know how to remove them from their bed.

2
  • You could try breaking and replacing (cloning back) the bed. (But that only works if the beds are in predefined locations)
    – aytimothy
    Commented Oct 24, 2015 at 10:14
  • I guess I could, and it is only for me when im online, so it wouldnt be too hard. How would I do that though? I dont have an extensive knowledge of command blocks. Also, how would I get the rotation correct? Commented Oct 24, 2015 at 10:16

3 Answers 3

4

You don't actually have to kill the player to push him out of his bed. All you need to do is damage him.

/effect @p 19 2

That will deal half a heart of damage to the player, by poisoning him briefly, in order to wake him up.

3
  • Thanks! Going to try it now, this seems like the best idea for what I want :) Commented Oct 25, 2015 at 10:52
  • Ok. Just tested it. That was simple and easy. Thank you, this had me stumped xD Commented Oct 25, 2015 at 10:54
  • Only just realised how to. Done it now though :) is there a way to mark the whole question as answered? Commented Oct 25, 2015 at 13:09
1

As of Minecraft 1.13.1, it is now possible to simply /tp the player to be not touching the bed, whereupon they will stop sleeping.

-2

Ok maybe this will work do /testfor (Name) at the x y z of the bed and use a comparator and connect one to an another commandblock and do /say this is not (Name) and the bed will disappear you can make it disappear by adding another command block and use /setblock x y z air then add two repeaters and delay it to its maximum and add another command block and use /setblock x y z bed and your done hope this worked

5
  • You might want to improve your answer a bit, for example by using punctuation, or less intimidating grammar.
    – Lars
    Commented Oct 24, 2015 at 14:11
  • what do you mean? Commented Oct 24, 2015 at 14:13
  • @The_Dark_One They mean that your answer is very hard to read; it's all one sentence without any kind of punctuation.
    – SirBenet
    Commented Oct 24, 2015 at 15:39
  • i already knew he told me that earlier Commented Oct 25, 2015 at 4:31
  • Punctuation is not optional. It is a requirement.
    – Frank
    Commented Oct 25, 2015 at 13:54

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.