Package net.minecraft.component
Interface ComponentHolder
- All Superinterfaces:
ComponentsAccess
- All Known Implementing Classes:
ItemStack
An object that holds components. Note that this interface does not expose
methods to modify the held components.
Component holders usually have "base" components and the overrides to the base (usually referred to as "changes"). The overrides may set additional components, modify the values from the base-provided default, or "unset"/remove base values. Methods in this interface expose the final value, after applying the changes.
- See Also:
- Mappings:
Namespace Name named net/minecraft/component/ComponentHolderintermediary net/minecraft/class_9322official kh
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancontains(ComponentType<?> type) Returns whether the held components includetype.default <T> Tget(ComponentType<? extends T> type) default <T> TgetOrDefault(ComponentType<? extends T> type, T fallback) default <T> Stream<T> Methods inherited from interface net.minecraft.component.ComponentsAccess
getTyped
-
Method Details
-
getComponents
ComponentMap getComponents()- Mappings:
Namespace Name Mixin selector named getComponentsLnet/minecraft/component/ComponentHolder;getComponents()Lnet/minecraft/component/ComponentMap;intermediary method_57353Lnet/minecraft/class_9322;method_57353()Lnet/minecraft/class_9323;official aLkh;a()Lki;
-
get
- Specified by:
getin interfaceComponentsAccess- Mappings:
Namespace Name Mixin selector named getLnet/minecraft/component/ComponentsAccess;get(Lnet/minecraft/component/ComponentType;)Ljava/lang/Object;intermediary method_58694Lnet/minecraft/class_9473;method_58694(Lnet/minecraft/class_9331;)Ljava/lang/Object;official aLkg;a(Lkk;)Ljava/lang/Object;
-
streamAll
- Mappings:
Namespace Name Mixin selector named streamAllLnet/minecraft/component/ComponentHolder;streamAll(Ljava/lang/Class;)Ljava/util/stream/Stream;intermediary method_62984Lnet/minecraft/class_9322;method_62984(Ljava/lang/Class;)Ljava/util/stream/Stream;official aLkh;a(Ljava/lang/Class;)Ljava/util/stream/Stream;
-
getOrDefault
- Specified by:
getOrDefaultin interfaceComponentsAccess- Mappings:
Namespace Name Mixin selector named getOrDefaultLnet/minecraft/component/ComponentsAccess;getOrDefault(Lnet/minecraft/component/ComponentType;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_58695Lnet/minecraft/class_9473;method_58695(Lnet/minecraft/class_9331;Ljava/lang/Object;)Ljava/lang/Object;official aLkg;a(Lkk;Ljava/lang/Object;)Ljava/lang/Object;
-
contains
Returns whether the held components includetype.- Returns:
- whether the held components include
type - Implementation Note:
- This is implemented as
get(type) != null. - Mappings:
Namespace Name Mixin selector named containsLnet/minecraft/component/ComponentHolder;contains(Lnet/minecraft/component/ComponentType;)Zintermediary method_57826Lnet/minecraft/class_9322;method_57826(Lnet/minecraft/class_9331;)Zofficial cLkh;c(Lkk;)Z
-