@@ -17,6 +17,7 @@ public class GuiTexture extends GuiElement<GuiTexture> implements BackgroundRend
17
17
private Supplier <Material > getMaterial ;
18
18
private Supplier <Integer > colour = () -> 0xFFFFFFFF ;
19
19
private Borders dynamicBorders = null ;
20
+ private Supplier <Integer > rotation = () -> 0 ;
20
21
21
22
/**
22
23
* @param parent parent {@link GuiParent}.
@@ -97,14 +98,32 @@ public GuiTexture setColour(Supplier<Integer> colour) {
97
98
return this ;
98
99
}
99
100
101
+ /**
102
+ * Sets the texture rotation, each integer increment will rotate the texture by 90 degrees.
103
+ * (Not compatible with dynamic textures)
104
+ */
105
+ public GuiTexture setRotation (Supplier <Integer > rotation ) {
106
+ this .rotation = rotation ;
107
+ return this ;
108
+ }
109
+
110
+ /**
111
+ * Sets the texture rotation, each integer increment will rotate the texture by 90 degrees.
112
+ * (Not compatible with dynamic textures)
113
+ */
114
+ public GuiTexture setRotation (int rotation ) {
115
+ this .rotation = () -> rotation ;
116
+ return this ;
117
+ }
118
+
100
119
@ Override
101
120
public void renderBackground (GuiRender render , double mouseX , double mouseY , float partialTicks ) {
102
121
Material material = getMaterial ();
103
122
if (material == null ) return ;
104
123
if (dynamicBorders != null ) {
105
124
render .dynamicTex (material , getRectangle (), dynamicBorders , colour .get ());
106
125
} else {
107
- render .texRect (material , getRectangle (), colour .get ());
126
+ render .texRect (material , rotation . get (), getRectangle (), colour .get ());
108
127
}
109
128
}
110
129
}
0 commit comments