Class VFPListEntry
java.lang.Object
net.minecraft.client.gui.components.ObjectSelectionList.Entry<VFPListEntry>
com.viaversion.viafabricplus.screen.VFPListEntry
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.layouts.LayoutElement, net.minecraft.client.gui.narration.NarrationSupplier
- Direct Known Subclasses:
BedrockRealmsScreen.SlotEntry, BetaCraftScreen.ServerSlot, BooleanListEntry, ButtonListEntry, ClassiCubeServerListScreen.ServerSlot, ModeListEntry, PerServerVersionScreen.SharedSlot, ProtocolSelectionScreen.ProtocolSlot, TitleEntry, VersionedBooleanListEntry
public abstract class VFPListEntry
extends net.minecraft.client.gui.components.ObjectSelectionList.Entry<VFPListEntry>
This class is a wrapper for the
ObjectSelectionList.Entry class.
Features included:
- Add wrapper function
mappedRender(GuiGraphicsExtractor, int, int, int, int, int, int, boolean, float)for:- cross-sharing entry position/dimension between other helper functions
- Setting the entry position as start inside the
PoseStack - rendering a default background
- Adds
mappedMouseClicked(double, double, int)to automatically play a click sound - Adds some more utility functions, see
renderScrollableText(Component, int, int)andrenderTooltip(Component, int, int)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextractContent(@NonNull net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean hovered, float deltaTicks) Automatically draws a background for the slot with the slot's dimension and calls themappedRender(GuiGraphicsExtractor, int, int, int, int, int, int, boolean, float)methodvoidmappedMouseClicked(double mouseX, double mouseY, int button) voidmappedRender(net.minecraft.client.gui.GuiGraphicsExtractor context, int x, int y, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) booleanmouseClicked(net.minecraft.client.input.MouseButtonEvent click, boolean doubled) Automatically plays a click sound and calls themappedMouseClicked(double, double, int)methodvoidrenderScrollableText(net.minecraft.network.chat.Component name, int offset) voidrenderScrollableText(net.minecraft.network.chat.Component text, int textY, int offset) Automatically scrolls the text if it is too long to be displayed in the slot.voidrenderTooltip(@Nullable net.minecraft.network.chat.Component tooltip, int mouseX, int mouseY) Draws a tooltip if the mouse is hovering over the slotMethods inherited from class net.minecraft.client.gui.components.ObjectSelectionList.Entry
getNarration, updateNarrationMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
charTyped, getBorderForArrowNavigation, getCurrentFocusPath, keyPressed, keyReleased, mouseDragged, mouseMoved, mouseReleased, mouseScrolled, nextFocusPath, preeditUpdated, shouldTakeFocusAfterInteractionMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPositionMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
SCISSORS_OFFSET
protected static final int SCISSORS_OFFSET- See Also:
-
SLOT_MARGIN
public static final int SLOT_MARGIN- See Also:
-
-
Constructor Details
-
VFPListEntry
public VFPListEntry()
-
-
Method Details
-
mappedRender
public void mappedRender(net.minecraft.client.gui.GuiGraphicsExtractor context, int x, int y, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) -
mappedMouseClicked
public void mappedMouseClicked(double mouseX, double mouseY, int button) -
mouseClicked
public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent click, boolean doubled) Automatically plays a click sound and calls themappedMouseClicked(double, double, int)method- Specified by:
mouseClickedin interfacenet.minecraft.client.gui.components.events.GuiEventListener- Overrides:
mouseClickedin classnet.minecraft.client.gui.components.ObjectSelectionList.Entry<VFPListEntry>
-
renderScrollableText
public void renderScrollableText(net.minecraft.network.chat.Component name, int offset) -
renderScrollableText
public void renderScrollableText(net.minecraft.network.chat.Component text, int textY, int offset) Automatically scrolls the text if it is too long to be displayed in the slot. The text will be scrolled from right to left- Parameters:
text- The text that should be displayedtextY- The Y position of the textoffset- The offset of the text from the left side of the slot, this is used to calculate the width of the text, which should be scrolled
-
renderTooltip
public void renderTooltip(@Nullable @Nullable net.minecraft.network.chat.Component tooltip, int mouseX, int mouseY) Draws a tooltip if the mouse is hovering over the slot- Parameters:
tooltip- The tooltip that should be displayedmouseX- The current mouse X positionmouseY- The current mouse Y position
-
extractContent
public void extractContent(@NonNull net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean hovered, float deltaTicks) Automatically draws a background for the slot with the slot's dimension and calls themappedRender(GuiGraphicsExtractor, int, int, int, int, int, int, boolean, float)method
-