minecraft-src/net/minecraft/core/component/DataComponentHolder.java
2025-07-04 01:41:11 +03:00

20 lines
549 B
Java

package net.minecraft.core.component;
import org.jetbrains.annotations.Nullable;
public interface DataComponentHolder {
DataComponentMap getComponents();
@Nullable
default <T> T get(DataComponentType<? extends T> component) {
return this.getComponents().get(component);
}
default <T> T getOrDefault(DataComponentType<? extends T> component, T defaultValue) {
return this.getComponents().getOrDefault(component, defaultValue);
}
default boolean has(DataComponentType<?> component) {
return this.getComponents().has(component);
}
}