NumericTag .java

net.minecraft.nbt.NumericTag (interface): members: asBoolean, asDouble, asNumber, asFloat, asShort, asByte, asInt, asLong, doubleValue, floatValue, box.

net.minecraft.nbtinterface60 linescommonextends PrimitiveTag1.0 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Code Graph: Dependencies (1)

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

Full Source

NumericTag.java60 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.nbt;
2
3
import java.util.Optional;
4
5
public sealed interface NumericTag extends PrimitiveTag permits ByteTag, ShortTag, IntTag, LongTag, FloatTag, DoubleTag {
6
	byte byteValue();
7
8
	short shortValue();
9
10
	int intValue();
11
12
	long longValue();
13
14
	float floatValue();
15
16
	double doubleValue();
17
18
	Number box();
19
20
	@Override
21
	default Optional<Number> asNumber() {
22
		return Optional.of(this.box());
23
	}
24
25
	@Override
26
	default Optional<Byte> asByte() {
27
		return Optional.of(this.byteValue());
28
	}
29
30
	@Override
31
	default Optional<Short> asShort() {
32
		return Optional.of(this.shortValue());
33
	}
34
35
	@Override
36
	default Optional<Integer> asInt() {
37
		return Optional.of(this.intValue());
38
	}
39
40
	@Override
41
	default Optional<Long> asLong() {
42
		return Optional.of(this.longValue());
43
	}
44
45
	@Override
46
	default Optional<Float> asFloat() {
47
		return Optional.of(this.floatValue());
48
	}
49
50
	@Override
51
	default Optional<Double> asDouble() {
52
		return Optional.of(this.doubleValue());
53
	}
54
55
	@Override
56
	default Optional<Boolean> asBoolean() {
57
		return Optional.of(this.byteValue() != 0);
58
	}
59
}
60

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