Class SelectorType<A>

java.lang.Object
com.pixelmonmod.pixelmon.api.selector.SelectorType<A>
Type Parameters:
A - The type to be selected

public class SelectorType<A> extends Object
This class represents a selector independent of the type of which it is selecting.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static com.mojang.serialization.Codec<SelectorType<?>>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <A> SelectorType<A>
    cast(Class<A> throwawayClass, SelectorType<?> selectorType)
    A utility method for casting the selector type to the given first paramater type
    static <A> SelectorType<List<A>>
    castList(Class<A> throwawayClass, SelectorType<?> selectorType)
    A utility method for casting the selector type to the given first paramater type
    static <A extends Selector<B>, B>
    com.mojang.serialization.Codec<A>
    codec(Class<B> typeClass, com.mojang.serialization.Codec<B> codec)
     
    boolean
     
    com.mojang.serialization.Codec<Selector<A>>
    getCodec(com.mojang.serialization.Codec<A> subCodec)
    Gets the codec for the selector type which will read the condition using the provided codec for the typing
    int
     
    static <B> com.mojang.serialization.Codec<Selector<List<B>>>
    listCodec(Class<B> typeClass, com.mojang.serialization.Codec<List<B>> codec)
     
    static <T> SelectorType<T>
    of(Function<com.mojang.serialization.Codec<T>,com.mojang.serialization.Codec<? extends Selector<T>>> function)
    Creates an instance of the SelectorType

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CODEC

      public static com.mojang.serialization.Codec<SelectorType<?>> CODEC
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getCodec

      public com.mojang.serialization.Codec<Selector<A>> getCodec(com.mojang.serialization.Codec<A> subCodec)
      Gets the codec for the selector type which will read the condition using the provided codec for the typing
      Parameters:
      subCodec - The sub-type codec
      Returns:
      The selector's codec
    • of

      public static <T> SelectorType<T> of(Function<com.mojang.serialization.Codec<T>,com.mojang.serialization.Codec<? extends Selector<T>>> function)
      Creates an instance of the SelectorType
      Type Parameters:
      T - The type of the condition
      Parameters:
      function - The function that will create the Selector's codec when required
      Returns:
      The selector type created
    • cast

      public static <A> SelectorType<A> cast(Class<A> throwawayClass, SelectorType<?> selectorType)
      A utility method for casting the selector type to the given first paramater type
      Type Parameters:
      A - The type
      Parameters:
      throwawayClass - The type of SelectorType desired
      selectorType - The selector type
      Returns:
      The casted selector type
    • castList

      public static <A> SelectorType<List<A>> castList(Class<A> throwawayClass, SelectorType<?> selectorType)
      A utility method for casting the selector type to the given first paramater type
      Type Parameters:
      A - The type
      Parameters:
      throwawayClass - The type of SelectorType desired
      selectorType - The selector type
      Returns:
      The casted selector type
    • codec

      public static <A extends Selector<B>, B> com.mojang.serialization.Codec<A> codec(Class<B> typeClass, com.mojang.serialization.Codec<B> codec)
    • listCodec

      public static <B> com.mojang.serialization.Codec<Selector<List<B>>> listCodec(Class<B> typeClass, com.mojang.serialization.Codec<List<B>> codec)