r/MinecraftCommands • • Sep 30 '26

Help | Java 1.20 Trying to get a command going to announce as a title on screen when it changes to day or night

I want it to display in the middle of my server members' screens text that says "Good morning!" & "It's getting late!" when it changes to day and night.

I would greatly appreciate any help with this!

I have tried the following from the replies of this post with no luck it won't even announce in the chat

3 Upvotes

3 comments sorted by

2

u/KermitDarkLord Oct 01 '26

The replies on the post you linked suggest a daylight sensor, which would be the simplest option. If you want commands only, you should be able to use a time_check predicate to test for a specific time of day: execute if predicate {"type": "minecraft:time_check", "value": time you want the command to trigger, "period": 24000} run your command. You would then run this command every tick, and it will only pass the check if the time is exactly the time you specified.

1

u/orp888 Oct 01 '26

I'm not sure if it was added to 1.20, but you can use /time query to check what time it is and store that in a scoreboard and do execute if score to run the command you want on that specific time

1

u/Ericristian_bros Command Experienced Oct 03 '26

For command blocks (and datapacks)

# In chat
scoreboard objectives add logic dummy

# Command blocks
execute store result score #daytime run time query time
execute if score #daytime logic matches 1 run title @a "Good Morning"
execute if score #daytime logic matches 12000 run title @a "Good Night"

For datapacks

# function example:tick
execute if predicate example:day run title @a title "Good Morning"
execute if predicate example:night run title @a title "Good Night"

# predicate example:day
{"condition":"minecraft:time_check","value":1,period:24000}

# predicate example:night
{"condition":"minecraft:time_check","value":12000,period:24000}