Jump to content

[1.16.4] Limiting number of entities rendered


Recommended Posts



A lot of automated designs (mob farms, for example) in Minecraft can generate a ton of entities and those entities getting rendered end up dumping your FPS to 0.

I'm trying to write a mod that allows you to limit the number of entities rendered, to avoid this.


So far I've found that WorldRenderer::updateCameraAndRender() seems to be the function I would want to modify, as it is calling the methods that end up causing an entity to be rendered, and counts the number of entities rendered.


What I want to do is add a simple "if" case that causes it to not render entities if "countEntitiesRendered" goes over a certain number.


However, I am having a hard time figuring out how to do this. At first, I thought I would just create a class extending WorldRenderer that overrides that method, copy and paste the code from it, and add in the if statement. But since many of the fields from WorldRenderer are private, the extension class cannot access them, requiring large amounts of reflection to change privacy levels.


Is there a better way to do what I am trying to do?

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.

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.

  • Create New...

Important Information

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