I'm making a data pack where the darkness kills you and iv'e figured everything out except how to detect if its night, I thought it would be an easy thing to do but i'm at a loss.
The game lets you use /time query daytime to see the daytime tick but you cant use it for command blocks, someone in a video used it with the /stat command to make a scoreboard but stat doesn't exist anymore. Is there anything i'm missing besides having to use a day/night detector which wont be very feasible for what i'm doing.
After a good nights sleep and watching a lot of videos i have found the solution you want to set up 4 command blocks
Scoreboard objectives add clock dummy "clock"
scoreboard players set Timeofday clock 0
scoreboard players set Night clock 13000
/execute store result score Timeofday clock run time query daytime
You will then have a fake player that always keeps track of the time and if you compare Timeofdays clock to Nights clock you can issue a command during the night.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm making a data pack where the darkness kills you and iv'e figured everything out except how to detect if its night, I thought it would be an easy thing to do but i'm at a loss.
The game lets you use /time query daytime to see the daytime tick but you cant use it for command blocks, someone in a video used it with the /stat command to make a scoreboard but stat doesn't exist anymore. Is there anything i'm missing besides having to use a day/night detector which wont be very feasible for what i'm doing.
Thanks for the help!
After a good nights sleep and watching a lot of videos i have found the solution you want to set up 4 command blocks
Scoreboard objectives add clock dummy "clock"
scoreboard players set Timeofday clock 0
scoreboard players set Night clock 13000
/execute store result score Timeofday clock run time query daytime
You will then have a fake player that always keeps track of the time and if you compare Timeofdays clock to Nights clock you can issue a command during the night.