Welcome on MasterOf13FPS! MasterOf13FPS

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

NameTags Module

MasterOf13FPS

Administrator
Staff member
Administrator
MasterOf13FPS
Joined
Jul 11, 2020
Messages
0
Reaction score
25
Points
0
Sry, hab keine Ahnung wo und wie ich Anfangen soll...
 
Am besten mit OpenGL! Sonst wirds nix...
 
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
 
Last edited by a moderator:
hier sourcecode:


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();
}
}
}
@MatthiasHD
Könntest du bitte noch das GLUtil schicken und dieses ChatColor? thx
 
Last edited by a moderator:
GLUtil:
Code:
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.lwjgl.opengl.GL11;

public class GLUtil
{
private static Map<Integer, Boolean> glCapMap = new HashMap();

public static void setGLCap(int cap, boolean flag)
{
glCapMap.put(Integer.valueOf(cap), Boolean.valueOf(GL11.glGetBoolean(cap)));
if (flag) {
GL11.glEnable(cap);
} else {
GL11.glDisable(cap);
}
}

public static void revertGLCap(int cap)
{
Boolean origCap = (Boolean)glCapMap.get(Integer.valueOf(cap));
if (origCap != null) {
if (origCap.booleanValue()) {
GL11.glEnable(cap);
} else {
GL11.glDisable(cap);
}
}
}

public static void revertAllCaps()
{
for (Iterator localIterator = glCapMap.keySet().iterator(); localIterator.hasNext();)
{
int cap = ((Integer)localIterator.next()).intValue();
revertGLCap(cap);
}
}
}

Edit by Aui: Added Code tags
 
Last edited by a moderator:
ChatColor:
Code:
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.Validate;

public enum ChatColor
{
BLACK(

'0', 0), DARK_BLUE(

'1', 1), DARK_GREEN(

'2', 2), DARK_AQUA(

'3', 3), DARK_RED(

'4', 4), DARK_PURPLE(

'5', 5), GOLD(

'6', 6), GRAY(

'7', 7), DARK_GRAY(

'8', 8), BLUE(

'9', 9), GREEN(

'a', 10), AQUA(

'b', 11), RED(

'c',
12), LIGHT_PURPLE(

'd',
13), YELLOW(

'e',
14), WHITE(

'f',
15), MAGIC(

'k',
16,
true), BOLD(

'l',
17,
true), STRIKETHROUGH(

'm',
18,
true), UNDERLINE(

'n',
19,
true), ITALIC(

'o',
20,
true), RESET(

'r',
21);

public static final char COLOR_CHAR = '$';
private static final Pattern STRIP_COLOR_PATTERN;
private final int intCode;
private final char code;
private final boolean isFormat;
private final String toString;
private static final Map<Integer, ChatColor> BY_ID;
private static final Map<Character, ChatColor> BY_CHAR;

private ChatColor(char code, int intCode)
{
this(code, intCode, false);
}

private ChatColor(char code, int intCode, boolean isFormat)
{
this.code = code;
this.intCode = intCode;
this.isFormat = isFormat;
this.toString = new String(new char[] { '§', code });
}

public char getChar()
{
return this.code;
}

public String toString()
{
return this.toString;
}

public boolean isFormat()
{
return this.isFormat;
}

public boolean isColor()
{
return (!this.isFormat) && (this != RESET);
}

public static ChatColor getByChar(char code)
{
return (ChatColor)BY_CHAR.get(Character.valueOf(code));
}

public static ChatColor getByChar(String code)
{
Validate.notNull(code, "Code cannot be null", new Object[0]);
Validate.isTrue(code.length() > 0, "Code must have at least one char", new Object[0]);
return (ChatColor)BY_CHAR.get(Character.valueOf(code.charAt(0)));
}

public static String stripColor(String input)
{
if (input == null) {
return null;
}
return STRIP_COLOR_PATTERN.matcher(input).replaceAll("");
}

public static String translateAlternateColorCodes(char altColorChar, String textToTranslate)
{
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
if ((b == altColorChar) && ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[(i + 1)]) > -1))
{
b = '§';
b[(i + 1)] = Character.toLowerCase(b[(i + 1)]);
}
}
return new String(b);
}

public static String getLastColors(String input)
{
String result = "";
int length = input.length();
for (int index = length - 1; index > -1; index--)
{
char section = input.charAt(index);
if ((section == '§') && (index < length - 1))
{
char c = input.charAt(index + 1);
ChatColor color = getByChar(c);
if (color != null)
{
result = color.toString() + result;
if ((color.isColor()) || (color.equals(RESET))) {
break;
}
}
}
}
return result;
}

static
{
STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('§') + "[0-9A-FK-OR]");

BY_ID = Maps.newHashMap();
BY_CHAR = Maps.newHashMap();
ChatColor[] arrayOfChatColor;
int j = (arrayOfChatColor = values()).length;
for (int i = 0; i < j; i++)
{
ChatColor color = arrayOfChatColor;
BY_ID.put(Integer.valueOf(color.intCode), color);
BY_CHAR.put(Character.valueOf(color.code), color);
}
}
}

Edit by Aui: Added Code tags
 
Last edited by a moderator:
ChatColor:
Code:
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.Validate;

public enum ChatColor
{
BLACK(

'0', 0), DARK_BLUE(

'1', 1), DARK_GREEN(

'2', 2), DARK_AQUA(

'3', 3), DARK_RED(

'4', 4), DARK_PURPLE(

'5', 5), GOLD(

'6', 6), GRAY(

'7', 7), DARK_GRAY(

'8', 8), BLUE(

'9', 9), GREEN(

'a', 10), AQUA(

'b', 11), RED(

'c',
12), LIGHT_PURPLE(

'd',
13), YELLOW(

'e',
14), WHITE(

'f',
15), MAGIC(

'k',
16,
true), BOLD(

'l',
17,
true), STRIKETHROUGH(

'm',
18,
true), UNDERLINE(

'n',
19,
true), ITALIC(

'o',
20,
true), RESET(

'r',
21);

public static final char COLOR_CHAR = '$';
private static final Pattern STRIP_COLOR_PATTERN;
private final int intCode;
private final char code;
private final boolean isFormat;
private final String toString;
private static final Map<Integer, ChatColor> BY_ID;
private static final Map<Character, ChatColor> BY_CHAR;

private ChatColor(char code, int intCode)
{
this(code, intCode, false);
}

private ChatColor(char code, int intCode, boolean isFormat)
{
this.code = code;
this.intCode = intCode;
this.isFormat = isFormat;
this.toString = new String(new char[] { '§', code });
}

public char getChar()
{
return this.code;
}

public String toString()
{
return this.toString;
}

public boolean isFormat()
{
return this.isFormat;
}

public boolean isColor()
{
return (!this.isFormat) && (this != RESET);
}

public static ChatColor getByChar(char code)
{
return (ChatColor)BY_CHAR.get(Character.valueOf(code));
}

public static ChatColor getByChar(String code)
{
Validate.notNull(code, "Code cannot be null", new Object[0]);
Validate.isTrue(code.length() > 0, "Code must have at least one char", new Object[0]);
return (ChatColor)BY_CHAR.get(Character.valueOf(code.charAt(0)));
}

public static String stripColor(String input)
{
if (input == null) {
return null;
}
return STRIP_COLOR_PATTERN.matcher(input).replaceAll("");
}

public static String translateAlternateColorCodes(char altColorChar, String textToTranslate)
{
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
if ((b == altColorChar) && ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[(i + 1)]) > -1))
{
b = '§';
b[(i + 1)] = Character.toLowerCase(b[(i + 1)]);
}
}
return new String(b);
}

public static String getLastColors(String input)
{
String result = "";
int length = input.length();
for (int index = length - 1; index > -1; index--)
{
char section = input.charAt(index);
if ((section == '§') && (index < length - 1))
{
char c = input.charAt(index + 1);
ChatColor color = getByChar(c);
if (color != null)
{
result = color.toString() + result;
if ((color.isColor()) || (color.equals(RESET))) {
break;
}
}
}
}
return result;
}

static
{
STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('§') + "[0-9A-FK-OR]");

BY_ID = Maps.newHashMap();
BY_CHAR = Maps.newHashMap();
ChatColor[] arrayOfChatColor;
int j = (arrayOfChatColor = values()).length;
for (int i = 0; i < j; i++)
{
ChatColor color = arrayOfChatColor;
BY_ID.put(Integer.valueOf(color.intCode), color);
BY_CHAR.put(Character.valueOf(color.code), color);
}
}
}

Edit by Aui: Added Code tags

Das sind sehr viele Code Fehler drin. Zum Beispiel ChatColor color = arrayOfChatColor;
 
@MatthiasHD ist auch GAAAAR kein skid das ist einfach 1:1 aus irgendeinem client, ich hab das schonmal irgendwo gesehen!
 
Warum nicht einfach die nametags aus Minecraft umschreiben da braucht man auch nicht so einen billigen skid Code lel
 
how would one make it to show a player's current item and armor?
would it be like a armor hud but smaller and it grabs the other players armor?
 
how would one make it to show a player's current item and armor?
would it be like a armor hud but smaller and it grabs the other players armor?
There's already a method for the inventory! Because in your inventory your armor is rendered, copy the method in your nametags module.
 
There's already a method for the inventory! Because in your inventory your armor is rendered, copy the method in your nametags module.
That doesn't make sense. Your saying that in my inventory, my armor is rendered, and that somehow will make the name tags show another player's armor if the method is copied and pasted.
 
That doesn't make sense. Your saying that in my inventory, my armor is rendered, and that somehow will make the name tags show another player's armor if the method is copied and pasted.
Think about your answer... instead of mc.thePlayer put in the name of the Entity (for Entity e: mc.theworld.loadedEntityList) There it would be "e"!
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top