Interface PreviewContext


public interface PreviewContext
Provides information for item previews, such as the item stack and player that owns the stack (if present).
Since:
2.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A builder for creating PreviewContext instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    builder(net.minecraft.world.item.ItemStack stack)
    Creates a new PreviewContext.Builder instance.
    Provides access to the configuration in use for this context.
    net.minecraft.world.entity.player.Player
    Gets the player associated with this context, or null if it does not exist.
    net.minecraft.core.HolderLookup.Provider
    Returns the registry lookup for this context, if available.
    net.minecraft.world.item.ItemStack
    Gets the item stack associated with this context.
  • Method Details

    • builder

      @Nonnull @Contract("_ -> new") static PreviewContext.Builder builder(net.minecraft.world.item.ItemStack stack)
      Creates a new PreviewContext.Builder instance.

      This is the recommended way to create a PreviewContext instance as of 4.1.0.

      Parameters:
      stack - The stack to create the context with, may not be null.
      Returns:
      a new PreviewContext.Builder instance.
      Since:
      4.1.0
    • stack

      @Nonnull net.minecraft.world.item.ItemStack stack()
      Gets the item stack associated with this context.
      Returns:
      The item stack.
      Since:
      3.1.0
    • owner

      @Nullable net.minecraft.world.entity.player.Player owner()
      Gets the player associated with this context, or null if it does not exist.
      Returns:
      The owner of this item stack, may be null.
      Since:
      3.1.0
    • config

      @Nonnull PreviewConfiguration config()
      Provides access to the configuration in use for this context.
      Returns:
      the configuration.
      Since:
      3.3.0
    • registryLookup

      @Nullable net.minecraft.core.HolderLookup.Provider registryLookup()
      Returns the registry lookup for this context, if available.
      Returns:
      the registry lookup, or null.
      Since:
      4.1.0