Class DataComponent

java.lang.Object
com.saicone.rtag.data.DataComponent

@Experimental public class DataComponent extends Object
Class to invoke methods from multiple DataComponent classes.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Class wrapper to invoke methods from map and patch data component types builder.
    This is not the real class, it's just a bridge between to set and get values before build.
    static class 
    Class to invoke methods from DataComponentHolder.
    This type of data component object (as the name said) is just a holder for DataComponentMap to delegate methods.
    static class 
    Class to invoke methods from DataComponentMap.
    A component map acts like an immutable map in java with the regular conception of components by Mojang.
    static class 
    Class to invoke methods from PatchedDataComponentMap.
    A patched map is a subclass of DataComponentMap but mutable, that means all the methods from component map are applicable in a patched map.
    static class 
    Class to invoke methods from DataComponentPatch.
    Instead of patched map, a component patch acts like a cloneable object that can be introduced into maps and also hold empty values to future deletion.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    get(Object component, Object type)
    Get a declared component type from data component object.
    getOptional(Object component, Object type)
    Get a declared component type from data component object wrapped as optional object.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • get

      public static Object get(Object component, Object type) throws IllegalArgumentException
      Get a declared component type from data component object.
      Parameters:
      component - the data component to get component.
      type - the DataComponentType instance that declares a component type.
      Returns:
      the component declared type from data component cache if exists, null otherwise.
      Throws:
      IllegalArgumentException - if the provided component is not a compatible data component type.
    • getOptional

      public static Optional<Object> getOptional(Object component, Object type) throws IllegalArgumentException
      Get a declared component type from data component object wrapped as optional object.
      Parameters:
      component - the data component to get component.
      type - the DataComponentType instance that declares a component type.
      Returns:
      the component declared type from data component cache wrapped into optional object.
      Throws:
      IllegalArgumentException - if the provided component is not a compatible data component type.