Interface PreviewRenderer
@Environment(CLIENT)
public interface PreviewRenderer
Renders a preview using a
PreviewProvider.- Since:
- 1.3.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault voiddraw(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.default voiddraw(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.static PreviewRendererReturns the default renderer instance, corresponds the return value of eithergetModRendererInstance(), orgetVanillaRendererInstance()depending on the mod's configuration.intGets the pixel height of the preview window.static PreviewRendererReturns the instance of ShulkerBoxTooltip's default preview renderer.static PreviewRendererReturns an instance of ShulkerBoxTooltip's vanilla-style preview renderer.intgetWidth()Gets the pixel width of the preview window.voidsetPreview(PreviewContext context, PreviewProvider provider) Sets the preview to use for the given context.voidsetPreviewType(PreviewType type) Sets the preview type.
-
Method Details
-
getDefaultRendererInstance
Returns the default renderer instance, corresponds the return value of eithergetModRendererInstance(), orgetVanillaRendererInstance()depending on the mod's configuration.- Returns:
- The instance of the default preview renderer.
- Since:
- 1.3.0
-
getModRendererInstance
Returns the instance of ShulkerBoxTooltip's default preview renderer.- Returns:
- The mod's default preview renderer.
- Since:
- 3.0.0
-
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
Sets the preview to use for the given context.- Parameters:
context- The preview context.provider- The provider.- Since:
- 2.0.0
-
setPreviewType
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
-
draw(int, int, int, int, GuiGraphics, Font, int, int)instead.