How to automatically set time to day with command blocks
Emily Wong
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 3 Answers
Ingredients:
- A dummy scoreboard objective called
clock - 2 command blocks
- OP permissions
Procedure:
- 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- 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 12455This 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!
4Use an day light sensor and then have an redstone line from it to and command block that does /time set day
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