Class ScreenBuilder

java.lang.Object
net.dillon.dillonlib.screen.ScreenBuilder

public class ScreenBuilder extends Object
Makes building screens easier.
Since:
1.2
See Also:
  • Method Details

    • of

      public static ScreenBuilder of(net.minecraft.client.gui.screens.Screen screen)
      Creates a new ScreenBuilder.
      Parameters:
      screen - the screen to build on.
      Returns:
      a new screen builder.
    • ofBottomCentered

      public static ScreenBuilder ofBottomCentered(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a bottom-centered screen builder.
    • ofCentered

      public static ScreenBuilder ofCentered(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a centered screen builder.
    • ofTopCentered

      public static ScreenBuilder ofTopCentered(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a top-centered screen builder.
    • ofBottomLeft

      public static ScreenBuilder ofBottomLeft(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a bottom-left screen builder.
    • ofBottomRight

      public static ScreenBuilder ofBottomRight(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a bottom-right screen builder.
    • ofTopLeft

      public static ScreenBuilder ofTopLeft(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a top-left screen builder.
    • ofTopRight

      public static ScreenBuilder ofTopRight(net.minecraft.client.gui.screens.Screen screen)
      Returns:
      a top-right screen builder.
    • captureWidth

      public int captureWidth()
      Captures the width in its current place.
    • captureHeight

      public int captureHeight()
      Captures the height in its current place.
    • captureGraphicsWidth

      public int captureGraphicsWidth()
      Captures the graphics width in its current place.
    • captureGraphicsHeight

      public int captureGraphicsHeight()
      Captures the graphics height in its current place.
    • defaultOffset

      public int defaultOffset()
      Returns:
      the default offset for modifying width and height.
    • defaultGraphicsOffset

      public int defaultGraphicsOffset()
      Returns:
      the default render offset for modifying graphics width and graphics height.
    • resetBounds

      public void resetBounds()
      Resets the width and height to the initial values.
    • resetRenderBounds

      public void resetRenderBounds()
      Resets the render bounds to the initial values.
    • textTitleGraphicsHeight

      public ScreenBuilder.ScreenValue textTitleGraphicsHeight(net.minecraft.client.gui.GuiGraphicsExtractor graphics)
      Draws title text on a screen.
    • textTitleGraphicsHeight

      public ScreenBuilder.ScreenValue textTitleGraphicsHeight(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component title)
      Draws custom title text on a screen.
    • textCenterAndGraphicsHeightDown

      public ScreenBuilder.ScreenValue textCenterAndGraphicsHeightDown(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text)
      Draws text and then moves the height down.
    • textCenterAndGraphicsHeightDown

      public ScreenBuilder.ScreenValue textCenterAndGraphicsHeightDown(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text, int amount)
      Draws text and then moves the height down by a specific amount.
    • textCenterGraphicsHeight

      public ScreenBuilder.ScreenValue textCenterGraphicsHeight(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text)
      Draws text in a centered fashion.
    • textCenterGraphicsHeight

      public ScreenBuilder.ScreenValue textCenterGraphicsHeight(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text, int height)
      Draws text in a centered fashion at a specific height.
    • textCenterAndGraphicsHeightDownWrapped

      public ScreenBuilder.ScreenValue textCenterAndGraphicsHeightDownWrapped(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text)
      Draws wrapped text centered and moves the height down after each line.
    • textCenterAndGraphicsHeightDownWrapped

      public ScreenBuilder.ScreenValue textCenterAndGraphicsHeightDownWrapped(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text, int maxWidth)
      Draws wrapped text centered and moves the height down after each line, with a custom max width.
    • textCenterAndGraphicsHeightDownWrapped

      public ScreenBuilder.ScreenValue textCenterAndGraphicsHeightDownWrapped(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.network.chat.Component text, int maxWidth, int amount)
      Draws wrapped text centered and moves the height down by a specific amount after each line, with a custom max width and amount for each line.
    • multiLineTextCenterAndHeightDown

      public ScreenBuilder.ScreenValue multiLineTextCenterAndHeightDown(net.minecraft.network.chat.Component text)
      Adds a centered multi-line text widget and then moves the height down.
    • multiLineTextCenterAndHeightDown

      public ScreenBuilder.ScreenValue multiLineTextCenterAndHeightDown(net.minecraft.network.chat.Component text, int maxWidth)
      Adds a centered multi-line text widget with a custom max width and then moves the height down.
    • multiLineTextCenterAndHeightDown

      public ScreenBuilder.ScreenValue multiLineTextCenterAndHeightDown(net.minecraft.network.chat.Component text, int maxWidth, int amount)
      Adds a centered multi-line text widget with a custom max width and height offset.
    • width

      public ScreenBuilder.ScreenValue width(net.dillon.dillonlib.screen.ScreenBuilder.ScreenPos pos, net.dillon.dillonlib.screen.ScreenBuilder.Type type)
      Parameters:
      pos - the screen position.
      Returns:
      the width at a specific screen position.
    • width

      public ScreenBuilder.ScreenValue width(net.minecraft.client.gui.components.AbstractWidget widget)
      Parameters:
      widget - the widget to reset width to.
      Returns:
      the width at the widget's position.
    • widthCenter

      public ScreenBuilder.ScreenValue widthCenter()
      Calculates the width at the center, and returns the new value.
    • widthBottomSideLeft

      public ScreenBuilder.ScreenValue widthBottomSideLeft()
      Calculates the width at the bottom left, and returns the new value.
    • widthBottomSideRight

      public ScreenBuilder.ScreenValue widthBottomSideRight()
      Calculates the width at the bottom right, and returns the new value.
    • widthRight

      public ScreenBuilder.ScreenValue widthRight()
      Calculates the current width moved right by defaultOffset(), and returns the new value.
    • widthRight

      public ScreenBuilder.ScreenValue widthRight(int amount)
      Calculates the current width moved right, and returns the new value.
    • widthLeft

      public ScreenBuilder.ScreenValue widthLeft()
      Calculates the current width moved left by defaultOffset(), and returns the new value.
    • widthLeft

      public ScreenBuilder.ScreenValue widthLeft(int amount)
      Calculates the current width moved left, and returns the new value.
    • graphicsWidth

      public ScreenBuilder.ScreenValue graphicsWidth(net.minecraft.client.gui.components.AbstractWidget widget)
      Parameters:
      widget - the widget to reset graphics width to.
      Returns:
      the graphics width at the widget's position.
    • graphicsWidthCenter

      public ScreenBuilder.ScreenValue graphicsWidthCenter()
      Calculates the graphics width at the center, and returns the new value.
    • graphicsWidthSideLeft

      public ScreenBuilder.ScreenValue graphicsWidthSideLeft()
      Calculates the graphics width at the bottom left, and returns the new value.
    • graphicsWidthSideRight

      public ScreenBuilder.ScreenValue graphicsWidthSideRight()
      Calculates the graphics width at the bottom right, and returns the new value.
    • graphicsWidthRight

      public ScreenBuilder.ScreenValue graphicsWidthRight()
      Calculates the current graphics width moved right by defaultGraphicsOffset(), and returns the new value.
    • graphicsWidthRight

      public ScreenBuilder.ScreenValue graphicsWidthRight(int amount)
      Calculates the current graphics width moved right, and returns the new value.
    • graphicsWidthLeft

      public ScreenBuilder.ScreenValue graphicsWidthLeft()
      Calculates the current graphics width moved left by defaultGraphicsOffset(), and returns the new value.
    • graphicsWidthLeft

      public ScreenBuilder.ScreenValue graphicsWidthLeft(int amount)
      Calculates the current graphics width moved left, and returns the new value.
    • height

      public ScreenBuilder.ScreenValue height(net.dillon.dillonlib.screen.ScreenBuilder.ScreenPos pos, net.dillon.dillonlib.screen.ScreenBuilder.Type type)
      Calculates the height at a specific screen position, and returns the new value.
    • height

      public ScreenBuilder.ScreenValue height(net.minecraft.client.gui.components.AbstractWidget widget)
      Parameters:
      widget - the widget to reset height to.
      Returns:
      the height at the widget's position.
    • heightBottom

      public ScreenBuilder.ScreenValue heightBottom()
      Calculates the height at the bottom center, and returns the new value.
    • heightCenter

      public ScreenBuilder.ScreenValue heightCenter()
      Calculates the height at the center, and returns the new value.
    • heightTop

      public ScreenBuilder.ScreenValue heightTop()
      Calculates the height at the top center, and returns the new value.
    • heightDown

      public ScreenBuilder.ScreenValue heightDown()
      Calculates the current height moved down by defaultOffset(), and returns the new value.
    • heightDown

      public ScreenBuilder.ScreenValue heightDown(int amount)
      Calculates the current height moved down, and returns the new value.
    • heightUp

      public ScreenBuilder.ScreenValue heightUp()
      Calculates the current height moved up by defaultOffset(), and returns the new value.
    • heightUp

      public ScreenBuilder.ScreenValue heightUp(int amount)
      Calculates the current height moved up, and returns the new value.
    • graphicsHeight

      public ScreenBuilder.ScreenValue graphicsHeight(net.minecraft.client.gui.components.AbstractWidget widget)
      Parameters:
      widget - the widget to reset graphics height to.
      Returns:
      the graphics height at the widget's position.
    • graphicsHeightBottom

      public ScreenBuilder.ScreenValue graphicsHeightBottom()
      Calculates the graphics height at the bottom center, and returns the new value.
    • graphicsHeightCenter

      public ScreenBuilder.ScreenValue graphicsHeightCenter()
      Calculates the graphics height at the center, and returns the new value.
    • graphicsHeightTop

      public ScreenBuilder.ScreenValue graphicsHeightTop()
      Calculates the graphics height at the top center, and returns the new value.
    • graphicsHeightDown

      public ScreenBuilder.ScreenValue graphicsHeightDown()
      Calculates the current graphics height moved down by defaultGraphicsOffset(), and returns the new value.
    • graphicsHeightDown

      public ScreenBuilder.ScreenValue graphicsHeightDown(int amount)
      Calculates the current graphics height moved down, and returns the new value.
    • graphicsHeightUp

      public ScreenBuilder.ScreenValue graphicsHeightUp()
      Calculates the current graphics height moved up by defaultOffset(), and returns the new value.
    • graphicsHeightUp

      public ScreenBuilder.ScreenValue graphicsHeightUp(int amount)
      Calculates the current graphics height moved up, and returns the new value.