Class InlineItemRenderer
java.lang.Object
com.samsthenerd.inline.api.client.renderers.InlineItemRenderer
- All Implemented Interfaces:
InlineRenderer<ItemInlineData>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.samsthenerd.inline.api.client.InlineRenderer
InlineRenderer.TextRenderingContext
-
Field Summary
FieldsFields inherited from interface com.samsthenerd.inline.api.client.InlineRenderer
DEFAULT_FONT_COLOR, DEFAULT_SHADOW_COLOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
charWidth
(ItemInlineData data, net.minecraft.text.Style style, int codepoint) Gets the width of the render without doing the rendering.getGlowPreference
(ItemInlineData forData) Indicates preferences for how the render system should handle glow effects with this renderer.net.minecraft.util.Identifier
getId()
Gets this renderer's ID.int
render
(ItemInlineData data, net.minecraft.client.gui.DrawContext context, int index, net.minecraft.text.Style style, int codepoint, InlineRenderer.TextRenderingContext trContext) Renders in place of a single codepoint/character based on the data given.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.samsthenerd.inline.api.client.InlineRenderer
handleOwnSizing, handleOwnTransparency
-
Field Details
-
INSTANCE
-
debugEarlyReturn
public static boolean debugEarlyReturn
-
-
Constructor Details
-
InlineItemRenderer
public InlineItemRenderer()
-
-
Method Details
-
getId
public net.minecraft.util.Identifier getId()Description copied from interface:InlineRenderer
Gets this renderer's ID. Used primarily by the InlineData to specify which renderer to use for it.- Specified by:
getId
in interfaceInlineRenderer<ItemInlineData>
- Returns:
- the id
-
render
public int render(ItemInlineData data, net.minecraft.client.gui.DrawContext context, int index, net.minecraft.text.Style style, int codepoint, InlineRenderer.TextRenderingContext trContext) Description copied from interface:InlineRenderer
Renders in place of a single codepoint/character based on the data given.- Specified by:
render
in interfaceInlineRenderer<ItemInlineData>
- Parameters:
data
- the data to render.context
- aDrawContext
with aMatrixStack
set to the correct position for this character and with aVertexConsumerProvider
for rendering to.index
- the index of this character in the overall string.style
- the style attached to the text.codepoint
- the unicode codepoint for this character.trContext
- a collection of values taken from the text renderer.- Returns:
- the width that this render takes up. more or less corresponds to pixels in the default font.
-
charWidth
Description copied from interface:InlineRenderer
Gets the width of the render without doing the rendering.- Specified by:
charWidth
in interfaceInlineRenderer<ItemInlineData>
- Parameters:
data
- the data to render.style
- the style attached to the text.codepoint
- the unicode codepoint for this character.- Returns:
- the width that this render takes up. more or less corresponds to pixels in the default font.
-
getGlowPreference
Description copied from interface:InlineRenderer
Indicates preferences for how the render system should handle glow effects with this renderer. Glow effects happen when a sign is clicked with a glow ink sac. Vanilla text handles this by rendering text in 8 offsets, doing this with inline renders tends to create a busy z-fighting mess. Instead, the render system can flatten the rendering to create an outline. SeeGlowHandling
for more details.- Specified by:
getGlowPreference
in interfaceInlineRenderer<ItemInlineData>
- Parameters:
forData
- incase the handling changes based on data. This should really only be used for returning a cache id in the GlowHandling.- Returns:
- a GlowHandling for if this renderer needs glow help.
-