Class TitleScreenButton
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractButton
net.minecraft.client.gui.components.Button
io.github.pixelmk.pixelmkmenu.gui.components.TitleScreenButton
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener,net.minecraft.client.gui.components.Renderable,net.minecraft.client.gui.components.TabOrderedElement,net.minecraft.client.gui.layouts.LayoutElement,net.minecraft.client.gui.narration.NarratableEntry,net.minecraft.client.gui.narration.NarrationSupplier,net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
public class TitleScreenButton
extends net.minecraft.client.gui.components.Button
Button that appears on the Pixel MK title screen.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.minecraft.client.gui.components.Button
net.minecraft.client.gui.components.Button.CreateNarration, net.minecraft.client.gui.components.Button.OnPressNested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intOffset on the vertical.booleanIs this button aligned to the right of the screen.Fields inherited from class net.minecraft.client.gui.components.Button
BIG_WIDTH, createNarration, DEFAULT_HEIGHT, DEFAULT_NARRATION, DEFAULT_SPACING, DEFAULT_WIDTH, onPress, SMALL_WIDTHFields inherited from class net.minecraft.client.gui.components.AbstractButton
SPRITES, TEXT_MARGINFields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTakes in a button builder to build aTitleScreenButton.TitleScreenButton(net.minecraft.client.gui.components.Button button) -
Method Summary
Modifier and TypeMethodDescriptionstatic TitleScreenButton.Builderbuilder(net.minecraft.network.chat.Component message, net.minecraft.client.gui.components.Button.OnPress onPress) Get a button builder from just the message component and the onPress action.static TitleScreenButton.Builderbuilder(net.minecraft.network.chat.Component message, net.minecraft.client.gui.components.Button.OnPress onPress, boolean rightAlign) Get a button builder from just the message component and the onPress action.voiddrawButtonBackground(net.minecraft.client.gui.GuiGraphics guiGraphics, Boolean mouseOver, int hightlightAlpha, int highlightRGBCol) Wrapper to configure params passed todrawRect.voiddrawButtonText(boolean mouseOver, net.minecraft.client.gui.GuiGraphics guiGraphics) Draws and colours text of the button.static voiddrawRect(net.minecraft.client.gui.GuiGraphics guiGraphics, int x1, int y1, int x2, int y2, int colour, int offset) Draws the parallelogram for the button.final net.minecraft.network.chat.ComponentReturns the apropriate message of the button.voidplayDownSound(net.minecraft.client.sounds.SoundManager soundManager) Empty method to remove the sound of clicking a button.protected voidrenderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) voidupdateButton(int updateCounter, float partialTick, int mouseX, int mouseY) Updates the button's propertys per tick.Methods inherited from class net.minecraft.client.gui.components.Button
createNarrationMessage, onPress, updateWidgetNarrationMethods inherited from class net.minecraft.client.gui.components.AbstractButton
keyPressed, onClick, renderStringMethods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, defaultButtonNarrationText, getBottom, getFGColor, getHeight, getRectangle, getRight, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, nextFocusPath, onDrag, onRelease, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setFocused, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
charTyped, getCurrentFocusPath, keyReleased, mouseMoved, mouseScrolledMethods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClickMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
-
Field Details
-
offsetY
public final int offsetYOffset on the vertical. -
rightAlign
public boolean rightAlignIs this button aligned to the right of the screen.
-
-
Constructor Details
-
TitleScreenButton
public TitleScreenButton(net.minecraft.client.gui.components.Button button)
-
Method Details
-
builder
public static TitleScreenButton.Builder builder(net.minecraft.network.chat.Component message, net.minecraft.client.gui.components.Button.OnPress onPress) Get a button builder from just the message component and the onPress action.- Parameters:
message- message component to be displayed.onPress- action on press.- Returns:
- the button builder.
-
builder
public static TitleScreenButton.Builder builder(net.minecraft.network.chat.Component message, net.minecraft.client.gui.components.Button.OnPress onPress, boolean rightAlign) Get a button builder from just the message component and the onPress action.- Parameters:
message- message component to be displayed.onPress- action on press.rightAlign- is this button aligned to the right of the screen?- Returns:
- the button builder.
-
drawRect
public static void drawRect(net.minecraft.client.gui.GuiGraphics guiGraphics, int x1, int y1, int x2, int y2, int colour, int offset) Draws the parallelogram for the button.- Parameters:
guiGraphics- GUI draw helperx1- bottom left corner xy1- bottom left corner yx2- top right corner xy2- top right corner ycolour- colour of the backgroundoffset- how slanted do you want the parallelogram
-
drawButtonBackground
public void drawButtonBackground(net.minecraft.client.gui.GuiGraphics guiGraphics, Boolean mouseOver, int hightlightAlpha, int highlightRGBCol) Wrapper to configure params passed todrawRect.- Parameters:
guiGraphics- GUI Graphics HelpermouseOver- is the mouse over the buttonhightlightAlpha- alpha transparencyhighlightRGBCol- RGB hex.
-
playDownSound
public void playDownSound(@Nonnull net.minecraft.client.sounds.SoundManager soundManager) Empty method to remove the sound of clicking a button.- Overrides:
playDownSoundin classnet.minecraft.client.gui.components.AbstractWidget
-
getMessage
public final net.minecraft.network.chat.Component getMessage()Returns the apropriate message of the button.- Overrides:
getMessagein classnet.minecraft.client.gui.components.AbstractWidget
-
renderWidget
protected void renderWidget(@Nonnull net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) - Overrides:
renderWidgetin classnet.minecraft.client.gui.components.AbstractButton
-
drawButtonText
public void drawButtonText(boolean mouseOver, net.minecraft.client.gui.GuiGraphics guiGraphics) Draws and colours text of the button.- Parameters:
mouseOver- is mouse over this widgetguiGraphics- graphics helper
-
updateButton
public void updateButton(int updateCounter, float partialTick, int mouseX, int mouseY) Updates the button's propertys per tick.Updates and sets the following fields:
lastTickNumberlastPartialTickalpha
alphais the most useful of these as it controls the state of the button.- Parameters:
updateCounter- the update counterpartialTick- current partial tickmouseX- mouse position on the horizontalmouseY- mouse position on the vertical
-