Class ScreenBuilder
java.lang.Object
xyz.gmitch215.socketmc.screen.builder.ScreenBuilder
Represents a builder for creating a
CustomScreen.-
Method Summary
Modifier and TypeMethodDescriptionbackground(@NotNull ScreenBackground background) Sets the background of the screen.build()Builds the screen.static @NotNull ScreenBuilderbuilder()Creates a newScreenBuilderwith a newCustomScreen, with an empty title.static @NotNull ScreenBuilderCreates a newScreenBuilderwith a newCustomScreen, with the given title.element(@NotNull Supplier<Positionable> element) Adds a new element to the screen.element(@NotNull Positionable element) Adds a new element to the screen.Adds a new element to the screen.imageButton(@NotNull Consumer<ImageButtonBuilder> button) Adds a new element to the screen.imageWidget(@NotNull Consumer<ImageWidgetBuilder> widget) Adds a new element to the screen.Sets the layout of the screen.Sets the layout of the screen.textButton(@NotNull Consumer<TextButtonBuilder> button) Adds a new element to the screen.textWidget(@NotNull Consumer<TextWidgetBuilder> widget) Adds a new element to the screen.Sets the title of the screen.Sets the title of the screen.
-
Method Details
-
title
Sets the title of the screen.- Parameters:
title- The title of the screen.- Returns:
- this class, for chaining
-
title
Sets the title of the screen.- Parameters:
title- The title of the screen.- Returns:
- this class, for chaining
-
element
Adds a new element to the screen.- Parameters:
element- The element to add.- Returns:
- this class, for chaining
-
element
Adds a new element to the screen.- Parameters:
element- The element to add.- Returns:
- this class, for chaining
-
focusedTextWidget
@NotNull public @NotNull ScreenBuilder focusedTextWidget(@NotNull @NotNull Consumer<FocusedTextWidgetBuilder> widget) Adds a new element to the screen.- Parameters:
widget- Constructor for aFocusedTextWidget- Returns:
- this class, for chaining
-
textWidget
@NotNull public @NotNull ScreenBuilder textWidget(@NotNull @NotNull Consumer<TextWidgetBuilder> widget) Adds a new element to the screen.- Parameters:
widget- Constructor for aTextWidget- Returns:
- this class, for chaining
-
textButton
@NotNull public @NotNull ScreenBuilder textButton(@NotNull @NotNull Consumer<TextButtonBuilder> button) Adds a new element to the screen.- Parameters:
button- Constructor for aTextButton- Returns:
- this class, for chaining
-
imageWidget
@NotNull public @NotNull ScreenBuilder imageWidget(@NotNull @NotNull Consumer<ImageWidgetBuilder> widget) Adds a new element to the screen.- Parameters:
widget- Constructor for aImageWidget- Returns:
- this class, for chaining
-
imageButton
@NotNull public @NotNull ScreenBuilder imageButton(@NotNull @NotNull Consumer<ImageButtonBuilder> button) Adds a new element to the screen.- Parameters:
button- Constructor for aImageButton- Returns:
- this class, for chaining
-
background
@NotNull public @NotNull ScreenBuilder background(@NotNull @NotNull ScreenBackground background) throws IllegalArgumentException Sets the background of the screen.- Parameters:
background- The background of the screen.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException- if the background is null
-
layout
Sets the layout of the screen.- Parameters:
layout- The layout of the screen.- Returns:
- this class, for chaining
-
layout
@NotNull public @NotNull ScreenBuilder layout(@NotNull @NotNull Supplier<Layout> layout) throws IllegalArgumentException Sets the layout of the screen.- Parameters:
layout- The generator for the screen layout.- Returns:
- this class, for chaining
- Throws:
IllegalArgumentException- if the generator is null
-
build
Builds the screen.- Returns:
- The built screen.
-
builder
Creates a newScreenBuilderwith a newCustomScreen, with an empty title.- Returns:
- ScreenBuilder
-
builder
Creates a newScreenBuilderwith a newCustomScreen, with the given title.- Parameters:
title- The title of the screen.- Returns:
- ScreenBuilder
-