Class Slider
- All Implemented Interfaces:
IGuiEventListener
,IRenderable
This class is blatantly stolen from iChunUtils with permission.
- Author:
- iChun
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.widget.button.Button
Button.IPressable, Button.ITooltip
-
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.widget.button.Button
NO_TOOLTIP, onPress, onTooltip
Fields inherited from class net.minecraft.client.gui.widget.Widget
active, alpha, height, isHovered, nextNarration, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width, x, y
Fields inherited from class net.minecraft.client.gui.AbstractGui
BACKGROUND_LOCATION, GUI_ICONS_LOCATION, STATS_ICON_LOCATION
-
Constructor Summary
ConstructorDescriptionSlider
(int xPos, int yPos, int width, int height, ITextComponent prefix, ITextComponent suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.IPressable handler) Slider
(int xPos, int yPos, int width, int height, ITextComponent prefix, ITextComponent suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.IPressable handler, Slider.ISlider par) Slider
(int xPos, int yPos, ITextComponent displayStr, double minVal, double maxVal, double currentVal, Button.IPressable 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
renderBg
(MatrixStack mStack, Minecraft par1Minecraft, int par2, int par3) Fired when the mouse button is dragged.void
setValue
(double d) void
Methods inherited from class net.minecraftforge.fml.client.gui.widget.ExtendedButton
renderButton
Methods inherited from class net.minecraft.client.gui.widget.button.Button
onPress, renderToolTip
Methods inherited from class net.minecraft.client.gui.widget.button.AbstractButton
keyPressed
Methods inherited from class net.minecraft.client.gui.widget.Widget
changeFocus, clearFGColor, clicked, createNarrationMessage, getFGColor, getHeight, getMessage, getWidth, isFocused, isHovered, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrate, onDrag, onFocusedChanged, playDownSound, queueNarration, render, setAlpha, setFGColor, setFocused, setHeight, setMessage, setWidth
Methods inherited from class net.minecraft.client.gui.AbstractGui
blit, blit, blit, blit, blit, blitOutlineBlack, drawCenteredString, drawCenteredString, drawString, drawString, fill, 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.IGuiEventListener
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, ITextComponent prefix, ITextComponent suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.IPressable handler) -
Slider
public Slider(int xPos, int yPos, int width, int height, ITextComponent prefix, ITextComponent suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.IPressable handler, @Nullable Slider.ISlider par) -
Slider
public Slider(int xPos, int yPos, ITextComponent displayStr, double minVal, double maxVal, double currentVal, Button.IPressable 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. -
renderBg
Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). -
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). -
getValueInt
public int getValueInt() -
getValue
public double getValue() -
setValue
public void setValue(double d)
-