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.
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final BackgroundPainterTheSLOTbackground painter draws item slots or slot-like widgets.static final BackgroundPainterTheVANILLAbackground painter draws a vanilla-like GUI panel using nine-patch textures. -
Method Summary
Modifier and TypeMethodDescriptionstatic BackgroundPaintercreateColorful(int panelColor) Creates a colorful gui panel painter.static BackgroundPaintercreateColorful(int panelColor, float contrast) Creates a colorful gui panel painter that has a custom contrast between the shadows and highlights.static BackgroundPaintercreateLightDarkVariants(BackgroundPainter light, BackgroundPainter dark) Creates a background painter that uses either thelightor thedarkbackground painter depending on the current setting.static NinePatchBackgroundPaintercreateNinePatch(Texture texture, Consumer<juuxel.libninepatch.NinePatch.Builder<net.minecraft.util.Identifier>> configurator) Creates a new nine-patch background painter with a custom configuration.static NinePatchBackgroundPaintercreateNinePatch(net.minecraft.util.Identifier texture) Creates a new nine-patch background painter.voidpaintBackground(net.minecraft.client.util.math.MatrixStack matrices, int left, int top, WWidget panel) Paint the specified panel to the screen.
-
Field Details
-
VANILLA
TheVANILLAbackground painter draws a vanilla-like GUI panel using nine-patch textures.This background painter uses
libgui:textures/widget/panel_light.pngas the light texture andlibgui:textures/widget/panel_dark.pngas 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
TheSLOTbackground 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 coordinatestop- The absolute position of the top of the panel, in gui-screen coordinatespanel- The panel being painted
-
createColorful
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
Creates a colorful gui panel painter that has a custom contrast between the shadows and highlights.- Parameters:
panelColor- the panel background colorcontrast- the contrast between the shadows and highlights- Returns:
- a colorful gui panel painter
-
createNinePatch
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 textureconfigurator- a consumer that configures theNinePatch.Builder- Returns:
- the created nine-patch background painter
- Since:
- 4.0.0
- See Also:
-
createLightDarkVariants
Creates a background painter that uses either thelightor thedarkbackground painter depending on the current setting.- Parameters:
light- the light mode background painterdark- the dark mode background painter- Returns:
- a new background painter that chooses between the two inputs
- Since:
- 1.5.0
-