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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for creatingPreviewContextinstances. -
Method Summary
Modifier and TypeMethodDescriptionstatic PreviewContext.Builderbuilder(net.minecraft.world.item.ItemStack stack) Creates a newPreviewContext.Builderinstance.config()Provides access to the configuration in use for this context.net.minecraft.world.entity.player.Playerowner()Gets the player associated with this context, or null if it does not exist.net.minecraft.core.HolderLookup.ProviderReturns the registry lookup for this context, if available.net.minecraft.world.item.ItemStackstack()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 newPreviewContext.Builderinstance.This is the recommended way to create a
PreviewContextinstance as of 4.1.0.- Parameters:
stack- The stack to create the context with, may not be null.- Returns:
- a new
PreviewContext.Builderinstance. - 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
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
-