Package net.uku3lig.ukulib.config.screen
Class ColorSelectScreen
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.AbstractParentElement
net.minecraft.client.gui.screen.Screen
net.uku3lig.ukulib.config.screen.CloseableScreen
net.uku3lig.ukulib.config.screen.TextInputScreen<Integer>
net.uku3lig.ukulib.config.screen.ColorSelectScreen
- All Implemented Interfaces:
net.minecraft.client.gui.Drawable,net.minecraft.client.gui.Element,net.minecraft.client.gui.ParentElement,net.minecraft.client.gui.screen.TickableElement
A color selection screen.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant for full alpha (255) with no color.Fields inherited from class net.uku3lig.ukulib.config.screen.CloseableScreen
parentFields inherited from class net.minecraft.client.gui.screen.Screen
buttons, children, client, height, itemRenderer, passEvents, textRenderer, title, widthFields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE -
Constructor Summary
ConstructorsConstructorDescriptionColorSelectScreen(net.minecraft.text.Text title, net.minecraft.client.gui.screen.Screen parent, Consumer<Integer> callback, int last, ConfigManager<?> manager) Creates a color selection screen. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanSets if alpha is allowed along with the RGB color.Converts the contents of the text field to the type needed.protected byteThe default alpha value for the color.Formats the raw value to a String.protected voidinit()voidrender(net.minecraft.client.util.math.MatrixStack matrices, int mouseX, int mouseY, float delta) protected voidrenderColor(net.minecraft.client.util.math.MatrixStack matrices, int mouseX, int mouseY, float delta, int color) Renders the selected color on the screenMethods inherited from class net.uku3lig.ukulib.config.screen.TextInputScreen
getTextField, onClose, onTextChange, removedMethods inherited from class net.minecraft.client.gui.screen.Screen
addButton, addChild, children, filesDragged, getNarrationMessage, getTitle, getTooltipFromItem, handleTextClick, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, keyPressed, renderBackground, renderBackground, renderBackgroundTexture, renderOrderedTooltip, renderTextHoverEffect, renderTooltip, renderTooltip, renderTooltip, resize, sendMessage, sendMessage, shouldCloseOnEsc, tick, wrapScreenErrorMethods inherited from class net.minecraft.client.gui.AbstractParentElement
getFocused, isDragging, setDragging, setFocusedMethods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredText, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
mouseMovedMethods inherited from interface net.minecraft.client.gui.ParentElement
changeFocus, charTyped, focusOn, hoveredElement, keyReleased, mouseClicked, mouseDragged, mouseReleased, mouseScrolled, setInitialFocus
-
Field Details
-
FULL_ALPHA
public static final int FULL_ALPHAConstant for full alpha (255) with no color.
Can be used like this:color |= FULL_ALPHA.- See Also:
-
-
Constructor Details
-
ColorSelectScreen
public ColorSelectScreen(net.minecraft.text.Text title, net.minecraft.client.gui.screen.Screen parent, Consumer<Integer> callback, int last, ConfigManager<?> manager) Creates a color selection screen.- Parameters:
title- The title of the screenparent- The parent screencallback- The action to be done after the screen is closedlast- The last known colormanager- The config manager
-
-
Method Details
-
init
protected void init()- Overrides:
initin classTextInputScreen<Integer>
-
render
public void render(net.minecraft.client.util.math.MatrixStack matrices, int mouseX, int mouseY, float delta) - Specified by:
renderin interfacenet.minecraft.client.gui.Drawable- Overrides:
renderin classTextInputScreen<Integer>
-
renderColor
protected void renderColor(net.minecraft.client.util.math.MatrixStack matrices, int mouseX, int mouseY, float delta, int color) Renders the selected color on the screen- Parameters:
matrices- The matrix stackmouseX- The x position of the mousemouseY- The y position of the mousedelta- The time deltacolor- The chosen color
-
allowAlpha
protected boolean allowAlpha()Sets if alpha is allowed along with the RGB color.- Returns:
trueif allowed,falseotherwise
-
defaultAlpha
protected byte defaultAlpha()The default alpha value for the color. Default disables alpha.- Returns:
- The default alpha value
-
convert
Description copied from class:TextInputScreenConverts the contents of the text field to the type needed.- Specified by:
convertin classTextInputScreen<Integer>- Parameters:
value- The value of the text field, given by the user- Returns:
- An empty optional is the value is incorrect, else the converted value
-
format
Description copied from class:TextInputScreenFormats the raw value to a String. Useful when String#valueOf doesn't yield the correct result.- Overrides:
formatin classTextInputScreen<Integer>- Parameters:
value- The value to format- Returns:
- A string representation of the value
-