I have been messing around with the world config files, and some mobs simply won’t turn off. I’d like to have a mod/plugin created that truly denies the spawning of specific mobs (including mod mobs)
Also an addition to limit the amount of a specific mob within a set range. Passive mobs for example, even while in “hard” game mode spawn WAY too frequently.
Not fully tested, just whipped it up real quick. I have a feeling this will probably cause some lag. What’s happening here is I’m listening for mob spawns and cancelling them if the amount already in the world is greater than or equal to what is in the config. My thought is this is going to cause the server to continually attempt to spawn in said mobs, hence lag. I will also add that this does not remove mobs already in the world it just prevents new mobs from spawning. Plugin has no commands, config will need to edited manually. A config will generate for each world on startup.
Oh and second note, The amount set in the config is not guaranteed because I can only check the number of mobs in loaded chunks.
1 Like
Awesome! If in future it can be re-written so it doesnt cause lagg that will be amazing, man youre a beast at working fast! Great job!
Reminds me of Mod Control - very nice. I would be definitely up for testing it if you let it become a full-fledged plugin of its own!
I haven’t actually verified if it’ll cause lag or not, I’m just saying it’s possible it could cause lag. From testing it’s not fighting the server as much as I originally thought it would so unless there is a lot of chunks loaded I don’t think it’ll be all that noticeable, however I cannot say for sure without profiling. I’m not sure if there is any easier way of accomplishing this from within the API. I’m surprised this isn’t built into Sponge. Personally if I were you I’d post a feature request on github. I think it’s something they might consider improving on.
Maybe iterate over World.getLoadedChunks() instead of querying the entire world?