Class ExtendedButton
java.lang.Object
net.minecraft.client.gui.GuiComponent
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractButton
net.minecraft.client.gui.components.Button
net.minecraftforge.client.gui.widget.ExtendedButton
- All Implemented Interfaces:
GuiEventListener
,Renderable
,NarratableEntry
,NarrationSupplier
- Direct Known Subclasses:
UnicodeGlyphButton
This class provides a button that fixes several bugs present in the vanilla GuiButton drawing code.
The gist of it is that it allows buttons of any size without gaps in the graphics and with the
borders drawn properly. It also prevents button text from extending out of the sides of the button by
trimming the end of the string and adding an ellipsis.
The code that handles drawing the button is in GuiUtils.
The code that handles drawing the button is in GuiUtils.
- Author:
- bspkrs
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.components.Button
Button.Builder, Button.CreateNarration, Button.OnPress
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
Fields inherited from class net.minecraft.client.gui.components.Button
createNarration, DEFAULT_HEIGHT, DEFAULT_NARRATION, DEFAULT_WIDTH, onPress, SMALL_WIDTH
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width
Fields inherited from class net.minecraft.client.gui.GuiComponent
BACKGROUND_LOCATION, GUI_ICONS_LOCATION, STATS_ICON_LOCATION
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorDescriptionExtendedButton
(int xPos, int yPos, int width, int height, Component displayString, Button.OnPress handler) ExtendedButton
(int xPos, int yPos, int width, int height, Component displayString, Button.OnPress handler, Button.CreateNarration createNarration) ExtendedButton
(Button.Builder builder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
renderButton
(PoseStack poseStack, int mouseX, int mouseY, float partialTick) Draws this button to the screen.Methods inherited from class net.minecraft.client.gui.components.Button
builder, createNarrationMessage, onPress, updateWidgetNarration
Methods inherited from class net.minecraft.client.gui.components.AbstractButton
keyPressed, onClick
Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
changeFocus, clearFGColor, clicked, createTooltipPositioner, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getWidth, getX, getY, getYImage, isActive, isFocused, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, onDrag, onFocusedChanged, onRelease, playDownSound, render, renderBg, setAlpha, setFGColor, setFocused, setHeight, setMessage, setPosition, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, wrapDefaultNarrationMessage
Methods inherited from class net.minecraft.client.gui.GuiComponent
blit, blit, blit, blit, blit, blitOutlineBlack, disableScissor, drawCenteredString, drawCenteredString, drawCenteredString, drawString, drawString, drawString, enableScissor, fill, fillGradient, fillGradient, fillGradient, getBlitOffset, hLine, setBlitOffset, vLine
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.GuiEventListener
charTyped, keyReleased, mouseMoved, mouseScrolled
-
Constructor Details
-
ExtendedButton
public ExtendedButton(int xPos, int yPos, int width, int height, Component displayString, Button.OnPress handler) -
ExtendedButton
public ExtendedButton(int xPos, int yPos, int width, int height, Component displayString, Button.OnPress handler, Button.CreateNarration createNarration) -
ExtendedButton
-
-
Method Details
-
renderButton
Draws this button to the screen.- Overrides:
renderButton
in classAbstractWidget
-