Class Slider
- java.lang.Object
-
- All Implemented Interfaces:
IGuiEventListener
,IRenderable
public class Slider extends ExtendedButton
This class is blatantly stolen from iChunUtils with permission.- Author:
- iChun
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Slider.ISlider
-
Nested classes/interfaces inherited from class net.minecraft.client.gui.widget.button.Button
Button.IPressable, Button.ITooltip
-
-
Field Summary
Fields Modifier and Type Field Description ITextComponent
dispString
boolean
dragging
Is this slider control being dragged.boolean
drawString
double
maxValue
double
minValue
Slider.ISlider
parent
int
precision
boolean
showDecimal
double
sliderValue
The value of this slider control.ITextComponent
suffix
-
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
Constructors Constructor Description 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(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getValue()
int
getValueInt()
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
updateSlider()
-
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 Detail
-
sliderValue
public double sliderValue
The value of this slider control.
-
dispString
public ITextComponent dispString
-
dragging
public boolean dragging
Is this slider control being dragged.
-
showDecimal
public boolean showDecimal
-
minValue
public double minValue
-
maxValue
public double maxValue
-
precision
public int precision
-
parent
@Nullable public Slider.ISlider parent
-
suffix
public ITextComponent suffix
-
drawString
public boolean drawString
-
-
Constructor Detail
-
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 Detail
-
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
protected void renderBg(MatrixStack mStack, Minecraft par1Minecraft, int par2, int par3)
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)
-
-