Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mob limiting with perchunk tag is functioning weirdly #442

Open
Razor235T opened this issue Aug 22, 2024 · 9 comments
Open

Mob limiting with perchunk tag is functioning weirdly #442

Razor235T opened this issue Aug 22, 2024 · 9 comments

Comments

@Razor235T
Copy link

Razor235T commented Aug 22, 2024

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.

@McJty
Copy link
Collaborator

McJty commented Aug 23, 2024

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?

@Razor235T
Copy link
Author

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.

@McJty
Copy link
Collaborator

McJty commented Aug 23, 2024

What's your view distance set at?

@Razor235T
Copy link
Author

Razor235T commented Aug 23, 2024

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.

@McJty
Copy link
Collaborator

McJty commented Aug 23, 2024

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

@Razor235T
Copy link
Author

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

@McJty
Copy link
Collaborator

McJty commented Aug 23, 2024

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

@Razor235T
Copy link
Author

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.

@Razor235T
Copy link
Author

Razor235T commented Aug 23, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants