Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
	}

 

You can add a layer to the renderer at any point after which the renderer itself is created.

So maybe postinit would be fine? You would need to debug it.

  • Author

then how would i get the renderer of the player.... from the postinit? 

thats the main point why i thought i should use the renderplayerevent

Edited by Oscarita25

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.