Package net.minecraft.client.gui.widget
Class Widget
- java.lang.Object
-
- net.minecraft.client.gui.AbstractGui
-
- net.minecraft.client.gui.widget.Widget
-
- All Implemented Interfaces:
IGuiEventListener
,IRenderable
- Direct Known Subclasses:
AbstractButton
,AbstractSlider
,GamemodeSelectionScreen.SelectorWidget
,RecipeOverlayGui.RecipeButtonWidget
,RecipeWidget
,TextFieldWidget
,ToggleWidget
public abstract class Widget extends AbstractGui implements IRenderable, IGuiEventListener
-
-
Field Summary
Fields Modifier and Type Field Description boolean
active
protected float
alpha
private boolean
focused
protected int
height
protected boolean
isHovered
private ITextComponent
message
protected long
nextNarration
protected int
packedFGColor
static int
UNSET_FG_COLOR
boolean
visible
private boolean
wasHovered
static ResourceLocation
WIDGETS_LOCATION
protected int
width
int
x
int
y
-
Fields inherited from class net.minecraft.client.gui.AbstractGui
BACKGROUND_LOCATION, GUI_ICONS_LOCATION, STATS_ICON_LOCATION
-
-
Constructor Summary
Constructors Constructor Description Widget(int p_i232254_1_, int p_i232254_2_, int p_i232254_3_, int p_i232254_4_, ITextComponent p_i232254_5_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
changeFocus(boolean p_231049_1_)
void
clearFGColor()
protected boolean
clicked(double p_230992_1_, double p_230992_3_)
protected IFormattableTextComponent
createNarrationMessage()
int
getFGColor()
int
getHeight()
ITextComponent
getMessage()
int
getWidth()
protected int
getYImage(boolean p_230989_1_)
boolean
isFocused()
boolean
isHovered()
boolean
isMouseOver(double p_231047_1_, double p_231047_3_)
protected boolean
isValidClickButton(int p_230987_1_)
boolean
mouseClicked(double p_231044_1_, double p_231044_3_, int p_231044_5_)
boolean
mouseDragged(double p_231045_1_, double p_231045_3_, int p_231045_5_, double p_231045_6_, double p_231045_8_)
boolean
mouseReleased(double p_231048_1_, double p_231048_3_, int p_231048_5_)
protected void
narrate()
void
onClick(double p_230982_1_, double p_230982_3_)
protected void
onDrag(double p_230983_1_, double p_230983_3_, double p_230983_5_, double p_230983_7_)
protected void
onFocusedChanged(boolean p_230995_1_)
void
onRelease(double p_231000_1_, double p_231000_3_)
void
playDownSound(SoundHandler p_230988_1_)
void
queueNarration(int p_230994_1_)
void
render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_)
protected void
renderBg(MatrixStack p_230441_1_, Minecraft p_230441_2_, int p_230441_3_, int p_230441_4_)
void
renderButton(MatrixStack p_230431_1_, int p_230431_2_, int p_230431_3_, float p_230431_4_)
void
renderToolTip(MatrixStack p_230443_1_, int p_230443_2_, int p_230443_3_)
void
setAlpha(float p_230986_1_)
void
setFGColor(int color)
protected void
setFocused(boolean p_230996_1_)
void
setHeight(int value)
void
setMessage(ITextComponent p_238482_1_)
void
setWidth(int p_230991_1_)
-
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, keyPressed, keyReleased, mouseMoved, mouseScrolled
-
-
-
-
Field Detail
-
WIDGETS_LOCATION
public static final ResourceLocation WIDGETS_LOCATION
-
width
protected int width
-
height
protected int height
-
x
public int x
-
y
public int y
-
message
private ITextComponent message
-
wasHovered
private boolean wasHovered
-
isHovered
protected boolean isHovered
-
active
public boolean active
-
visible
public boolean visible
-
alpha
protected float alpha
-
nextNarration
protected long nextNarration
-
focused
private boolean focused
-
UNSET_FG_COLOR
public static final int UNSET_FG_COLOR
- See Also:
- Constant Field Values
-
packedFGColor
protected int packedFGColor
-
-
Constructor Detail
-
Widget
public Widget(int p_i232254_1_, int p_i232254_2_, int p_i232254_3_, int p_i232254_4_, ITextComponent p_i232254_5_)
-
-
Method Detail
-
getHeight
public int getHeight()
-
getYImage
protected int getYImage(boolean p_230989_1_)
-
render
public void render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_)
- Specified by:
render
in interfaceIRenderable
-
narrate
protected void narrate()
-
createNarrationMessage
protected IFormattableTextComponent createNarrationMessage()
-
renderButton
public void renderButton(MatrixStack p_230431_1_, int p_230431_2_, int p_230431_3_, float p_230431_4_)
-
renderBg
protected void renderBg(MatrixStack p_230441_1_, Minecraft p_230441_2_, int p_230441_3_, int p_230441_4_)
-
onClick
public void onClick(double p_230982_1_, double p_230982_3_)
-
onRelease
public void onRelease(double p_231000_1_, double p_231000_3_)
-
onDrag
protected void onDrag(double p_230983_1_, double p_230983_3_, double p_230983_5_, double p_230983_7_)
-
mouseClicked
public boolean mouseClicked(double p_231044_1_, double p_231044_3_, int p_231044_5_)
- Specified by:
mouseClicked
in interfaceIGuiEventListener
-
mouseReleased
public boolean mouseReleased(double p_231048_1_, double p_231048_3_, int p_231048_5_)
- Specified by:
mouseReleased
in interfaceIGuiEventListener
-
isValidClickButton
protected boolean isValidClickButton(int p_230987_1_)
-
mouseDragged
public boolean mouseDragged(double p_231045_1_, double p_231045_3_, int p_231045_5_, double p_231045_6_, double p_231045_8_)
- Specified by:
mouseDragged
in interfaceIGuiEventListener
-
clicked
protected boolean clicked(double p_230992_1_, double p_230992_3_)
-
isHovered
public boolean isHovered()
-
changeFocus
public boolean changeFocus(boolean p_231049_1_)
- Specified by:
changeFocus
in interfaceIGuiEventListener
-
onFocusedChanged
protected void onFocusedChanged(boolean p_230995_1_)
-
isMouseOver
public boolean isMouseOver(double p_231047_1_, double p_231047_3_)
- Specified by:
isMouseOver
in interfaceIGuiEventListener
-
renderToolTip
public void renderToolTip(MatrixStack p_230443_1_, int p_230443_2_, int p_230443_3_)
-
playDownSound
public void playDownSound(SoundHandler p_230988_1_)
-
getWidth
public int getWidth()
-
setWidth
public void setWidth(int p_230991_1_)
-
setHeight
public void setHeight(int value)
-
setAlpha
public void setAlpha(float p_230986_1_)
-
setMessage
public void setMessage(ITextComponent p_238482_1_)
-
queueNarration
public void queueNarration(int p_230994_1_)
-
getMessage
public ITextComponent getMessage()
-
isFocused
public boolean isFocused()
-
setFocused
protected void setFocused(boolean p_230996_1_)
-
getFGColor
public int getFGColor()
-
setFGColor
public void setFGColor(int color)
-
clearFGColor
public void clearFGColor()
-
-