DebugEntityNameGenerator .java

net.minecraft.network.protocol.game.DebugEntityNameGenerator (class): members: NAMES_SECOND_PART, NAMES_FIRST_PART, getEntityName. strings: "Whisper".

net.minecraft.network.protocol.gameclass97 linescommon1.7 KB

API Surface (2)

String getEntityName(final Entity entity)
String getEntityName(final UUID uuid)

Fields & Constants (2)

NAMES_FIRST_PART
NAMES_SECOND_PART

String literals (48)

"Slim"
"River"
"Silly"
"Thin"
"Fish"
"Dark"
"Bush"
"Bark"
"Slack"
"Soup"
"Grim"
"Hook"
"Dirt"
"Hard"
"Crook"
"Sneak"
"Stink"
"Weird"
"Fire"
"Soot"
"Soft"
"Rough"
"Cling"
"Scar"

Same Package (197)

Code Graph: Dependencies (5)

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

Full Source

DebugEntityNameGenerator.java97 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import java.util.UUID;
4
import net.minecraft.network.chat.Component;
5
import net.minecraft.util.RandomSource;
6
import net.minecraft.util.Util;
7
import net.minecraft.world.entity.Entity;
8
import net.minecraft.world.entity.player.Player;
9
10
public class DebugEntityNameGenerator {
11
	private static final String[] NAMES_FIRST_PART = new String[]{
12
		"Slim",
13
		"Far",
14
		"River",
15
		"Silly",
16
		"Fat",
17
		"Thin",
18
		"Fish",
19
		"Bat",
20
		"Dark",
21
		"Oak",
22
		"Sly",
23
		"Bush",
24
		"Zen",
25
		"Bark",
26
		"Cry",
27
		"Slack",
28
		"Soup",
29
		"Grim",
30
		"Hook",
31
		"Dirt",
32
		"Mud",
33
		"Sad",
34
		"Hard",
35
		"Crook",
36
		"Sneak",
37
		"Stink",
38
		"Weird",
39
		"Fire",
40
		"Soot",
41
		"Soft",
42
		"Rough",
43
		"Cling",
44
		"Scar"
45
	};
46
	private static final String[] NAMES_SECOND_PART = new String[]{
47
		"Fox",
48
		"Tail",
49
		"Jaw",
50
		"Whisper",
51
		"Twig",
52
		"Root",
53
		"Finder",
54
		"Nose",
55
		"Brow",
56
		"Blade",
57
		"Fry",
58
		"Seek",
59
		"Wart",
60
		"Tooth",
61
		"Foot",
62
		"Leaf",
63
		"Stone",
64
		"Fall",
65
		"Face",
66
		"Tongue",
67
		"Voice",
68
		"Lip",
69
		"Mouth",
70
		"Snail",
71
		"Toe",
72
		"Ear",
73
		"Hair",
74
		"Beard",
75
		"Shirt",
76
		"Fist"
77
	};
78
79
	public static String getEntityName(final Entity entity) {
80
		if (entity instanceof Player) {
81
			return entity.getPlainTextName();
82
		}
83
84
		Component customName = entity.getCustomName();
85
		return customName != null ? customName.getString() : getEntityName(entity.getUUID());
86
	}
87
88
	public static String getEntityName(final UUID uuid) {
89
		RandomSource random = RandomSource.createThreadLocalInstance(uuid.hashCode() >> 2);
90
		return getRandomString(random, NAMES_FIRST_PART) + getRandomString(random, NAMES_SECOND_PART);
91
	}
92
93
	private static String getRandomString(final RandomSource random, final String[] names) {
94
		return Util.getRandom(names, random);
95
	}
96
}
97

Decompiled Minecraft 26.3 source of DebugEntityNameGenerator (net/minecraft/network/protocol/game/DebugEntityNameGenerator.java) with Mojang official mappings, stored verbatim on the site.