cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent Java Examples

The following examples show how to use cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TickDynamicMod.java    From TickDynamic with MIT License 6 votes vote down vote up
@SubscribeEvent(priority=EventPriority.LOWEST)
public void tickEventEnd(ServerTickEvent event) {	
	if(event.phase == Phase.END)
	{
  	getTimedGroup("other").endTimer();
  	root.endTick(true);
  	
  	if(debugTimer)
  		System.out.println("Tick time used: " + (root.getTimeUsed()/root.timeMilisecond) + "ms");
  	
  	//After every world is done ticking, re-balance the time slices according
  	//to the data gathered during the tick.
  	root.balanceTime();
  	
  	//Calculate TPS
  	updateTPS();
  	
  	if(saveConfig)
  	{
  		saveConfig = false;
  		config.save();
  	}
	}
}
 
Example #2
Source File: TankSynchroniser.java    From EnderStorage with MIT License 5 votes vote down vote up
@SubscribeEvent
public void tickEnd(ServerTickEvent event)
{
    if(event.phase == Phase.END && playerItemTankStates != null)
        for(Entry<String, PlayerItemTankCache> entry : playerItemTankStates.entrySet())
            entry.getValue().update();
}
 
Example #3
Source File: MovementScheduler.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {

    if (Framez.proxy.isGamePaused())
        return;

    for (World w : MinecraftServer.getServer().worldServers)
        tick(w, event.phase);
}
 
Example #4
Source File: WRAddonEventHandler.java    From WirelessRedstone with MIT License 5 votes vote down vote up
@SubscribeEvent
public void serverTick(ServerTickEvent event) {
    if(event.phase == Phase.START)
        RedstoneEtherAddons.server().processTrackers();
    else {
        RedstoneEtherAddons.server().tickTriangs();
        RedstoneEtherAddons.server().updateREPTimeouts();
    }
}
 
Example #5
Source File: TickDynamicMod.java    From TickDynamic with MIT License 4 votes vote down vote up
@SubscribeEvent(priority=EventPriority.HIGHEST)
public void tickEventStart(ServerTickEvent event) {
	if(event.phase == Phase.START)
	{
		if(!versionCheckDone)
		{
			VersionChecker.VersionData versionData = versionChecker.getVersionData();
			if(versionData != null)
			{
				versionCheckDone = true;
				if(versionData.checkOk)
				{
 				//TODO: Parse versions, split at ',', then split version numbers at '.'
 				System.out.println("TickDynamic version check: Latest version = " + versionData.modVersion + ". Download URL: http://" + versionData.updateUrl);
				}
				else
					System.out.println("TickDynamic version check: Error while checking latest version!");
			}
		}
		
		TimedGroup externalGroup = getTimedGroup("external");
		externalGroup.endTimer();
		
		//Set the correct externalGroup time
		long msPerTick = 50;
		long overTime = externalGroup.getTimeUsed() - (msPerTick*externalGroup.timeMilisecond); //overTime = time used above given tick time
		long overTimeTick = (msPerTick*externalGroup.timeMilisecond) - (root.getTimeUsed() - externalGroup.getTimeUsed());
		if(overTimeTick < 0)
			overTime += overTimeTick;
		/*System.out.println("TickTime: " + ((root.getTimeUsed()-externalGroup.getTimeUsed())/(double)externalGroup.timeMilisecond) + 
				" Full Tick time: " + (externalGroup.getTimeUsed()/(double)externalGroup.timeMilisecond) +
				" External time used: " + (overTime/(double)externalGroup.timeMilisecond)+"ms");*/
		if(overTime < 0)
			externalGroup.setTimeUsed(0);
		else
			externalGroup.setTimeUsed(overTime);
		
		externalGroup.startTimer();
		
		
     //Clear any values from the previous tick for all worlds.
		root.newTick(true);
		
		getTimedGroup("other").startTimer();
	}
}
 
Example #6
Source File: ChunkLoaderEventHandler.java    From ChickenChunks with MIT License 4 votes vote down vote up
@SubscribeEvent
public void serverTick(ServerTickEvent event) {
    if (event.phase == Phase.END)
        PlayerChunkViewerManager.instance().update();
}
 
Example #7
Source File: WRCoreEventHandler.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@SubscribeEvent
public void serverTick(ServerTickEvent event) {
    if(event.phase == Phase.START)
        WirelessBolt.update(WirelessBolt.serverboltlist);
}