Skip to content

[Feature request] [Enhancement] Local player mob cap #563

Description

@PizzaConBacon

There is currently a problem with Minecraft's global and per player mob cap in which a player afk on a farm will fill up the global cap efectively disabling mob spawns for every other player in the dimension and making the per player mob cap irrelevant. This can be exploited to make "mob switches" which are very useful in singleplayer worlds but not so much on multiplayer servers.

Say I set a hostile mob cap of 70 mobs per player (or per chunk) in a 2 player server but one of the players is in a mob farm and has 140+ zombies loaded. The first player will not see a single hostile mob spawn until some of the zombies from the second player are killed. Trying to cap only spawner spawn types will fix the natural spawns for the first player (if the spawner and natural caps are different) but it will make it so that the first player won't see spawners working either, like for example when exploring a dungeon or custom structure. Increasing the mob cap is also not an option, since it will just create more lag and wont fix the problem, just delay it for longer.

I've been trying to get around this limitation with InControl! by creating "local player mob caps", this would make it so that each player would have their own mob cap and one of them could have 70 hostile mobs around and thus every spawn near them completely blocked but another player with only 30 hostile mobs around them could easily see new mobs spawn. The problem is that I've found that the only way to achieve this is by disabling vanilla Minecraft's spawning system completely and adding every single spawn for every dimension for every single mob for every single biome in the spawner.json rules with the "maxlocal" parameter set. This, as tedious as it is, is also very inefficient as specified in the wiki. maxlocal: this will cause counting in the spawn box around the player. This is somewhat more expensive so use with care

New feature, "perlocal" tag for spawn.json

Ideally, the "perlocal" tag would check for mobs near a player and let users create local mob caps similar to "maxlocal" but in the spawn.json rules. PaperMC devs already have a similar implementation in their popular Paper server software with the per-player-mob-spawns setting with very minimal performance cost, I'm not entirely sure how viable would it be to add this option to InControl! with this specific implementation, which seems incredibly performant, but it would be incredible for large population servers and players using mob farms. Plus this mod would be the first NeoForge mod to implement this mechanic as the only other mod that adds local per player mob caps is Fabric per player spawns (Github), this mod is a direct port of the Paper patch for Fabric so it should be useful for learning how to implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions