Add power net to profiling data.
This commit is contained in:
parent
2ec7340383
commit
b8949ee8fa
3 changed files with 11 additions and 2 deletions
|
@ -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++;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue