|
21 | 21 | package com.falsepattern.lib.util;
|
22 | 22 |
|
23 | 23 | import com.falsepattern.lib.StableAPI;
|
24 |
| -import lombok.NoArgsConstructor; |
25 | 24 | import lombok.SneakyThrows;
|
26 | 25 | import lombok.experimental.UtilityClass;
|
27 | 26 | import lombok.val;
|
|
31 | 30 | import net.minecraft.util.Timer;
|
32 | 31 | import cpw.mods.fml.relauncher.ReflectionHelper;
|
33 | 32 | import cpw.mods.fml.relauncher.SideOnly;
|
| 33 | +import org.lwjgl.opengl.GL11; |
34 | 34 |
|
35 | 35 | import static cpw.mods.fml.relauncher.Side.CLIENT;
|
36 |
| -import static lombok.AccessLevel.PRIVATE; |
37 | 36 | import static net.minecraft.client.Minecraft.getMinecraft;
|
38 | 37 |
|
39 | 38 | @SideOnly(CLIENT)
|
|
42 | 41 | public final class RenderUtil {
|
43 | 42 | private static final Timer MINECRAFT_TIMER = getMinecraftTimer();
|
44 | 43 |
|
| 44 | + @StableAPI.Expose(since = "0.12.0") |
| 45 | + public static void setGLTranslationRelativeToPlayer() { |
| 46 | + val player = getMinecraft().thePlayer; |
| 47 | + val partialTick = partialTick(); |
| 48 | + |
| 49 | + val offsetX = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTick); |
| 50 | + val offsetY = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTick); |
| 51 | + val offsetZ = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTick); |
| 52 | + |
| 53 | + GL11.glTranslatef(-offsetX, -offsetY, -offsetZ); |
| 54 | + } |
| 55 | + |
45 | 56 | @StableAPI.Expose(since = "0.10.0")
|
46 | 57 | public static IIcon getFullTextureIcon(String iconName, int width, int height) {
|
47 | 58 | return new IIcon() {
|
|
0 commit comments