Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NameTags extends Module {
- public NameTags() {
- super("NameTags", "Shows the players name and some info about the player", Category.RENDER);
- }
- @Subscribe
- public void onRender3D(EventRender3D event) {
- if (!isEnabled() || mc.thePlayer == null || mc.theWorld == null) return;
- for (Entity entity : mc.theWorld.loadedEntityList) {
- if (entity instanceof AbstractClientPlayer && entity != mc.thePlayer) {
- EntityLivingBase e = (EntityLivingBase) entity;
- double x = e.lastTickPosX + (e.posX - e.lastTickPosX) * this.mc.timer.renderPartialTicks - this.mc.getRenderManager().renderPosX;
- double y = e.lastTickPosY + (e.posY - e.lastTickPosY) * this.mc.timer.renderPartialTicks - this.mc.getRenderManager().renderPosY;
- double z = e.lastTickPosZ + (e.posZ - e.lastTickPosZ) * this.mc.timer.renderPartialTicks - this.mc.getRenderManager().renderPosZ;
- double r = (e.getHealth() / e.getMaxHealth());
- int c =
- (r < 0.3)
- ? Color.red.getRGB()
- : (r < 0.5)
- ? Color.orange.getRGB()
- : (r < 0.7)
- ? Color.yellow.getRGB()
- : Color.green.getRGB();
- GL11.glPushMatrix();
- GL11.glTranslated(x, y + 2.5D, z);
- GL11.glScalef(-0.03f, -0.03f, -0.03f);
- GL11.glRotated(-this.mc.getRenderManager().playerViewY, 0.0d, 1.0d, 0.0d);
- GL11.glRotated(this.mc.getRenderManager().playerViewX, 1.0d, 0.0d, 0.0d);
- GlStateManager.disableDepth();
- float width = (float) FontUtil.two.getStringWidth(e.getName());
- float progress = e.getHealth() / e.getMaxHealth();
- Gui.drawRect(-width / 2 - 5, 5, width / 2 + 5, FontUtil.two.getHeight() + 8, new Color(0, 0, 0, 80).getRGB());
- Gui.drawRect(-width / 2 - 5, FontUtil.two.getHeight() + 8, -width / 2 - 5 + (width / 2 + 5 - -width / 2 + 5) * progress, FontUtil.two.getHeight() + 6, c);
- FontUtil.two.drawCenteredString(e.getName(), 0, 7, 0xFFFFFFFF);
- GL11.glTranslated(-x, -(y + 2.5D), -z);
- GL11.glScalef(1.0f,1.0f,1.0f);
- GlStateManager.enableDepth();
- GL11.glPopMatrix();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment