Class ModMismatchDisconnectedScreen.MismatchInfoPanel

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement, NarratableEntry, NarrationSupplier
Enclosing class:
ModMismatchDisconnectedScreen

class ModMismatchDisconnectedScreen.MismatchInfoPanel extends ScrollPanel
  • Field Details

    • nameIndent

      private final int nameIndent
      See Also:
    • tableWidth

      private final int tableWidth
    • nameWidth

      private final int nameWidth
    • versionWidth

      private final int versionWidth
    • lineTable

      private List<org.apache.commons.lang3.tuple.Pair<FormattedCharSequence,FormattedCharSequence>> lineTable
    • contentSize

      private int contentSize
    • oneChannelPerEntry

      private boolean oneChannelPerEntry
  • Constructor Details

    • MismatchInfoPanel

      public MismatchInfoPanel(Minecraft client, int width, int height, int top, int left)
  • Method Details

    • updateListContent

      private void updateListContent()
    • sortAndMergeChannelData

      private Map<List<ResourceLocation>,Component> sortAndMergeChannelData(Map<ResourceLocation,Component> mismatchedChannelData)
      Iterates over the raw channel mismatch data and merges entries with the same reason component into one channel mismatch entry each. Due to the reason component always containing the display name of the mod that likely owns the associated channel, this step effectively groups channels by their most likely owning mod candidate, so users can see more easily which mods might be the culprits of the negotiation failure that caused this screen to appear.
      Parameters:
      mismatchedChannelData - The raw mismatched channel data received from the server, which might contain entries with duplicate channel mismatch reasons
      Returns:
      A map containing channel mismatch entries with unique reasons. Each channel mismatch entry contains the list of all channels that share the same reason component, mapped to that reason component.
    • splitLineToWidth

      private List<org.apache.commons.lang3.tuple.Pair<FormattedCharSequence,FormattedCharSequence>> splitLineToWidth(MutableComponent name, MutableComponent reason)
      Splits the raw channel namespace and mismatch reason strings, making them use multiple lines if needed, to fit within the table dimensions. The style assigned to the name element is then applied to the entire content row.
      Parameters:
      name - The first element of the content row, usually representing a table section header or a channel name entry
      reason - The second element of the content row, usually representing the reason why the channel is mismatched
      Returns:
      A list of table rows consisting of 2 elements each which consist of the same content as was given by the parameters, but split up to fit within the table dimensions.
    • toChannelComponent

      private MutableComponent toChannelComponent(List<ResourceLocation> ids, ChatFormatting color)
      Formats the given list of channel ids to a component which, depending on the current display mode of the list, will list either the first or all channel ids. If only one channel id is shown, the amount of channels that have the same reason component will also be displayed next to the channel id. The component is colored in the given color, which will be used for the whole content row.
      Parameters:
      ids - The list of channel ids to be formatted to the component. Depending on the current list mode, either the full list or the first entry will be used for the component text.
      color - Defines the color of the returned component.
      Returns:
      A component with one or all entries of the channel id list as the main text component, and an assigned color which will be used for the whole content row.
    • toggleSimplifiedView

      public void toggleSimplifiedView()
    • getContentHeight

      protected int getContentHeight()
      Specified by:
      getContentHeight in class ScrollPanel
    • drawPanel

      protected void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY)
      Description copied from class: ScrollPanel
      Draw anything special on the screen. Scissor (RenderSystem.enableScissor) is enabled for anything that is rendered outside the view box. Do not mess with Scissor unless you support this.
      Specified by:
      drawPanel in class ScrollPanel
    • render

      public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
      Specified by:
      render in interface Renderable
      Overrides:
      render in class ScrollPanel
    • getComponentStyleAt

      public Style getComponentStyleAt(double x, double y)
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Specified by:
      mouseClicked in interface ContainerEventHandler
      Specified by:
      mouseClicked in interface GuiEventListener
      Overrides:
      mouseClicked in class ScrollPanel
    • narrationPriority

      public NarratableEntry.NarrationPriority narrationPriority()
    • updateNarration

      public void updateNarration(NarrationElementOutput output)