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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInfoSection
(IInfoBook infoBook, InfoSection parent, int childIndex, String translationKey, List<String> paragraphs, List<SectionAppendix> appendixes, ArrayList<String> tagList, ModBaseNeoForge<?> 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) 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) getMod()
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
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, ModBaseNeoForge<?> mod)
-
-
Method Details
-
getAppendixes
-
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
-
constructInfoSectionClient
-
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
-
getInfoBook
-
getMod
-
getTranslationKey
-