Class ExpandDataComponentMap
java.lang.Object
com.blamejared.crafttweaker.natives.component.ExpandDataComponentMap
A map of
DataComponentTypes to their values.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.core.component.DataComponentMap.Builderbuilder()Creates a newDataComponentMap.Builder.static net.minecraft.core.component.DataComponentMapcomposite(net.minecraft.core.component.DataComponentMap a, net.minecraft.core.component.DataComponentMap b) Combines twoDataComponentMaps.static <T> TgetComponent(net.minecraft.core.component.DataComponentMap internal, Class<T> tClass, net.minecraft.core.component.DataComponentType<T> type) Gets the value of the data component for the givenDataComponentType.static <T> TgetOrDefault(net.minecraft.core.component.DataComponentMap internal, Class<T> tClass, net.minecraft.core.component.DataComponentType<T> type, T defaultValue) Gets the value of the data component for the givenDataComponentType.static <T> net.minecraft.core.component.TypedDataComponent<T> getTyped(net.minecraft.core.component.DataComponentMap internal, Class<T> tClass, net.minecraft.core.component.DataComponentType<T> type) Gets theTypedDataComponentfor the givenDataComponentType.static booleanhas(net.minecraft.core.component.DataComponentMap internal, net.minecraft.core.component.DataComponentType<?> type) Checks if the data component map has aDataComponentType.static booleanisEmpty(net.minecraft.core.component.DataComponentMap internal) Checks if the data component map is empty.static Set<net.minecraft.core.component.DataComponentType<?>> keySet(net.minecraft.core.component.DataComponentMap internal) Gets the set ofDataComponentTypes in the data component map.static List<net.minecraft.core.component.TypedDataComponent<?>> list(net.minecraft.core.component.DataComponentMap internal) static intsize(net.minecraft.core.component.DataComponentMap internal) Gets the size of the data component map.
-
Constructor Details
-
ExpandDataComponentMap
public ExpandDataComponentMap()
-
-
Method Details
-
size
public static int size(net.minecraft.core.component.DataComponentMap internal) Gets the size of the data component map.- Returns:
- The size of the data component map.
-
getOrDefault
public static <T> T getOrDefault(net.minecraft.core.component.DataComponentMap internal, Class<T> tClass, net.minecraft.core.component.DataComponentType<T> type, T defaultValue) Gets the value of the data component for the givenDataComponentType. If the data component is not present, the default value is returned.- Parameters:
type- TheDataComponentTypeto get the value of.defaultValue- The default value to return if the data component is not present.- Returns:
- The value of the data component for the given type.
-
getTyped
public static <T> net.minecraft.core.component.TypedDataComponent<T> getTyped(net.minecraft.core.component.DataComponentMap internal, Class<T> tClass, net.minecraft.core.component.DataComponentType<T> type) Gets theTypedDataComponentfor the givenDataComponentType.- Parameters:
type- TheDataComponentTypeto get theTypedDataComponentfor.- Returns:
- The
TypedDataComponentfor the given type.
-
getComponent
public static <T> T getComponent(net.minecraft.core.component.DataComponentMap internal, Class<T> tClass, net.minecraft.core.component.DataComponentType<T> type) Gets the value of the data component for the givenDataComponentType.- Parameters:
type- TheDataComponentTypeto get the value of.- Returns:
- The value of the data component for the given type.
-
list
public static List<net.minecraft.core.component.TypedDataComponent<?>> list(net.minecraft.core.component.DataComponentMap internal) -
has
public static boolean has(net.minecraft.core.component.DataComponentMap internal, net.minecraft.core.component.DataComponentType<?> type) Checks if the data component map has aDataComponentType.- Parameters:
type- TheDataComponentTypeto check for.- Returns:
- True if the data component map has the
DataComponentType, false otherwise.
-
keySet
public static Set<net.minecraft.core.component.DataComponentType<?>> keySet(net.minecraft.core.component.DataComponentMap internal) Gets the set ofDataComponentTypes in the data component map.- Returns:
- The set of
DataComponentTypes in the data component map.
-
isEmpty
public static boolean isEmpty(net.minecraft.core.component.DataComponentMap internal) Checks if the data component map is empty.- Returns:
- True if the data component map is empty, false otherwise.
-
composite
public static net.minecraft.core.component.DataComponentMap composite(net.minecraft.core.component.DataComponentMap a, net.minecraft.core.component.DataComponentMap b) Combines twoDataComponentMaps.- Parameters:
a- The firstDataComponentMapto combine.b- The secondDataComponentMapto combine.- Returns:
- A new
DataComponentMapthat is the result of combining the twoDataComponentMaps.
-
builder
public static net.minecraft.core.component.DataComponentMap.Builder builder()Creates a newDataComponentMap.Builder.- Returns:
- A new
DataComponentMap.Builder.
-