3

I'm trying to setup something similar to the MindCrack team's current server set up for my single player world so that the world border expands slowly as I play the game. I already know how to work the worldborder command, I just want it to happen at the exact same time every game day.

I know that you can query for the time with time query daytime which gives you the time of the day in ticks. I would set up a comparator to test the output. I just can't seem to get the testfor command to work with this. I figure I'm doing something wrong. I would guess the code would be something like this testfor [time query daytime = 1000] but of course that was wrong.

Anyone know if what I want to do is even possible?

  • If you want to have an expanding border, then why don't you just ask how to get it? I can't answer this question, but I can tell you how to get an expanding border. Please change your question if possible. – BlaXpirit Aug 23 '14 at 17:14
  • Welp, had to make another question to make my answer appropriate. – BlaXpirit Aug 23 '14 at 17:49
4

You're along the right path with /time query daytime.

First of all, create an objective. In these examples I'll use "TimeObjective" although you can call it whatever you want:

/scoreboard objectives add TimeObjective dummy

Next, put /time query daytime into a command block. Then stand ontop of the command block and type this. Again, "TimePlayer" is just a fake player name, it can be anything so long as it's consistent:

/stats block ~ ~-1 ~ set QueryResult TimePlayer TimeObjective

Now, whenever the command block is activated, the current time will be stored in TimePlayer's TimeObjective score. Set that block on a clock. To test the score of a player that doesn't actually exist, you need to use this command rather than /testfor:

/scoreboard players test <PLAYER> <OBJECTIVE> <MIN> <MAX>

So for this case:

/scoreboard players test TimePlayer TimeObjective 0 1000
  • 1
    Awesome works except you forgot one command, that I had to look up. /scoreboard players add TimePlayer TimeObjective 0 then the command block produced the right output. Thanks for your help works exactly like I wanted. – JRSofty Aug 23 '14 at 18:37
  • Well it would work perfectly if the time query returned correctly. It seems as of now using MC 1.8-pre1 is that unless you issue a command /time set day or such then the time continues the count and doesn't start over from 0 as it is shown in the wiki. I think I'm probably going to check with Mojang's bug tracker and see if this is an open issue. – JRSofty Aug 23 '14 at 18:53
  • Mojang confirmed it is a bug. A modolo 24000 is missing. – JRSofty Aug 24 '14 at 6:13
  • 1
    Just to inform everyone who reads this. The bug I've mentioned in the comment above has been corrected and everything is working correctly as of Minecraft 1.9 – JRSofty Apr 22 '16 at 7:01
1

The following steps apply to the 1.13.1 version of Minecraft:

  1. Create a dummy scoreboard. Type the following command into chat;

    /scoreboard objectives add timeOfDay dummy "Time of Day (in ticks)"

  2. Show the scoreboard for testing. Use the command below;

    /scoreboard objectives setdisplay sidebar timeOfDay

  3. Summon an Armor Stand and name it "timeOfDay". You could use this command;

    /summon armor_stand ~ ~1 ~ {NoGravity:1,CustomName:"{\"text\":\"timeOfDayArmorStand\"}",CustomNameVisible:1b}

  4. Set the value of the time of day (in ticks) as the timeOfDay scoreboard value for the timeOfDayArmorStand. Paste the command in an active repeating command block;

    /execute store result score @e[type=armor_stand,name=timeOfDayArmorStand] timeOfDay run time query daytime

    To remove the timeOfDay scoreboard in the right side of the screen, type this;

    /scoreboard objectives setdisplay sidebar

  • You can also store the value under a "fake name" instead of using an armor stand: /execute store result score FakePlayer timeOfDay run time query daytime (and skip the summon step) – Florrie Sep 3 '18 at 16:31
0

Ok I figured it out for what I was doing it was easy I just put a comparator up next to a command block with this command in it:

/time query daytime

Then I had two pieces of redstone going from that comparator to a block with a torch on it going to a command block.

  • This doesnt actually answer the question. And it doesn't even look like an answer. – ydobonebi Aug 12 '15 at 21:31
0

If you are still interested in this, a way you can get around the bug where the time doesn't reset to zero, is test for if the time query is 24000, like with:

/scoreboard players test timeFakePlayer time 23990 24000

Then have the comparator set the time to 0 with /time set 0 since that time of day is equal to zero

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.