Configurable radius around spawn for disabling mob spawning attempts
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem?
Yes. On my public hardcore SMP, I have a spawn area protected by a WorldGuard region. Said spawn area is also surrounded by a larger WorldGuard region, whose purpose is to be a buffer between the safety of spawn and the dangers of the wilderness. In both my spawn and buffer regions, mob spawning is disabled via the WorldGuard flag.
The problem with this is that the server is spending a significant portion of each tick trying to spawn mobs within these regions. This is a waste of resource, since mobs will never be able to spawn here.
I suspect many servers with spawn regions in their worlds suffer from this, and they might not even realise it (I only found out that this was very likely a significant contributor to my server's lag issue recently).
Describe the solution you'd like.
I would love there to be a configuration option that is a radius, in blocks, around the spawn point of the world, inside which the server will not even attempt to spawn mobs. I believe this would directly solve the problem described.
The setting would be -1 by default, meaning it is disabled. If it is set to 0, only the single block at the world's spawn point would have mob spawning disabled, and higher numbers would increase the radius outward in a square shape.
Describe alternatives you've considered.
An alternative solution could be to have a separate world with the doMobSpawning game rule set to false for my spawn area, instead of having it in my main world. However, in my case, the spawn area being in the main world is an important aspect of my server, so this is not an ideal solution for me. This solution also pretty much necessitates a world management plugin, which, in my opinion, shouldn't be necessary purely to fix this one issue.
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file or test is named. Start by locating the server's mob-spawning attempt logic and world spawn configuration, then determine where a configurable square radius could be evaluated. Done means the default -1 preserves current behavior, configured radii skip attempts as described, and coverage verifies the boundary cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100