Interface BackgroundPainter

All Known Implementing Classes:
NinePatchBackgroundPainter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BackgroundPainter
Background painters are used to paint the background of a widget. The background painter instance of a widget can be changed to customize the look of a widget.
  • Field Details

    • VANILLA

      static final BackgroundPainter VANILLA
      The VANILLA background painter draws a vanilla-like GUI panel using nine-patch textures.

      This background painter uses libgui:textures/widget/panel_light.png as the light texture and libgui:textures/widget/panel_dark.png as the dark texture.

      This background painter is the default painter for root panels. * You can override GuiDescription.addPainters() to customize the painter yourself.

      Since:
      1.5.0
    • SLOT

      static final BackgroundPainter SLOT
      The SLOT background painter draws item slots or slot-like widgets.
  • Method Details

    • paintBackground

      void paintBackground(net.minecraft.client.util.math.MatrixStack matrices, int left, int top, WWidget panel)
      Paint the specified panel to the screen.
      Parameters:
      left - The absolute position of the left of the panel, in gui-screen coordinates
      top - The absolute position of the top of the panel, in gui-screen coordinates
      panel - The panel being painted
    • createColorful

      static BackgroundPainter createColorful(int panelColor)
      Creates a colorful gui panel painter. This painter paints the panel using the specified color.
      Parameters:
      panelColor - the panel background color
      Returns:
      a colorful gui panel painter
      See Also:
    • createColorful

      static BackgroundPainter createColorful(int panelColor, float contrast)
      Creates a colorful gui panel painter that has a custom contrast between the shadows and highlights.
      Parameters:
      panelColor - the panel background color
      contrast - the contrast between the shadows and highlights
      Returns:
      a colorful gui panel painter
    • createNinePatch

      static NinePatchBackgroundPainter createNinePatch(net.minecraft.util.Identifier texture)
      Creates a new nine-patch background painter.

      The resulting painter has a corner size of 4 px and a corner UV of 0.25.

      Parameters:
      texture - the background painter texture
      Returns:
      a new nine-patch background painter
      Since:
      1.5.0
      See Also:
    • createNinePatch

      static NinePatchBackgroundPainter createNinePatch(Texture texture, Consumer<juuxel.libninepatch.NinePatch.Builder<net.minecraft.util.Identifier>> configurator)
      Creates a new nine-patch background painter with a custom configuration.
      Parameters:
      texture - the background painter texture
      configurator - a consumer that configures the NinePatch.Builder
      Returns:
      the created nine-patch background painter
      Since:
      4.0.0
      See Also:
    • createLightDarkVariants

      static BackgroundPainter createLightDarkVariants(BackgroundPainter light, BackgroundPainter dark)
      Creates a background painter that uses either the light or the dark background painter depending on the current setting.
      Parameters:
      light - the light mode background painter
      dark - the dark mode background painter
      Returns:
      a new background painter that chooses between the two inputs
      Since:
      1.5.0