Add power net to profiling data.

This commit is contained in:
modmuss50 2017-01-09 12:55:08 +00:00
parent 2ec7340383
commit b8949ee8fa
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
3 changed files with 11 additions and 2 deletions

View file

@ -40,7 +40,7 @@ public class TRTickHandler {
} }
long start = System.nanoTime(); long start = System.nanoTime();
MinecraftForge.EVENT_BUS.post(new PowerTickEvent()); MinecraftForge.EVENT_BUS.post(new PowerTickEvent(e.world));
long elapsed = System.nanoTime() - start; long elapsed = System.nanoTime() - start;
tickTime += elapsed; tickTime += elapsed;
ticksCounted++; ticksCounted++;

View file

@ -1,8 +1,15 @@
package techreborn.power; package techreborn.power;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event;
public class PowerTickEvent extends Event { public class PowerTickEvent extends Event {
public PowerTickEvent() { World world;
public PowerTickEvent(World world) {
this.world = world;
}
public World getWorld() {
return world;
} }
} }

View file

@ -58,6 +58,7 @@ public class TRPowerNet {
@SubscribeEvent @SubscribeEvent
public void tick(PowerTickEvent evt) { public void tick(PowerTickEvent evt) {
evt.getWorld().theProfiler.startSection("TechRebornPowerNet");
if (tick < 20) { if (tick < 20) {
tick++; tick++;
return; return;
@ -101,6 +102,7 @@ public class TRPowerNet {
MinecraftForge.EVENT_BUS.unregister(this); MinecraftForge.EVENT_BUS.unregister(this);
} }
tick++; tick++;
evt.getWorld().theProfiler.endSection();
} }
public void addElement(CableMultipart te) { public void addElement(CableMultipart te) {