DebugEntrySoundCache .java

net.minecraft.client.gui.components.debug.DebugEntrySoundCache (class, 36 lines): members: isAllowed, serverOrClientLevel, displayer, clientChunk, display.

net.minecraft.client.gui.components.debugclass36 linesclient1.2 KB

Implements

API Surface (2)

boolean isAllowed(final boolean reducedDebugInfo)
void display(final DebugScreenDisplayer displayer, final @Nullable Level serverOrClientLevel, final @Nullable LevelChunk clientChunk, final @Nullable LevelChunk serverChunk)

Fields & Constants (3)

displayer
serverOrClientLevel
clientChunk

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

DebugEntrySoundCache.java36 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.components.debug;
2
3
import java.util.Locale;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.Minecraft;
7
import net.minecraft.client.sounds.SoundBufferLibrary.DebugOutput.Counter;
8
import net.minecraft.util.Mth;
9
import net.minecraft.world.level.Level;
10
import net.minecraft.world.level.chunk.LevelChunk;
11
import org.jspecify.annotations.Nullable;
12
13
@Environment(EnvType.CLIENT)
14
public class DebugEntrySoundCache implements DebugScreenEntry {
15
	@Override
16
	public boolean isAllowed(final boolean reducedDebugInfo) {
17
		return true;
18
	}
19
20
	@Override
21
	public void display(
22
		final DebugScreenDisplayer displayer,
23
		final @Nullable Level serverOrClientLevel,
24
		final @Nullable LevelChunk clientChunk,
25
		final @Nullable LevelChunk serverChunk
26
	) {
27
		Counter counter = new Counter();
28
		Minecraft.getInstance().getSoundManager().getSoundCacheDebugStats(counter);
29
		displayer.addLine(String.format(Locale.ROOT, "Sound cache: %d buffers, %d MiB", counter.totalCount(), bytesToMegabytes(counter.totalSize())));
30
	}
31
32
	private static long bytesToMegabytes(final long used) {
33
		return Mth.ceilLong(used / 1024.0 / 1024.0);
34
	}
35
}
36

Decompiled Minecraft 26.3 source of DebugEntrySoundCache (net/minecraft/client/gui/components/debug/DebugEntrySoundCache.java) with Mojang official mappings, stored verbatim on the site.