Jump to content

Recommended Posts

Posted

I'm having trouble changing the time server side on server tick. I don't know where to access the server version of world, but I can access the client side so I know my time change code is working. Any help?

@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
	if(i == (20*60)){
		try{
			String time = sdf.format(cal.getTime());

			String[] Time = time.split(":");

			int hour = Integer.parseInt(Time[0]);	

			System.out.println("[" + Reference.modID + "] " + hour);	

			System.out.println(hour * 1000);

			long worldTime = hour * 1000;

			System.out.println("[" + Reference.modID + "] " + worldTime);

			if(!mc.theWorld.isRemote){
				System.out.println("[" + Reference.modID + "] Changing world time...");
				mc.theWorld.setWorldTime(worldTime);
				System.out.println("[" + Reference.modID + "] Time changed!");
			}
		}catch(NullPointerException exception){
			System.out.println("[" + Reference.modID + "] ERROR:" + exception);
		}
		i = 0;
	}
	System.out.println(i);
	i++;
}

Posted

And your goal here is to...?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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