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:
parent
796df6c055
commit
871edce960
3 changed files with 30 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue