Java Code Examples for cpw.mods.fml.common.gameevent.TickEvent.Phase#START

The following examples show how to use cpw.mods.fml.common.gameevent.TickEvent.Phase#START . 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: WorldEventHandler.java    From TickDynamic with MIT License 5 votes vote down vote up
@SubscribeEvent
  public void worldTickEvent(WorldTickEvent event) {
Profiler profiler = event.world.theProfiler;
if(!(profiler instanceof CustomProfiler))
	return;
CustomProfiler customProfiler = (CustomProfiler)profiler;
  	
  	if(event.phase == Phase.START) {
  		customProfiler.setStage(CustomProfiler.Stage.BeforeLoop);
  	}
  	else {
  		customProfiler.setStage(CustomProfiler.Stage.None);
  	}
  }
 
Example 2
Source File: ClientTickHandler.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onClientTick(ClientTickEvent evt) {
    if (evt.phase == Phase.START) {
        tickStart();
    } else {
        tickEnd();
    }
}
 
Example 3
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 4
Source File: WRAddonEventHandler.java    From WirelessRedstone with MIT License 5 votes vote down vote up
@SubscribeEvent
public void clientTick(ClientTickEvent event) {
    if(ClientUtils.inWorld()) {
        if (event.phase == Phase.START)
            TriangTexManager.processAllTextures();
        else
            RedstoneEtherAddons.client().tick();
    }
}
 
Example 5
Source File: TerminalManagerServer.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent evt) {
	if (evt.phase == Phase.START && evt.player instanceof EntityPlayerMP) {
		final Optional<Long> guid = TerminalIdAccess.instance.getIdFrom(evt.player);
		if (guid.isPresent()) {
			TileEntityGlassesBridge listener = listeners.get(guid.get());
			if (listener != null) listener.registerTerminal((EntityPlayerMP)evt.player);
		}
	}
}
 
Example 6
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 7
Source File: KeyHandler.java    From SimplyJetpacks with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onClientTick(ClientTickEvent evt) {
    if (evt.phase == Phase.START) {
        tickStart();
    }
}
 
Example 8
Source File: WRAddonEventHandler.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
    if(event.phase == Phase.START)
        RedstoneEtherAddons.server().processSMPMaps(event.world);
}
 
Example 9
Source File: WRCoreEventHandler.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@SubscribeEvent
public void clientTick(ClientTickEvent event) {
    if(event.phase == Phase.START)
        WirelessBolt.update(WirelessBolt.clientboltlist);
}
 
Example 10
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);
}