Class ExpandDataComponentMap

java.lang.Object
com.blamejared.crafttweaker.natives.component.ExpandDataComponentMap

@ZenRegister public class ExpandDataComponentMap extends Object
A map of DataComponentTypes to their values.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.core.component.DataComponentMap.Builder
    Creates a new DataComponentMap.Builder.
    static net.minecraft.core.component.DataComponentMap
    composite(net.minecraft.core.component.DataComponentMap a, net.minecraft.core.component.DataComponentMap b)
    Combines two DataComponentMaps.
    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 given DataComponentType.
    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 given DataComponentType.
    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 the TypedDataComponent for the given DataComponentType.
    static boolean
    has(net.minecraft.core.component.DataComponentMap internal, net.minecraft.core.component.DataComponentType<?> type)
    Checks if the data component map has a DataComponentType.
    static boolean
    isEmpty(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 of DataComponentTypes in the data component map.
    static List<net.minecraft.core.component.TypedDataComponent<?>>
    list(net.minecraft.core.component.DataComponentMap internal)
     
    static int
    size(net.minecraft.core.component.DataComponentMap internal)
    Gets the size of the data component map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 given DataComponentType. If the data component is not present, the default value is returned.
      Parameters:
      type - The DataComponentType to 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 the TypedDataComponent for the given DataComponentType.
      Parameters:
      type - The DataComponentType to get the TypedDataComponent for.
      Returns:
      The TypedDataComponent for 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 given DataComponentType.
      Parameters:
      type - The DataComponentType to 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 a DataComponentType.
      Parameters:
      type - The DataComponentType to 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 of DataComponentTypes 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 two DataComponentMaps.
      Parameters:
      a - The first DataComponentMap to combine.
      b - The second DataComponentMap to combine.
      Returns:
      A new DataComponentMap that is the result of combining the two DataComponentMaps.
    • builder

      public static net.minecraft.core.component.DataComponentMap.Builder builder()
      Creates a new DataComponentMap.Builder.
      Returns:
      A new DataComponentMap.Builder.