Interface PreviewRenderer


@Environment(CLIENT) public interface PreviewRenderer
Renders a preview using a PreviewProvider.
Since:
1.3.0
  • Method Details

    • getDefaultRendererInstance

      @Nonnull static PreviewRenderer getDefaultRendererInstance()
      Returns the default renderer instance, corresponds the return value of either getModRendererInstance(), or getVanillaRendererInstance() depending on the mod's configuration.
      Returns:
      The instance of the default preview renderer.
      Since:
      1.3.0
    • getModRendererInstance

      @Nonnull static PreviewRenderer getModRendererInstance()
      Returns the instance of ShulkerBoxTooltip's default preview renderer.
      Returns:
      The mod's default preview renderer.
      Since:
      3.0.0
    • getVanillaRendererInstance

      @Nonnull static PreviewRenderer getVanillaRendererInstance()
      Returns an instance of ShulkerBoxTooltip's vanilla-style preview renderer.
      Returns:
      The mod's default preview renderer.
      Since:
      3.0.0
    • getHeight

      int getHeight()
      Gets the pixel height of the preview window.
      Returns:
      the height (in pixels) of the preview window.
      Since:
      1.3.0
    • getWidth

      int getWidth()
      Gets the pixel width of the preview window.
      Returns:
      the width (in pixels) of the preview window.
      Since:
      1.3.0
    • setPreview

      void setPreview(PreviewContext context, PreviewProvider provider)
      Sets the preview to use for the given context.
      Parameters:
      context - The preview context.
      provider - The provider.
      Since:
      2.0.0
    • setPreviewType

      void setPreviewType(PreviewType type)
      Sets the preview type.
      Parameters:
      type - The preview type.
      Since:
      1.3.0
    • draw

      @Deprecated(forRemoval=true, since="5.2.0") default void draw(int x, int y, net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.client.gui.Font font, int mouseX, int mouseY)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Renders the preview at the given coordinates.
      Parameters:
      x - X position of the preview's upper-right corner.
      y - Y position of the preview's upper-right corner.
      graphics - Context about the current matrices and more.
      font - The text renderer.
      mouseX - The X position of the mouse cursor, relative to the current active Screen.
      mouseY - The Y position of the mouse cursor, relative to the current active Screen.
      Since:
      4.0.0
    • draw

      default void draw(int x, int y, int viewportWidth, int viewportHeight, net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.client.gui.Font font, int mouseX, int mouseY)
      Renders the preview at the given coordinates.
      Parameters:
      x - X position of the preview's upper-right corner.
      y - Y position of the preview's upper-right corner.
      viewportWidth - Number of pixels available for rendering the preview in the X axis.
      viewportHeight - Number of pixels available for rendering the preview in the Y axis.
      graphics - Context about the current matrices and more.
      font - The text renderer.
      mouseX - The X position of the mouse cursor, relative to the current active Screen.
      mouseY - The Y position of the mouse cursor, relative to the current active Screen.
      Since:
      5.2.0