Jump to content

[1.15.2] How to stop an Item from rendering on your head?


Fuffles

Recommended Posts

Hey all,
Im currently trying to make a special armor using an Entity Layer (Long Story/Short, it uses a Tile Ent renderer and I want to display that, and I kinda dont wanna make a new BipedModel extension for all the models it uses...) and it all works super well, but the Item still displays on the head for some reason, resulting in the proper one (The Layer) and the other one (The Item in its block state) to show...
Is there a way to force stop it from rendering on the Head? Or do I have to scrap the Entity Layer idea and go with a different way?

Also, is it possible to make the Event only add the layer once? Im pretty sure with this:

Quote

private static Class<?>[] armorWearers =
    {
        ClientPlayerEntity.class,
        DrownedEntity.class,
        GiantEntity.class,
        HuskEntity.class,
        SkeletonEntity.class,
        StrayEntity.class,
        PlayerEntity.class,
        WitherSkeletonEntity.class,
        ZombieEntity.class,
        ZombiePigmanEntity.class,
        ZombieVillagerEntity.class,
    };
    
    public static void onLivingRender(final RenderLivingEvent.Post<?, ?> renderLivingEvent)
    {
        LivingEntity entity = renderLivingEvent.getEntity();
        LivingRenderer<?, ?> entityRenderer = renderLivingEvent.getRenderer();
        for (Class<?> entityClass : armorWearers)
        {
            if (entity.getClass() == entityClass)
            {
                if (entity.isAddedToWorld())
                {
                    JustAnotherHeadMod.LOGGER.info("PUSH FOR " + entity.getClass().toString());
                    entityRenderer.addLayer(new AnotherHeadLayer(entityRenderer));
                }
            }
        }
    }

It's generating more than 1 of these layers, creating lag when you wear it on your head

Edited by Fuffles
Link to comment
Share on other sites

Bump
Alright maybe more info is needed;
My Item  is a Block that you can place in the world, but also equipable on the head. It uses an ISTER (ItemStackTileEntityRegister) and as with all blocks/items it displays on your head. Due to the fact that I am using an LivingEntRenderer and a Layer, like the Elytra, Head or HeldItem it displays it twice, the actual Layer that  I want and the displayed Item/Block which is unwanted. I'd like to get rid of that display, but I dont know how to.

On the other hand, whenever I equip the item, lags seem to spike, I believe this is due to the fact that the renderEvent happens constantly which adds infinite layers. If it would be possible to get the Layer data, which its not since it has not a get() and it's protected, this wouldnt be a problem. Is there any way to add the layer otherwise or should I look into a different method? I'd prefer not to have to make 20 BipedModel extensions for all the forms the Item has and use the ModelBases

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.