Jump to content

[Solved] [1.8] Block Custom Entity Name Render


delpi

Recommended Posts

Ultimately, i'm trying to block the rendering of the name of my custom entity if it can't be seen.  However, I'd settle right now just to figure out which method is rendering the name.

 

I'm extending 'RendererLivingEntity' and doing nothing but changing the getEntityTexture method.

 

To try and block the name, I originally overrode 'protected boolean canRenderName(EntityLivingBase targetEntity)' and I kept doing so.

 

then I added overrode other functions to make them do nothing to try and fix this.

protected boolean canRenderName(Entity entity) { return false;}

public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) {}

public void renderName(Entity entity, double x, double y, double z) {}

 

And yes, I'm using the '@Override' tag, just didn't list above. 

 

 

The dang name still freaking shows up.  Searched 'RendererLivingEntity' and 'render' for everplace name showed up and I can't find anything else.

 

Anyone know how to do this?

 

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

I agree 100%, but yet it is.

 

Here is the whole class in case it sparks a thought

 

 

 

@SideOnly(Side.CLIENT)

public class NPC_Render extends RendererLivingEntity {

 

    // Setup Variables

    protected Custom_NPC instance = Custom_NPC.instance;

 

    // setup Variables

    protected ResourceLocation texture;

   

    public NPC_Render(RenderManager renderManager, String texture, ModelBiped model, float size) {   

        super(renderManager, model, size);

       

        // Set Texture

        this.texture = new ResourceLocation("custom_npc", texture);

       

        // Armor

        this.addLayer(new LayerBipedArmor(this));

        this.addLayer(new LayerHeldItem(this));

       

    }

 

    @Override

    protected ResourceLocation getEntityTexture(Entity entity) {

   

        return texture;

       

    }

   

    @Override

    protected boolean canRenderName(Entity entity) { return false;}

   

    @Override

    protected boolean canRenderName(EntityLivingBase targetEntity) {

   

    // Get Player

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

       

        // Determin if can see

        boolean test = entityplayersp.canEntityBeSeen(targetEntity);

        System.out.println("  - test : " + test);

        return  test;     

       

    }

   

    // This seemed to be rendering name as well

    @Override

    protected void renderLivingLabel(Entity p_147906_1_, String p_147906_2_, double p_147906_3_, double p_147906_5_, double p_147906_7_, int p_147906_9_) {}

 

    //@Override

    public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) {}

   

    //@Override

public void renderName(Entity entity, double x, double y, double z) {}

   

}

[\spoiler]

 

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Yes.  After all the entity is showing up.  :)

 

 

Found the issue.  The way I'm using to render techne item models in 1.8 was causing it.  Needed to override the methods somewhere else to.  It all looks good now.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.