DebugEntrySoundCache.java

net.minecraft.client.gui.components.debug.DebugEntrySoundCache

信息

  • 全限定名:net.minecraft.client.gui.components.debug.DebugEntrySoundCache
  • 类型:public class
  • 包:net.minecraft.client.gui.components.debug
  • 源码路径:src/main/java/net/minecraft/client/gui/components/debug/DebugEntrySoundCache.java
  • 起始行号:L14
  • 实现:DebugScreenEntry
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public boolean isAllowed(boolean reducedDebugInfo) @ L15

  • 方法名:isAllowed
  • 源码定位:L15
  • 返回类型:boolean
  • 修饰符:public

参数:

  • reducedDebugInfo: boolean

说明:

TODO

public void display(DebugScreenDisplayer displayer, Level serverOrClientLevel, LevelChunk clientChunk, LevelChunk serverChunk) @ L20

  • 方法名:display
  • 源码定位:L20
  • 返回类型:void
  • 修饰符:public

参数:

  • displayer: DebugScreenDisplayer
  • serverOrClientLevel: Level
  • clientChunk: LevelChunk
  • serverChunk: LevelChunk

说明:

TODO

private static long bytesToMegabytes(long used) @ L27

  • 方法名:bytesToMegabytes
  • 源码定位:L27
  • 返回类型:long
  • 修饰符:private static

参数:

  • used: long

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class DebugEntrySoundCache implements DebugScreenEntry {
    @Override
    public boolean isAllowed(boolean reducedDebugInfo) {
        return true;
    }
 
    @Override
    public void display(DebugScreenDisplayer displayer, @Nullable Level serverOrClientLevel, @Nullable LevelChunk clientChunk, @Nullable LevelChunk serverChunk) {
        SoundBufferLibrary.DebugOutput.Counter counter = new SoundBufferLibrary.DebugOutput.Counter();
        Minecraft.getInstance().getSoundManager().getSoundCacheDebugStats(counter);
        displayer.addLine(String.format(Locale.ROOT, "Sound cache: %d buffers, %d MiB", counter.totalCount(), bytesToMegabytes(counter.totalSize())));
    }
 
    private static long bytesToMegabytes(long used) {
        return Mth.ceilLong(used / 1024.0 / 1024.0);
    }
}

引用的其他类