Class DataComponent.Map

java.lang.Object
com.saicone.rtag.data.DataComponent.Map
Enclosing class:
DataComponent

@Experimental public static class DataComponent.Map extends Object
Class to invoke methods from DataComponentMap.
A component map acts like an immutable map in java with the regular conception of components by Mojang.
  • Field Details

    • EMPTY

      public static final Object EMPTY
      An empty DataComponentMap instance.
  • Method Details

    • builder

      public static DataComponent.Builder<Object> builder()
      Create a DataComponentMap builder to set values and then wrap into component map.
      Returns:
      a newly generated builder to edit.
    • size

      public static int size(Object map)
      Get the size of provided component map.
      Parameters:
      map - the component map to get size.
      Returns:
      the number of data type elements in provided component map.
    • isEmpty

      public static boolean isEmpty(Object map)
      Check if the provided component map is empty.
      Parameters:
      map - the component map to check.
      Returns:
      true if the component map has no elements.
    • get

      public static Object get(Object map, Object type)
      Get a declared component type from provided component map.
      Parameters:
      map - the component map to get component from.
      type - the DataComponentType instance that declares a component type.
      Returns:
      the component declared type from data component cache if exists, null otherwise.
    • has

      public static boolean has(Object map, Object type)
      Check if the provided component map has any type of DataComponentType inside.
      Parameters:
      map - the component map to check content.
      type - the DataComponentType instance.
      Returns:
      true if holder contains the provided component type.
    • getValue

      public static it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Object,Object> getValue(Object map)
      Get the map value from component map.
      Parameters:
      map - the map to get the value itself.
      Returns:
      a Reference2ObjectMap inside component map.
    • keySet

      public static Set<Object> keySet(Object map)
      Get a DataComponentType key set from component map.
      Parameters:
      map - the map to get the key set.
      Returns:
      set full of DataComponentType objects.