Advertisement
Nessiesson

Untitled

Dec 14th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. //QC - fancy TPS display
  2. if(this.tickCounter % 20 == 0)
  3. {
  4. this.profiler.startSection("qc_tps_display");
  5. double MSPT = MathHelper.average(this.tickTimeArray) * 1.0E-6D;
  6. double TPS = 1000.0D / Math.max(50.0D, MSPT);
  7.  
  8. String tps_display = TextFormatting.GRAY + "TPS: " +
  9. (TPS > 16.0D ? TextFormatting.YELLOW : TextFormatting.RED) +
  10. String.format("%.1f", TPS) +
  11. TextFormatting.GRAY + " MSPT: " +
  12. (TPS > 16.0D ? TextFormatting.YELLOW : TextFormatting.RED) +
  13. String.format("%.1f", MSPT);
  14.  
  15. SPacketPlayerListHeaderFooter packet = new SPacketPlayerListHeaderFooter();
  16. Field header = packet.getClass().getDeclaredFields()[0];
  17. Field footer = packet.getClass().getDeclaredFields()[1];
  18. header.setAccessible(true);
  19. footer.setAccessible(true);
  20. try {
  21. header.set(packet, new TextComponentString(""));
  22. footer.set(packet, new TextComponentString(tps_display));
  23. } catch (IllegalArgumentException e) {
  24. e.printStackTrace();
  25. } catch (IllegalAccessException e) {
  26. e.printStackTrace();
  27. }
  28. this.getPlayerList().sendPacketToAllPlayers(packet);
  29. this.profiler.endSection();
  30. }
  31. //QC end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement