Fix some CME's in the powernet, and add a basic profiler to it, might add a command or someway to use this without enabling it in the code

This commit is contained in:
modmuss50 2016-10-03 20:54:05 +01:00
parent 796df6c055
commit 871edce960
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
3 changed files with 30 additions and 4 deletions

View file

@ -29,12 +29,26 @@ public class TRTickHandler {
previouslyWearing = chestslot;
}
int ticksCounted = 0;
long tickTime = 0;
@SubscribeEvent
public void worldTick(TickEvent.WorldTickEvent e) {
if (e.world.isRemote) {
return;
}
long start = System.nanoTime();
MinecraftForge.EVENT_BUS.post(new PowerTickEvent());
long elapsed = System.nanoTime() - start;
tickTime += elapsed;
ticksCounted ++;
if(ticksCounted == 20 * 5){
//Enable this this line to get some infomation when debuging.
//System.out.println("Average powernet tick time over last 5 seconds: " + (tickTime / ticksCounted) + "ns");
ticksCounted = 0;
tickTime = 0;
}
}
}