Wesley1808 / ServerCore

A mod that aims to optimize the minecraft server.
75 stars 11 forks source link

[Feature Request] Auto-removal of extra animal monsters / spawn limit in %amount% chunks. #65

Open GitJhopa opened 1 year ago

GitJhopa commented 1 year ago

Hello! Your help is very much needed. Can you please add a function to stop monster/animal spawning in your beautiful mod if there are already a lot of monsters or animals in a certain number of chunks? Since players make a farm of silverfish with Create and they spawn a lot, which creates a server delay. You already have a function to stop breeding animals, but would like to see a function to stop spawning or clear excess animals or monsters, as is done in the FarmLimiter plugin (spigotmc). Thank you!

GitJhopa commented 1 year ago

Forge 1.19.2

Wesley1808 commented 1 year ago

Regular natural monster / animal spawning is already capped by vanilla's own mobcaps. These work in pretty much the same way you suggested - by limiting the amount of mobs of a certain type (monster, ambient, etc) that can naturally spawn near each player (but also globally).

ServerCore does have some functionality to inspect and modify these, for example you can do /sc settings mobcaps 10 to set all mobcaps to 10% of its usual value, meaning less mobs can spawn naturally. You can use /mobcaps to inspect them.

There's little I can do about other mods having their own mobspawning functionality, if thats an issue here. I can't just go hook into every single mod in existence that may try to do this, thats their own responsibility, and maybe its even intentional for reasons I wouldn't know about.

GitJhopa commented 1 year ago

Hm, https://www.spigotmc.org/resources/farm-limiter.1419/ Is it possible to transfer this functionality?

GitJhopa commented 1 year ago

For example, I specify a mob ID, for example savage_and_ravage:mini_creeper and if a player makes 1000 of them, then given my limit of 1 chunk of about 20 monsters, all 980 creepers are deleted

GitJhopa commented 1 year ago

Just try to install the Savage Ravage mod for the sake of testing and take creeper spores and just throw them, there are a lot of little creepers and they are not limited to your mod.

GitJhopa commented 1 year ago

Likewise with the silverfish from the Create mod, they spawn from blocks. And the extra ones are not removed, so the server lags behind. https://youtu.be/u2GFPUwkBQY

Wesley1808 commented 1 year ago

or example, I specify a mob ID, for example savage_and_ravage:mini_creeper and if a player makes 1000 of them, then given my limit of 1 chunk of about 20 monsters, all 980 creepers are deleted

Couldn't you do this for specific cases using /kill? like /kill @e[type=mob_id,distance=..64,limit=980]

Just try to install the Savage Ravage mod for the sake of testing and take creeper spores and just throw them, there are a lot of little creepers and they are not limited to your mod.

Savage and ravage creepies are a good example of one of those cases I can't do much about. They just spawn creepies without checking much else, theres not much I can do about that.

I generally prefer to stop mobs from spawning rather than "removing" existing ones, these existing ones may be unsafe or less than preferred for players to remove. Though generally this can be avoided by checking if its persistent. That farm limiter seems quite big and honestly is a little out of scope in its full size, should really be its own mod if anything.

If you need an alternative to its searching function to find large amounts of entities, ServerCore has /statistics for that. (ex: /statistics entities byPlayer)

GitJhopa commented 1 year ago

I can't be 24.7 on the server to write these commands) It would be nice to see the mod)

GitJhopa commented 1 year ago

image need help, TPS = 10.0

GitJhopa commented 1 year ago

image create farm silver_fish

GitJhopa commented 1 year ago

It would be necessary to somehow limit the appearance of animals / monsters in a chunk, so that, for example, the limit of appearance, breeding of monsters and animals can be adjusted, for example, 24 monsters and 24 animals per chunk. And then they create lagging farms and monsters endlessly appear from blocks (silverfish)