Created
February 4, 2014 16:52
-
-
Save allout58/8807630 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package allout58.mods.prisoncraft.client.render; | |
import java.awt.Color; | |
import net.minecraft.client.Minecraft; | |
import net.minecraft.client.gui.FontRenderer; | |
import net.minecraft.client.renderer.Tessellator; | |
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; | |
import net.minecraft.entity.EntityLivingBase; | |
import net.minecraft.tileentity.TileEntity; | |
import net.minecraft.util.EnumChatFormatting; | |
import org.lwjgl.opengl.GL11; | |
import org.lwjgl.util.vector.Vector3f; | |
public class JailViewHUDRenderer extends TileEntitySpecialRenderer | |
{ | |
public static double WIDTH = 3; | |
public static double HEIGHT = 3; | |
@Override | |
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tick) | |
{ | |
Tessellator tess = Tessellator.instance; | |
GL11.glPushMatrix(); | |
GL11.glDisable(GL11.GL_TEXTURE_2D); | |
GL11.glDisable(GL11.GL_LIGHTING); | |
GL11.glTranslated(x + 0.5, y + 1, z + 0.5); | |
EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity; | |
Vector3f vPlayer = new Vector3f(((float) player.posX), ((float) player.posY), ((float) player.posZ)); | |
Vector3f vTE = new Vector3f(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord); | |
Vector3f vRes = Vector3f.sub(vPlayer, vTE, null); | |
double ro = Math.atan2(vRes.x, vRes.z) * 180 / Math.PI + 180; | |
GL11.glRotated(ro, 0, 1, 0); | |
double dx = -0.5 * WIDTH; | |
double dy = 0; | |
double dz = 0; | |
tess.startDrawingQuads(); | |
tess.setColorRGBA(255, 255, 255, 255); | |
tess.addVertex(dx, dy, dz); | |
tess.addVertex(dx, dy + HEIGHT, dz); | |
tess.addVertex(dx + WIDTH, dy + HEIGHT, dz); | |
tess.addVertex(dx + WIDTH, dy, dz); | |
tess.draw(); | |
float var14 = 0.01266667F * 1.5F; | |
float var17 = 0.015F; | |
// GL11.glPushMatrix(); | |
// GL11.glDepthMask(true); | |
// GL11.glDisable(GL11.GL_DEPTH_TEST); | |
GL11.glEnable(GL11.GL_TEXTURE_2D); | |
FontRenderer frender = Minecraft.getMinecraft().fontRenderer; | |
if ((frender.getStringWidth("allout58") / 2) > 30) var17 = 0.9F / frender.getStringWidth("allout58"); | |
else var17 = var14; | |
GL11.glTranslated(0, 1, -.05); | |
GL11.glRotated(180, 0, 0, 1); | |
GL11.glScalef(.02F, .02F, 0F); | |
frender.drawString(EnumChatFormatting.GREEN.toString() + "allout58", 0, 0, 4210752); | |
GL11.glEnable(GL11.GL_LIGHTING); | |
// GL11.glDisable(GL11.GL_DEPTH_TEST); | |
// GL11.glPopMatrix(); | |
GL11.glPopMatrix(); | |
// GL11.glPopAttrib(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment