diff --git a/src/main/java/codechicken/lib/gui/modular/elements/GuiTexture.java b/src/main/java/codechicken/lib/gui/modular/elements/GuiTexture.java index da5c0577..542b6ee2 100644 --- a/src/main/java/codechicken/lib/gui/modular/elements/GuiTexture.java +++ b/src/main/java/codechicken/lib/gui/modular/elements/GuiTexture.java @@ -17,6 +17,7 @@ public class GuiTexture extends GuiElement implements BackgroundRend private Supplier getMaterial; private Supplier colour = () -> 0xFFFFFFFF; private Borders dynamicBorders = null; + private Supplier rotation = () -> 0; /** * @param parent parent {@link GuiParent}. @@ -97,6 +98,24 @@ public GuiTexture setColour(Supplier colour) { return this; } + /** + * Sets the texture rotation, each integer increment will rotate the texture by 90 degrees. + * (Not compatible with dynamic textures) + */ + public GuiTexture setRotation(Supplier rotation) { + this.rotation = rotation; + return this; + } + + /** + * Sets the texture rotation, each integer increment will rotate the texture by 90 degrees. + * (Not compatible with dynamic textures) + */ + public GuiTexture setRotation(int rotation) { + this.rotation = () -> rotation; + return this; + } + @Override public void renderBackground(GuiRender render, double mouseX, double mouseY, float partialTicks) { Material material = getMaterial(); @@ -104,7 +123,7 @@ public void renderBackground(GuiRender render, double mouseX, double mouseY, flo if (dynamicBorders != null) { render.dynamicTex(material, getRectangle(), dynamicBorders, colour.get()); } else { - render.texRect(material, getRectangle(), colour.get()); + render.texRect(material, rotation.get(), getRectangle(), colour.get()); } } }