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:
ContainerEventHandler
,GuiEventListener
,Renderable
,TabOrderedElement
,NarratableEntry
,NarrationSupplier
- Enclosing class:
ModMismatchDisconnectedScreen
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
private List
<org.apache.commons.lang3.tuple.Pair<FormattedCharSequence, 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
ConstructorDescriptionMismatchInfoPanel
(Minecraft client, int width, int height, int top, int left) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
drawPanel
(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) Draw anything special on the screen.getComponentStyleAt
(double x, double y) protected int
boolean
mouseClicked
(double mouseX, double mouseY, int button) void
render
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) 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.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.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.void
private void
void
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
getRectangle, mouseMoved
Methods inherited from interface net.minecraft.client.gui.narration.NarratableEntry
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<FormattedCharSequence,FormattedCharSequence>> lineTable -
contentSize
private int contentSize -
oneChannelPerEntry
private boolean oneChannelPerEntry
-
-
Constructor Details
-
MismatchInfoPanel
-
-
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 entryreason
- 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
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 classScrollPanel
-
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 classScrollPanel
-
render
- Specified by:
render
in interfaceRenderable
- Overrides:
render
in classScrollPanel
-
getComponentStyleAt
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) - Specified by:
mouseClicked
in interfaceContainerEventHandler
- Specified by:
mouseClicked
in interfaceGuiEventListener
- Overrides:
mouseClicked
in classScrollPanel
-
narrationPriority
-
updateNarration
-