package net.minecraft.core.component; import org.jetbrains.annotations.Nullable; public interface DataComponentGetter { @Nullable T get(DataComponentType component); default T getOrDefault(DataComponentType component, T defaultValue) { T object = this.get(component); return object != null ? object : defaultValue; } @Nullable default TypedDataComponent getTyped(DataComponentType component) { T object = this.get(component); return object != null ? new TypedDataComponent<>(component, object) : null; } }