Class ModMismatchDisconnectedScreen.MismatchInfoPanel

java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.neoforged.neoforge.client.gui.widget.ScrollPanel
net.neoforged.neoforge.client.gui.ModMismatchDisconnectedScreen.MismatchInfoPanel
All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier
Enclosing class:
ModMismatchDisconnectedScreen

class ModMismatchDisconnectedScreen.MismatchInfoPanel extends ScrollPanel
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private List<org.apache.commons.lang3.tuple.Pair<net.minecraft.util.FormattedCharSequence,net.minecraft.util.FormattedCharSequence>>
     
    private final int
     
    private final int
     
    private boolean
     
    private final int
     
    private final int
     

    Fields inherited from class net.neoforged.neoforge.client.gui.widget.ScrollPanel

    border, bottom, captureMouse, height, left, right, scrollDistance, top, width

    Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    MismatchInfoPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    drawPanel(net.minecraft.client.gui.GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY)
    Draw anything special on the screen.
    net.minecraft.network.chat.Style
    getComponentStyleAt(double x, double y)
     
    protected int
     
    boolean
    mouseClicked(double mouseX, double mouseY, int button)
     
    net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
     
    void
    render(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
     
    private Map<List<net.minecraft.resources.ResourceLocation>,net.minecraft.network.chat.Component>
    sortAndMergeChannelData(Map<net.minecraft.resources.ResourceLocation,net.minecraft.network.chat.Component> mismatchedChannelData)
    Iterates over the raw channel mismatch data and merges entries with the same reason component into one channel mismatch entry each.
    private List<org.apache.commons.lang3.tuple.Pair<net.minecraft.util.FormattedCharSequence,net.minecraft.util.FormattedCharSequence>>
    splitLineToWidth(net.minecraft.network.chat.MutableComponent name, net.minecraft.network.chat.MutableComponent reason)
    Splits the raw channel namespace and mismatch reason strings, making them use multiple lines if needed, to fit within the table dimensions.
    private net.minecraft.network.chat.MutableComponent
    toChannelComponent(List<net.minecraft.resources.ResourceLocation> ids, net.minecraft.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.
    void
     
    private void
     
    void
    updateNarration(net.minecraft.client.gui.narration.NarrationElementOutput output)
     

    Methods inherited from class net.neoforged.neoforge.client.gui.widget.ScrollPanel

    children, clickPanel, drawBackground, drawGradientRect, getScrollAmount, isMouseOver, mouseDragged, mouseReleased, mouseScrolled

    Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler

    getFocused, isDragging, setDragging, setFocused

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler

    charTyped, getChildAt, getCurrentFocusPath, isFocused, keyPressed, keyReleased, nextFocusPath, setFocused

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    getBorderForArrowNavigation, getRectangle, mouseMoved

    Methods inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    getNarratables, isActive

    Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement

    getTabOrderGroup
  • 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<net.minecraft.util.FormattedCharSequence,net.minecraft.util.FormattedCharSequence>> lineTable
    • contentSize

      private int contentSize
    • oneChannelPerEntry

      private boolean oneChannelPerEntry
  • Constructor Details

    • MismatchInfoPanel

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

    • updateListContent

      private void updateListContent()
    • sortAndMergeChannelData

      private Map<List<net.minecraft.resources.ResourceLocation>,net.minecraft.network.chat.Component> sortAndMergeChannelData(Map<net.minecraft.resources.ResourceLocation,net.minecraft.network.chat.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<net.minecraft.util.FormattedCharSequence,net.minecraft.util.FormattedCharSequence>> splitLineToWidth(net.minecraft.network.chat.MutableComponent name, net.minecraft.network.chat.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 net.minecraft.network.chat.MutableComponent toChannelComponent(List<net.minecraft.resources.ResourceLocation> ids, net.minecraft.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(net.minecraft.client.gui.GuiGraphics guiGraphics, int entryRight, int relativeY, 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(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
      Specified by:
      render in interface net.minecraft.client.gui.components.Renderable
      Overrides:
      render in class ScrollPanel
    • getComponentStyleAt

      public net.minecraft.network.chat.Style getComponentStyleAt(double x, double y)
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseClicked in class ScrollPanel
    • narrationPriority

      public net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority narrationPriority()
    • updateNarration

      public void updateNarration(net.minecraft.client.gui.narration.NarrationElementOutput output)