41
41
public final class RenderUtil {
42
42
private static final Timer MINECRAFT_TIMER = getMinecraftTimer ();
43
43
44
+ /**
45
+ * Sets the OpenGL translation, relative to the player's position.
46
+ * <p>
47
+ * This is useful for rendering things that are not part of the world mesh, but should be rendered as if they were.
48
+ * <p>
49
+ * It's good practice to make this call inside a {@link GL11#glPushMatrix() push}/{@link GL11#glPopMatrix() pop} matrix block.
50
+ */
44
51
@ StableAPI .Expose (since = "0.12.0" )
45
52
public static void setGLTranslationRelativeToPlayer () {
46
53
val player = getMinecraft ().thePlayer ;
@@ -53,6 +60,16 @@ public static void setGLTranslationRelativeToPlayer() {
53
60
GL11 .glTranslatef (-offsetX , -offsetY , -offsetZ );
54
61
}
55
62
63
+ /**
64
+ * Provides a texture icon with the given name and dimensions.
65
+ * <p>
66
+ * This is useful for rendering textures that are not part of the Minecraft texture atlas.
67
+ *
68
+ * @param iconName The icon name
69
+ * @param width The icon width in pixels
70
+ * @param height The icon height in pixels
71
+ * @return The full resolution texture icon.
72
+ */
56
73
@ StableAPI .Expose (since = "0.10.0" )
57
74
public static IIcon getFullTextureIcon (String iconName , int width , int height ) {
58
75
return new IIcon () {
@@ -103,6 +120,13 @@ public String getIconName() {
103
120
};
104
121
}
105
122
123
+ /**
124
+ * Provides the partial tick between the last and next client tick, in the range of 0 to 1.
125
+ * <p>
126
+ * Sometimes referred to as 'subTick', it is used mostly for interpolation in rendering.
127
+ *
128
+ * @return The current partial tick
129
+ */
106
130
@ StableAPI .Expose
107
131
public static float partialTick () {
108
132
return MINECRAFT_TIMER .renderPartialTicks ;
0 commit comments