Posted April 28, 201411 yr Can't understand.. I create model with techne. add to my project java code.. add texture.. run for test.. and over mob see his name. Why? how to remove?
April 28, 201411 yr This is pretty vague description. In order for your mob to have a name over it, you had to tell it to do that in the render. This name render is normally only for players. I took that code and put it in place for my custom NPC's, but then had it do a distance check so it only shows up in a very short radius around the NPC. Delete from your render code the part you put in associated with displayname. Long time Bukkit & Forge Programmer Happy to try and help
April 29, 201411 yr Author I do not understand, I never pointed out to show the name of the mob .. pieces of code: Entity: public class EntityBustHellDog extends EntityMob { public EntityBustHellDog(World par1World) { super(par1World); // TODO Auto-generated constructor stub this.isImmuneToFire = true; } Model: public class ModelHellDog extends ModelBase { //fields ModelRenderer WolfHead; ModelRenderer Body; ModelRenderer Mane; ModelRenderer Leg1; ModelRenderer Leg2; ModelRenderer Leg3; ModelRenderer Leg4; ModelRenderer Tail; ModelRenderer Ear1; ModelRenderer Ear2; ModelRenderer Nose; public ModelHellDog() { // TODO Auto-generated constructor stub textureWidth = 64; textureHeight = 32; WolfHead = new ModelRenderer(this, 24, 17); WolfHead.addBox(-3F, -3F, -3F, 6, 6, 5); WolfHead.setRotationPoint(-1F, 13.5F, -7F); WolfHead.setTextureSize(64, 32); WolfHead.mirror = true; setRotation(WolfHead, 0F, 0F, 0F); Body = new ModelRenderer(this, 0, 17); Body.addBox(-4F, -2F, -3F, 6, 9, 6); Body.setRotationPoint(0F, 14F, 2F); Body.setTextureSize(64, 32); Body.mirror = true; setRotation(Body, 1.570796F, 0F, 0F); Mane = new ModelRenderer(this, 0, 0); Mane.addBox(-4F, -3F, -5F, 8, 7, 10); Mane.setRotationPoint(-1F, 14F, -3F); Mane.setTextureSize(64, 32); Mane.mirror = true; setRotation(Mane, 1.570796F, 0F, 0F); Leg1 = new ModelRenderer(this, 44, 0); Leg1.addBox(-1F, 0F, -1F, 2, 8, 2); Leg1.setRotationPoint(-2.5F, 16F, 7F); Leg1.setTextureSize(64, 32); Leg1.mirror = true; setRotation(Leg1, 0F, 0F, 0F); Leg2 = new ModelRenderer(this, 44, 0); Leg2.addBox(-1F, 0F, -1F, 2, 8, 2); Leg2.setRotationPoint(0.5F, 16F, 7F); Leg2.setTextureSize(64, 32); Leg2.mirror = true; setRotation(Leg2, 0F, 0F, 0F); Leg3 = new ModelRenderer(this, 44, 0); Leg3.addBox(-1F, 0F, -1F, 2, 8, 2); Leg3.setRotationPoint(-2.5F, 16F, -4F); Leg3.setTextureSize(64, 32); Leg3.mirror = true; setRotation(Leg3, 0F, 0F, 0F); Leg4 = new ModelRenderer(this, 44, 0); Leg4.addBox(-1F, 0F, -1F, 2, 8, 2); Leg4.setRotationPoint(0.5F, 16F, -4F); Leg4.setTextureSize(64, 32); Leg4.mirror = true; setRotation(Leg4, 0F, 0F, 0F); Tail = new ModelRenderer(this, 36, 0); Tail.addBox(-1F, 0F, -1F, 2, 8, 2); Tail.setRotationPoint(-1F, 12F, 8F); Tail.setTextureSize(64, 32); Tail.mirror = true; setRotation(Tail, 1.130069F, 0F, 0F); Ear1 = new ModelRenderer(this, 36, 10); Ear1.addBox(-3F, -6F, 0F, 2, 3, 1); Ear1.setRotationPoint(-1F, 13.5F, -7F); Ear1.setTextureSize(64, 32); Ear1.mirror = true; setRotation(Ear1, 0F, 0F, 0F); Ear2 = new ModelRenderer(this, 36, 10); Ear2.addBox(1F, -6F, 0F, 2, 3, 1); Ear2.setRotationPoint(-1F, 13.5F, -7F); Ear2.setTextureSize(64, 32); Ear2.mirror = true; setRotation(Ear2, 0F, 0F, 0F); Nose = new ModelRenderer(this, 46, 11); Nose.addBox(-2F, 0F, -7F, 3, 3, 6); Nose.setRotationPoint(-0.5F, 13.5F, -7F); Nose.setTextureSize(64, 32); Nose.mirror = true; setRotation(Nose, 0.1745329F, 0F, 0F); } public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { super.render(par1Entity, par2, par3, par4, par5, par6, par7); this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); if (this.isChild) { float f6 = 2.0F; GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7); this.WolfHead.renderWithRotation(par7); this.Nose.renderWithRotation(par7); this.Ear1.renderWithRotation(par7); this.Ear2.renderWithRotation(par7); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6); GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); this.Body.render(par7); this.Leg1.render(par7); this.Leg2.render(par7); this.Leg3.render(par7); this.Leg4.render(par7); this.Tail.renderWithRotation(par7); this.Mane.render(par7); GL11.glPopMatrix(); } else { this.WolfHead.renderWithRotation(par7); this.Nose.renderWithRotation(par7); this.Ear1.renderWithRotation(par7); this.Ear2.renderWithRotation(par7); this.Body.render(par7); this.Leg1.render(par7); this.Leg2.render(par7); this.Leg3.render(par7); this.Leg4.render(par7); this.Tail.renderWithRotation(par7); this.Mane.render(par7); } } public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) { this.Body.setRotationPoint(0.0F, 14.0F, 2.0F); this.Body.rotateAngleX = ((float)Math.PI / 2F); this.Mane.setRotationPoint(-1.0F, 14.0F, -3.0F); this.Mane.rotateAngleX = this.Body.rotateAngleX; this.Tail.setRotationPoint(-1.0F, 12.0F, 8.0F); this.Leg1.setRotationPoint(-2.5F, 16.0F, 7.0F); this.Leg2.setRotationPoint(0.5F, 16.0F, 7.0F); this.Leg3.setRotationPoint(-2.5F, 16.0F, -4.0F); this.Leg4.setRotationPoint(0.5F, 16.0F, -4.0F); this.Leg1.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3; this.Leg2.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3; this.Leg3.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3; this.Leg4.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3; } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); this.WolfHead.rotateAngleX = par5 / (180F / (float)Math.PI); this.WolfHead.rotateAngleY = par4 / (180F / (float)Math.PI); this.Nose.rotateAngleX = par5 / (180F / (float)Math.PI); this.Nose.rotateAngleY = par4 / (180F / (float)Math.PI); this.Ear1.rotateAngleX = par5 / (180F / (float)Math.PI); this.Ear1.rotateAngleY = par4 / (180F / (float)Math.PI); this.Ear2.rotateAngleX = par5 / (180F / (float)Math.PI); this.Ear2.rotateAngleY = par4 / (180F / (float)Math.PI); //this.Tail.rotateAngleX = par3; } } Render public class RenderBustHellDog extends RendererLivingEntity { private static final ResourceLocation helldogTextures = new ResourceLocation("KwastiBustMonsters:textures/entity/helldog.png"); public RenderBustHellDog() { super(new ModelHellDog(), 0.5F); // TODO Auto-generated constructor stub } protected ResourceLocation getHellDogTextures(EntityBustHellDog par1EntityBlaze) { return helldogTextures; } protected void scaleBustHellDog(EntityBustHellDog par1EntityCaveSpider, float par2) { GL11.glScalef(1.0F, 1.0F, 1.5F); } protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) { this.scaleBustHellDog((EntityBustHellDog)par1EntityLivingBase, par2); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(Entity entity) { // TODO Auto-generated method stub return this.getHellDogTextures((EntityBustHellDog)entity); } }
April 29, 201411 yr EntityMob extends EntityCreature which extends EntityLiving. EntityLiving has name tag methods as follow: public String getCustomNameTag() { return this.dataWatcher.getWatchableObjectString(10); } public boolean hasCustomNameTag() { return this.dataWatcher.getWatchableObjectString(10).length() > 0; } public void setAlwaysRenderNameTag(boolean par1) { this.dataWatcher.updateObject(11, Byte.valueOf((byte)(par1 ? 1 : 0))); } public boolean getAlwaysRenderNameTag() { return this.dataWatcher.getWatchableObjectByte(11) == 1; } Maybe somewhere in your code you're setting the always render name tag? Check out my tutorials here: http://jabelarminecraft.blogspot.com/
April 29, 201411 yr Author not working I'm add next: @Override public boolean hasCustomNameTag() { return false; //this.dataWatcher.getWatchableObjectString(10).length() > 0; } protected void entityInit() { super.entityInit(); //this.getDataWatcher().addObject(21, Byte.valueOf((byte)0)); // -this copy from vanilla mobs. (mobs have different first parameter, what that?) this.setAlwaysRenderNameTag(false); setCustomNameTag(""); } @Override public boolean getAlwaysRenderNameTag() { return false; //this.dataWatcher.getWatchableObjectByte(11) == 1; } @Override public String getCustomNameTag() { return "";//this.dataWatcher.getWatchableObjectString(10); } bat I see tag..
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.