Class SelectorType<A>
java.lang.Object
com.pixelmonmod.pixelmon.api.selector.SelectorType<A>
- Type Parameters:
A
- The type to be selected
This class represents a selector independent of the type of which it is
selecting.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> SelectorType<A>
cast
(Class<A> throwawayClass, SelectorType<?> selectorType) A utility method for casting the selector type to the given first paramater typestatic <A> SelectorType<List<A>>
castList
(Class<A> throwawayClass, SelectorType<?> selectorType) A utility method for casting the selector type to the given first paramater typestatic <A extends Selector<B>,
B>
com.mojang.serialization.Codec<A>boolean
Gets the codec for the selector type which will read the condition using the provided codec for the typingint
hashCode()
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
-
Field Details
-
CODEC
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
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
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 desiredselectorType
- 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 desiredselectorType
- The selector type- Returns:
- The casted selector type
-
codec
-
listCodec
-