Class WidgetNumberField
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.EditBox
org.cyclops.cyclopscore.client.gui.component.input.WidgetTextFieldExtended
org.cyclops.cyclopscore.client.gui.component.input.WidgetNumberField
- 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
A number field which by default only accepts positive numbers.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
-
Field Summary
Fields inherited from class net.minecraft.client.gui.components.EditBox
BACKWARDS, DEFAULT_TEXT_COLOR, FORWARDS
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
ACCESSIBILITY_TEXTURE, active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorDescriptionWidgetNumberField
(net.minecraft.client.gui.Font fontrenderer, int x, int y, int width, int height, boolean arrows, net.minecraft.network.chat.Component narrationMessage, boolean background) -
Method Summary
Modifier and TypeMethodDescriptionboolean
charTyped
(char typedChar, int keyCode) protected void
decrease()
protected int
double
float
getFloat()
int
getInt()
int
int
protected void
increase()
boolean
boolean
keyPressed
(int typedChar, int keyCode, int modifiers) boolean
mouseClicked
(double mouseX, double mouseY, int mouseButton) void
renderWidget
(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) void
setEditable
(boolean enabled) void
setMaxValue
(int maxValue) void
setMinValue
(int minValue) void
setPositiveOnly
(boolean positiveOnly) void
protected void
double
validateNumber
(double number) float
validateNumber
(float number) int
validateNumber
(int number) Methods inherited from class org.cyclops.cyclopscore.client.gui.component.input.WidgetTextFieldExtended
drawBackground, getInnerWidth, setListener
Methods inherited from class net.minecraft.client.gui.components.EditBox
canConsumeInput, createNarrationMessage, deleteChars, deleteWords, getCursorPosition, getHighlighted, getScreenX, getValue, getWordPosition, insertText, isMouseOver, isVisible, moveCursor, moveCursorTo, moveCursorToEnd, moveCursorToStart, nextFocusPath, onClick, playDownSound, setBordered, setCanLoseFocus, setCursorPosition, setFilter, setFocused, setFormatter, setHighlightPos, setHint, setMaxLength, setResponder, setSuggestion, setTextColor, setTextColorUneditable, setVisible, tick, updateWidgetNarration
Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, createTooltipPositioner, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getRectangle, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isValidClickButton, mouseDragged, mouseReleased, narrationPriority, onDrag, onRelease, render, renderScrollingString, renderScrollingString, renderTexture, setAlpha, setFGColor, setHeight, setMessage, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessage
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
getCurrentFocusPath, keyReleased, mouseMoved, mouseScrolled
Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
Methods inherited from interface net.minecraft.client.gui.components.Renderable
render
-
Constructor Details
-
WidgetNumberField
public WidgetNumberField(net.minecraft.client.gui.Font fontrenderer, int x, int y, int width, int height, boolean arrows, net.minecraft.network.chat.Component narrationMessage, boolean background)
-
-
Method Details
-
setEditable
public void setEditable(boolean enabled) - Overrides:
setEditable
in classnet.minecraft.client.gui.components.EditBox
-
isBordered
public boolean isBordered()- Overrides:
isBordered
in classnet.minecraft.client.gui.components.EditBox
-
setPositiveOnly
public void setPositiveOnly(boolean positiveOnly) -
getMinValue
public int getMinValue() -
setMinValue
public void setMinValue(int minValue) - Parameters:
minValue
- The minimal value (inclusive)
-
getMaxValue
public int getMaxValue() -
setMaxValue
public void setMaxValue(int maxValue) - Parameters:
maxValue
- The maximal value (inclusive)
-
getInt
- Throws:
NumberFormatException
-
getDouble
- Throws:
NumberFormatException
-
getFloat
- Throws:
NumberFormatException
-
renderWidget
public void renderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) - Overrides:
renderWidget
in classWidgetTextFieldExtended
-
validateNumber
public int validateNumber(int number) -
validateNumber
public double validateNumber(double number) -
validateNumber
public float validateNumber(float number) -
getDiffAmount
protected int getDiffAmount() -
increase
protected void increase() -
decrease
protected void decrease() -
setValue
- Overrides:
setValue
in classWidgetTextFieldExtended
-
charTyped
public boolean charTyped(char typedChar, int keyCode) - Specified by:
charTyped
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
charTyped
in classnet.minecraft.client.gui.components.EditBox
-
keyPressed
public boolean keyPressed(int typedChar, int keyCode, int modifiers) - Specified by:
keyPressed
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
keyPressed
in classnet.minecraft.client.gui.components.EditBox
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) - Specified by:
mouseClicked
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
mouseClicked
in classWidgetTextFieldExtended
-
updateArrowsState
protected void updateArrowsState()
-