Class InfoSection

java.lang.Object
org.cyclops.cyclopscore.infobook.InfoSection
Direct Known Subclasses:
InfoSectionTagIndex

public class InfoSection extends Object
Section of the info book. Can have child sections.
  • Field Details

  • Constructor Details

  • Method Details

    • getRelativeWebPath

      public String getRelativeWebPath()
    • addLinks

      protected void addLinks(int maxLines, int lineHeight, int yOffset, Map<String,org.apache.commons.lang3.tuple.Pair<InfoSection,Integer>> softLinks)
      Add all links from the given map to this section, starting from page 0.
      Parameters:
      maxLines - The maximum amount of lines per page.
      lineHeight - The line height.
      yOffset - The y gui offset.
      softLinks - The map of links.
    • shouldAddIndex

      protected boolean shouldAddIndex()
    • constructAllLinks

      protected static void constructAllLinks(InfoSection root, Map<String,org.apache.commons.lang3.tuple.Pair<InfoSection,Integer>> softLinks, int indent, int maxDepth)
    • bakeSection

      public void bakeSection(net.minecraft.client.gui.Font fontRenderer, int width, int maxLines, int lineHeight, int yOffset)
      Will make a localized version of this section with a variable amount of paragraphs. Must be called once before the section will be drawn.
      Parameters:
      fontRenderer - The font renderer.
      width - Section width
      maxLines - The maximum amount of lines per page.
      lineHeight - The line height.
      yOffset - The y gui offset.
    • trimStringToWidth

      protected static List<net.minecraft.util.FormattedCharSequence> trimStringToWidth(net.minecraft.client.gui.Font fontRenderer, net.minecraft.network.chat.FormattedText text, int width)
    • getAppendixLineHeight

      protected static int getAppendixLineHeight(SectionAppendix appendix, net.minecraft.client.gui.Font fontRenderer)
    • getFontHeight

      public static int getFontHeight(net.minecraft.client.gui.Font fontRenderer)
    • isTitlePage

      public boolean isTitlePage(int page)
    • registerSection

      public void registerSection(InfoSection section)
    • getPages

      public int getPages()
    • formatString

      public static String formatString(String string)
      Give the correct format to a string. Will allow the convenient "&" format codes to be used instead of "ยง": http://minecraft.gamepedia.com/Formatting_codes Will also refresh all formats at the end of the string. This will replace "&N"'s with a newlines.
      Parameters:
      string - The string to format.
      Returns:
      The formatted string.
    • getLocalizedPageLines

      protected List<net.minecraft.util.FormattedCharSequence> getLocalizedPageLines(int page)
    • getLocalizedTitle

      public String getLocalizedTitle()
    • getSubSections

      public int getSubSections()
    • getSubSection

      public InfoSection getSubSection(int index)
    • getParent

      public InfoSection getParent()
    • isRoot

      public boolean isRoot()
    • getChildIndex

      public int getChildIndex()
    • getLinks

      public List<HyperLink> getLinks(int page)
    • drawScreen

      public void drawScreen(ScreenInfoBook gui, net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, int yOffset, int width, int height, int page, int mx, int my, int footnoteOffsetX, int footnoteOffsetY)
      Draw the screen for a given page.
      Parameters:
      gui - The gui.
      guiGraphics - The gui graphics object
      mouseX - X.
      mouseY - Y.
      yOffset - The y offset.
      width - The width of the page.
      height - The height of the page.
      page - The page to render.
      mx - Mouse X.
      my - Mouse Y.
      footnoteOffsetX - Footnote offset x
      footnoteOffsetY - Footnote offset y
    • postDrawScreen

      public void postDrawScreen(ScreenInfoBook gui, net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, int width, int height, int page, int mx, int my)
      Draw the overlays for the given page, for tooltips and such.
      Parameters:
      gui - The gui.
      guiGraphics - The gui graphics object.
      mouseX - X.
      mouseY - Y.
      width - The width of the page.
      height - The height of the page.
      page - The page to render.
      mx - Mouse X.
      my - Mouse Y.
    • getNext

      public InfoSection.Location getNext(int page, boolean stepSection)
      Get the next InfoSection relative to this one plus page in this tree hierarchy using pre-order traversal.
      Parameters:
      page - The current page.
      stepSection - Take a complete section as traversal step.
      Returns:
      The next location or the current location if this was the last location.
    • getPrevious

      public InfoSection.Location getPrevious(int page, boolean stepSection)
      Get the previous InfoSection relative to this one plus page in this tree hierarchy using pre-order traversal.
      Parameters:
      page - The current page.
      stepSection - Take a complete section as traversal step.
      Returns:
      The previous location or the current location if this was the last location.
    • getAppendixOffsetLine

      protected static int getAppendixOffsetLine(net.minecraft.client.gui.Font fontRenderer, SectionAppendix appendix)
    • getTags

      public ArrayList<String> getTags()
    • getAdvancedButtons

      public List<AdvancedButton> getAdvancedButtons(int page)
    • addAdvancedButton

      public void addAdvancedButton(int page, AdvancedButton advancedButton)
    • addAdvancedButtons

      public <T extends AdvancedButton> void addAdvancedButtons(int page, Collection<T> advancedButtons)