NarratorStatus .java

net.minecraft.client.NarratorStatus (enum): members: OFF, ALL, CHAT, SYSTEM, shouldNarrateSystemOrChat, shouldNarrateSystem, shouldNarrateChat, byId, name.

net.minecraft.clientenum52 linesclient1.4 KB

API Surface (6)

int getId()
Component getName()
NarratorStatus byId(final int id)
boolean shouldNarrateChat()
boolean shouldNarrateSystem()
boolean shouldNarrateSystemOrChat()

Fields & Constants (4)

BY_ID
LEGACY_CODEC
id
name

String literals (4)

"options.narrator.off"
"options.narrator.all"
"options.narrator.chat"
"options.narrator.system"

Code Graph: Dependencies (2)

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

Full Source

NarratorStatus.java52 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client;
2
3
import com.mojang.serialization.Codec;
4
import java.util.function.IntFunction;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import net.minecraft.network.chat.Component;
8
import net.minecraft.util.ByIdMap;
9
import net.minecraft.util.ByIdMap.OutOfBoundsStrategy;
10
11
@Environment(EnvType.CLIENT)
12
public enum NarratorStatus {
13
	OFF(0, "options.narrator.off"),
14
	ALL(1, "options.narrator.all"),
15
	CHAT(2, "options.narrator.chat"),
16
	SYSTEM(3, "options.narrator.system");
17
18
	private static final IntFunction<NarratorStatus> BY_ID = ByIdMap.continuous(NarratorStatus::getId, values(), OutOfBoundsStrategy.WRAP);
19
	public static final Codec<NarratorStatus> LEGACY_CODEC = Codec.INT.xmap(NarratorStatus::byId, NarratorStatus::getId);
20
	private final int id;
21
	private final Component name;
22
23
	NarratorStatus(final int id, final String key) {
24
		this.id = id;
25
		this.name = Component.translatable(key);
26
	}
27
28
	public int getId() {
29
		return this.id;
30
	}
31
32
	public Component getName() {
33
		return this.name;
34
	}
35
36
	public static NarratorStatus byId(final int id) {
37
		return BY_ID.apply(id);
38
	}
39
40
	public boolean shouldNarrateChat() {
41
		return this == ALL || this == CHAT;
42
	}
43
44
	public boolean shouldNarrateSystem() {
45
		return this == ALL || this == SYSTEM;
46
	}
47
48
	public boolean shouldNarrateSystemOrChat() {
49
		return this == ALL || this == SYSTEM || this == CHAT;
50
	}
51
}
52

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