DebugEntryLookingAtEntity .java

net.minecraft.client.gui.components.debug.DebugEntryLookingAtEntity (class): members: GROUP, serverOrClientLevel, displayer, clientChunk, display.

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

Implements

API Surface (1)

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

Fields & Constants (4)

GROUP
displayer
serverOrClientLevel
clientChunk

String literals (2)

"looking_at_entity"
"Targeted Entity"

Full Source

DebugEntryLookingAtEntity.java37 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.components.debug;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import net.minecraft.ChatFormatting;
8
import net.minecraft.client.Minecraft;
9
import net.minecraft.resources.Identifier;
10
import net.minecraft.world.entity.Entity;
11
import net.minecraft.world.level.Level;
12
import net.minecraft.world.level.chunk.LevelChunk;
13
import org.jspecify.annotations.Nullable;
14
15
@Environment(EnvType.CLIENT)
16
public class DebugEntryLookingAtEntity implements DebugScreenEntry {
17
	public static final Identifier GROUP = Identifier.withDefaultNamespace("looking_at_entity");
18
19
	@Override
20
	public void display(
21
		final DebugScreenDisplayer displayer,
22
		final @Nullable Level serverOrClientLevel,
23
		final @Nullable LevelChunk clientChunk,
24
		final @Nullable LevelChunk serverChunk
25
	) {
26
		Minecraft minecraft = Minecraft.getInstance();
27
		Entity entity = minecraft.crosshairPickEntity;
28
		List<String> result = new ArrayList<>();
29
		if (entity != null) {
30
			result.add(ChatFormatting.UNDERLINE + "Targeted Entity");
31
			result.add(entity.typeHolder().getRegisteredName());
32
		}
33
34
		displayer.addToGroup(GROUP, result);
35
	}
36
}
37

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