Skip to content

Commit d3b1461

Browse files
committed
Documented RenderUtils
1 parent f4c2a32 commit d3b1461

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/main/java/com/falsepattern/lib/util/RenderUtil.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141
public final class RenderUtil {
4242
private static final Timer MINECRAFT_TIMER = getMinecraftTimer();
4343

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+
*/
4451
@StableAPI.Expose(since = "0.12.0")
4552
public static void setGLTranslationRelativeToPlayer() {
4653
val player = getMinecraft().thePlayer;
@@ -53,6 +60,16 @@ public static void setGLTranslationRelativeToPlayer() {
5360
GL11.glTranslatef(-offsetX, -offsetY, -offsetZ);
5461
}
5562

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+
*/
5673
@StableAPI.Expose(since = "0.10.0")
5774
public static IIcon getFullTextureIcon(String iconName, int width, int height) {
5875
return new IIcon() {
@@ -103,6 +120,13 @@ public String getIconName() {
103120
};
104121
}
105122

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+
*/
106130
@StableAPI.Expose
107131
public static float partialTick() {
108132
return MINECRAFT_TIMER.renderPartialTicks;

0 commit comments

Comments
 (0)