38 lines
1.4 KiB
Java
38 lines
1.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.client.gui.components.debug;
|
|
|
|
import java.util.ArrayList;
|
|
import net.minecraft.ChatFormatting;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.components.debug.DebugScreenDisplayer;
|
|
import net.minecraft.client.gui.components.debug.DebugScreenEntry;
|
|
import net.minecraft.core.registries.BuiltInRegistries;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.chunk.LevelChunk;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public class DebugEntryLookingAtEntity
|
|
implements DebugScreenEntry {
|
|
private static final Identifier GROUP = Identifier.withDefaultNamespace("looking_at_entity");
|
|
|
|
@Override
|
|
public void display(DebugScreenDisplayer displayer, @Nullable Level serverOrClientLevel, @Nullable LevelChunk clientChunk, @Nullable LevelChunk serverChunk) {
|
|
Minecraft minecraft = Minecraft.getInstance();
|
|
Entity entity = minecraft.crosshairPickEntity;
|
|
ArrayList<String> result = new ArrayList<String>();
|
|
if (entity != null) {
|
|
result.add(String.valueOf(ChatFormatting.UNDERLINE) + "Targeted Entity");
|
|
result.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
|
|
}
|
|
displayer.addToGroup(GROUP, result);
|
|
}
|
|
}
|
|
|