minecraft_25w45a_unobfuscated/net/minecraft/network/BandwidthDebugMonitor.java
2025-11-24 22:52:51 +03:00

26 lines
659 B
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.network;
import java.util.concurrent.atomic.AtomicInteger;
import net.minecraft.util.debugchart.LocalSampleLogger;
public class BandwidthDebugMonitor {
private final AtomicInteger bytesReceived = new AtomicInteger();
private final LocalSampleLogger bandwidthLogger;
public BandwidthDebugMonitor(LocalSampleLogger bandwidthLogger) {
this.bandwidthLogger = bandwidthLogger;
}
public void onReceive(int bytes) {
this.bytesReceived.getAndAdd(bytes);
}
public void tick() {
this.bandwidthLogger.logSample(this.bytesReceived.getAndSet(0));
}
}