McJtyMods/InControl

Mob limiting with perchunk tag is functioning weirdly

Opened this issue · 9 comments

Minecraft 1.20.1, Forge 47.3.5, InControl 9.2.6. Controlled with no other mods installed in singleplayer world.
For example, the code:
[
{
"mob": ["minecraft:zombie", "minecraft:husk"],
"spawner": true,
"when": "onjoin",
"result": "default"
},
{
"mob": ["minecraft:zombie", "minecraft:husk"],
"mincount": {
"amount": 1,
"perchunk": true
},
"when": "onjoin",
"result": "deny"
}
]

I don't think there is a mistake since the code is functioning. However, it limits the zombies with amount*9, in singleplayer flat world. So I can spawn 9 zombies totally. If I set amount to 2, I can spawn for some reason 19 zombies. And the amount can vary depending on mobs and mods. It is quite frustrating, because I want very tight control over the mobs from mods that bring a lot of difficulty to the game, like Monsters plus or Hostile mobs improve over time.

From the wiki:

perchunk: if this is true the amount will be scaled with the amount of loaded chunks divided by 289 (this is how vanilla mobcap works)

Did you correct to 289?

I don't get what you mean, but vanilla scaling works by formula mobcap * loaded chunks / 289. I checked in singleplayer, so loaded chunks are 289. So we have 1 mob * 289 chunks / 289 chunks. But I can spawn 9 zombies with that piece of code.

What's your view distance set at?

14 chunks. I don't think vanilla mobcap depends on that.
Edit: sorry, 12 chunks is set on the client, which I checked the piece of code on.

It actually does. See this page: https://minecraft.fandom.com/wiki/Spawn#:~:text=Most%20mobs%20have%20a%20spawning,mobs%20(animals)%20spawn%20rarely.

Quote:
The cap is scaled by the total number of chunks within a 17×17 chunk square around any player. The cap is then scaled as globalCap = mobCap × chunks ÷ 289.

In Control tries to mimic the same behaviour

If you mean that my loaded chunks are 12x12, then globalCap = 1 * 144 / 289, which is around 0.5.

Also I don't see where it says about a distance view. I can see there, that if view distance is below 9 then mobs are spawning less frequently. But my issue is that the zombies spawn too often

A view distance of 12 means 12 chunks in every direction. So that means (12+12+1)*(12+12+1) chunks and that's 625

Okay, it starts to make sense. But you the quote says the cap is scaled by the total number of chunks "within" 17x17 chunk square around a player. So for one player the cap should be 17x17 square.

Monsters can't spawn outside the 8 chunk view distance.
image
So if I set view distance on a server to more than 8, minecraft won't let more mobs to spawn. It counts only the 17x17 square. But Incontrol will increase the cap