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

    Nested Classes
    Modifier and Type
    Class
    Description
    static 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 Type
    Method
    Description
     
    float
     
     
    builder(String identifier)
     
    void
     
    void
     
    boolean
    charTyped(char typedChar, int keyCode)
     
     
     
     
    void
     
     
     
    <T> T
    getAndPutAttribute(String key, T defaultValue, T newValue)
     
    <T> T
     
    <T> T
    getAttribute(String key, T defaultValue)
     
     
    float
     
    int
     
     
    void
     
     
    boolean
    is(String identifier)
     
    boolean
    is(net.minecraft.client.gui.screens.Screen screen)
     
    boolean
     
    boolean
     
    boolean
    keyPressed(int keyCode, int scanCode, int modifiers)
     
    boolean
    keyReleased(int keyCode, int scanCode, int modifiers)
     
    net.minecraft.world.level.Level
     
    void
     
     
    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
     
     
    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
     
    <T> T
    putAttribute(String key, Object value)
     
    boolean
     
    void
     
    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
     
    void
     
    boolean
     
    void
     
    void
     
    void
     
    <W extends StatefulWidget<W>>
    W
    widget(int uid)
     
    float
     
    int
     

    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

      public String identifier()
    • is

      public boolean is(net.minecraft.client.gui.screens.Screen screen)
    • is

      public boolean is(String identifier)
    • isOpen

      public boolean isOpen()
    • allWidgets

      public List<StatefulWidget<? extends StatefulWidget<?>>> allWidgets()
    • widget

      public <W extends StatefulWidget<W>> W widget(int uid)
    • nextUID

      public int nextUID()
    • design

      public ScreenStyle.Design design()
    • colorScheme

      public ScreenStyle.ColorScheme colorScheme()
    • changeDesign

      public void changeDesign()
    • changeColorScheme

      public void changeColorScheme()
    • palette

      public ColorPalette palette()
    • width

      public float width()
    • widthInt

      public int widthInt()
    • height

      public float height()
    • heightInt

      public int heightInt()
    • aspect

      public float aspect()
    • bounds

      public Bounds bounds()
    • mathMode

      public MathMode mathMode()
    • focusedWidget

      public Optional<StatefulWidget<? extends StatefulWidget<?>>> focusedWidget()
    • setFocusedWidget

      public void setFocusedWidget(StatefulWidget<? extends StatefulWidget<?>> widget)
    • unfocusWidget

      public void unfocusWidget()
    • getDraggedWidget

      public Optional<StatefulWidget<? extends StatefulWidget<?>>> getDraggedWidget()
    • setDraggedWidget

      public void setDraggedWidget(StatefulWidget<? extends StatefulWidget<?>> widget)
    • stopDraggingWidget

      public void stopDraggingWidget()
    • init

      public StatefulScreen init(Consumer<StatefulScreen> init)
    • closeOnEsc

      public StatefulScreen closeOnEsc(Predicate<StatefulScreen> closeOnEsc)
    • close

      public StatefulScreen close(Consumer<StatefulScreen> close)
    • init

      public void init()
      Overrides:
      init in class net.minecraft.client.gui.screens.Screen
    • markReady

      public void markReady()
    • ready

      public boolean ready()
    • getAttribute

      public <T> T getAttribute(String key)
    • getAttribute

      public <T> T getAttribute(String key, T defaultValue)
    • getAndPutAttribute

      public <T> T getAndPutAttribute(String key, T defaultValue, T newValue)
    • putAttribute

      public <T> T putAttribute(String key, Object value)
    • copyAttributes

      public void copyAttributes(StatefulScreen screen)
    • tick

      public void tick()
      Overrides:
      tick in class net.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 class net.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 interface net.minecraft.client.gui.components.Renderable
      Overrides:
      render in class net.minecraft.client.gui.screens.Screen
    • keyPressed

      public boolean keyPressed(int keyCode, int scanCode, int modifiers)
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      keyPressed in class net.minecraft.client.gui.screens.Screen
    • keyReleased

      public boolean keyReleased(int keyCode, int scanCode, int modifiers)
      Specified by:
      keyReleased in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      keyReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
    • charTyped

      public boolean charTyped(char typedChar, int keyCode)
      Specified by:
      charTyped in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      charTyped in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int button)
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
      Specified by:
      mouseDragged in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseDragged in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY)
      Specified by:
      mouseScrolled in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseScrolled in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseMoved

      public void mouseMoved(double mouseX, double mouseY)
      Specified by:
      mouseMoved in interface net.minecraft.client.gui.components.events.GuiEventListener
    • removed

      public void removed()
      Overrides:
      removed in class net.minecraft.client.gui.screens.Screen
    • shouldCloseOnEsc

      public boolean shouldCloseOnEsc()
      Overrides:
      shouldCloseOnEsc in class net.minecraft.client.gui.screens.Screen
    • isPauseScreen

      public boolean isPauseScreen()
      Overrides:
      isPauseScreen in class net.minecraft.client.gui.screens.Screen
    • builder

      public static StatefulScreen.Builder builder(String identifier)