SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.celestiam.mod.client.render;
  2.  
  3. import net.minecraft.client.Minecraft;
  4.  
  5. import net.minecraft.client.gui.FontRenderer;
  6. import net.minecraft.client.renderer.OpenGlHelper;
  7. import net.minecraft.client.renderer.Tessellator;
  8. import net.minecraft.client.renderer.entity.RenderManager;
  9. import net.minecraft.entity.EntityLivingBase;
  10. import org.lwjgl.opengl.GL11;
  11.  
  12. public class RenderChestRadar {
  13.     static Minecraft mc ;
  14.  
  15.     public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
  16.         drawTexturedModalRect(par1, par2, z, par3, par4, par5, par6, 0.00390625F, 0.00390625F);
  17.     }
  18.  
  19.     public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6,
  20.             float f, float f1) {
  21.         Tessellator tessellator = Tessellator.instance;
  22.         tessellator.startDrawingQuads();
  23.         tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1);
  24.         tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1);
  25.         tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1);
  26.         tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1);
  27.         tessellator.draw();
  28.     }
  29.  
  30.     public static void renderEntity(int x, int y, int scale, float rotX, float rotY, EntityLivingBase entity,
  31.             boolean nametag) {
  32.         GL11.glEnable(2903);
  33.         GL11.glPushMatrix();
  34.         GL11.glTranslatef(x, y, 50.0F);
  35.         GL11.glScalef(-scale, scale, scale);
  36.         GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
  37.         float f2 = entity.renderYawOffset;
  38.         float f3 = entity.rotationYaw;
  39.         float f4 = entity.rotationPitch;
  40.         float f5 = entity.prevRotationYawHead;
  41.         float f6 = entity.rotationYawHead;
  42.         GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
  43.         GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
  44.         GL11.glRotatef(-(float) Math.atan(rotY / 40.0F) * 20.0F, 1.0F, 0.0F, 0.0F);
  45.         entity.renderYawOffset = ((float) Math.atan(rotX / 40.0F) * 20.0F);
  46.         entity.rotationYaw = ((float) Math.atan(rotX / 40.0F) * 40.0F);
  47.         entity.rotationPitch = (-(float) Math.atan(rotY / 40.0F) * 20.0F);
  48.         entity.rotationYawHead = entity.rotationYaw;
  49.         entity.prevRotationYawHead = entity.rotationYaw;
  50.         GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
  51.         RenderManager.instance.playerViewY = 180.0F;
  52.         RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
  53.         entity.renderYawOffset = f2;
  54.         entity.rotationYaw = f3;
  55.         entity.rotationPitch = f4;
  56.         entity.prevRotationYawHead = f5;
  57.         entity.rotationYawHead = f6;
  58.         GL11.glPopMatrix();
  59.         GL11.glDisable(32826);
  60.         OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
  61.         GL11.glDisable(3553);
  62.         OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
  63.     }
  64.  
  65.     public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel) {
  66.         Tessellator tessellator = Tessellator.instance;
  67.         tessellator.startDrawingQuads();
  68.         tessellator.addVertexWithUV(x + 0.0D, y + height, zLevel, 0.0D, 1.0D);
  69.         tessellator.addVertexWithUV(x + width, y + height, zLevel, 1.0D, 1.0D);
  70.         tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, 1.0D, 0.0D);
  71.         tessellator.addVertexWithUV(x + 0.0D, y + 0.0D, zLevel, 0.0D, 0.0D);
  72.         tessellator.draw();
  73.     }
  74.  
  75.     public static void renderFloatingText(String text, float x, float y, float z, int color) {
  76.         RenderManager renderManager = RenderManager.instance;
  77.         FontRenderer fontRenderer = mc.fontRenderer;
  78.         float scale = 0.027F;
  79.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
  80.         GL11.glPushMatrix();
  81.         GL11.glTranslatef(x + 0.0F, y + 2.3F, z);
  82.         GL11.glNormal3f(0.0F, 1.0F, 0.0F);
  83.         GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
  84.         GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
  85.         GL11.glScalef(-scale, -scale, scale);
  86.         GL11.glDisable(2896);
  87.         GL11.glDepthMask(false);
  88.         GL11.glDisable(2929);
  89.         GL11.glEnable(3042);
  90.         GL11.glBlendFunc(770, 771);
  91.         Tessellator tessellator = Tessellator.instance;
  92.         int yOffset = 0;
  93.  
  94.         GL11.glDisable(3553);
  95.         tessellator.startDrawingQuads();
  96.         int stringMiddle = fontRenderer.getStringWidth(text) / 2;
  97.         tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.5F);
  98.         tessellator.addVertex(-stringMiddle - 1, -1 + yOffset, 0.0D);
  99.         tessellator.addVertex(-stringMiddle - 1, 8 + yOffset, 0.0D);
  100.         tessellator.addVertex(stringMiddle + 1, 8 + yOffset, 0.0D);
  101.         tessellator.addVertex(stringMiddle + 1, -1 + yOffset, 0.0D);
  102.         tessellator.draw();
  103.         GL11.glEnable(3553);
  104.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
  105.         fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
  106.         GL11.glEnable(2929);
  107.         GL11.glDepthMask(true);
  108.         fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
  109.         GL11.glEnable(2896);
  110.         GL11.glDisable(3042);
  111.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  112.         GL11.glPopMatrix();
  113.     }
  114. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top