public interface GuiDescription
GUI descriptions contain the root panel and the property delegate of the GUI. They also manage the focused widget.
LightweightGuiDescription,
SyncedGuiDescription| Modifier and Type | Method and Description |
|---|---|
void |
addPainters()
Guis should use this method to add clientside styles and BackgroundPainters to their controls
|
void |
addSlotPeer(ValidatedSlot slot)
Typical users won't call this.
|
default void |
cycleFocus(boolean lookForwards)
Cycles the focused widget in the GUI.
|
@Nullable WWidget |
getFocus()
Gets the currently-focused WWidget.
|
@Nullable net.minecraft.screen.PropertyDelegate |
getPropertyDelegate()
Gets the object which manages the integer properties used by WBars and such.
|
WPanel |
getRootPanel() |
HorizontalAlignment |
getTitleAlignment()
Gets the horizontal alignment of the GUI title.
|
int |
getTitleColor() |
boolean |
isFocused(WWidget widget)
Tests whether the widget is the currently-focused one.
|
boolean |
isFullscreen()
Gets whether this GUI is fullscreen.
|
boolean |
isTitleVisible()
Gets whether the title of this GUI should be rendered by the screen.
|
void |
releaseFocus(WWidget widget)
Notifies this gui that the widget wants to give up its hold over focus.
|
void |
requestFocus(WWidget widget)
Notifies this gui that the widget wants to acquire focus.
|
void |
setFullscreen(boolean fullscreen)
Sets whether this GUI is fullscreen.
|
GuiDescription |
setPropertyDelegate(net.minecraft.screen.PropertyDelegate delegate)
Sets the object which manages the integer properties used by WBars
|
GuiDescription |
setRootPanel(WPanel panel) |
void |
setTitleAlignment(HorizontalAlignment alignment)
Sets the horizontal alignment of the GUI title.
|
GuiDescription |
setTitleColor(int color)
Sets the title color of this GUI.
|
GuiDescription |
setTitleColor(int lightColor,
int darkColor)
Sets the light and dark title colors of this GUI.
|
void |
setTitleVisible(boolean titleVisible)
Sets whether the title of this GUI should be rendered by the screen.
|
WPanel getRootPanel()
int getTitleColor()
GuiDescription setRootPanel(WPanel panel)
GuiDescription setTitleColor(int color)
The dark-mode title color will also be set by this method.
If the specified color is WLabel.DEFAULT_TEXT_COLOR,
the dark-mode color will be WLabel.DEFAULT_DARKMODE_TEXT_COLOR;
otherwise it will be the specified color.
color - the new title colorGuiDescription setTitleColor(int lightColor, int darkColor)
lightColor - the light-mode colordarkColor - the dark-mode colorGuiDescription setPropertyDelegate(net.minecraft.screen.PropertyDelegate delegate)
void addSlotPeer(ValidatedSlot slot)
@Environment(value=CLIENT) void addPainters()
@Nullable @Nullable net.minecraft.screen.PropertyDelegate getPropertyDelegate()
boolean isFocused(WWidget widget)
@Nullable @Nullable WWidget getFocus()
void requestFocus(WWidget widget)
void releaseFocus(WWidget widget)
default void cycleFocus(boolean lookForwards)
lookForwards - whether this should cycle forwards (true) or backwards (false)boolean isFullscreen()
Fullscreen GUIs have no default background painter and have the root panel stretched to fit the entire screen on the client.
void setFullscreen(boolean fullscreen)
fullscreen - true if this GUI is fullscreen, false otherwiseboolean isTitleVisible()
Modders can disable this to render the title themselves with a widget.
void setTitleVisible(boolean titleVisible)
titleVisible - true if the title is visible, false otherwiseHorizontalAlignment getTitleAlignment()
void setTitleAlignment(HorizontalAlignment alignment)
alignment - the new alignment