Package org.cyclops.cyclopscore.infobook
Class InfoSection
java.lang.Object
org.cyclops.cyclopscore.infobook.InfoSection
- Direct Known Subclasses:
InfoSectionTagIndex
Section of the info book.
Can have child sections.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionInfoSection
(IInfoBook infoBook, InfoSection parent, int childIndex, String translationKey, List<String> paragraphs, List<SectionAppendix> appendixes, ArrayList<String> tagList) Deprecated.InfoSection
(IInfoBook infoBook, InfoSection parent, int childIndex, String translationKey, List<String> paragraphs, List<SectionAppendix> appendixes, ArrayList<String> tagList, ModBase<?> mod) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdvancedButton
(int page, AdvancedButton advancedButton) <T extends AdvancedButton>
voidaddAdvancedButtons
(int page, Collection<T> advancedButtons) 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.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.protected static void
constructAllLinks
(InfoSection root, Map<String, org.apache.commons.lang3.tuple.Pair<InfoSection, Integer>> softLinks, int indent, int maxDepth) 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.static String
formatString
(String string) Give the correct format to a string.getAdvancedButtons
(int page) protected static int
getAppendixLineHeight
(SectionAppendix appendix, net.minecraft.client.gui.Font fontRenderer) protected static int
getAppendixOffsetLine
(net.minecraft.client.gui.Font fontRenderer, SectionAppendix appendix) int
static int
getFontHeight
(net.minecraft.client.gui.Font fontRenderer) getLinks
(int page) protected List<net.minecraft.util.FormattedCharSequence>
getLocalizedPageLines
(int page) getNext
(int page, boolean stepSection) Get the next InfoSection relative to this one plus page in this tree hierarchy using pre-order traversal.int
getPages()
getPrevious
(int page, boolean stepSection) Get the previous InfoSection relative to this one plus page in this tree hierarchy using pre-order traversal.getSubSection
(int index) int
getTags()
boolean
isRoot()
boolean
isTitlePage
(int page) 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.void
registerSection
(InfoSection section) protected boolean
protected static List<net.minecraft.util.FormattedCharSequence>
trimStringToWidth
(net.minecraft.client.gui.Font fontRenderer, net.minecraft.network.chat.FormattedText text, int width)
-
Field Details
-
paragraphs
-
-
Constructor Details
-
InfoSection
public InfoSection(IInfoBook infoBook, InfoSection parent, int childIndex, String translationKey, List<String> paragraphs, List<SectionAppendix> appendixes, ArrayList<String> tagList, ModBase<?> mod) -
InfoSection
@Deprecated public InfoSection(IInfoBook infoBook, InfoSection parent, int childIndex, String translationKey, List<String> paragraphs, List<SectionAppendix> appendixes, ArrayList<String> tagList) Deprecated.
-
-
Method Details
-
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 widthmaxLines
- 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
-
getPages
public int getPages() -
formatString
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
-
getLocalizedTitle
-
getSubSections
public int getSubSections() -
getSubSection
-
getParent
-
isRoot
public boolean isRoot() -
getChildIndex
public int getChildIndex() -
getLinks
-
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 objectmouseX
- 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 xfootnoteOffsetY
- 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
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
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
-
getAdvancedButtons
-
addAdvancedButton
-
addAdvancedButtons
-