Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //QC - fancy TPS display
- if(this.tickCounter % 20 == 0)
- {
- this.profiler.startSection("qc_tps_display");
- double MSPT = MathHelper.average(this.tickTimeArray) * 1.0E-6D;
- double TPS = 1000.0D / Math.max(50.0D, MSPT);
- String tps_display = TextFormatting.GRAY + "TPS: " +
- (TPS > 16.0D ? TextFormatting.YELLOW : TextFormatting.RED) +
- String.format("%.1f", TPS) +
- TextFormatting.GRAY + " MSPT: " +
- (TPS > 16.0D ? TextFormatting.YELLOW : TextFormatting.RED) +
- String.format("%.1f", MSPT);
- SPacketPlayerListHeaderFooter packet = new SPacketPlayerListHeaderFooter();
- Field header = packet.getClass().getDeclaredFields()[0];
- Field footer = packet.getClass().getDeclaredFields()[1];
- header.setAccessible(true);
- footer.setAccessible(true);
- try {
- header.set(packet, new TextComponentString(""));
- footer.set(packet, new TextComponentString(tps_display));
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- this.getPlayerList().sendPacketToAllPlayers(packet);
- this.profiler.endSection();
- }
- //QC end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement