Class NoOpStoredContext

java.lang.Object
com.pixelmonmod.pixelmon.api.context.StoredContext
com.pixelmonmod.pixelmon.api.context.NoOpStoredContext

public final class NoOpStoredContext extends StoredContext
A StoredContext implementation that intentionally stores no values.

Mutating methods are accepted and ignored, while inherited read methods behave as an empty context. This is useful as a shared default for APIs that expose context access but do not always need per-instance context storage.

  • Field Details

  • Method Details

    • setContext

      public <A> StoredContext setContext(ContextKey<A> key, @Nullable A value)
      Description copied from class: StoredContext
      Sets the context key with the given value
      Overrides:
      setContext in class StoredContext
      Type Parameters:
      A - The type of the key and value
      Parameters:
      key - The key
      value - The value being set
      Returns:
      The context instance
    • setContext

      public <A> StoredContext setContext(net.minecraft.resources.ResourceLocation key, @Nullable A value)
      Description copied from class: StoredContext
      Sets the context key with the given value
      Overrides:
      setContext in class StoredContext
      Type Parameters:
      A - The type of the key and value
      Parameters:
      key - The key
      value - The value being set
      Returns:
      The context instance
    • withPlayer

      public StoredContext withPlayer(net.minecraft.server.level.ServerPlayer player)
      Description copied from class: StoredContext
      Adds the generic contexts for the player
      Overrides:
      withPlayer in class StoredContext
      Parameters:
      player - The player for adding the generic contexts
      Returns:
      The context instance
    • copy

      public StoredContext copy()
      Overrides:
      copy in class StoredContext
    • copy

      public void copy(StoredContext other)
      Overrides:
      copy in class StoredContext
    • clear

      public void clear()
      Overrides:
      clear in class StoredContext