0

I have made an iron golem farm in 1.15.2 which only works if the villagers can sleep once in a while, but I have lit all of the caves in my area and I can't stand it being night. I am looking for a command block system that automatically sets the time to day when I would be able to sleep.

I found a solution, but it seems it was made before the 1.13 update.

To clarify, the sun must move during the day (so /gamerule doDaylightCycle false isn't a valid answer), or otherwise my iron golem farm will break. I would like a system that does this:

if time=x
set time 1000
0

Ingredients:

  • A dummy scoreboard objective called clock
  • 2 command blocks
  • OP permissions

Procedure:

  1. Query the time of day with a repeating, unconditional, always active command block:

Note that if you want to be able to turn this system off, make this one Needs Redstone and attach a lever to it.

/execute store result score time clock run time query daytime
  1. Make it morning just as night starts with a chain, unconditional, always active command block:
/execute if score time clock matches 12545 run time add 12455

This will advance the time to 1000 on the next day, effectively making the time 7AM when it reaches 6:32PM. A day is divided into 24000 ticks, starting at 6AM. This is why midday is 6000 and midnight is 18000. Tick 12545 (approximately 6:32PM) is the tick that the game defines as 'nighttime', meaning you can sleep in beds.

Hope this recipe helps!

4
  • yes, this workds perfectly, thank you, kind internet stranger! Apr 22 '20 at 19:12
  • Note that time set # resets the day counter, so if you wanted that then replace it with time add 12455
    – AMJ
    Apr 23 '20 at 0:03
  • @AMJ You should replace that in your answer directly, because not everybody understands the effects of resetting the day counter. Apr 23 '20 at 7:58
  • @FabianRöling Okay, edited :)
    – AMJ
    Apr 23 '20 at 22:26
0

Use an day light sensor and then have an redstone line from it to and command block that does /time set day

0
-1

i didnt quite understand what you want to do but if i understand you correctly this answer should work.

If you want it to always be day time you can just do /gamerule dodaylightcircle false and they do /time set day

1
  • no, i want a command block system that checks the time and if it is just before night, it should set it to day again, so my villagers can sleep but no monsters can spawn Apr 20 '20 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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