Class StatefulScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
com.pixelmonmod.api.client.screen.StatefulScreen
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler
,net.minecraft.client.gui.components.events.GuiEventListener
,net.minecraft.client.gui.components.Renderable
,net.minecraft.client.gui.components.TabOrderedElement
public final class StatefulScreen
extends net.minecraft.client.gui.screens.Screen
implements net.minecraft.client.gui.components.events.GuiEventListener
Welcome to the Stateful Screen, a screen implementation with all the fun features of vanilla screens, but with the
ability to do designs (think skins), color themes, and more!
Stateful screens are created with a builder, rather than being extended or instantiated directly.
Stateful widgets come with various utilities as standard, such as parent-child hierarchy, all event handlers being
passed to all widgets automatically, and convenience classes and methods for ease of use.
TODO: Bring the UI particle system we have into this. That would be very good.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.Screen.NarratableSearchResult
-
Field Summary
Fields inherited from class net.minecraft.client.gui.screens.Screen
BACKGROUND_LOCATION, children, font, height, renderables, screenExecutor, title, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Method Summary
Modifier and TypeMethodDescriptionList<StatefulWidget<? extends StatefulWidget<?>>>
float
aspect()
bounds()
static StatefulScreen.Builder
void
void
boolean
charTyped
(char typedChar, int keyCode) close
(Consumer<StatefulScreen> close) closeOnEsc
(Predicate<StatefulScreen> closeOnEsc) void
copyAttributes
(StatefulScreen screen) design()
Optional<StatefulWidget<? extends StatefulWidget<?>>>
<T> T
getAndPutAttribute
(String key, T defaultValue, T newValue) <T> T
getAttribute
(String key) <T> T
getAttribute
(String key, T defaultValue) Optional<StatefulWidget<? extends StatefulWidget<?>>>
float
height()
int
void
init()
init
(Consumer<StatefulScreen> init) boolean
boolean
is
(net.minecraft.client.gui.screens.Screen screen) boolean
isOpen()
boolean
boolean
keyPressed
(int keyCode, int scanCode, int modifiers) boolean
keyReleased
(int keyCode, int scanCode, int modifiers) net.minecraft.world.level.Level
level()
void
mathMode()
net.minecraft.client.Minecraft
boolean
mouseClicked
(double mouseX, double mouseY, int button) boolean
mouseDragged
(double mouseX, double mouseY, int button, double deltaX, double deltaY) void
mouseMoved
(double mouseX, double mouseY) boolean
mouseReleased
(double mouseX, double mouseY, int button) boolean
mouseScrolled
(double mouseX, double mouseY, double deltaX, double deltaY) int
nextUID()
palette()
void
play
(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound) void
play
(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, float volume) void
play
(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, float volume, float pitch) void
play
(net.minecraft.sounds.SoundEvent sound) void
play
(net.minecraft.sounds.SoundEvent sound, float volume) void
play
(net.minecraft.sounds.SoundEvent sound, float volume, float pitch) void
net.minecraft.client.player.LocalPlayer
player()
<T> T
putAttribute
(String key, Object value) boolean
ready()
void
removed()
void
render
(@NotNull net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) void
renderBackground
(@NotNull net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) void
setDraggedWidget
(StatefulWidget<? extends StatefulWidget<?>> widget) void
setFocusedWidget
(StatefulWidget<? extends StatefulWidget<?>> widget) boolean
void
void
tick()
void
<W extends StatefulWidget<W>>
Wwidget
(int uid) float
width()
int
widthInt()
Methods inherited from class net.minecraft.client.gui.screens.Screen
added, addEventWidget, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearWidgets, confirmLink, createArrowEvent, createTabEvent, findNarratableWidget, getBackgroundMusic, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, hideWidgets, init, insertText, isCopy, isCut, isMouseOver, isPaste, isSelectAll, isValidCharacterForName, narrationEnabled, onClose, onFilesDrop, openLink, rebuildWidgets, removeWidget, renderDirtBackground, renderTransparentBackground, renderWithTooltip, repositionElements, resize, runNarration, scheduleNarration, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldNarrateNavigation, shouldRunNarration, suppressNarration, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, wrapScreenError
Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocused
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.ContainerEventHandler
getChildAt, getCurrentFocusPath, isFocused, magicalSpecialHackyFocus, nextFocusPath, setFocused
Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getRectangle, isMouseOver
Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Method Details
-
minecraft
public net.minecraft.client.Minecraft minecraft() -
player
public net.minecraft.client.player.LocalPlayer player() -
level
public net.minecraft.world.level.Level level() -
play
public void play(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound) -
play
public void play(net.minecraft.sounds.SoundEvent sound) -
play
public void play(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, float volume) -
play
public void play(net.minecraft.sounds.SoundEvent sound, float volume) -
play
public void play(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, float volume, float pitch) -
play
public void play(net.minecraft.sounds.SoundEvent sound, float volume, float pitch) -
playClick
public void playClick() -
identifier
-
is
public boolean is(net.minecraft.client.gui.screens.Screen screen) -
is
-
isOpen
public boolean isOpen() -
allWidgets
-
widget
-
nextUID
public int nextUID() -
design
-
colorScheme
-
changeDesign
public void changeDesign() -
changeColorScheme
public void changeColorScheme() -
palette
-
width
public float width() -
widthInt
public int widthInt() -
height
public float height() -
heightInt
public int heightInt() -
aspect
public float aspect() -
bounds
-
mathMode
-
focusedWidget
-
setFocusedWidget
-
unfocusWidget
public void unfocusWidget() -
getDraggedWidget
-
setDraggedWidget
-
stopDraggingWidget
public void stopDraggingWidget() -
init
-
closeOnEsc
-
close
-
init
public void init()- Overrides:
init
in classnet.minecraft.client.gui.screens.Screen
-
markReady
public void markReady() -
ready
public boolean ready() -
getAttribute
-
getAttribute
-
getAndPutAttribute
-
putAttribute
-
copyAttributes
-
tick
public void tick()- Overrides:
tick
in classnet.minecraft.client.gui.screens.Screen
-
renderBackground
public void renderBackground(@NotNull @NotNull net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) - Overrides:
renderBackground
in classnet.minecraft.client.gui.screens.Screen
-
render
public void render(@NotNull @NotNull net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) - Specified by:
render
in interfacenet.minecraft.client.gui.components.Renderable
- Overrides:
render
in classnet.minecraft.client.gui.screens.Screen
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) - Specified by:
keyPressed
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
keyPressed
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
keyPressed
in classnet.minecraft.client.gui.screens.Screen
-
keyReleased
public boolean keyReleased(int keyCode, int scanCode, int modifiers) - Specified by:
keyReleased
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
keyReleased
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
charTyped
public boolean charTyped(char typedChar, int keyCode) - Specified by:
charTyped
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
charTyped
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) - Specified by:
mouseClicked
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
mouseClicked
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) - Specified by:
mouseReleased
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
mouseReleased
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) - Specified by:
mouseDragged
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
mouseDragged
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY) - Specified by:
mouseScrolled
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
mouseScrolled
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseMoved
public void mouseMoved(double mouseX, double mouseY) - Specified by:
mouseMoved
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
removed
public void removed()- Overrides:
removed
in classnet.minecraft.client.gui.screens.Screen
-
shouldCloseOnEsc
public boolean shouldCloseOnEsc()- Overrides:
shouldCloseOnEsc
in classnet.minecraft.client.gui.screens.Screen
-
isPauseScreen
public boolean isPauseScreen()- Overrides:
isPauseScreen
in classnet.minecraft.client.gui.screens.Screen
-
builder
-