Jump to content

Counting the days passing by :P


daafganggdg

Recommended Posts

Why....

You can just calculate it by using the world time.

IIRC 24000 ticks is a minecraft day, so just get the world time, do a little math and you have the day count.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

It continues on.

As for time being changed by /time set, you have to allocate for that in your time comparison.

When it changes, you're pretty much screwed anyway for getting real numbers, so you just have to deal.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

How about?

 

@SubscribeEvent
public void onTickEvent(WorldTickEvent event)
{
	// Overworld only
	if(event.world.provider.dimensionId != 0)
	{
		return;
	}

	// What time is it?
	long worldTime = event.world.getWorldTime();

	// 24000 ticks is one minecraft day
	if(worldTime%24000 != 0)
	{
		return;
	}

	// Do something
}

 

The event is https://docs.larry1123.net/forge/1060/cpw/mods/fml/common/gameevent/TickEvent.WorldTickEvent.html

 

You need to register FMLCommonHandler.instance().bus().register(new yourClass());

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.