Posted April 22, 201411 yr So, I've been looking over the Minecraft coding a bit, but I can't figure out how to do this... I want to put a name plate over an entity's head (like the player has). I want to do this because I'm making a mod that involves minecraft players (it's a youtubers mod) and I want to put their names over their heads as if they were actual characters. How would I go about doing that? I can't seem to find that coding in Minecraft (unless it's the NBTTagCompound in EntityPlayer, in which case, I don't understand it...)
April 22, 201411 yr Hey, first your entity must be extending EntityLiving, then in the constuctor put setCustomNameTag("myYoutuber"); My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
April 22, 201411 yr Go to net.minecraft.client.renderer.entity.Render class and look into renderLivingLabel() method. You can either call it, or copy and use in your render class. If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
April 22, 201411 yr Author hmm...I don't see a "renderLivingLabel" method in the Render class. I'm using forge 1024 for Minecraft 1.7. The setCustomNameTag works, but is there a way to keep it up on the character? When I mouse off of the entity, it disappears.
April 23, 201411 yr Try experimenting with this. protected void func_147906_a(Entity p_147906_1_, String p_147906_2_, double p_147906_3_, double p_147906_5_, double p_147906_7_, int p_147906_9_) { double d3 = p_147906_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); if (d3 <= (double)(p_147906_9_ * p_147906_9_)) { FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); float f = 1.6F; float f1 = 0.016666668F * f; GL11.glPushMatrix(); GL11.glTranslatef((float)p_147906_3_ + 0.0F, (float)p_147906_5_ + p_147906_1_.height + 0.5F, (float)p_147906_7_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Tessellator tessellator = Tessellator.instance; byte b0 = 0; if (p_147906_2_.equals("deadmau5")) { b0 = -10; } GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int j = fontrenderer.getStringWidth(p_147906_2_) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex((double)(-j - 1), (double)(-1 + b0), 0.0D); tessellator.addVertex((double)(-j - 1), (double)(8 + b0), 0.0D); tessellator.addVertex((double)(j + 1), (double)(8 + b0), 0.0D); tessellator.addVertex((double)(j + 1), (double)(-1 + b0), 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, 553648127); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } }[/close] If i helped you, don't forget pressing "Thank You" button. Thanks for your time.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.