Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

NameTags Module

hier sourcecode:
Code:
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.Timer;
import org.lwjgl.opengl.GL11;


public class NameTags
  extends Module
{
  private String nameCol;
 
  public NameTags()
  {
    super("Nametags", "Nametags", 0x00ff00,  0, Category.RENDER);
  }
 
  public static boolean cancel = true;
 
  public void onRender()
  {
    setAddon("");
    if ((Minecraft.thePlayer == null) || (Minecraft.theWorld == null)) {
      return;
    }
    for (Object o : Minecraft.theWorld.playerEntities)
    {
      EntityPlayer p = (EntityPlayer)o;
      if ((p != mc.func_175606_aa()) && (p.isEntityAlive()))
      {
        mc.getRenderManager();double pX = p.lastTickPosX + (p.posX - p.lastTickPosX) * mc.timer.renderPartialTicks - RenderManager.renderPosX;
        mc.getRenderManager();double pY = p.lastTickPosY + (p.posY - p.lastTickPosY) * mc.timer.renderPartialTicks - RenderManager.renderPosY;
        mc.getRenderManager();double pZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * mc.timer.renderPartialTicks - RenderManager.renderPosZ;
     
        renderNameTag(p, p.getDisplayName().getUnformattedTextForChat(), pX, pY, pZ);
      }
    }
  }
 
  public void renderNameTag(EntityPlayer entity, String tag, double pX, double pY, double pZ)
  {
    FontRenderer var12 = Minecraft.fontRendererObj;
    pY += 0.9D;
    float var13 = Minecraft.thePlayer.getDistanceToEntity(entity) / 4.0F;
    if (var13 < 1.1F) {
      var13 = 1.6F;
    }
    if ((entity instanceof EntityLivingBase))
    {
      if ((entity instanceof EntityPlayer))
      {
        ChatColor nameCol = ChatColor.RESET;
        if (entity.isInvisible()) {
          nameCol = ChatColor.BLUE;
        } else if (entity.isSneaking()) {
          nameCol = ChatColor.BLACK;
        }
        double health = Math.ceil(entity.getHealth()) / 2.0D;
        ChatColor healthCol;
        ChatColor healthCol1;
        if (health < 1.0D)
        {
          healthCol1 = ChatColor.RED;
        }
        else
        {
          ChatColor healthCol11;
          if ((health > 1.0D) && (health < 6.1D)) {
            healthCol11 = ChatColor.YELLOW;
          } else {
            healthCol11 = ChatColor.GREEN;
          }
        }
        tag = tag + " §f[§c" + health + "§f]";
      }
      RenderManager renderManager = mc.getRenderManager();
      int color = 16776960;
      float scale = var13 * 2.0F;
      scale /= 100.0F;
      GL11.glPushMatrix();
      GL11.glTranslatef((float)pX, (float)pY + 1.5F, (float)pZ);
      GL11.glNormal3f(0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
      GL11.glScalef(-scale, -scale, scale);
      GLUtil.setGLCap(2896, false);
      GLUtil.setGLCap(2929, false);
      Tessellator var14 = Tessellator.getInstance();
      WorldRenderer var15 = var14.getWorldRenderer();
      int width = Minecraft.fontRendererObj.getStringWidth(tag) / 2;
      GLUtil.setGLCap(3042, true);
      GL11.glBlendFunc(11, 771);
      Gui.drawRect(-width - 1, -1, width + 1, Minecraft.fontRendererObj.FONT_HEIGHT, 1275068416);
      var12.func_175065_a(tag, -width, 0.0F, 16777215, true);
      GLUtil.revertAllCaps();
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glPopMatrix();
    }
  }
}

Edit by Aui: Added Code tags
Schreib wenigstens dazu, dass der Code aus THC/Liquidsmoke ist
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top