Class StrictStoredContext
java.lang.Object
com.pixelmonmod.pixelmon.api.context.StoredContext
com.pixelmonmod.pixelmon.api.context.StrictStoredContext
This is a "strict" implementation of
This is only intended to be used internally for code usages of context. For example, the battle engine.
Whereas, the
StoredContext that only allows
immutable context keys to be set and retrieved.
This is only intended to be used internally for code usages of context. For example, the battle engine.
Whereas, the
StoredContext is intended to be used for the public facing API, and pipelines such as the NPC and Research
pipelines where a user might want to set a context key that is mutable, or that is not registered in the code.-
Method Summary
Modifier and TypeMethodDescription<A> Optional<A> getContext(ContextKey<A> key) Gets the value stored by a given context key for this stored context<A> Optional<A> getContext(net.minecraft.resources.ResourceLocation key) Gets the value stored by a given context key for this stored context<A> AgetNullableContext(ContextKey<A> key) Gets the value stored by a given context key for this stored context<A> AgetNullableContext(net.minecraft.resources.ResourceLocation key) Gets the value stored by a given context key for this stored context<A> StoredContextsetContext(ContextKey<A> key, A value) Sets the context key with the given value<A> StoredContextsetContext(net.minecraft.resources.ResourceLocation key, A value) Sets the context key with the given valuewithPlayer(net.minecraft.server.level.ServerPlayer player) Adds the generic contexts for the playerMethods inherited from class com.pixelmonmod.pixelmon.api.context.StoredContext
clear, contextKeyEntrySet, copy, entrySet, getContextOrDefault, getContextType, hasContext, hasContext, of, of, replace, replace, strict, strict
-
Method Details
-
setContext
Description copied from class:StoredContextSets the context key with the given value- Overrides:
setContextin classStoredContext- Type Parameters:
A- The type of the key and value- Parameters:
key- The keyvalue- The value being set- Returns:
- The context instance
-
getNullableContext
Description copied from class:StoredContextGets the value stored by a given context key for this stored context- Overrides:
getNullableContextin classStoredContext- Type Parameters:
A- The type of the key and value- Parameters:
key- The key to check for- Returns:
- The potential value stored
-
getContext
Description copied from class:StoredContextGets the value stored by a given context key for this stored context- Overrides:
getContextin classStoredContext- Type Parameters:
A- The type of the key and value- Parameters:
key- The key to check for- Returns:
- The potential value stored
-
withPlayer
Description copied from class:StoredContextAdds the generic contexts for the player- Overrides:
withPlayerin classStoredContext- Parameters:
player- The player for adding the generic contexts- Returns:
- The context instance
-
setContext
public <A> StoredContext setContext(net.minecraft.resources.ResourceLocation key, @Nullable A value) Description copied from class:StoredContextSets the context key with the given value- Overrides:
setContextin classStoredContext- Type Parameters:
A- The type of the key and value- Parameters:
key- The keyvalue- The value being set- Returns:
- The context instance
-
getNullableContext
@Nullable public <A> A getNullableContext(net.minecraft.resources.ResourceLocation key) Description copied from class:StoredContextGets the value stored by a given context key for this stored context- Overrides:
getNullableContextin classStoredContext- Type Parameters:
A- The type of the key and value- Parameters:
key- The key to check for- Returns:
- The potential value stored
-
getContext
Description copied from class:StoredContextGets the value stored by a given context key for this stored context- Overrides:
getContextin classStoredContext- Type Parameters:
A- The type of the key and value- Parameters:
key- The key to check for- Returns:
- The potential value stored
-