DataComponentGetter .java

net.minecraft.core.component.DataComponentGetter (interface, 18 lines): members: getTyped, getOrDefault, get. imports: Nullable.

net.minecraft.core.componentinterface18 linescommon548 B

API Surface (0)

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

Code Graph: Dependencies (2)

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

Full Source

DataComponentGetter.java18 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.core.component;
2
3
import org.jspecify.annotations.Nullable;
4
5
public interface DataComponentGetter {
6
	<T> @Nullable T get(DataComponentType<? extends T> type);
7
8
	default <T> T getOrDefault(final DataComponentType<? extends T> type, final T defaultValue) {
9
		T value = this.get(type);
10
		return value != null ? value : defaultValue;
11
	}
12
13
	default <T> @Nullable TypedDataComponent<T> getTyped(final DataComponentType<T> type) {
14
		T value = this.get(type);
15
		return value != null ? new TypedDataComponent<>(type, value) : null;
16
	}
17
}
18

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