Class Slider
- All Implemented Interfaces:
GuiEventListener
,Widget
,NarratableEntry
,NarrationSupplier
This class is blatantly stolen from iChunUtils with permission.
- Author:
- iChun
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.components.Button
Button.OnPress, Button.OnTooltip
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Is this slider control being dragged.boolean
double
double
int
boolean
double
The value of this slider control.Fields inherited from class net.minecraft.client.gui.components.Button
NO_TOOLTIP, onPress, onTooltip
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width, x, y
Fields inherited from class net.minecraft.client.gui.GuiComponent
BACKGROUND_LOCATION, GUI_ICONS_LOCATION, STATS_ICON_LOCATION
-
Constructor Summary
ConstructorDescriptionSlider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.OnPress handler)
Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.OnPress handler, Slider.ISlider par)
Slider(int xPos, int yPos, Component displayStr, double minVal, double maxVal, double currentVal, Button.OnPress handler, Slider.ISlider par)
-
Method Summary
Modifier and TypeMethodDescriptiondouble
getValue()
int
int
getYImage(boolean par1)
Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over this button.void
onClick(double mouseX, double mouseY)
Returns true if the mouse has been pressed on this control.void
onRelease(double mouseX, double mouseY)
Fired when the mouse button is released.protected void
Fired when the mouse button is dragged.void
setValue(double d)
void
Methods inherited from class net.minecraftforge.fmlclient.gui.widget.ExtendedButton
renderButton
Methods inherited from class net.minecraft.client.gui.components.Button
onPress, renderToolTip, updateNarration
Methods inherited from class net.minecraft.client.gui.components.AbstractButton
keyPressed
Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
changeFocus, clearFGColor, clicked, createNarrationMessage, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getWidth, isActive, isFocused, isHovered, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, onDrag, onFocusedChanged, playDownSound, render, setAlpha, setFGColor, setFocused, setHeight, setMessage, setWidth, wrapDefaultNarrationMessage
Methods inherited from class net.minecraft.client.gui.GuiComponent
blit, blit, blit, blit, blit, blitOutlineBlack, drawCenteredString, drawCenteredString, drawCenteredString, drawString, drawString, drawString, 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
-
Field Details
-
sliderValue
public double sliderValueThe value of this slider control. -
dispString
-
dragging
public boolean draggingIs this slider control being dragged. -
showDecimal
public boolean showDecimal -
minValue
public double minValue -
maxValue
public double maxValue -
precision
public int precision -
parent
-
suffix
-
drawString
public boolean drawString
-
-
Constructor Details
-
Slider
public Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.OnPress handler) -
Slider
public Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.OnPress handler, @Nullable Slider.ISlider par) -
Slider
public Slider(int xPos, int yPos, Component displayStr, double minVal, double maxVal, double currentVal, Button.OnPress handler, Slider.ISlider par)
-
-
Method Details
-
getYImage
public int getYImage(boolean par1)Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over this button.- Overrides:
getYImage
in classAbstractWidget
-
renderBg
Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).- Overrides:
renderBg
in classAbstractWidget
-
onClick
public void onClick(double mouseX, double mouseY)Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent e).- Overrides:
onClick
in classAbstractButton
-
updateSlider
public void updateSlider() -
onRelease
public void onRelease(double mouseX, double mouseY)Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e).- Overrides:
onRelease
in classAbstractWidget
-
getValueInt
public int getValueInt() -
getValue
public double getValue() -
setValue
public void setValue(double d)
-