mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:11:31 +01:00
Better Image Positions
This commit is contained in:
parent
b999211582
commit
c5eba78bf6
@ -5,6 +5,9 @@ import net.minecraft.client.gui.FontRenderer;
|
|||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.cosmetics.StaticResourceLocation;
|
import net.silentclient.client.cosmetics.StaticResourceLocation;
|
||||||
@ -185,7 +188,7 @@ public class RenderUtil {
|
|||||||
} else {
|
} else {
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(image);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(image);
|
||||||
}
|
}
|
||||||
Gui.drawModalRectWithCustomSizedTexture((int) x, (int) y, (float) 0.0f, (float) 0.0f, (int) width, (int) height, (float) width, (float) height);
|
drawModalRectWithCustomSizedTexture(x, y, 0.0f, 0.0f, width, height, width, height);
|
||||||
GL11.glDepthMask((boolean) true);
|
GL11.glDepthMask((boolean) true);
|
||||||
GL11.glDisable((int) 3042);
|
GL11.glDisable((int) 3042);
|
||||||
GL11.glEnable((int) 2929);
|
GL11.glEnable((int) 2929);
|
||||||
@ -194,6 +197,20 @@ public class RenderUtil {
|
|||||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, 1f);
|
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void drawModalRectWithCustomSizedTexture(float x, float y, float u, float v, float width, float height, float textureWidth, float textureHeight)
|
||||||
|
{
|
||||||
|
float f = 1.0F / textureWidth;
|
||||||
|
float f1 = 1.0F / textureHeight;
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
|
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)height) * f1)).endVertex();
|
||||||
|
worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)width) * f), (double)((v + (float)height) * f1)).endVertex();
|
||||||
|
worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)width) * f), (double)(v * f1)).endVertex();
|
||||||
|
worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
public static void drawImage(ResourceLocation image, float x, float y, float width, float height, boolean mip) {
|
public static void drawImage(ResourceLocation image, float x, float y, float width, float height, boolean mip) {
|
||||||
drawImage(image, x, y, width, height, mip, -1);
|
drawImage(image, x, y, width, height, mip, -1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user