Class DebugInfoSection

java.lang.Object
api.client.debug.DebugInfoSection

public class DebugInfoSection extends Object
  • Constructor Details

    • DebugInfoSection

      public DebugInfoSection(ResourceLocation identifier, int orderPriority)
  • Method Details

    • getID

      public ResourceLocation getID()
    • setOrderPriority

      public void setOrderPriority(int priority)
    • getOrderPriority

      public int getOrderPriority()
    • addEntry

      public void addEntry(IDebugInfoProvider provider)
      Example 1:
           mcSection.addEntry((mc, isExtended) -> Optional.of("test"));
       This will add the string 'test' to the entries of the section mcSection.
       


      Example 2:
       mcSection.addEntry((mc, isExtended) -> {
       String username = mc.thePlayer.username;
      
       if(isExtended) {
          return Optional.of(username);
       }
       else {
          return Optional.empty();
       }});
       This will add the username of the player to the section mcSection if isExtended is true
       and if false, will return an empty Optional which result in no text added to the section.
       
    • addEntryWithIndex

      public void addEntryWithIndex(IDebugInfoProvider provider, int index)
      Example 1:
           mcSection.addEntryWithIndex((mc, isExtendedDebug) -> Optional.of("test"), 3);
       This will add the string 'test' at the 4th line of the section mcSection and move next lines by 1 (starts at 0).
       


      Example 2:
       mcSection.addEntryWithIndex((mc, isExtended) -> {
       String username = mc.thePlayer.username;
      
       if(isExtended) {
          return Optional.of(username);
       }
       else {
          return Optional.empty();
       }}, 3);
       This will add the username of the player at the 4th line of the section mcSection if isExtended is true
       and if false, will return an empty Optional which result in no text added to the section.
       
    • removeEntry

      public void removeEntry(int entryOrdinal)
      Example:
           mcSection.removeEntry(1);
       This will remove the second entry of mcSection (start at 0).
       
      Parameters:
      entryOrdinal - entry's ordinal that need to be removed from this section's entries.
      Throws:
      RuntimeException - If the game try to remove a non-existing entry.
    • orderSection

      public void orderSection(ResourceLocation afterSectionID)
      Example: orderSection(B) -> "this section should be after section B"

      By default, this order have a priority of '0', higher priority sections orders will be placed before
      If multiple section have the same priority, the section registered first will be placed first

      Parameters:
      afterSectionID - section's id after which current section will be placed.
    • orderSection

      public void orderSection(ResourceLocation afterSectionID, int priority)
      Example: orderSection(B, n) -> "this section should be after section B with a priority 'n' "

      The highest priority section will be placed first.
      The highest priority section will be placed first.

      Parameters:
      afterSectionID - section's id after which current section will be placed.
    • getLines

      public List<String> getLines(Minecraft mc, boolean isExtendedDebug)
      Parameters:
      mc - The Minecraft instance.
      isExtendedDebug - Whether extended debug info is enabled.
      Returns:
      a list of String to draw in this section.