How to test if time is 13000 [duplicate]
Solution 1:
An easier option might be to use a daylight sensor. Set it up with a string of Redstone and see how far the signal is when you set the time (/time set 18000
).
Then, you can do something tricky like this to invert the signal:
What this will do, is when the signal from the daylight sensor dies, the Redstone torch will be turned on, firing up the command block.
Solution 2:
So this method isn't by any means easy, but it's no worse than some of the other command block solutions I've come up with in the past.
First things first, you need a 20Hz fill clock. How to make one isn't exactly within the scope of this question.
Next, you'll need a scoreboard objective to hold the current day time:
/scoreboard objectives add DayTime dummy
You'll also need an empty player that will keep track of day time:
/scoreboard players set #TimePlayer DayTime 0
The first command block to be triggered by the fill clock should query the time of day from the game:
time query daytime
We need to redirect the result of command block to the scoreboard objective we set up earlier. Turn off the fill clock, stand directly on the command block, and enter this command:
/stats block ~ ~-1 ~ set QueryResult #TimePlayer DayTime
Now, you'll need a pair of command blocks for each time you want to test for. The first will do the actual test, and the range values on it should be one below and one above the time that you want to test for. For example, if you wanted to test if it's noon (6000), the command would be this:
scoreboard players test #TimePlayer DayTime 5999 6001
Use a comparator to output the result to the second command block, and get it to perform whatever action you want, for instance, telling everyone that it's noon:
say It's Noon!
Solution 3:
A command block with the command
/time query 18000
Would test for the time 18000 and be able to send a comparator output.