Interface WebRenderingContext

All Known Subinterfaces:
CustomElementWebRenderingContext, RecipeWebRenderingContext

@Experimental @NonExtendable public interface WebRenderingContext
  • Method Summary

    Modifier and Type
    Method
    Description
    compile(guideme.libs.mdast.model.MdAstNode node, guideme.libs.mdast.model.MdAstParent<?> parentNode)
    Returns the given node compiled to HTML.
    compileChildren(guideme.libs.mdast.model.MdAstParent<?> parentNode)
    Returns the children of this node compiled to HTML.
    Compile an error message to HTML.
    fluidIcon(String fluidId)
    Creates the icon of a fluid, or an error if the fluid was not exported.
    getAssetUrl(String assetPath)
    Resolves the path from the current page to the given asset, which is for example the path returned by an exported item icon.
    getAssetUrl(net.minecraft.resources.Identifier resource)
    Copies a resource from assets/<namespace>/<path> on the classpath of the website generator into the website and resolves the path from the current page to it.
    Resolves the path from the current page to another page.
    Access to the exported guide data.
    itemIcon(String itemId, boolean link)
    Creates the icon of an item.
    itemLink(String itemId, @Nullable HtmlFragment content)
    Creates a link to the primary page of the item, which shows the icon of the item on hover.
    void
    requireScript(String resourcePath)
    Includes a script from the classpath of the website generator on the current page.
    void
    requireStylesheet(String resourcePath)
    Includes a stylesheet from the classpath of the website generator on the current page, i.e.
  • Method Details

    • guide

      ExportedGuide guide()
      Access to the exported guide data.
    • getAssetUrl

      String getAssetUrl(String assetPath)
      Resolves the path from the current page to the given asset, which is for example the path returned by an exported item icon.
    • getAssetUrl

      String getAssetUrl(net.minecraft.resources.Identifier resource)
      Copies a resource from assets/<namespace>/<path> on the classpath of the website generator into the website and resolves the path from the current page to it. Use this for static images your renderers need, such as textures from your mods resources.
      Throws:
      IllegalArgumentException - If the resource does not exist.
    • requireStylesheet

      void requireStylesheet(String resourcePath)
      Includes a stylesheet from the classpath of the website generator on the current page, i.e. for the styles your renderer uses. Relative url(...) references in it are copied as well.
      Parameters:
      resourcePath - The path of the stylesheet on the classpath, i.e. modid/web/recipes.css.
      Throws:
      IllegalArgumentException - If the resource does not exist.
    • requireScript

      void requireScript(String resourcePath)
      Includes a script from the classpath of the website generator on the current page. It is loaded with the defer attribute.
      Parameters:
      resourcePath - The path of the script on the classpath, i.e. modid/web/recipes.js.
      Throws:
      IllegalArgumentException - If the resource does not exist.
    • getPageUrl

      String getPageUrl(String pageId)
      Resolves the path from the current page to another page.
      Throws:
      IllegalArgumentException - If the page does not exist.
    • itemIcon

      HtmlNode itemIcon(String itemId, boolean link)
      Creates the icon of an item.
      Parameters:
      link - If true, the icon links to the primary page of the item, if it has one, and shows the name of the item on hover.
    • fluidIcon

      HtmlNode fluidIcon(String fluidId)
      Creates the icon of a fluid, or an error if the fluid was not exported.
    • itemLink

      HtmlNode itemLink(String itemId, @Nullable HtmlFragment content)
      Creates a link to the primary page of the item, which shows the icon of the item on hover. If the item has no primary page, or it is the current page, no link is created.
      Parameters:
      content - The content of the link. If null, the name of the item is used.
    • compileError

      HtmlTag compileError(String message)
      Compile an error message to HTML.
    • compileChildren

      HtmlFragment compileChildren(guideme.libs.mdast.model.MdAstParent<?> parentNode)
      Returns the children of this node compiled to HTML.
      Returns:
      the children of this node compiled to HTML
    • compile

      HtmlFragment compile(guideme.libs.mdast.model.MdAstNode node, guideme.libs.mdast.model.MdAstParent<?> parentNode)
      Returns the given node compiled to HTML.
      Returns:
      the given node compiled to HTML