@Override public IChatComponent func_151519_b(EntityLivingBase entity) { String locTag = "death.railcraft." + damageType + "." + (MiscTools.getRand().nextInt(numMessages) + 1); return ChatPlugin.chatComp(locTag, entity.getCommandSenderName()); }
@Override public void run() { long p, sp; int no_data_count; MiscTools.swingSetText(this.down.getPanel().speed, "------ KB/s", false); MiscTools.swingSetText(this.down.getPanel().rem_time, "--d --:--:--", false); MiscTools.swingSetVisible(this.down.getPanel().speed, true, false); MiscTools.swingSetVisible(this.down.getPanel().rem_time, true, false); while (!this.exit) { try { Thread.sleep(SpeedMeter.SLEEP); if (!this.exit) { no_data_count = 0; do { p = this.down.getProg(); sp = (p - this.progress) / (1024 * ((SpeedMeter.SLEEP / 1000) + no_data_count * (SpeedMeter.NO_DATA_SLEEP / 1000))); if (sp > 0) { this.progress = p; MiscTools.swingSetText( this.down.getPanel().speed, String.valueOf(sp) + " KB/s", false); MiscTools.swingSetText( this.down.getPanel().rem_time, this.calculateRemTime( (long) Math.floor(this.down.getFile_Size() - p) / (sp * 1024)), false); } else if (!this.down.isPause()) { no_data_count++; MiscTools.swingSetText(this.down.getPanel().speed, "------ KB/s", false); MiscTools.swingSetText(this.down.getPanel().rem_time, "--d --:--:--", false); Thread.sleep(SpeedMeter.NO_DATA_SLEEP); } } while (sp == 0 && !this.down.isPause()); if (this.down.isPause()) { MiscTools.swingSetText(this.down.getPanel().speed, "------ KB/s", false); MiscTools.swingSetText(this.down.getPanel().rem_time, "--d --:--:--", false); synchronized (this.down.getPauseLock()) { this.down.getPauseLock().wait(); } } } } catch (InterruptedException ex) { this.exit = true; } } MiscTools.swingSetVisible(this.down.getPanel().speed, false, false); MiscTools.swingSetVisible(this.down.getPanel().rem_time, false, false); this.down.printDebug("Speedmeter: bye bye"); }