Jump to content

RenderLayer causing Frame drops?!


Oscarita25

Recommended Posts

ok i wanted to make a renderlayer (on the player) that renders a model / entity on the player ... i have done all of this but the renderlayer causes Frame drops over time .... after like 1 minute of looking on anything that renders on it the fps are 0-4 fps

here a screen of the Lag o Meter of minecraft when i am in thirdperson:
image.png.c306960e1bb55bd9561b135d6a958ea8.png

^^ Slowly going up and getting Frame drops ^^

here is the relevant code(i am using a parrot as placeholder just to test): 

My Render Layer Class:

@SideOnly(Side.CLIENT)
public class LayerEntityOnPlayerBack implements LayerRenderer<EntityLivingBase>{

    private final RenderManager renderManager;
    protected RenderLivingBase <? extends EntityLivingBase > Renderer;
    private ModelBase Model = new ModelParrot();
    private ResourceLocation Resource = RenderParrot.PARROT_TEXTURES[2];


    public LayerEntityOnPlayerBack(RenderManager rendermanager)
    {
        this.renderManager = rendermanager;
    }

    public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
    {
        if (entitylivingbaseIn.getCapability(ModelProvider.MODEL_CAP, null).getModelID() != 0)
        {
            GlStateManager.enableRescaleNormal();
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

            if (entitylivingbaseIn.getCapability(ModelProvider.MODEL_CAP, null).getModelID() == 1)
            {
            	if(Renderer == null) 
            	Renderer = new RenderParrot(this.renderManager);
            	
            	Renderer.bindTexture(Resource);
            	
            	
                GlStateManager.pushMatrix();
                float f = entitylivingbaseIn.isSneaking() ? -1.3F : -1.5F;
                GlStateManager.translate(0.0F, f, 0.0F);
                
                ageInTicks = 0.0F;

                Model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks);
                Model.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entitylivingbaseIn);
                Model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
                GlStateManager.popMatrix();
            }

            GlStateManager.disableRescaleNormal();
        }
    }

    public boolean shouldCombineTextures()
    {
        return false;
    }





}

 

 

RenderPlayerEvent.Pre:

 

	@SubscribeEvent
	public void RenderPlayerEvent(RenderPlayerEvent.Pre event) {		
		
		LayerEntityOnPlayerBack layer = new LayerEntityOnPlayerBack(event.getRenderer().getRenderManager());
        event.getRenderer().addLayer(layer);
	}

 

Link to comment
Share on other sites

RenderPlayer is very specific since it is attached to a "skin" identifier(steve or alex)

You can get the map from Minecraft.getMinecraft().getRenderManager().getSkinMap()

The value of a given key in said map will be the RenderPlayer instance.

Edited by V0idWa1k3r
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.