Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.cryptonicdev.cryptonic.utils;
- import java.awt.Color;
- import java.awt.Rectangle;
- import org.lwjgl.opengl.GL11;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.ScaledResolution;
- import net.minecraft.client.renderer.RenderGlobal;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.WorldRenderer;
- import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
- import net.minecraft.entity.Entity;
- import net.minecraft.util.AxisAlignedBB;
- import net.minecraft.util.BlockPos;
- import net.minecraft.util.Vec3i;
- public class RenderUtils {
- protected Minecraft mc = Minecraft.getMinecraft();
- public static void drawBorderedCircle(int x, int y, float radius, int outsideC, int insideC) {
- GL11.glEnable(3042);
- GL11.glDisable(3553);
- GL11.glBlendFunc(770, 771);
- GL11.glEnable(2848);
- GL11.glPushMatrix();
- float scale = 0.1F;
- GL11.glScalef(scale, scale, scale);
- x = (int) (x * (1.0F / scale));
- y = (int) (y * (1.0F / scale));
- radius *= 1.0F / scale;
- drawCircle(x, y, radius, insideC);
- drawUnfilledCircle(x, y, radius, 1.0F, outsideC);
- GL11.glScalef(1.0F / scale, 1.0F / scale, 1.0F / scale);
- GL11.glPopMatrix();
- GL11.glEnable(3553);
- GL11.glDisable(3042);
- GL11.glDisable(2848);
- }
- public static void drawUnfilledCircle(int x, int y, float radius, float lineWidth, int color) {
- float alpha = (color >> 24 & 0xFF) / 255.0F;
- float red = (color >> 16 & 0xFF) / 255.0F;
- float green = (color >> 8 & 0xFF) / 255.0F;
- float blue = (color & 0xFF) / 255.0F;
- GL11.glColor4f(red, green, blue, alpha);
- GL11.glLineWidth(lineWidth);
- GL11.glEnable(2848);
- GL11.glBegin(2);
- for (int i = 0; i <= 360; i++) {
- GL11.glVertex2d(x + Math.sin(i * 3.141526D / 180.0D) * radius,
- y + Math.cos(i * 3.141526D / 180.0D) * radius);
- }
- GL11.glEnd();
- GL11.glDisable(2848);
- }
- public static void drawCircle(int x, int y, float radius, int color) {
- float alpha = (color >> 24 & 0xFF) / 255.0F;
- float red = (color >> 16 & 0xFF) / 255.0F;
- float green = (color >> 8 & 0xFF) / 255.0F;
- float blue = (color & 0xFF) / 255.0F;
- GL11.glColor4f(red, green, blue, alpha);
- GL11.glBegin(9);
- for (int i = 0; i <= 360; i++) {
- GL11.glVertex2d(x + Math.sin(i * 3.141526D / 180.0D) * radius,
- y + Math.cos(i * 3.141526D / 180.0D) * radius);
- }
- GL11.glEnd();
- }
- public static int rainbow(long delay) {
- double rainbowState = Math.ceil((System.currentTimeMillis() + delay) / 20.0D);
- rainbowState %= 360;
- return Color.getHSBColor((float) rainbowState / 360f, 0.8f, 0.7f).getRGB();
- }
- public static int purple(long delay) {
- double rainbowState = 10D;
- rainbowState %= 180;
- return Color.magenta.getHSBColor((float) 0F, 1.0f, 0.7f).getRGB();
- }
- /* Start of HashExec's Methods */
- public static void entityESPBox(Entity entity, Color c) {
- GL11.glBlendFunc(770, 771);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glLineWidth(2.0F);
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glDisable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(false);
- GL11.glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha() / 255f);
- Minecraft.getMinecraft().getRenderManager();
- RenderGlobal.func_181561_a(new AxisAlignedBB(
- entity.boundingBox.minX - 0.05 - entity.posX
- + (entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX),
- entity.boundingBox.minY - entity.posY
- + (entity.posY - Minecraft.getMinecraft().getRenderManager().renderPosY),
- entity.boundingBox.minZ - 0.05 - entity.posZ
- + (entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ),
- entity.boundingBox.maxX + 0.05 - entity.posX
- + (entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX),
- entity.boundingBox.maxY + 0.1 - entity.posY
- + (entity.posY - Minecraft.getMinecraft().getRenderManager().renderPosY),
- entity.boundingBox.maxZ + 0.05 - entity.posZ
- + (entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ)));
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glEnable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(true);
- GL11.glDisable(GL11.GL_BLEND);
- }
- public static void framelessBlockESP(BlockPos pos, Color c) {
- double d0 = pos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
- double d1 = pos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
- double d2 = pos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
- GL11.glBlendFunc(770, 771);
- GL11.glEnable(3042);
- GL11.glLineWidth(2.0F);
- GL11.glDisable(3553);
- GL11.glDisable(2929);
- GL11.glDepthMask(false);
- GL11.glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f,
- c.getAlpha() / 255f);
- drawColorBox(new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 1.0D, d2 + 1.0D), c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
- GL11.glEnable(3553);
- GL11.glEnable(2929);
- GL11.glDepthMask(true);
- GL11.glDisable(3042);
- }
- public static void drawColorBox(AxisAlignedBB axisalignedbb, float red, float green, float blue, float alpha) {
- Tessellator tessellator = Tessellator.getInstance();
- WorldRenderer vertexbuffer = tessellator.getWorldRenderer();
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- tessellator.draw();
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- tessellator.draw();
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- tessellator.draw();
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- tessellator.draw();
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- tessellator.draw();
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- vertexbuffer.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).color(red, green, blue, alpha)
- .endVertex();
- tessellator.draw();
- }
- public static void blockESPBox(BlockPos blockPos) {
- double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
- double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
- double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
- GL11.glBlendFunc(770, 771);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glLineWidth(2.0F);
- GL11.glColor4d(0, 1, 0, 0.15F);
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glDisable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(false);
- GL11.glColor4d(0, 0, 1, 0.5F);
- RenderGlobal.func_181561_a(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glEnable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(true);
- GL11.glDisable(GL11.GL_BLEND);
- }
- public static void enableGL2D() {
- GL11.glDisable(2929);
- GL11.glEnable(3042);
- GL11.glDisable(3553);
- GL11.glBlendFunc(770, 771);
- GL11.glDepthMask(true);
- GL11.glEnable(2848);
- GL11.glHint(3154, 4354);
- GL11.glHint(3155, 4354);
- }
- public static void disableGL2D() {
- GL11.glEnable(3553);
- GL11.glDisable(3042);
- GL11.glEnable(2929);
- GL11.glDisable(2848);
- GL11.glHint(3154, 4352);
- GL11.glHint(3155, 4352);
- }
- public static void drawRect(Rectangle rectangle, int color) {
- RenderUtils.drawRect(rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height,
- color);
- }
- public static void drawRect(float x2, float y2, float x1, float y1, int color) {
- RenderUtils.enableGL2D();
- RenderUtils.glColor(color);
- RenderUtils.drawRect(x2, y2, x1, y1);
- RenderUtils.disableGL2D();
- }
- public static void drawBorderedRect(float x2, float y2, float x1, float y1, float width, int internalColor,
- int borderColor) {
- RenderUtils.enableGL2D();
- RenderUtils.glColor(internalColor);
- RenderUtils.drawRect(x2 + width, y2 + width, x1 - width, y1 - width);
- RenderUtils.glColor(borderColor);
- RenderUtils.drawRect(x2 + width, y2, x1 - width, y2 + width);
- RenderUtils.drawRect(x2, y2, x2 + width, y1);
- RenderUtils.drawRect(x1 - width, y2, x1, y1);
- RenderUtils.drawRect(x2 + width, y1 - width, x1 - width, y1);
- RenderUtils.disableGL2D();
- }
- public static void drawBorderedRect(float x2, float y2, float x1, float y1, int insideC, int borderC) {
- RenderUtils.enableGL2D();
- GL11.glScalef(0.5f, 0.5f, 0.5f);
- RenderUtils.drawVLine(x2 *= 2.0f, y2 *= 2.0f, y1 *= 2.0f, borderC);
- RenderUtils.drawVLine((x1 *= 2.0f) - 1.0f, y2, y1, borderC);
- RenderUtils.drawHLine(x2, x1 - 1.0f, y2, borderC);
- RenderUtils.drawHLine(x2, x1 - 2.0f, y1 - 1.0f, borderC);
- RenderUtils.drawRect(x2 + 1.0f, y2 + 1.0f, x1 - 1.0f, y1 - 1.0f, insideC);
- GL11.glScalef(2.0f, 2.0f, 2.0f);
- RenderUtils.disableGL2D();
- }
- public static void drawBorderedRectReliant(float x2, float y2, float x1, float y1, float lineWidth, int inside,
- int border) {
- RenderUtils.enableGL2D();
- RenderUtils.drawRect(x2, y2, x1, y1, inside);
- RenderUtils.glColor(border);
- GL11.glEnable(3042);
- GL11.glDisable(3553);
- GL11.glBlendFunc(770, 771);
- GL11.glLineWidth(lineWidth);
- GL11.glBegin(3);
- GL11.glVertex2f(x2, y2);
- GL11.glVertex2f(x2, y1);
- GL11.glVertex2f(x1, y1);
- GL11.glVertex2f(x1, y2);
- GL11.glVertex2f(x2, y2);
- GL11.glEnd();
- GL11.glEnable(3553);
- GL11.glDisable(3042);
- RenderUtils.disableGL2D();
- }
- public static void drawGradientBorderedRectReliant(float x2, float y2, float x1, float y1, float lineWidth,
- int border, int bottom, int top) {
- RenderUtils.enableGL2D();
- RenderUtils.drawGradientRect(x2, y2, x1, y1, top, bottom);
- RenderUtils.glColor(border);
- GL11.glEnable(3042);
- GL11.glDisable(3553);
- GL11.glBlendFunc(770, 771);
- GL11.glLineWidth(lineWidth);
- GL11.glBegin(3);
- GL11.glVertex2f(x2, y2);
- GL11.glVertex2f(x2, y1);
- GL11.glVertex2f(x1, y1);
- GL11.glVertex2f(x1, y2);
- GL11.glVertex2f(x2, y2);
- GL11.glEnd();
- GL11.glEnable(3553);
- GL11.glDisable(3042);
- RenderUtils.disableGL2D();
- }
- public static void drawRoundedRect(float x2, float y2, float x1, float y1, int borderC, int insideC) {
- RenderUtils.enableGL2D();
- GL11.glScalef(0.5f, 0.5f, 0.5f);
- RenderUtils.drawVLine(x2 *= 2.0f, (y2 *= 2.0f) + 1.0f, (y1 *= 2.0f) - 2.0f, borderC);
- RenderUtils.drawVLine((x1 *= 2.0f) - 1.0f, y2 + 1.0f, y1 - 2.0f, borderC);
- RenderUtils.drawHLine(x2 + 2.0f, x1 - 3.0f, y2, borderC);
- RenderUtils.drawHLine(x2 + 2.0f, x1 - 3.0f, y1 - 1.0f, borderC);
- RenderUtils.drawHLine(x2 + 1.0f, x2 + 1.0f, y2 + 1.0f, borderC);
- RenderUtils.drawHLine(x1 - 2.0f, x1 - 2.0f, y2 + 1.0f, borderC);
- RenderUtils.drawHLine(x1 - 2.0f, x1 - 2.0f, y1 - 2.0f, borderC);
- RenderUtils.drawHLine(x2 + 1.0f, x2 + 1.0f, y1 - 2.0f, borderC);
- RenderUtils.drawRect(x2 + 1.0f, y2 + 1.0f, x1 - 1.0f, y1 - 1.0f, insideC);
- GL11.glScalef(2.0f, 2.0f, 2.0f);
- RenderUtils.disableGL2D();
- }
- public static void drawBorderedRect(Rectangle rectangle, float width, int internalColor, int borderColor) {
- float x2 = rectangle.x;
- float y2 = rectangle.y;
- float x22 = rectangle.x + rectangle.width;
- float y22 = rectangle.y + rectangle.height;
- RenderUtils.enableGL2D();
- RenderUtils.glColor(internalColor);
- RenderUtils.drawRect(x2 + width, y2 + width, x22 - width, y22 - width);
- RenderUtils.glColor(borderColor);
- RenderUtils.drawRect(x2 + 1.0f, y2, x22 - 1.0f, y2 + width);
- RenderUtils.drawRect(x2, y2, x2 + width, y22);
- RenderUtils.drawRect(x22 - width, y2, x22, y22);
- RenderUtils.drawRect(x2 + 1.0f, y22 - width, x22 - 1.0f, y22);
- RenderUtils.disableGL2D();
- }
- public static void drawGradientRect(float x2, float y2, float x1, float y1, int topColor, int bottomColor) {
- RenderUtils.enableGL2D();
- GL11.glShadeModel(7425);
- GL11.glBegin(7);
- RenderUtils.glColor(topColor);
- GL11.glVertex2f(x2, y1);
- GL11.glVertex2f(x1, y1);
- RenderUtils.glColor(bottomColor);
- GL11.glVertex2f(x1, y2);
- GL11.glVertex2f(x2, y2);
- GL11.glEnd();
- GL11.glShadeModel(7424);
- RenderUtils.disableGL2D();
- }
- public static void drawGradientHRect(float x2, float y2, float x1, float y1, int topColor, int bottomColor) {
- RenderUtils.enableGL2D();
- GL11.glShadeModel(7425);
- GL11.glBegin(7);
- RenderUtils.glColor(topColor);
- GL11.glVertex2f(x2, y2);
- GL11.glVertex2f(x2, y1);
- RenderUtils.glColor(bottomColor);
- GL11.glVertex2f(x1, y1);
- GL11.glVertex2f(x1, y2);
- GL11.glEnd();
- GL11.glShadeModel(7424);
- RenderUtils.disableGL2D();
- }
- public static void drawGradientRect(double x2, double y2, double x22, double y22, int col1, int col2) {
- GL11.glEnable(3042);
- GL11.glDisable(3553);
- GL11.glBlendFunc(770, 771);
- GL11.glEnable(2848);
- GL11.glShadeModel(7425);
- GL11.glPushMatrix();
- GL11.glBegin(7);
- RenderUtils.glColor(col1);
- GL11.glVertex2d(x22, y2);
- GL11.glVertex2d(x2, y2);
- RenderUtils.glColor(col2);
- GL11.glVertex2d(x2, y22);
- GL11.glVertex2d(x22, y22);
- GL11.glEnd();
- GL11.glPopMatrix();
- GL11.glEnable(3553);
- GL11.glDisable(3042);
- GL11.glDisable(2848);
- GL11.glShadeModel(7424);
- }
- public static void drawGradientBorderedRect(double x2, double y2, double x22, double y22, float l1, int col1,
- int col2, int col3) {
- RenderUtils.enableGL2D();
- GL11.glPushMatrix();
- RenderUtils.glColor(col1);
- GL11.glLineWidth(1.0f);
- GL11.glBegin(1);
- GL11.glVertex2d(x2, y2);
- GL11.glVertex2d(x2, y22);
- GL11.glVertex2d(x22, y22);
- GL11.glVertex2d(x22, y2);
- GL11.glVertex2d(x2, y2);
- GL11.glVertex2d(x22, y2);
- GL11.glVertex2d(x2, y22);
- GL11.glVertex2d(x22, y22);
- GL11.glEnd();
- GL11.glPopMatrix();
- RenderUtils.drawGradientRect(x2, y2, x22, y22, col2, col3);
- RenderUtils.disableGL2D();
- }
- public static void glColor(Color color) {
- GL11.glColor4f((float) color.getRed() / 255.0f, (float) color.getGreen() / 255.0f,
- (float) color.getBlue() / 255.0f, (float) color.getAlpha() / 255.0f);
- }
- public static void glColor(int hex) {
- float alpha = (float) (hex >> 24 & 255) / 255.0f;
- float red = (float) (hex >> 16 & 255) / 255.0f;
- float green = (float) (hex >> 8 & 255) / 255.0f;
- float blue = (float) (hex & 255) / 255.0f;
- GL11.glColor4f(red, green, blue, alpha);
- }
- public static void glColor(float alpha, int redRGB, int greenRGB, int blueRGB) {
- float red = 0.003921569f * (float) redRGB;
- float green = 0.003921569f * (float) greenRGB;
- float blue = 0.003921569f * (float) blueRGB;
- GL11.glColor4f(red, green, blue, alpha);
- }
- public static void drawStrip(int x2, int y2, float width, double angle, float points, float radius, int color) {
- float a2;
- float xc2;
- float yc2;
- int i2;
- float f1 = (float) (color >> 24 & 255) / 255.0f;
- float f2 = (float) (color >> 16 & 255) / 255.0f;
- float f3 = (float) (color >> 8 & 255) / 255.0f;
- float f4 = (float) (color & 255) / 255.0f;
- GL11.glPushMatrix();
- GL11.glTranslated(x2, y2, 0.0);
- GL11.glColor4f(f2, f3, f4, f1);
- GL11.glLineWidth(width);
- if (angle > 0.0) {
- GL11.glBegin(3);
- i2 = 0;
- while ((double) i2 < angle) {
- a2 = (float) ((double) i2 * (angle * 3.141592653589793 / (double) points));
- xc2 = (float) (Math.cos(a2) * (double) radius);
- yc2 = (float) (Math.sin(a2) * (double) radius);
- GL11.glVertex2f(xc2, yc2);
- ++i2;
- }
- GL11.glEnd();
- }
- if (angle < 0.0) {
- GL11.glBegin(3);
- i2 = 0;
- while ((double) i2 > angle) {
- a2 = (float) ((double) i2 * (angle * 3.141592653589793 / (double) points));
- xc2 = (float) (Math.cos(a2) * (double) (-radius));
- yc2 = (float) (Math.sin(a2) * (double) (-radius));
- GL11.glVertex2f(xc2, yc2);
- --i2;
- }
- GL11.glEnd();
- }
- RenderUtils.disableGL2D();
- GL11.glDisable(3479);
- GL11.glPopMatrix();
- }
- public static void drawHLine(float x2, float y2, float x1, int y1) {
- if (y2 < x2) {
- float var5 = x2;
- x2 = y2;
- y2 = var5;
- }
- RenderUtils.drawRect(x2, x1, y2 + 1.0f, x1 + 1.0f, y1);
- }
- public static void drawVLine(float x2, float y2, float x1, int y1) {
- if (x1 < y2) {
- float var5 = y2;
- y2 = x1;
- x1 = var5;
- }
- RenderUtils.drawRect(x2, y2 + 1.0f, x2 + 1.0f, x1, y1);
- }
- public static void drawHLine(float x2, float y2, float x1, int y1, int y22) {
- if (y2 < x2) {
- float var5 = x2;
- x2 = y2;
- y2 = var5;
- }
- RenderUtils.drawGradientRect(x2, x1, y2 + 1.0f, x1 + 1.0f, y1, y22);
- }
- public static void drawRect(float x2, float y2, float x1, float y1, float r2, float g2, float b2, float a2) {
- RenderUtils.enableGL2D();
- GL11.glColor4f(r2, g2, b2, a2);
- RenderUtils.drawRect(x2, y2, x1, y1);
- RenderUtils.disableGL2D();
- }
- public static void drawRect(float x2, float y2, float x1, float y1) {
- GL11.glBegin(7);
- GL11.glVertex2f(x2, y1);
- GL11.glVertex2f(x1, y1);
- GL11.glVertex2f(x1, y2);
- GL11.glVertex2f(x2, y2);
- GL11.glEnd();
- }
- public static void drawCircle(float cx, float cy2, float r2, int num_segments, int c2) {
- cx *= 2.0f;
- cy2 *= 2.0f;
- float f2 = (float) (c2 >> 24 & 255) / 255.0f;
- float f22 = (float) (c2 >> 16 & 255) / 255.0f;
- float f3 = (float) (c2 >> 8 & 255) / 255.0f;
- float f4 = (float) (c2 & 255) / 255.0f;
- float theta = (float) (6.2831852 / (double) num_segments);
- float p2 = (float) Math.cos(theta);
- float s = (float) Math.sin(theta);
- float x2 = r2 *= 2.0f;
- float y2 = 0.0f;
- RenderUtils.enableGL2D();
- GL11.glScalef(0.5f, 0.5f, 0.5f);
- GL11.glColor4f(f22, f3, f4, f2);
- GL11.glBegin(2);
- int ii2 = 0;
- while (ii2 < num_segments) {
- GL11.glVertex2f(x2 + cx, y2 + cy2);
- float t = x2;
- x2 = p2 * x2 - s * y2;
- y2 = s * t + p2 * y2;
- ++ii2;
- }
- GL11.glEnd();
- GL11.glScalef(2.0f, 2.0f, 2.0f);
- RenderUtils.disableGL2D();
- }
- public static void drawFullCircle(int cx, int cy2, double r2, int c2) {
- r2 *= 2.0;
- cx *= 2;
- cy2 *= 2;
- float f2 = (float) (c2 >> 24 & 255) / 255.0f;
- float f22 = (float) (c2 >> 16 & 255) / 255.0f;
- float f3 = (float) (c2 >> 8 & 255) / 255.0f;
- float f4 = (float) (c2 & 255) / 255.0f;
- RenderUtils.enableGL2D();
- GL11.glScalef(0.5f, 0.5f, 0.5f);
- GL11.glColor4f(f22, f3, f4, f2);
- GL11.glBegin(6);
- int i2 = 0;
- while (i2 <= 360) {
- double x2 = Math.sin((double) i2 * 3.141592653589793 / 180.0) * r2;
- double y2 = Math.cos((double) i2 * 3.141592653589793 / 180.0) * r2;
- GL11.glVertex2d((double) cx + x2, (double) cy2 + y2);
- ++i2;
- }
- GL11.glEnd();
- GL11.glScalef(2.0f, 2.0f, 2.0f);
- RenderUtils.disableGL2D();
- }
- public static void drawSmallString(String s, int x2, int y2, int color) {
- GL11.glPushMatrix();
- GL11.glScalef(0.5f, 0.5f, 0.5f);
- Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(s, x2 * 2, y2 * 2, color);
- GL11.glPopMatrix();
- }
- public static void drawLargeString(String text, int x2, int y2, int color) {
- GL11.glPushMatrix();
- GL11.glScalef(1.5f, 1.5f, 1.5f);
- GL11.glPopMatrix();
- }
- private static ScaledResolution scaledResolution;
- public static ScaledResolution getScaledResolution() {
- return scaledResolution;
- }
- /* End of HashExec's Methods */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement