Class InlineItemRenderer

java.lang.Object
com.samsthenerd.inline.api.client.renderers.InlineItemRenderer
All Implemented Interfaces:
InlineRenderer<ItemInlineData>

public class InlineItemRenderer extends Object implements InlineRenderer<ItemInlineData>
  • Field Details

    • INSTANCE

      public static final InlineItemRenderer 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 interface InlineRenderer<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 interface InlineRenderer<ItemInlineData>
      Parameters:
      data - the data to render.
      context - a DrawContext with a MatrixStack set to the correct position for this character and with a VertexConsumerProvider 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

      public int charWidth(ItemInlineData data, net.minecraft.text.Style style, int codepoint)
      Description copied from interface: InlineRenderer
      Gets the width of the render without doing the rendering.
      Specified by:
      charWidth in interface InlineRenderer<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

      public GlowHandling getGlowPreference(ItemInlineData forData)
      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. See GlowHandling for more details.
      Specified by:
      getGlowPreference in interface InlineRenderer<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.