Kinniken Posted February 11, 2018 Posted February 11, 2018 (edited) Hi guys, My mod (Millénaire, for those who remember) depends heavily on keeping mobs active far away from the player (on loaded chunks of course). In 1.12 I'm having difficulties with this, Minecraft tends to freeze or even despawn my villagers when the player is 100 meters away or so, and if the player loads the game with villagers beyond that range they don't respawn even if the chunk is active. Is there any way to force this? Thanks K. Edited February 14, 2018 by Kinniken Quote http://www.millenaire.org/img/dynamicsig.png[/img]
jabelar Posted February 11, 2018 Posted February 11, 2018 This is a common problem in most large games. It is very difficult to keep performance up if all the logic for all the things you cannot see is still running. Most games need to deactivate complicated objects that are "off screen". Minecraft uses this technique in many ways. For example, whole chunks get unloaded when possible. Entities can be unloaded as well, and even if they are still running on the server they will stop "tracking" (sending packets to the client) beyond a certain distance. Some of these things can be overridden a bit, for example the tracking range. I would start by seeing if using the Minecraft methods can help you. I would first make sure that the entities are registered with a very long (like 8000) tracking range. Secondly I would us the enablePersistence() method on your entities to prevent despawning. Just keep in mind that if you do this a lot it will cause performance issues. 1 Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Kinniken Posted February 11, 2018 Author Posted February 11, 2018 I know the theory of it, I've been battling with it since Minecraft 1.4 And yes this means Millénaire is a very CPU-demanding mod, especially if you set it up with a large activity radius. Still, it's a worthwhile compromise for many players, and in fact one of the most requested feature ever is a way to keep villages running permanently even if the player is really far away (on the converse, you can also set it up so that only villages within say 100 meters are active). I'll check that enable persistence feature but if it's about persisting entities when a chunk is reloaded I already have that. That tracking range might be more what I'm looking for, thanks. Quote http://www.millenaire.org/img/dynamicsig.png[/img]
Kinniken Posted February 14, 2018 Author Posted February 14, 2018 Ok, solved it, it was mostly faulty debugging on my side. With this in the entity class: public boolean canDespawn() { return false; } It seems to be working fine. Quote http://www.millenaire.org/img/dynamicsig.png[/img]
Recommended Posts
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.